diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 9a72e6a3..bda1b51d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,32 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - + + @@ -80,7 +89,7 @@ - + @@ -94,7 +103,7 @@ - + @@ -104,7 +113,7 @@ - + @@ -120,11 +129,21 @@ - + - - + + + + + + + + + + + + @@ -209,10 +228,10 @@ @@ -410,6 +429,14 @@ + + + + + + + + @@ -895,12 +922,12 @@ - + - @@ -947,13 +974,6 @@ - - - - - - - @@ -1278,14 +1298,6 @@ - - - - - - - - @@ -1305,7 +1317,7 @@ - + @@ -1313,7 +1325,7 @@ - + @@ -1334,5 +1346,21 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 85739c2a..ee9eb1e6 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,18 @@ # README -SXRestuarant is a new Dedicate project for SmartSales Restaurant. It is improvement from v1.2 with upgrade to latest Bootstrap and Rails 5. The API is better define and route are refactor. +SXRestuarant is a new Dedicate project for SmartSales Restaurant. It is improvement from v1.2 with upgrade to latest Bootstrap and Rails 5.2. The API is better define and route are refactor. Things you may want to cover: * Ruby version -ruby 2.3.2p217 +ruby 2.4.1p111 * ToDo list + +1. Cloud Sync +2. Action Cable +3. Shop Setup +4. Payment Integation * System dependencies @@ -23,4 +28,55 @@ ruby 2.3.2p217 * Deployment instructions -* ... + +* Features + +1. OQS + + 1. Filter + 2. Order Item to each Stations + 3. Edit Order Item + +2. Origami(Sale) + + 1. Sale + 2. Add Customer for membership + 3. Discount and Member Discount for Sale + 4. Assign Commissioner + 5. Add other charges to Sale + +3. CRM + + 1. Customer Management + + 2. Queue Management + +4. Backend + + 1. Dining Setup + + 2. Queue Station Setup + + 3. Menu Setup + + 4. Cashier Terminal Setup + + 5. Tax Profile Setup + + 6. Printer Setup + + 7. Payment Integration + + 8. Employee Management + + 9. Promotion Setup + + 10. Commissioner Setup + + 11. Membership Integration + + +5. Inventory + + +6. Report diff --git a/app/controllers/api/restaurant/menu_controller.rb b/app/controllers/api/restaurant/menu_controller.rb index b45e1189..ad8ad7f9 100644 --- a/app/controllers/api/restaurant/menu_controller.rb +++ b/app/controllers/api/restaurant/menu_controller.rb @@ -4,8 +4,25 @@ class Api::Restaurant::MenuController < Api::ApiController # Pull the default menu details and also other available (active) menus # Input Params - order_id def index - @menus = Menu.all - # @current_menu = Menu.current_menu + param_checksum = params[:checksum] + # checksum = File.readlines("public/checksums/menu_json.txt").pop.chomp + + all_menu = Menu.all + + # to hash + menu_array = [] + all_menu.each do |m| + menu_array.push(m.to_json(:include => {:menu_categories => { :include => { :menu_items => { :include => [:menu_item_sets, :menu_item_instances => {:include => :menu_instance_item_sets}]} } }})) + end + + #export Checksum file generate by md5 + menu_checksum = Digest::MD5.hexdigest(menu_array.to_json) + + if menu_checksum != param_checksum + response.headers['CHECKSUM'] = menu_checksum + @menus = all_menu + end + # @current_menu = Menu.current_menu end #Description diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index ffa714a2..2a0626dd 100644 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -6,13 +6,33 @@ class Crm::CustomersController < BaseCrmController # GET /crm/customers.json def index filter = params[:filter] + type = params[:type] if filter.nil? @crm_customers = Customer.all else @crm_customers = Customer.search(filter) - + # search account no from paypar + if !@crm_customers.present? && type == "card" + response = Customer.search_paypar_account_no(filter) + if response["status"] == true + @crm_customers = Customer.new + @crm_customers.name = response["customer_data"]["name"] + @crm_customers.contact_no = response["customer_data"]["phone"] + @crm_customers.email = response["customer_data"]["email"] + @crm_customers.date_of_birth = response["customer_data"]["DOB"] + @crm_customers.nrc_no = response["customer_data"]["NRC"] + @crm_customers.address = response["customer_data"]["address"] + @crm_customers.card_no = response["customer_data"]["customer_card_no"] + @crm_customers.paypar_account_no = filter + @crm_customers.membership_id = response["customer_data"]["id"] + @crm_customers.membership_type = response["customer_data"]["member_group_id"] + @crm_customers.customer_type = "Dinein" + @crm_customers.tax_profiles = ["1", "2"] + @crm_customers.save + @crm_customers = Customer.search(filter) + end + end end - #@crm_customers = Customer.all @crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50) @crm_customer = Customer.new @count_customer = Customer.count_customer diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb index 8faaa221..72597613 100644 --- a/app/controllers/origami/customers_controller.rb +++ b/app/controllers/origami/customers_controller.rb @@ -9,13 +9,40 @@ class Origami::CustomersController < BaseOrigamiController end def get_customer + filter = params[:filter] + type = params[:type] + if filter.nil? @crm_customers = Customer.order("customer_id").page(params[:page]) #@products = Product.order("name").page(params[:page]).per(5) else - @crm_customers = Customer.search(filter) + @crm_customers = Customer.search(filter) + # search account no from paypar + if !@crm_customers.present? && type == "card" + response = Customer.search_paypar_account_no(filter) + if response["status"] == true + @crm_customers = Customer.new + @crm_customers.name = response["customer_data"]["name"] + @crm_customers.contact_no = response["customer_data"]["phone"] + @crm_customers.email = response["customer_data"]["email"] + @crm_customers.date_of_birth = response["customer_data"]["DOB"] + @crm_customers.nrc_no = response["customer_data"]["NRC"] + @crm_customers.address = response["customer_data"]["address"] + @crm_customers.card_no = response["customer_data"]["customer_card_no"] + @crm_customers.paypar_account_no = filter + @crm_customers.membership_id = response["customer_data"]["id"] + @crm_customers.membership_type = response["customer_data"]["member_group_id"] + @crm_customers.customer_type = "Dinein" + @crm_customers.tax_profiles = ["1", "2"] + @crm_customers.save + @crm_customers = Customer.search(filter) + else + @crm_customers = [{"customer_id": response["status"],"message": response["message"] }] + end + end end + render :json => @crm_customers.to_json end diff --git a/app/controllers/origami/in_juties_controller.rb b/app/controllers/origami/in_juties_controller.rb index 821aa409..5903ace3 100644 --- a/app/controllers/origami/in_juties_controller.rb +++ b/app/controllers/origami/in_juties_controller.rb @@ -8,9 +8,10 @@ class Origami::InJutiesController < BaseOrigamiController end def index_in_juty - @juties_in= InJuty.where("dinning_id=?",params[:table_id]) + @juty_in= InJuty.where("dinning_id=?",params[:table_id]) @table = DiningFacility.find(params[:table_id]) @in_juty = InJuty.new + @juties_in = Kaminari.paginate_array(@juty_in).page(params[:page]).per(10) end # GET /in_juties/1 @@ -31,6 +32,9 @@ class Origami::InJutiesController < BaseOrigamiController def edit_in_juty @in_juty = InJuty.find(params[:id]) @table = DiningFacility.find(params[:table_id]) + @commissioner = @in_juty.commissioner + + render json: {in_juty: @in_juty, commissioner: @commissioner} end def assign_in_juty @@ -89,12 +93,19 @@ class Origami::InJutiesController < BaseOrigamiController end - def update_for_in_juty - @in_juty.dinning_id = params[:dining_id] - @in_juty.commissioner_ids = params[:commissioner_ids] - @in_juty.in_time = params[:in_time] - @in_juty.out_time = params[:out_time] - @in_juty.save + def update_for_in_juty + @in_juty.commissioner_ids = in_juty_params[:commissioner_ids] + @in_juty.in_time = in_juty_params[:in_time] + @in_juty.out_time = in_juty_params[:out_time] + respond_to do |format| + if @in_juty.save + format.html { redirect_to origami_index_in_juty_path(in_juty_params[:dinning_id]), notice: 'In juty was successfully updated.' } + format.json { render :show, status: :ok, location: @in_juty } + else + format.html { render :edit } + format.json { render json: @in_juty.errors, status: :unprocessable_entity } + end + end end # DELETE /in_juties/1 @@ -125,6 +136,6 @@ class Origami::InJutiesController < BaseOrigamiController # Never trust parameters from the scary internet, only allow the white list through. def in_juty_params - params.require(:in_juty).permit(:dinning_id,:commissioner_ids,:in_time,:out_time) + params.require(:in_juty).permit(:id,:dinning_id,:commissioner_ids,:in_time,:out_time) end end diff --git a/app/controllers/settings/simple_menu_items_controller.rb b/app/controllers/settings/simple_menu_items_controller.rb index 418cc2b8..e3010e30 100644 --- a/app/controllers/settings/simple_menu_items_controller.rb +++ b/app/controllers/settings/simple_menu_items_controller.rb @@ -79,7 +79,7 @@ class Settings::SimpleMenuItemsController < ApplicationController respond_to do |format| if @settings_menu_item.save menu_item = MenuItem.find(@settings_menu_item.id) - menu_item.update_attributes(item_options: params[:simple_menu_item][:item_options]) + menu_item.update_attributes(item_attributes: params[:simple_menu_item][:item_attributes], item_options: params[:simple_menu_item][:item_options]) format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully created.' } format.json { render :show, status: :created, location: @settings_menu_item } diff --git a/app/models/customer.rb b/app/models/customer.rb index dff92ba2..9e629721 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -91,46 +91,54 @@ class Customer < ApplicationRecord auth_token = memberaction.auth_token.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s - @customers = Customer.where("membership_type IS NOT NULL AND membership_id IS NULL") + @customers = Customer.where("membership_type IS NOT NULL AND membership_id IS NULL") @customers.each do |customer| - begin - response = HTTParty.post(url, - :body => - { name: customer.name,phone: customer.contact_no, - email: customer.email,dob: customer.date_of_birth, - address: customer.address,nrc:customer.nrc_no, - card_no:customer.card_no,member_group_id: customer.membership_type, - merchant_uid:merchant_uid,auth_token:auth_token - }.to_json, - :headers => { - 'Content-Type' => 'application/json', - 'Accept' => 'application/json' - }) - rescue Net::OpenTimeout - response = { status: false, message: "Server Time out" } - - rescue OpenURI::HTTPError - response = { status: false, message: "Can't connect server"} + member_params = { name: customer.name,phone: customer.contact_no, + email: customer.email,dob: customer.date_of_birth, + address: customer.address,nrc:customer.nrc_no, + card_no:customer.card_no,member_group_id: customer.membership_type, + merchant_uid:merchant_uid,auth_token:auth_token}.to_json - rescue SocketError - response = { status: false, message: "Can't connect server"} - end + # Check for paypar account exists + # if paypar_account_no != nil || paypar_account_no != '' + if paypar_account_no.present? + member_params = { name: customer.name,phone: customer.contact_no, + email: customer.email,dob: customer.date_of_birth, + address: customer.address,nrc:customer.nrc_no, + paypar_account_no: customer.paypar_account_no, + card_no:customer.card_no,member_group_id: customer.membership_type, + merchant_uid:merchant_uid,auth_token:auth_token}.to_json + end - if response["status"] == true - status = customer.update_attributes(membership_id: response["customer_datas"]["id"]) - end + begin + response = HTTParty.post(url, + :body => member_params, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + }) + rescue Net::OpenTimeout + response = { status: false, message: "Server Time out" } + + rescue OpenURI::HTTPError + response = { status: false, message: "Can't connect server"} + rescue SocketError + response = { status: false, message: "Can't connect server"} + end + + if response["status"] == true + status = customer.update_attributes(membership_id: response["customer_datas"]["id"]) + end end end def self.update_rebate - sales = Sale.where("rebate_status = 'false'") sales.each do |sale| if sale.customer.membership_id - response = self.rebat(Sale.find(sale.sale_id)) - puts response.to_json + response = self.rebat(Sale.find(sale.sale_id)) if response["status"] == true status = sale.update_attributes(rebate_status: "true") end @@ -188,12 +196,44 @@ class Customer < ApplicationRecord response = { "status": false, "message": "Can't connect server"} end - return response - puts response.to_json + return response end end end + def self.search_paypar_account_no(account_no) + membership = MembershipSetting.find_by_membership_type("paypar_url") + memberaction = MembershipAction.find_by_membership_type("search_paypar_account_no") + merchant_uid = memberaction.merchant_account_id.to_s + auth_token = memberaction.auth_token.to_s + url = membership.gateway_url.to_s + memberaction.gateway_url.to_s + begin + response = HTTParty.get(url, + :body => { paypar_account_no:account_no, + merchant_uid:merchant_uid, + auth_token:auth_token + }.to_json, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + }, + :timeout => 10 + ) + rescue HTTParty::Error + response = {status: false, message: "Server Error"} + + rescue Net::OpenTimeout + response = { status: false , message: "Server Time out"} + + rescue OpenURI::HTTPError + response = { status: false, message: "Can't connect server"} + + rescue SocketError + response = { status: false, message: "Can't connect server"} + end + return response + end + def self.search(search) if search # find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"]) diff --git a/app/models/menu_item_attribute.rb b/app/models/menu_item_attribute.rb index 54d2f34e..e57085cb 100644 --- a/app/models/menu_item_attribute.rb +++ b/app/models/menu_item_attribute.rb @@ -1,6 +1,6 @@ class MenuItemAttribute < ApplicationRecord validates_presence_of :attribute_type, :name, :value def self.collection - MenuItemAttribute.select("name, value").map { |e| [e.name, e.value] } + MenuItemAttribute.select("name").map { |e| [e.name, e.name] } end end diff --git a/app/models/order.rb b/app/models/order.rb index 0ef19729..e26d1ee2 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -90,7 +90,7 @@ class Order < ApplicationRecord # self.employee_name) # end - OrderItem.processs_item(menu_item[:item_code], menu_item[:name], menu_item[:alt_name], menu_item[:account_id], + OrderItem.processs_item(menu_item[:item_code], item[:item_instance_code], menu_item[:name], menu_item[:alt_name], menu_item[:account_id], item[:quantity],menu_item[:price], item[:options], set_order_items, self.id, self.employee_name) diff --git a/app/models/order_item.rb b/app/models/order_item.rb index 897a4b1e..12c8c378 100644 --- a/app/models/order_item.rb +++ b/app/models/order_item.rb @@ -20,11 +20,12 @@ class OrderItem < ApplicationRecord # option_values : [], # sub_order_items : [], # } - def self.processs_item (item_code, menu_name, alt_name, account_id, qty,price, options, set_menu_items, order_id, item_order_by) + def self.processs_item (item_code, instance_code, menu_name, alt_name, account_id, qty,price, options, set_menu_items, order_id, item_order_by) orderitem = OrderItem.create do |oitem| oitem.order_id = order_id oitem.item_code = item_code + oitem.item_instance_code = instance_code oitem.item_name = menu_name oitem.alt_name = alt_name oitem.account_id = account_id diff --git a/app/models/promotion.rb b/app/models/promotion.rb index 025abd4b..482d2c3b 100644 --- a/app/models/promotion.rb +++ b/app/models/promotion.rb @@ -69,7 +69,7 @@ class Promotion < ApplicationRecord give_promotion_nett_price(same,promo_product,promo.min_qty, orderitem, sale_id) elsif promo.promo_type == Promotion::PROMO_TYPE4 - give_promotion_nett_price(same,promo_product,promo.min_qty, orderitem, sale_id) + give_promotion_discount(same,promo_product,promo.min_qty, orderitem, sale_id) end end @@ -138,8 +138,8 @@ class Promotion < ApplicationRecord sale_item.remark = type sale_item.qty = foc_qty * (-1) - sale_item.unit_price = item_price * (-1) - sale_item.taxable_price = item_price * (-1) + sale_item.unit_price = item_price # * (-1) + sale_item.taxable_price = item_price # * (-1) sale_item.price = foc_qty * item_price * (-1) sale_item.is_taxable = false @@ -170,8 +170,8 @@ class Promotion < ApplicationRecord if same foc_qty = orderitem[1].to_i / foc_min_qty - item = OrderItem.find_by_item_code(orderitem[0]) - price = item.price - promo_product.net_price + item = OrderItem.find_by_item_code(orderitem[0]) # need to specify with menu item instance + price = item.price.to_i - promo_product.net_price.to_i update_existing_item(foc_qty, item, sale_id, "promotion nett price", price) else foc_qty = find_second_item_qty(sale_id, promo_product.item_code) @@ -187,13 +187,15 @@ class Promotion < ApplicationRecord if same foc_qty = orderitem[1].to_i / foc_min_qty item = OrderItem.find_by_item_code(orderitem[0]) - total = orderitem[1].to_i * item.price + # total = orderitem[1].to_i * item.price + total = item.price price = calculate_discount(total, promo_product.percentage) update_existing_item(foc_qty, item, sale_id, "promotion discount", price) else foc_qty = find_second_item_qty(sale_id, promo_product.item_code) item = OrderItem.find_by_item_code(promo_product.item_code) - total = item.price * foc_qty + # total = item.price * foc_qty + total = item.price price = calculate_discount(total, promo_product.percentage) update_existing_item(foc_qty, item, sale_id, "promotion discount", price) end diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 3435190d..4719e546 100644 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -324,7 +324,6 @@ class SalePayment < ApplicationRecord update_shift end end - end # update for cashier shift diff --git a/app/views/api/restaurant/menu/_menu.json.jbuilder b/app/views/api/restaurant/menu/_menu.json.jbuilder index cfa950d7..29982631 100644 --- a/app/views/api/restaurant/menu/_menu.json.jbuilder +++ b/app/views/api/restaurant/menu/_menu.json.jbuilder @@ -17,5 +17,4 @@ if (menu.menu_categories) end end end - end diff --git a/app/views/api/restaurant/menu/_menu_item.json.jbuilder b/app/views/api/restaurant/menu/_menu_item.json.jbuilder index 7a450850..3f8b5358 100644 --- a/app/views/api/restaurant/menu/_menu_item.json.jbuilder +++ b/app/views/api/restaurant/menu/_menu_item.json.jbuilder @@ -1,44 +1,82 @@ # Format for attributes json attr_format = [] -param_count = item.item_attributes.count -# Format for attributes json -item.item_attributes.each do|attr_id| - menu_attr = MenuItemAttribute.find(attr_id) - if attr_format.count == 0 - attr_format.push({ type: menu_attr.attribute_type, value: [] }) - end - - attr_format.each do |af| - if menu_attr.attribute_type == af[:type] - af[:value].push(menu_attr.value) - else - new_attr = {type: menu_attr.attribute_type, value: [ menu_attr.value ] } - attr_format.push(new_attr) +# Format for attributes json +if item.item_attributes.count > 0 + item.item_attributes.each do|attr_id| + menu_attr = MenuItemAttribute.find(attr_id) + if attr_format.count == 0 + attr_format.push({ type: menu_attr.attribute_type, values: [menu_attr.name] }) + next end - - break if attr_format.count > param_count - end - param_count -= 1 + attr_format.each do |af| + if menu_attr.attribute_type.in? attr_format.map {|k| k[:type]} + if menu_attr.attribute_type == af[:type] + af[:values].push(menu_attr.name) + end + else + new_attr = {type: menu_attr.attribute_type, values: [ menu_attr.name ] } + attr_format.push(new_attr) + break + end + end + end +end + +# Format for option json +opt_format = [] +# Format for attributes json +if item.item_options.count > 0 + item.item_options.each do|opt| + menu_opt = MenuItemOption.find(opt) + if opt_format.count == 0 + opt_format.push({ type: menu_opt.option_type, values: [menu_opt.name] }) + next + end + + opt_format.each do |of| + if menu_opt.option_type.in? opt_format.map {|k| k[:type]} + if menu_opt.option_type == of[:type] + of[:values].push(menu_opt.name) + end + else + new_opt = {type: menu_opt.option_type, values: [ menu_opt.name ] } + opt_format.push(new_opt) + break + end + end + end end #Menu Item Information json.id item.id -json.item_code item.item_code +json.code item.item_code json.name item.name json.alt_name item.alt_name json.image item.image_path.url json.description item.description -json.Information item.information +json.information item.information json.type item.type json.account_id item.account_id json.min_qty item.min_qty json.is_available item.is_available json.is_sub_item item.is_sub_item json.unit item.unit -json.item_sets item.item_sets + +# Item Sets of Menu Item +json.item_sets item.item_sets do |its| + json.id its.id + json.name its.name + json.alt_name its.alt_name + json.min_selectable_qty its.min_selectable_qty + json.max_selectable_qty its.max_selectable_qty + json.instances its.menu_item_instances do |i| + json.id i.id + end +end + json.attributes attr_format -json.options item.item_options +json.options opt_format # json.min_selectable_item item.min_selectable_item # json.max_selectable_item item.max_selectable_item @@ -52,6 +90,7 @@ json.options item.item_options # json.item_attributes = item_instance.item_attributes json.instances item.menu_item_instances do |is| + json.id is.id json.code is.item_instance_code json.name is.item_instance_name json.price is.price @@ -59,8 +98,8 @@ json.options item.item_options json.is_default is.is_default json.is_on_promotion is.is_on_promotion json.promotion_price is.promotion_price - json.item_attributes is.item_attributes - json.item_sets is.item_sets + json.values is.item_attributes + # json.item_sets is.item_sets end #Child Menu items diff --git a/app/views/api/restaurant/menu/index.json.jbuilder b/app/views/api/restaurant/menu/index.json.jbuilder index 55e876f6..46f35e60 100644 --- a/app/views/api/restaurant/menu/index.json.jbuilder +++ b/app/views/api/restaurant/menu/index.json.jbuilder @@ -1,4 +1,4 @@ -json.array! @menus do |menu| +menu_json = json.array! @menus do |menu| json.id menu.id json.name menu.name json.valid_days menu.valid_days @@ -12,3 +12,4 @@ json.array! @menus do |menu| # end # end end + diff --git a/app/views/crm/customers/_new_form.html.erb b/app/views/crm/customers/_new_form.html.erb index 35c3a46d..c39f065f 100644 --- a/app/views/crm/customers/_new_form.html.erb +++ b/app/views/crm/customers/_new_form.html.erb @@ -169,6 +169,7 @@ if(cardNo.length == 16){ $("#paypar_account_no").val(cardNo); $("#search").val(cardNo); + $("#type").val("card"); } } \ No newline at end of file diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 71772c92..9d2fa62b 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -25,6 +25,7 @@ <%= form_tag crm_customers_path, :id => "filter_form", :method => :get do %>
+ diff --git a/app/views/origami/addorders/show.html.erb b/app/views/origami/addorders/show.html.erb index 0e8a8163..8f9b1c08 100644 --- a/app/views/origami/addorders/show.html.erb +++ b/app/views/origami/addorders/show.html.erb @@ -49,48 +49,6 @@
- - - - - + + + + \ No newline at end of file diff --git a/app/views/origami/in_juties/_edit_in_juty.html.erb b/app/views/origami/in_juties/_edit_in_juty.html.erb index a2405f58..9eaf8353 100644 --- a/app/views/origami/in_juties/_edit_in_juty.html.erb +++ b/app/views/origami/in_juties/_edit_in_juty.html.erb @@ -2,8 +2,7 @@ <%= f.error_notification %>
- <%= f.input :dinning_id %> - <%= f.input :commissioner_ids %> + <%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>

<%= f.input :in_time %> <%= f.input :out_time %>
diff --git a/app/views/origami/in_juties/index_in_juty.html.erb b/app/views/origami/in_juties/index_in_juty.html.erb index 0141af05..2ac1048e 100644 --- a/app/views/origami/in_juties/index_in_juty.html.erb +++ b/app/views/origami/in_juties/index_in_juty.html.erb @@ -4,6 +4,7 @@ + @@ -21,13 +22,12 @@ - - <% end %>
Select Dining Facility Name Commissioner Ids In time<%= in_juty.commissioner.name rescue '-' %> <%= in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %> <%= in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %><%= link_to 'Back', origami_path(in_juty.dining_facility.id) %><%= link_to 'Edit', origami_edit_in_juty_path(in_juty.dining_facility.id,in_juty) %> <%= link_to 'Destroy', origami_destroy_in_juty_path(in_juty.dining_facility.id,in_juty),method: :delete, data: {confirm: 'Are you sure?'} %>
+ <%= paginate @juties_in %>
@@ -35,40 +35,45 @@
+
+ +
\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 3b88e88e..1130bf36 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -89,10 +89,11 @@ Rails.application.routes.draw do post 'apply_void' => 'sale_edit#apply_void' # in_juties get '/table/:table_id/assign_in_juty' => 'in_juties#assign_in_juty', as: 'assign_in_juty' - post 'assign_in_juty' => 'in_juties#create_for_in_juty', as: 'create_for_in_juty' get 'assign_in_juty/:table_id' => 'in_juties#index_in_juty', as: 'index_in_juty' - get 'table/:table_id/in_juty/:id/edit' => 'in_juties#edit_in_juty', as: 'edit_in_juty' - put '/edit_in_juty/:id' => 'in_juties#update_for_in_juty', as: 'update_for_in_juty' + post 'assign_in_juty/:table_id' => 'in_juties#create_for_in_juty' + + get 'assign_in_juty/table/:table_id/in_juty/:id/edit' => 'in_juties#edit_in_juty' ,as: 'edit_in_juty' + patch 'edit_in_juty/:id' => 'in_juties#update_for_in_juty', as: 'update_for_in_juty' delete 'table/:table_id/destroy_in_juty/:id' => 'in_juties#destroy_in_juty', as: 'destroy_in_juty' get 'table/:dining_id/movetable' => "movetable#move_dining" diff --git a/db/migrate/20170403140820_create_order_items.rb b/db/migrate/20170403140820_create_order_items.rb index 1882bd62..0bca8500 100644 --- a/db/migrate/20170403140820_create_order_items.rb +++ b/db/migrate/20170403140820_create_order_items.rb @@ -6,6 +6,7 @@ class CreateOrderItems < ActiveRecord::Migration[5.1] t.string :order_item_status, :null => false, :default => "new" t.string :item_order_by #person who order this t.string :item_code, :null => false + t.string :item_instance_code t.string :item_name, :null => false t.string :alt_name, :null => false t.integer :account_id, :limit => 8, :null => false, :default => 1 diff --git a/db/seeds.rb b/db/seeds.rb index 27859c89..0da65820 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -218,25 +218,26 @@ zone3 = Zone.create({id:3, name: "H3", is_active:true, created_by: "SYSTEM DEFAU table = Table.create({name:"77", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"}) table = Table.create({name:"78", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"}) -member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "http://staging.membership.paypar.ws",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"}) +member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "http://staging.membership.paypar.ws",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv"}) -member_actions= MembershipAction.create([{membership_type:"get_account_balance",gateway_url:"/api/membership_campaigns/get_correspond_account_data",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, - {membership_type:"redeem",gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, - {membership_type:"create_membership_customer",gateway_url:"/api/generic_customer/create_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, - {membership_type:"update_membership_customer",gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, - {membership_type:"get_all_member_group",gateway_url:"/api/member_group/get_all_member_group",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, - {membership_type:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, - {membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, - {membership_type:"get_member_transactions",gateway_url:"/api/generic_customer/get_membership_transactions",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, - {membership_type:"member_discount",gateway_url:"/api/membership_campaigns/discount",additional_parameter:{campaign_type_id:6},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, - {membership_type:"get_member_campaign",gateway_url:"/api/membership_campaigns/get_member_campaign",additional_parameter:{campaign_type_id:6},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, +member_actions= MembershipAction.create([{membership_type:"get_account_balance",gateway_url:"/api/membership_campaigns/get_correspond_account_data",additional_parameter:{campaign_type_id:1},merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",auth_token:"code2lab"}, + {membership_type:"redeem",gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1},merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",auth_token:"code2lab"}, + {membership_type:"create_membership_customer",gateway_url:"/api/generic_customer/create_membership_customer",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",auth_token:"code2lab"}, + {membership_type:"update_membership_customer",gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",auth_token:"code2lab"}, + {membership_type:"get_all_member_group",gateway_url:"/api/member_group/get_all_member_group",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",auth_token:"code2lab"}, + {membership_type:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",auth_token:"code2lab"}, + {membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",auth_token:"code2lab"}, + {membership_type:"get_member_transactions",gateway_url:"/api/generic_customer/get_membership_transactions",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",auth_token:"code2lab"}, + {membership_type:"member_discount",gateway_url:"/api/membership_campaigns/discount",additional_parameter:{campaign_type_id:6},merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",auth_token:"code2lab"}, + {membership_type:"get_member_campaign",gateway_url:"/api/membership_campaigns/get_member_campaign",additional_parameter:{campaign_type_id:6},merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",auth_token:"code2lab"}, + {membership_type:"search_paypar_account_no",gateway_url:"/api/generic_customer/get_membership_customer_data",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",auth_token:"code2lab"} ]) payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http://membership.paypar.ws"}) payment_methods = PaymentMethodSetting.create({payment_method:"VISA",gateway_url: "http://membership.paypar.ws"}) payment_methods = PaymentMethodSetting.create({payment_method:"JCB",gateway_url: "http://membership.paypar.ws"}) payment_methods = PaymentMethodSetting.create({payment_method:"Master",gateway_url: "http://membership.paypar.ws"}) -payment_methods = PaymentMethodSetting.create({payment_method:"Redeem",gateway_url: "http://membership.paypar.ws",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"}) +payment_methods = PaymentMethodSetting.create({payment_method:"Redeem",gateway_url: "http://membership.paypar.ws",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv"}) #Default Order Queue stations order_queue_station1 = OrderQueueStation.create({station_name: "K1", is_active: true,printer_name: "Cashier", processing_items: JSON.generate(['01001','01002','01003','01004']), print_copy:true, cut_per_item: false, use_alternate_name: false, created_by: "SYSTEM DEFAULT"})