From 94cc126969fa6b0f5df2e8ae5dd232e925dd02cb Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 22 Aug 2017 18:02:16 +0630 Subject: [PATCH 01/17] fix for pdf print setting --- app/pdf/order_item_pdf.rb | 4 ++-- app/pdf/order_summary_pdf.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/pdf/order_item_pdf.rb b/app/pdf/order_item_pdf.rb index 4b9fb821..64df3adb 100644 --- a/app/pdf/order_item_pdf.rb +++ b/app/pdf/order_item_pdf.rb @@ -2,8 +2,8 @@ class OrderItemPdf < Prawn::Document include ActionView::Helpers::NumberHelper attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width def initialize(print_settings,order_item, print_status, options, alt_name) - self.page_width = printer_settings.page_width - self.page_height = printer_settings.page_height + self.page_width = print_settings.page_width + self.page_height = print_settings.page_height self.margin = 0 self.price_width = 40 # No Need for item self.qty_width = 40 diff --git a/app/pdf/order_summary_pdf.rb b/app/pdf/order_summary_pdf.rb index 53248ebb..d23f2677 100644 --- a/app/pdf/order_summary_pdf.rb +++ b/app/pdf/order_summary_pdf.rb @@ -2,8 +2,8 @@ class OrderSummaryPdf < Prawn::Document include ActionView::Helpers::NumberHelper attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width def initialize(print_settings,order, print_status, order_items = nil,alt_name) - self.page_width = printer_settings.page_width - self.page_height = printer_settings.page_height + self.page_width = print_settings.page_width + self.page_height = print_settings.page_height self.margin = 0 self.price_width = 40 # No Need for item self.qty_width = 40 From 28dab9d3e06e27cc5829a851ae0225092251318e Mon Sep 17 00:00:00 2001 From: Nweni Date: Wed, 23 Aug 2017 09:48:15 +0630 Subject: [PATCH 02/17] promotion --- app/models/promotion.rb | 147 ++++++++++++++++++++++++++++++++++++++++ app/models/shop.rb | 112 ------------------------------ 2 files changed, 147 insertions(+), 112 deletions(-) diff --git a/app/models/promotion.rb b/app/models/promotion.rb index b255ceec..3b4b61ed 100644 --- a/app/models/promotion.rb +++ b/app/models/promotion.rb @@ -9,4 +9,151 @@ class Promotion < ApplicationRecord PROMO_TYPE2 = "Net_off" PROMO_TYPE3 = "Net_price" PROMO_TYPE4 = "Percentage" + + def self.promo_activate + saleObj = Sale.first # Test + current_day = Time.now.strftime("%Y-%m-%d") + current_time = Time.now.strftime('%H:%M:%S') + day = Date.today.wday + promoList = is_between_promo_datetime(current_day,current_time) + puts "promoList - " + promoList.size.to_s + if promoList.size > 0 + itemList = combine_item(saleObj) + is_promo_day(promoList,day, itemList) + end + end + + def self.is_between_promo_datetime(current_day,current_time) #database is not local time + promoList = Promotion.where("(TO_CHAR(promo_start_date, 'YYYY-MM-DD') <=? AND TO_CHAR(promo_end_date, 'YYYY-MM-DD') >=?) AND (promo_start_hour < ? AND promo_end_hour > ?)", current_day, current_day, current_time, current_time) + return promoList + end + + def self.combine_item(saleObj) + itemList = saleObj.sale_items.group(:product_code).sum(:qty) + end + + def self.is_promo_day(promoList, day, orderitemList) + puts "Today date - " + day.to_s + promoList.each do |promo| + dayresult = promo.promo_day.include?(day.to_s) + if dayresult + orderitemList.each do |item| + find_promo_item(promo, item) + end + end + end + end + + def self.find_promo_item(promo, orderitem) + if promo.original_product.to_s == orderitem[0].to_s + if promo.min_qty.to_i > orderitem[1].to_i + return false + else + check_promo_type(promo,orderitem) + end + end + end + + def self.check_promo_type(promo, orderitem) + if promo.promo_type == Promotion::PROMO_TYPE1 + same, foc_min_qty = check_giveaway_product(promo, orderitem[0]) + if same + give_promotion_same_product(orderitem[1], promo.min_qty, foc_min_qty, orderitem) + else + find_promo_item_in_orderlist + end + elsif promo.promo_type == Promotion::PROMO_TYPE2 + + elsif promo.promo_type == Promotion::PROMO_TYPE3 + + elsif promo.promo_type == Promotion::PROMO_TYPE4 + + end + end + + def self.check_giveaway_product(promo, orderitem) + promo.promotion_products.each do |promo_product| + if promo_product.item_code == orderitem + return true, promo_product.min_qty.to_i + else + return false, 0 + end + end + end + + def self.give_promotion_same_product(qty, promoqty, foc_min_qty, orderitem) + puts " Order qty: " + qty.to_s + " / promoqty: " + promoqty.to_s + " / giveaway: " + foc_min_qty.to_s + multiple = qty.to_i / promoqty.to_i # loop count + charge_qty = 0 + foc_qty = 0 + if multiple > 0 + multiple.times.each do |key| + if qty >= promoqty + charge_qty += promoqty + different = qty - promoqty + qty = different + if different == 0 + foc_qty += foc_min_qty + else + foc_qty += foc_min_qty + qty = qty - foc_min_qty + end + else + if multiple == foc_qty + charge_qty += qty + else + charge_qty += qty + end + end + end + else + charge_qty = qty + end + if qty == promoqty + update_existing_item(foc_qty, orderitem) + else + update_existing_item(foc_qty, orderitem) + end + puts "Charged - " + charge_qty.to_s + puts "FOC - " + foc_qty.to_s + end + + def find_promo_item_in_orderlist(promo_item_code, orderitemList) + orderitemList.each do |item| + if item.item_code == promo_item_code + give_promotion_second_product(item) + else + add_promotion_second_item + end + end + end + + def give_promotion_second_product(item, foc_min_qty) + if item.qty > foc_min_qty + + else + + end + end + + def self.update_existing_item(foc_qty, item) + + sale_item = SaleItem.new + sale_item.product_code = item.item_code + sale_item.product_name = item.item_name + " (promotion)" + sale_item.product_alt_name = item.alt_name + sale_item.account_id = item.account_id + sale_item.remark = " Promotion " + + sale_item.qty = foc_qty + sale_item.unit_price = item.price + sale_item.taxable_price = item.price + sale_item.is_taxable = item.taxable + + sale_item.price = foc_qty * item.price + end + + def self.add_promotion_second_item + + end end diff --git a/app/models/shop.rb b/app/models/shop.rb index dbb0930e..24f4bc1e 100644 --- a/app/models/shop.rb +++ b/app/models/shop.rb @@ -1,116 +1,4 @@ class Shop < ApplicationRecord - def promo_activate - current_day = Time.now.strftime("%Y-%d-%m") - current_time = Time.now.strftime('%H:%M') - day = Date.today.wday - promoList = is_between_promo_datetime(current_day,current_time) - if promoList.size > 0 - itemList = combine_item(saleObj) - is_promo_day(promoList,day, itemList) - end - end - def is_between_promo_datetime(current_day,current_time) - promoList = Promotion.where('( promo_start_date < ? AND promo_end_date > ?) AND (promo_start_time < ? AND promo_end_time > ?)', current_day, current_day, current_time, current_time) - return promoList - end - - def combine_item(saleObj) - itemList = saleObj.sale_items.group(:product_code).sum(:qty) - end - - def is_promo_day(promoList, day, orderitemList) - promoList.each do |promo| - dayresult = promo.promo_day.include?(day) - if dayresult - orderitemList.each do |item| - find_promo_item(promo, item) - end - end - end - end - - def find_promo_item(promo, orderitem) - if promo.prouduct_item == orderitem - if promo.minmum_qty < orderitem.qty - return false - else - same, promo_item_code = check_giveaway_product(promo, orderitem) - if same - give_promotion_same_product - else - find_promo_item_in_orderlist - end - end - end - end - - def check_giveaway_product(promo, orderitem) - promo.promotion_products.each do |promo_product| - if promo_product.item_code == orderitem.item_code - return true, promo_product.item_code - else - return false, promo_product.item_code - end - end - end - - def self.give_promotion_same_product(qty, promoqty, foc_min_qty) - multiple = qty / promoqty # loop count - charge_qty = 0 - foc_qty = 0 - if multiple > 0 - multiple.times.each do |key| - if qty >= promoqty - charge_qty += promoqty - different = qty - promoqty - qty = different - if different == 0 - Shop.add_promotion_item - foc_qty += foc_min_qty - else - foc_qty += foc_min_qty - qty = qty - foc_min_qty - end - else - if multiple == foc_qty - charge_qty += qty - else - charge_qty += qty - end - end - end - else - charge_qty = qty - end - puts "Charged - " + charge_qty.to_s - puts "FOC - " + foc_qty.to_s - end - - def find_promo_item_in_orderlist(promo_item_code, orderitemList) - orderitemList.each do |item| - if item.item_code == promo_item_code - give_promotion_second_product(item) - else - add_promotion_second_item - end - end - end - - def give_promotion_second_product(item, foc_min_qty) - if item.qty > foc_min_qty - - else - - end - end - - def self.add_promotion_item - - end - - def self.add_promotion_second_item - - end end From eedf6c39a1c33abb99fd6e516eb499a45734e8fc Mon Sep 17 00:00:00 2001 From: Nweni Date: Wed, 23 Aug 2017 10:12:41 +0630 Subject: [PATCH 03/17] promotion + merge with master --- app/controllers/api/bill_controller.rb | 1 + app/models/promotion.rb | 3 +-- app/models/sale.rb | 24 ++++++++++++------------ app/views/origami/home/index.html.erb | 14 ++++++-------- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/app/controllers/api/bill_controller.rb b/app/controllers/api/bill_controller.rb index eba40816..7ee80f00 100644 --- a/app/controllers/api/bill_controller.rb +++ b/app/controllers/api/bill_controller.rb @@ -24,6 +24,7 @@ class Api::BillController < Api::ApiController @sale = Sale.new @status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier) end + # Promotion.promo_activate(@sale) else @status = false @error_message = "No Current Open Shift" diff --git a/app/models/promotion.rb b/app/models/promotion.rb index 3b4b61ed..778f7638 100644 --- a/app/models/promotion.rb +++ b/app/models/promotion.rb @@ -10,8 +10,7 @@ class Promotion < ApplicationRecord PROMO_TYPE3 = "Net_price" PROMO_TYPE4 = "Percentage" - def self.promo_activate - saleObj = Sale.first # Test + def self.promo_activate(saleObj) current_day = Time.now.strftime("%Y-%m-%d") current_time = Time.now.strftime('%H:%M:%S') day = Date.today.wday diff --git a/app/models/sale.rb b/app/models/sale.rb index 71994ca1..9927251d 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -298,8 +298,8 @@ class Sale < ApplicationRecord customer = Customer.find(sale.customer_id) # #Creat new tax records tax_profiles.each do |tax| - customer.tax_profiles.each do |cus_tax| - if cus_tax.to_i == tax.id + customer.tax_profiles.each do |cus_tax| + if cus_tax.to_i == tax.id sale_tax = SaleTax.new(:sale => sale) sale_tax.tax_name = tax.name sale_tax.tax_rate = tax.rate @@ -311,7 +311,7 @@ class Sale < ApplicationRecord rate = tax.rate divided_value = (100 + rate)/rate sale_tax.tax_payable_amount = total_tax / divided_value - else + else sale_tax.tax_payable_amount = total_tax * tax.rate / 100 total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount end @@ -319,7 +319,7 @@ class Sale < ApplicationRecord # total_taxable = total_taxable + sale_tax.tax_payable_amount sale_tax.inclusive = tax.inclusive - sale_tax.save + sale_tax.save end end end @@ -338,13 +338,13 @@ class Sale < ApplicationRecord total_tax_amount = 0 #tax_profile - list by order_by tax_profiles = TaxProfile.all.order("order_by asc") - - customer = Customer.find(self.customer_id) + customer = Customer.find(self.customer_id) + puts customer #Create new tax records tax_profiles.each do |tax| - customer.tax_profiles.each do |cus_tax| - if cus_tax.to_i == tax.id + customer.tax_profiles.each do |cus_tax| + if cus_tax.to_i == tax.id sale_tax = SaleTax.new(:sale => self) sale_tax.tax_name = tax.name sale_tax.tax_rate = tax.rate @@ -356,16 +356,16 @@ class Sale < ApplicationRecord rate = tax.rate divided_value = (100 + rate)/rate sale_tax.tax_payable_amount = total_tax / divided_value - else + else sale_tax.tax_payable_amount = total_tax * tax.rate / 100 total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount end - + #new taxable amount is standard rule for step by step # total_taxable = total_taxable + sale_tax.tax_payable_amount sale_tax.inclusive = tax.inclusive - sale_tax.save + sale_tax.save end end end @@ -596,7 +596,7 @@ def self.get_item_query() query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id") query = query.group('i.product_code ').order("mi.account_id, mi.menu_category_id") -end +end def self.get_by_shift_items(shift_sale_range, shift, from, to, status) # date_type_selection = get_sql_function_for_report_type(report_type) diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index 05094504..2742f249 100644 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -108,17 +108,15 @@ - <%if current_login_employee.role == "cashier" && @shop.quick_sale_summary == true%> - - <%end%> + - - - <%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %> - <%end%> - + From fd1bfb7c0e9ebd0c7463af632d4ec96309791829 Mon Sep 17 00:00:00 2001 From: Zin Lin Phyo Date: Wed, 23 Aug 2017 10:24:26 +0630 Subject: [PATCH 04/17] load commissioner --- .idea/workspace.xml | 671 ++++++++++++------ .../origami/commissions_controller.rb | 15 + app/models/commission.rb | 2 + app/models/commissioner.rb | 4 +- app/models/employee.rb | 3 +- app/models/product.rb | 3 +- .../_commissioners_form.html.erb | 16 + .../origami/commissioners/_form.html.erb | 5 +- .../origami/commissioners/index.html.erb | 40 +- app/views/origami/commissioners/show.html.erb | 8 +- .../commissions/load_commissioners.html.erb | 217 ++++++ app/views/origami/home/show.html.erb | 6 + config/routes.rb | 3 + 13 files changed, 738 insertions(+), 255 deletions(-) create mode 100644 app/views/origami/commissioners/_commissioners_form.html.erb create mode 100644 app/views/origami/commissions/load_commissioners.html.erb diff --git a/.idea/workspace.xml b/.idea/workspace.xml index de9b54ce..feb2e6c0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,10 +3,16 @@ - - - + + + + + + + + + @@ -23,74 +29,91 @@ - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - - + + - - + + + + + + + + + + + + @@ -106,6 +129,13 @@ void red origami + order + orders + table + tables + sale_edit#edit + @saleobj + edit @@ -132,25 +162,31 @@ @@ -161,10 +197,10 @@ DEFINITION_ORDER - @@ -184,8 +220,21 @@ - + + + + + + + + + + @@ -297,11 +346,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + @@ -397,6 +589,7 @@ + @@ -732,35 +925,37 @@ - + + + - - + - + - + - - + - + - - + + - + + @@ -774,14 +969,6 @@ - - - - - - - - @@ -805,13 +992,6 @@ - - - - - - - @@ -819,13 +999,6 @@ - - - - - - - @@ -842,14 +1015,6 @@ - - - - - - - - @@ -857,27 +1022,10 @@ - - - - - - - - - - - - - - - - - @@ -885,15 +1033,6 @@ - - - - - - - - - @@ -905,59 +1044,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -965,7 +1055,6 @@ - @@ -973,7 +1062,6 @@ - @@ -981,7 +1069,6 @@ - @@ -989,31 +1076,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1021,7 +1083,6 @@ - @@ -1029,7 +1090,6 @@ - @@ -1037,7 +1097,6 @@ - @@ -1045,17 +1104,185 @@ - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/controllers/origami/commissions_controller.rb b/app/controllers/origami/commissions_controller.rb index fdd1bf73..a10e59c6 100644 --- a/app/controllers/origami/commissions_controller.rb +++ b/app/controllers/origami/commissions_controller.rb @@ -61,6 +61,21 @@ class Origami::CommissionsController < BaseOrigamiController end end + def load_commissioners + sale_id = params[:sale_id] + @table_id = params[:table_id] + @saleobj = Sale.find(sale_id) + + @commissioners = [] + end + + def select_sale_item + byebug + sale_item_id = params[:sale_item_id] + @sale_item = SaleItem.find_by_sale_item_id(sale_item_id) + @commissioners = Commissioner.active.all + end + private # Use callbacks to share common setup or constraints between actions. def set_commission diff --git a/app/models/commission.rb b/app/models/commission.rb index 8d14db70..48f73f87 100644 --- a/app/models/commission.rb +++ b/app/models/commission.rb @@ -1,2 +1,4 @@ class Commission < ApplicationRecord + belongs_to :product, foreign_key: 'product_id' + has_many :commissioners end diff --git a/app/models/commissioner.rb b/app/models/commissioner.rb index c6d4ab4c..ac199468 100644 --- a/app/models/commissioner.rb +++ b/app/models/commissioner.rb @@ -1,3 +1,5 @@ class Commissioner < ApplicationRecord - has_many :employees + belongs_to :employee, foreign_key: 'emp_id' + belongs_to :commission, foreign_key: 'commission_type' + scope :active, -> { where(is_active: true) } end diff --git a/app/models/employee.rb b/app/models/employee.rb index a6b52f21..a12521cb 100644 --- a/app/models/employee.rb +++ b/app/models/employee.rb @@ -1,7 +1,8 @@ class Employee < ApplicationRecord has_secure_password - belongs_to :commissioner + has_many :commissioners has_many :shit_sales + validates_presence_of :name, :role validates_presence_of :password, :on => [:create] validates :emp_id, uniqueness: true, numericality: true, length: {in: 1..4}, allow_blank: true diff --git a/app/models/product.rb b/app/models/product.rb index 8f6811e2..fed8ee97 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -1,6 +1,7 @@ class Product < ApplicationRecord validates_presence_of :name - + has_many :commissions + # Product Image Uploader mount_uploader :image_path, ProductImageUploader end diff --git a/app/views/origami/commissioners/_commissioners_form.html.erb b/app/views/origami/commissioners/_commissioners_form.html.erb new file mode 100644 index 00000000..10637a82 --- /dev/null +++ b/app/views/origami/commissioners/_commissioners_form.html.erb @@ -0,0 +1,16 @@ +
+
+
COMMISSIONERS
+
+
+
+ <% @commissioners.each do |commissioner| %> +
+
+ <%= commissioner.name %> +
+
+ <% end %> +
+
+
diff --git a/app/views/origami/commissioners/_form.html.erb b/app/views/origami/commissioners/_form.html.erb index 4c2a17f8..3923d564 100644 --- a/app/views/origami/commissioners/_form.html.erb +++ b/app/views/origami/commissioners/_form.html.erb @@ -5,8 +5,9 @@
<%= f.input :name %> <%= f.label :emp_id %> - <%= f.collection_select :emp_id, Employee.all.order('name asc'), :emp_id, :name, {prompt: "Select an Employee"}, {class: "form-control"} %>
- <%= f.input :commission_type %> + <%= f.collection_select :emp_id, Employee.all.order('name asc'), :id, :name, {prompt: 'Select an Employee'}, {class: "form-control"} %>
+ <%= f.label :commission_type %> + <%= f.collection_select :commission_type, Commission.all, :id, :product_id, {prompt: 'Select Commission Type'}, class: 'form-control' %>
diff --git a/app/views/origami/commissioners/index.html.erb b/app/views/origami/commissioners/index.html.erb index baadb225..cf06ed6d 100644 --- a/app/views/origami/commissioners/index.html.erb +++ b/app/views/origami/commissioners/index.html.erb @@ -1,11 +1,11 @@
@@ -23,22 +23,18 @@ <% @commissioners.each do |commissioner| %> - - <%= commissioner.name %> - - <% if Employee.exists? %> - <% employee = Employee.where('emp_id=?',commissioner.emp_id) %> - <%= employee[0].name %> - <% end %> - - - <%= commissioner.commission_type %> - <%= commissioner.is_active %> - <%= link_to 'Show', origami_commissioner_path(commissioner) %> - <%= link_to 'Edit', edit_origami_commissioner_path(commissioner) %> - <%= link_to 'Destroy', origami_commissioner_path(commissioner), method: :delete, data: { confirm: 'Are you sure?' } %> - + + <%= commissioner.name %> + + <%= commissioner.employee.name rescue '-' %> + + <%= commissioner.commission.product.name rescue '-' %> + <%= commissioner.is_active %> + <%= link_to 'Show', origami_commissioner_path(commissioner) %> + <%= link_to 'Edit', edit_origami_commissioner_path(commissioner) %> + <%= link_to 'Destroy', origami_commissioner_path(commissioner), method: :delete, data: {confirm: 'Are you sure?'} %> + <% end %> - + diff --git a/app/views/origami/commissioners/show.html.erb b/app/views/origami/commissioners/show.html.erb index 83d5442b..1f9b2780 100644 --- a/app/views/origami/commissioners/show.html.erb +++ b/app/views/origami/commissioners/show.html.erb @@ -21,16 +21,12 @@ Employee Name - <% if Employee.exists? %> - <% employee = Employee.where('emp_id=?', @commissioner.emp_id) %> - <%= employee[0].name %> - <% end %> - + <%= @commissioner.employee.name rescue '-' %> Commission Type - <%= @commissioner.commission_type %> + <%= @commissioner.commission.product.name rescue '-' %> Active diff --git a/app/views/origami/commissions/load_commissioners.html.erb b/app/views/origami/commissions/load_commissioners.html.erb new file mode 100644 index 00000000..5252b1bd --- /dev/null +++ b/app/views/origami/commissions/load_commissioners.html.erb @@ -0,0 +1,217 @@ +
+ +
+ <%= render 'origami/commissioners/commissioners_form', commissioners: @commissioners %> +
+ + +
+
+
+
INVOICE DETAILS
+
+
+
+
+

Receipt No: + <%= @saleobj.receipt_no rescue '' %> +

+
+
+

Date: + <%= @saleobj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %> +

+
+
+
+
+

Customer :

+
+ +
+
+ + + + + + + + + <% + count = 0 + sub_total = 0 + @saleobj.sale_items.each do |sale_item| + count += 1 + sub_total = sub_total + sale_item.price + %> + + <% + # Can't check for discount + unless sale_item.price == 0 + %> + + + + + + + <% + end + end + %> + +
#ItemsQTY + + Price + +
<%= count %> + <%= sale_item.product_name %> + + <%= sale_item.qty %> + + <%= sale_item.unit_price %> +
+
+ +
+
+
+ + +
+ + + +
+
+ diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index a79c1ce1..1e39bd8d 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -572,6 +572,12 @@ window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/edit"; }); + $('#commissions').on('click', function () { + var dining_id = "<%= @dining.id %>" + var sale_id = "<%= @obj_sale.sale_id rescue "" %>" + window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/load_commissioners"; + }); + $('#void').on('click', function () { var sure = confirm("Are you sure want to Void"); if (sure == true) { diff --git a/config/routes.rb b/config/routes.rb index 7276e31f..8277e58f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -86,6 +86,9 @@ Rails.application.routes.draw do post 'item_void_cancel' => "sale_edit#item_void_cancel" post 'cancel_all_void' => 'sale_edit#cancel_all_void' post 'apply_void' => 'sale_edit#apply_void' + # commissions + get '/table/:table_id/sale/:sale_id/load_commissioners' => 'commissions#load_commissioners', as: 'load_commissioners' + post 'select_sale_item' => 'commissions#select_sale_item' get 'table/:dining_id/movetable' => "movetable#move_dining" get 'table/:dining_id/moveroom' => "moveroom#move_dining" From 3132bc7c3448d414dfec198c3487aa02aec2c231 Mon Sep 17 00:00:00 2001 From: Zin Lin Phyo Date: Wed, 23 Aug 2017 11:14:24 +0630 Subject: [PATCH 05/17] commission update --- .idea/sxrestaurant.iml | 1 + .idea/workspace.xml | 302 ++++++++++-------- Gemfile | 1 + Gemfile.lock | 3 + app/assets/javascripts/application.js | 2 + app/assets/stylesheets/application.scss | 3 +- .../origami/commissions_controller.rb | 2 + app/models/commission.rb | 2 +- app/models/menu_item.rb | 2 + app/models/product.rb | 1 - app/views/origami/commissions/_form.html.erb | 6 +- app/views/origami/commissions/index.html.erb | 38 +-- app/views/origami/commissions/show.html.erb | 7 +- 13 files changed, 204 insertions(+), 166 deletions(-) diff --git a/.idea/sxrestaurant.iml b/.idea/sxrestaurant.iml index e1c0cfaa..23c2b8f5 100644 --- a/.idea/sxrestaurant.iml +++ b/.idea/sxrestaurant.iml @@ -210,6 +210,7 @@ + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index feb2e6c0..1e51bfe8 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,17 +2,19 @@ + + + + + - - + - - - - - + + + @@ -29,31 +31,51 @@ - - + + - - + + - - - - - - - - - - - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -62,58 +84,41 @@ - - + + - - + + - - + + - - + + - - - + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - + + @@ -163,12 +168,9 @@ @@ -927,12 +936,12 @@ - + - @@ -943,19 +952,19 @@ + + - - @@ -969,16 +978,6 @@ - - - - - - - - - - @@ -1058,20 +1057,6 @@ - - - - - - - - - - - - - - @@ -1178,28 +1163,6 @@ - - - - - - - - - - - - - - - - - - - - - - @@ -1208,14 +1171,6 @@ - - - - - - - - @@ -1263,14 +1218,6 @@ - - - - - - - - @@ -1280,9 +1227,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + diff --git a/Gemfile b/Gemfile index 7b2cdca5..06b49df2 100644 --- a/Gemfile +++ b/Gemfile @@ -116,3 +116,4 @@ gem 'httparty', '~> 0.15.5' # # gem 'momentjs-rails', '>= 2.9.0' # gem 'bootstrap3-datetimepicker-rails'z gem 'bootstrap-datepicker-rails' +gem 'select2-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 912f79ef..602a5b15 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -196,6 +196,8 @@ GEM tilt (>= 1.1, < 3) schema_to_scaffold (0.8.0) activesupport (>= 3.2.1) + select2-rails (4.0.3) + thor (~> 0.14) shoulda-matchers (3.1.1) activesupport (>= 4.0.0) sidekiq (5.0.3) @@ -280,6 +282,7 @@ DEPENDENCIES rspec-rails (~> 3.5) sass-rails (~> 5.0) schema_to_scaffold + select2-rails shoulda-matchers (~> 3.1) sidekiq simple_form diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index cd056d1c..e0e5eba8 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -20,6 +20,8 @@ //= require settings/processing_items //= require jquery-ui //= require bootstrap-datepicker +//= require select2 +//= require select2-full $(document).on('turbolinks:load', function() { $('.datepicker').datepicker({ diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 1c5ada90..03e049b4 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -4,7 +4,8 @@ @import "theme"; @import "jquery-ui"; @import "bootstrap-datepicker3"; - +@import "select2"; +@import "select2-bootstrap"; /* Show it is fixed to the top */ // body { diff --git a/app/controllers/origami/commissions_controller.rb b/app/controllers/origami/commissions_controller.rb index a10e59c6..f18bd11e 100644 --- a/app/controllers/origami/commissions_controller.rb +++ b/app/controllers/origami/commissions_controller.rb @@ -15,10 +15,12 @@ class Origami::CommissionsController < BaseOrigamiController # GET /commissions/new def new @commission = Commission.new + @products = MenuItem.all end # GET /commissions/1/edit def edit + @products = MenuItem.all end # POST /commissions diff --git a/app/models/commission.rb b/app/models/commission.rb index 48f73f87..df11eb24 100644 --- a/app/models/commission.rb +++ b/app/models/commission.rb @@ -1,4 +1,4 @@ class Commission < ApplicationRecord - belongs_to :product, foreign_key: 'product_id' + belongs_to :menu_item, foreign_key: 'product_id' has_many :commissioners end diff --git a/app/models/menu_item.rb b/app/models/menu_item.rb index 8213ae88..c581a7b0 100644 --- a/app/models/menu_item.rb +++ b/app/models/menu_item.rb @@ -3,6 +3,8 @@ class MenuItem < ApplicationRecord belongs_to :menu_category, :optional => true has_many :menu_item_instances + has_many :commissions + # belongs_to :parent, :class_name => "MenuItem", foreign_key: "menu_item_id", :optional => true # has_many :children, :class_name => "MenuItem", foreign_key: "menu_item_id" belongs_to :account diff --git a/app/models/product.rb b/app/models/product.rb index fed8ee97..5aff41f5 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -1,6 +1,5 @@ class Product < ApplicationRecord validates_presence_of :name - has_many :commissions # Product Image Uploader mount_uploader :image_path, ProductImageUploader diff --git a/app/views/origami/commissions/_form.html.erb b/app/views/origami/commissions/_form.html.erb index a5c0d2c0..1f7fee4a 100644 --- a/app/views/origami/commissions/_form.html.erb +++ b/app/views/origami/commissions/_form.html.erb @@ -4,11 +4,11 @@
<%= f.label :product_id %> - <%= f.collection_select :product_id, Product.all.order('name asc'), :id, :name, {prompt: "Select a Product"}, {class: "form-control"} %>
+ <%= f.collection_select :product_id, @products, :id, :name, {prompt: 'Select a Product'}, {class: 'form-control'} %>
<%= f.input :amount %> - <%= f.input :commission_type, :collection => [:percentage, :net_amount] %> + <%= f.input :commission_type, :collection => ['Percentage','Net Amount'], prompt: 'Select Commission Type', class: 'form-control' %> -
+
<%= link_to 'Back', origami_commissions_path, class: 'btn btn-success' %> <%= f.button :submit, class: 'btn btn-info' %> diff --git a/app/views/origami/commissions/index.html.erb b/app/views/origami/commissions/index.html.erb index e5a83639..da589347 100644 --- a/app/views/origami/commissions/index.html.erb +++ b/app/views/origami/commissions/index.html.erb @@ -1,11 +1,11 @@
@@ -23,22 +23,16 @@ <% @commissions.each do |commission| %> - - - <% if Product.exists? %> - <% product = Product.find(commission.product_id) %> - <%= product.name %> - <% end %> - - - <%= commission.amount %> - <%= commission.commission_type %> - <%= commission.is_active %> - <%= link_to 'Show', origami_commission_path(commission) %> - <%= link_to 'Edit', edit_origami_commission_path(commission) %> - <%= link_to 'Destroy', origami_commission_path(commission), method: :delete, data: { confirm: 'Are you sure?' } %> - + + <%= commission.menu_item.name rescue '-' %> + <%= commission.amount rescue '-' %> + <%= commission.commission_type rescue '-' %> + <%= commission.is_active rescue '-' %> + <%= link_to 'Show', origami_commission_path(commission) %> + <%= link_to 'Edit', edit_origami_commission_path(commission) %> + <%= link_to 'Destroy', origami_commission_path(commission), method: :delete, data: {confirm: 'Are you sure?'} %> + <% end %> - +
diff --git a/app/views/origami/commissions/show.html.erb b/app/views/origami/commissions/show.html.erb index da04710e..439e2c45 100644 --- a/app/views/origami/commissions/show.html.erb +++ b/app/views/origami/commissions/show.html.erb @@ -16,12 +16,7 @@ Product Name - - <% if Product.exists? %> - <% product = Product.find(@commission.product_id) %> - <%= product.name %> - <% end %> - + <%= @commission.menu_item.name rescue '-' %> Amount From d6b8e8bdee6acd49ab18489ef2d10e7e0ebaebe0 Mon Sep 17 00:00:00 2001 From: Zin Lin Phyo Date: Wed, 23 Aug 2017 11:36:36 +0630 Subject: [PATCH 06/17] update commissioner --- .idea/sxrestaurant.iml | 1 - .idea/workspace.xml | 281 +++++++----------- Gemfile | 1 - Gemfile.lock | 3 - app/assets/javascripts/application.js | 2 - app/assets/stylesheets/application.scss | 2 - .../origami/commissioners/index.html.erb | 2 +- 7 files changed, 113 insertions(+), 179 deletions(-) diff --git a/.idea/sxrestaurant.iml b/.idea/sxrestaurant.iml index 23c2b8f5..e1c0cfaa 100644 --- a/.idea/sxrestaurant.iml +++ b/.idea/sxrestaurant.iml @@ -210,7 +210,6 @@ - diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1e51bfe8..70f67cc7 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -8,13 +8,7 @@ - - - - - - - + @@ -31,94 +25,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -180,7 +121,6 @@ @@ -206,7 +147,7 @@ DEFINITION_ORDER - - - + @@ -1149,13 +1090,6 @@
- - - - - - - @@ -1171,14 +1105,6 @@ - - - - - - - - @@ -1242,57 +1168,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1312,15 +1187,83 @@ - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Gemfile b/Gemfile index 06b49df2..7b2cdca5 100644 --- a/Gemfile +++ b/Gemfile @@ -116,4 +116,3 @@ gem 'httparty', '~> 0.15.5' # # gem 'momentjs-rails', '>= 2.9.0' # gem 'bootstrap3-datetimepicker-rails'z gem 'bootstrap-datepicker-rails' -gem 'select2-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 602a5b15..912f79ef 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -196,8 +196,6 @@ GEM tilt (>= 1.1, < 3) schema_to_scaffold (0.8.0) activesupport (>= 3.2.1) - select2-rails (4.0.3) - thor (~> 0.14) shoulda-matchers (3.1.1) activesupport (>= 4.0.0) sidekiq (5.0.3) @@ -282,7 +280,6 @@ DEPENDENCIES rspec-rails (~> 3.5) sass-rails (~> 5.0) schema_to_scaffold - select2-rails shoulda-matchers (~> 3.1) sidekiq simple_form diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index e0e5eba8..cd056d1c 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -20,8 +20,6 @@ //= require settings/processing_items //= require jquery-ui //= require bootstrap-datepicker -//= require select2 -//= require select2-full $(document).on('turbolinks:load', function() { $('.datepicker').datepicker({ diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 03e049b4..2db849ab 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -4,8 +4,6 @@ @import "theme"; @import "jquery-ui"; @import "bootstrap-datepicker3"; -@import "select2"; -@import "select2-bootstrap"; /* Show it is fixed to the top */ // body { diff --git a/app/views/origami/commissioners/index.html.erb b/app/views/origami/commissioners/index.html.erb index cf06ed6d..dfef0320 100644 --- a/app/views/origami/commissioners/index.html.erb +++ b/app/views/origami/commissioners/index.html.erb @@ -28,7 +28,7 @@ <%= commissioner.employee.name rescue '-' %> - <%= commissioner.commission.product.name rescue '-' %> + <%= commissioner.commission.menu_item.name rescue '-' %> <%= commissioner.is_active %> <%= link_to 'Show', origami_commissioner_path(commissioner) %> <%= link_to 'Edit', edit_origami_commissioner_path(commissioner) %> From 911b941793266eb495d7b7be0d319f33f6c60d8f Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 23 Aug 2017 13:43:31 +0630 Subject: [PATCH 07/17] fix member sync and menu json --- app/models/customer.rb | 61 +++++++++++-------- .../restaurant/menu/_menu_item.json.jbuilder | 49 +++++++++++++-- 2 files changed, 78 insertions(+), 32 deletions(-) diff --git a/app/models/customer.rb b/app/models/customer.rb index dff92ba2..b33b13b4 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -91,41 +91,50 @@ 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 diff --git a/app/views/api/restaurant/menu/_menu_item.json.jbuilder b/app/views/api/restaurant/menu/_menu_item.json.jbuilder index 7a450850..c76a4808 100644 --- a/app/views/api/restaurant/menu/_menu_item.json.jbuilder +++ b/app/views/api/restaurant/menu/_menu_item.json.jbuilder @@ -22,23 +22,59 @@ item.item_attributes.each do|attr_id| param_count -= 1 end +# Format for option json +opt_format = [] +param_count = item.item_options.count +# Format for attributes json +item.item_options.each do|opt| + menu_opt = MenuItemOption.find(opt) + if opt_format.count == 0 + opt_format.push({ type: menu_opt.option_type, value: [] }) + end + + opt_format.each do |af| + if menu_opt.option_type == af[:type] + af[:value].push(menu_opt.value) + else + new_attr = {type: menu_opt.option_type, value: [ menu_opt.value ] } + opt_format.push(new_attr) + end + + break if opt_format.count > param_count + end + + param_count -= 1 +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 +88,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 +96,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 From 248b80763389ef8bfba19c0b027c873c1f17deed Mon Sep 17 00:00:00 2001 From: Phyo Date: Wed, 23 Aug 2017 13:59:27 +0630 Subject: [PATCH 08/17] Dining Charges Fix for free time --- app/models/dining_charge.rb | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/app/models/dining_charge.rb b/app/models/dining_charge.rb index 75cf7d7b..b7be007d 100644 --- a/app/models/dining_charge.rb +++ b/app/models/dining_charge.rb @@ -3,19 +3,22 @@ class DiningCharge < ApplicationRecord belongs_to :room def self.amount_calculate(dining_charges_obj, checkin , checkout) - + # note :: the first Charge Block will cost all, the Time rounding block will included in 2nd Charge Block if !checkin.nil? && !checkout.nil? && !dining_charges_obj.nil? price = 0 minutes = DiningCharge.time_diff(checkout, checkin) - free_time = DiningCharge.convert_to_minutes(dining_charges_obj.minimum_free_time.strftime('%H:%M')) + free_time = DiningCharge.convert_to_minutes(dining_charges_obj.minimum_free_time.utc.localtime.strftime('%H:%M')) dining_minutes = minutes - free_time # stayminutes - free minutes - charge_type = dining_charges_obj.charge_type - if charge_type == 'hr' - price = DiningCharge.charges(dining_charges_obj, dining_minutes, 'hr') - elsif charge_type == 'day' - price = charges(dining_charges_obj, dining_minutes, 'day') + if dining_minutes <= 0 + price = 0 + else + charge_type = dining_charges_obj.charge_type + if charge_type == 'hr' + price = DiningCharge.charges(dining_charges_obj, dining_minutes, 'hr') + elsif charge_type == 'day' + price = charges(dining_charges_obj, dining_minutes, 'day') + end end - return price else puts "<<<<<<<< NO" @@ -25,14 +28,15 @@ class DiningCharge < ApplicationRecord def self.charges(chargesObj, dining_minutes, type) solid_price = 0 - block = DiningCharge.convert_to_minutes(chargesObj.charge_block.strftime('%H:%M')) + block = DiningCharge.convert_to_minutes(chargesObj.charge_block.utc.localtime.strftime('%H:%M')) + result = dining_minutes / block if result.to_i < 1 return chargesObj.unit_price elsif result.to_i >= 1 solid_price = result * chargesObj.unit_price remain_value = dining_minutes % block - rounding_block = DiningCharge.convert_to_minutes(chargesObj.time_rounding_block.strftime('%H:%M')) + rounding_block = DiningCharge.convert_to_minutes(chargesObj.time_rounding_block.utc.localtime.strftime('%H:%M')) roundingblock = remain_value / rounding_block if roundingblock.to_i < 1 return DiningCharge.check_rounding(chargesObj, solid_price) @@ -48,7 +52,7 @@ class DiningCharge < ApplicationRecord end end - def self.check_rounding(chargesObj) + def self.check_rounding(chargesObj,solid_price) if chargesObj.time_rounding == "down" return solid_price else From 874a9b60bec90d40b500b3ed927092435ceec744 Mon Sep 17 00:00:00 2001 From: Zin Lin Phyo Date: Wed, 23 Aug 2017 15:02:27 +0630 Subject: [PATCH 09/17] create InJuty --- .idea/.generators | 2 +- .idea/workspace.xml | 828 ++++++------------ .../origami/commissions_controller.rb | 91 -- .../origami/in_juties_controller.rb | 74 ++ app/helpers/origami/in_juties_helper.rb | 2 + app/models/in_juty.rb | 2 + app/views/origami/in_juties/_form.html.erb | 10 + .../origami/in_juties/_in_juty.json.jbuilder | 2 + app/views/origami/in_juties/edit.html.erb | 6 + app/views/origami/in_juties/index.html.erb | 25 + .../origami/in_juties/index.json.jbuilder | 1 + app/views/origami/in_juties/new.html.erb | 5 + app/views/origami/in_juties/show.html.erb | 4 + .../origami/in_juties/show.json.jbuilder | 1 + config/routes.rb | 1 + db/migrate/20170823081747_create_in_juties.rb | 11 + .../origami/in_juties_controller_spec.rb | 141 +++ spec/helpers/origami/in_juties_helper_spec.rb | 15 + spec/models/in_juty_spec.rb | 5 + .../origami/origami_in_juties_spec.rb | 10 + .../routing/origami/in_juties_routing_spec.rb | 39 + .../origami/in_juties/edit.html.erb_spec.rb | 14 + .../origami/in_juties/index.html.erb_spec.rb | 14 + .../origami/in_juties/new.html.erb_spec.rb | 14 + .../origami/in_juties/show.html.erb_spec.rb | 11 + 25 files changed, 692 insertions(+), 636 deletions(-) delete mode 100644 app/controllers/origami/commissions_controller.rb create mode 100644 app/controllers/origami/in_juties_controller.rb create mode 100644 app/helpers/origami/in_juties_helper.rb create mode 100644 app/models/in_juty.rb create mode 100644 app/views/origami/in_juties/_form.html.erb create mode 100644 app/views/origami/in_juties/_in_juty.json.jbuilder create mode 100644 app/views/origami/in_juties/edit.html.erb create mode 100644 app/views/origami/in_juties/index.html.erb create mode 100644 app/views/origami/in_juties/index.json.jbuilder create mode 100644 app/views/origami/in_juties/new.html.erb create mode 100644 app/views/origami/in_juties/show.html.erb create mode 100644 app/views/origami/in_juties/show.json.jbuilder create mode 100644 db/migrate/20170823081747_create_in_juties.rb create mode 100644 spec/controllers/origami/in_juties_controller_spec.rb create mode 100644 spec/helpers/origami/in_juties_helper_spec.rb create mode 100644 spec/models/in_juty_spec.rb create mode 100644 spec/requests/origami/origami_in_juties_spec.rb create mode 100644 spec/routing/origami/in_juties_routing_spec.rb create mode 100644 spec/views/origami/in_juties/edit.html.erb_spec.rb create mode 100644 spec/views/origami/in_juties/index.html.erb_spec.rb create mode 100644 spec/views/origami/in_juties/new.html.erb_spec.rb create mode 100644 spec/views/origami/in_juties/show.html.erb_spec.rb diff --git a/.idea/.generators b/.idea/.generators index 98526fe7..16189766 100644 --- a/.idea/.generators +++ b/.idea/.generators @@ -5,4 +5,4 @@ You are allowed to: 2. Remove generators 3. Add installed generators To add new installed generators automatically delete this file and reload the project. ---> +--> diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 70f67cc7..0ba2fcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,13 +2,31 @@ - + + + + + + + + + + + + + + + + + + + + + + + - - - - - + @@ -25,11 +43,51 @@ - - + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + @@ -38,28 +96,18 @@ - - + + - - + + - - - - - - - - - - - - + + @@ -123,13 +171,11 @@ @@ -170,368 +221,49 @@ - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +