Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into addorder

This commit is contained in:
Aung Myo
2017-08-22 16:10:29 +06:30
118 changed files with 2941 additions and 769 deletions

View File

@@ -11,6 +11,7 @@
// about supported directives.
//
//= require jquery
//= require jquery_nested_form
//= require tether
//= require bootstrap
//= require jquery_ujs
@@ -26,14 +27,14 @@ $(document).on('turbolinks:load', function() {
autoclose: true
});
$('.datepicker').attr('ReadOnly','true');
$('.datepicker').css('cursor','pointer');
$('.datepicker').css('cursor','pointer');
// Image Upload
$("#simple_menu_item_image_path").fileinput({
previewFileType: "image",
allowedFileExtensions: ["jpg", "gif", "png"],
browseClass: "btn btn-success",
browseLabel: "Pick Image",
browseLabel: "Pick Image",
browseIcon: "<i class=\"fa fa-image\"></i> ",
removeClass: "btn btn-danger",
removeLabel: "Delete",
@@ -41,10 +42,30 @@ $(document).on('turbolinks:load', function() {
showUpload: false,
// uploadClass: "btn btn-info",
// uploadLabel: "Upload",
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
previewTemplates: {
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
'</div>\n',
}
});
$("#product_image_path").fileinput({
previewFileType: "image",
allowedFileExtensions: ["jpg", "gif", "png"],
browseClass: "btn btn-success",
browseLabel: "Pick Image",
browseIcon: "<i class=\"fa fa-image\"></i> ",
removeClass: "btn btn-danger",
removeLabel: "Delete",
removeIcon: "<i class=\"fa fa-trash\"></i> ",
showUpload: false,
// uploadClass: "btn btn-info",
// uploadLabel: "Upload",
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
previewTemplates: {
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
'</div>\n',
}
});
@@ -52,7 +73,7 @@ $(document).on('turbolinks:load', function() {
$(document).on("focus", "[data-behaviour~='datepicker']", function(e){
$(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true});
$('.dropdown-toggle').dropdown();
$('.dropdown-toggle').dropdown();
});
function export_to(path)
@@ -60,7 +81,3 @@ function export_to(path)
var form_params = $("#frm_report").serialize();
window.location = path+"?"+ form_params;
}

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the Commissioners controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the Commissions controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,75 @@
class Origami::CommissionersController < BaseOrigamiController
before_action :set_commissioner, only: [:show, :edit, :update, :destroy]
# GET /commissioners
# GET /commissioners.json
def index
@commissioners = Commissioner.all
end
# GET /commissioners/1
# GET /commissioners/1.json
def show
end
# GET /commissioners/new
def new
@commissioner = Commissioner.new
@employee = Employee.all.order('name asc')
end
# GET /commissioners/1/edit
def edit
end
# POST /commissioners
# POST /commissioners.json
def create
@commissioner = Commissioner.new(commissioner_params)
@commissioner.created_by = current_user.id
respond_to do |format|
if @commissioner.save
format.html { redirect_to origami_commissioners_path , notice: 'Commissioner was successfully created.' }
format.json { render :show, status: :created, location: @commissioner }
else
format.html { render :new }
format.json { render json: @commissioner.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /commissioners/1
# PATCH/PUT /commissioners/1.json
def update
respond_to do |format|
if @commissioner.update(commissioner_params)
format.html { redirect_to origami_commissioner_path(@commissioner) , notice: 'Commissioner was successfully updated.' }
format.json { render :show, status: :ok, location: @commissioner }
else
format.html { render :edit }
format.json { render json: @commissioner.errors, status: :unprocessable_entity }
end
end
end
# DELETE /commissioners/1
# DELETE /commissioners/1.json
def destroy
@commissioner.destroy
respond_to do |format|
format.html { redirect_to origami_commissioners_path , notice: 'Commissioner was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_commissioner
@commissioner = Commissioner.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def commissioner_params
params.require(:commissioner).permit(:name,:emp_id,:created_by,:commission_type, :is_active)
end
end

View File

@@ -0,0 +1,74 @@
class Origami::CommissionsController < BaseOrigamiController
before_action :set_commission, only: [:show, :edit, :update, :destroy]
# GET /commissions
# GET /commissions.json
def index
@commissions = Commission.all
end
# GET /commissions/1
# GET /commissions/1.json
def show
end
# GET /commissions/new
def new
@commission = Commission.new
end
# GET /commissions/1/edit
def edit
end
# POST /commissions
# POST /commissions.json
def create
@commission = Commission.new(commission_params)
respond_to do |format|
if @commission.save
format.html { redirect_to origami_commissions_path , notice: 'Commission was successfully created.' }
format.json { render :show, status: :created, location: @commission }
else
format.html { render :new }
format.json { render json: @commission.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /commissions/1
# PATCH/PUT /commissions/1.json
def update
respond_to do |format|
if @commission.update(commission_params)
format.html { redirect_to origami_commission_path(@commission), notice: 'Commission was successfully updated.' }
format.json { render :show, status: :ok, location: @commission }
else
format.html { render :edit }
format.json { render json: @commission.errors, status: :unprocessable_entity }
end
end
end
# DELETE /commissions/1
# DELETE /commissions/1.json
def destroy
@commission.destroy
respond_to do |format|
format.html { redirect_to origami_commissions_path, notice: 'Commission was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_commission
@commission = Commission.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def commission_params
params.require(:commission).permit(:product_id,:amount,:commission_type, :is_active)
end
end

View File

@@ -0,0 +1,74 @@
class Origami::ProductCommissionsController < ApplicationController
before_action :set_product_commission, only: [:show, :edit, :update, :destroy]
# GET /product_commissions
# GET /product_commissions.json
def index
@product_commissions = ProductCommission.all
end
# GET /product_commissions/1
# GET /product_commissions/1.json
def show
end
# GET /product_commissions/new
def new
@product_commission = ProductCommission.new
end
# GET /product_commissions/1/edit
def edit
end
# POST /product_commissions
# POST /product_commissions.json
def create
@product_commission = ProductCommission.new(product_commission_params)
respond_to do |format|
if @product_commission.save
format.html { redirect_to @product_commission, notice: 'Product commission was successfully created.' }
format.json { render :show, status: :created, location: @product_commission }
else
format.html { render :new }
format.json { render json: @product_commission.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /product_commissions/1
# PATCH/PUT /product_commissions/1.json
def update
respond_to do |format|
if @product_commission.update(product_commission_params)
format.html { redirect_to @product_commission, notice: 'Product commission was successfully updated.' }
format.json { render :show, status: :ok, location: @product_commission }
else
format.html { render :edit }
format.json { render json: @product_commission.errors, status: :unprocessable_entity }
end
end
end
# DELETE /product_commissions/1
# DELETE /product_commissions/1.json
def destroy
@product_commission.destroy
respond_to do |format|
format.html { redirect_to product_commissions_url, notice: 'Product commission was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_product_commission
@product_commission = ProductCommission.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def product_commission_params
params.fetch(:product_commission, {})
end
end

View File

@@ -22,7 +22,7 @@ class Origami::VoucherController < BaseOrigamiController
def create
cash = params[:amount]
sale_id = params[:sale_id]
sale_id = params[:refnumber]
voucher_no = params[:refnumber]
if(Sale.exists?(sale_id))
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
if customer_data
@@ -37,11 +37,12 @@ class Origami::VoucherController < BaseOrigamiController
auth_token = member_actions.auth_token.to_s
# membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token)
# if membership_data["status"]==true
# app_token: token,membership_id:membership_id,
# campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,
# auth_token:auth_token
begin
response = HTTParty.get(url,
:body => { app_token: token,membership_id:membership_id,
campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,
auth_token:auth_token
:body => { voucher_no: voucher_no,membership_id:membership_id
}.to_json,
:headers => {
'Content-Type' => 'application/json',

View File

@@ -55,7 +55,7 @@ class Settings::MenuItemInstancesController < ApplicationController
sets = ItemSet.find(params[:menu_item_instance][:item_sets])
if sets.count > 0
@settings_menu_item.item_sets = sets
@settings_menu_item_instances.item_sets = sets
end
end
@@ -92,7 +92,7 @@ class Settings::MenuItemInstancesController < ApplicationController
sets = ItemSet.find(params[:menu_item_instance][:item_sets])
if sets.count > 0
@settings_menu_item.item_sets = sets
@settings_menu_item_instances.item_sets = sets
end
end

View File

@@ -0,0 +1,77 @@
class Settings::PromotionProductsController < ApplicationController
before_action :set_promotion, only: [:show, :edit, :update, :destroy,:new]
before_action :set_promotion_product, only: [:show, :edit, :update, :destroy]
# GET /promotion_products
# GET /promotion_products.json
def index
@promotion_products = PromotionProduct.all
end
# GET /promotion_products/1
# GET /promotion_products/1.json
def show
end
# GET /promotion_products/new
def new
@promotion_product = PromotionProduct.new
end
# GET /promotion_products/1/edit
def edit
end
# POST /promotion_products
# POST /promotion_products.json
def create
@promotion_product = PromotionProduct.new(promotion_params)
respond_to do |format|
if @promotion_product.save
format.html { redirect_to edit_settings_promotion_path(@promotion), notice: 'PromotionProduct was successfully created.' }
format.json { render :show, status: :created, location: @promotion_product }
else
format.html { render :new }
format.json { render json: @promotion_product.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /promotion_products/1
# PATCH/PUT /promotion_products/1.json
def update
respond_to do |format|
if @promotion_product.update(promotion_params)
format.html { redirect_to edit_settings_promotion_path(@promotion), notice: 'PromotionProduct was successfully updated.' }
format.json { render :show, status: :ok, location: @promotion_product }
else
format.html { render :edit }
format.json { render json: @promotion_product.errors, status: :unprocessable_entity }
end
end
end
# DELETE /promotion_products/1
# DELETE /promotion_products/1.json
def destroy
@promotion_product.destroy
respond_to do |format|
format.html { redirect_to edit_settings_promotion_path(@promotion) , notice: 'PromotionProduct was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_promotion
@promotion = Promotion.find(params[:promotion_id])
end
def set_promotion_product
@promotion_product = PromotionProduct.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def promotion_params
params.require(:promotion_product).permit(:promo_code, :promo_start_date, :promo_end_date, :promo_start_hour,:promo_end_hour ,:promo_day, :promo_type,:original_product ,:min_qty ,:created_by)
end
end

View File

@@ -71,6 +71,7 @@ class Settings::PromotionsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def promotion_params
params.require(:promotion).permit(:promo_code, :promo_start_date, :promo_end_date, :promo_start_hour,:promo_end_hour ,:promo_day, :promo_type,:original_product ,:min_qty ,:created_by)
params.require(:promotion).permit(:promo_code, :promo_start_date, :promo_end_date, :promo_start_hour,:promo_end_hour ,:promo_day, :promo_type,:original_product ,:min_qty ,:created_by,
:promotion_products_attributes => [:item_code, :min_qty, :net_off, :net_price, :percentage, :_destroy])
end
end

View File

@@ -132,6 +132,6 @@ class Settings::SetMenuItemsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def settings_menu_item_params
params.require(:set_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id,:account_id , :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets)
params.require(:set_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id,:account_id , :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets, :unit)
end
end

View File

@@ -154,6 +154,6 @@ class Settings::SimpleMenuItemsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def settings_menu_item_params
params.require(:simple_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id, :account_id, :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets)
params.require(:simple_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id, :account_id, :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets, :unit)
end
end

View File

@@ -0,0 +1,2 @@
module CommissionersHelper
end

View File

@@ -0,0 +1,2 @@
module CommissionsHelper
end

View File

@@ -0,0 +1,2 @@
module Origami::ProductCommissionsHelper
end

2
app/models/commission.rb Normal file
View File

@@ -0,0 +1,2 @@
class Commission < ApplicationRecord
end

View File

@@ -0,0 +1,3 @@
class Commissioner < ApplicationRecord
has_many :employees
end

View File

@@ -1,6 +1,6 @@
class Employee < ApplicationRecord
has_secure_password
belongs_to :commissioner
has_many :shit_sales
validates_presence_of :name, :role
validates_presence_of :password, :on => [:create]

View File

@@ -1,3 +1,6 @@
class Product < ApplicationRecord
validates_presence_of :name
# Product Image Uploader
mount_uploader :image_path, ProductImageUploader
end

View File

@@ -0,0 +1,2 @@
class ProductCommission < ApplicationRecord
end

View File

@@ -1,2 +1,12 @@
class Promotion < ApplicationRecord
validates_presence_of :promo_code,:promo_start_date,:promo_end_date,:promo_start_hour,:promo_end_hour,:promo_day,:promo_type,:original_product,:min_qty
has_many :promotion_products
accepts_nested_attributes_for :promotion_products , :allow_destroy => true
PROMO_TYPE1 = "Quantity"
PROMO_TYPE2 = "Net_off"
PROMO_TYPE3 = "Net_price"
PROMO_TYPE4 = "Percentage"
end

View File

@@ -0,0 +1,3 @@
class PromotionProduct < ApplicationRecord
belongs_to :promotion
end

View File

@@ -1,8 +1,8 @@
class CrmOrderPdf < Prawn::Document
attr_accessor :receipt_width,:price_column_width,:p_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_column_width,:item_description_width
def initialize(booking,order_items,printer_settings)
self.page_width = PrintSetting.where("name = ?","CRM Order").first.page_width
self.page_height = PrintSetting.where("name = ?","CRM Order").first.page_height
self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height
self.margin = 10
# self.price_width = self.p_width / 2
self.price_width=80

View File

@@ -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 = PrintSetting.where("name = ?","OrderItemPdf").first.page_width
self.page_height = PrintSetting.where("name = ?","OrderItemPdf").first.page_height
self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height
self.margin = 0
self.price_width = 40 # No Need for item
self.qty_width = 40

View File

@@ -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 = PrintSetting.where("name = ?","Order Summary").first.page_width
self.page_height = PrintSetting.where("name = ?","Order Summary").first.page_height
self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height
self.margin = 0
self.price_width = 40 # No Need for item
self.qty_width = 40

View File

@@ -1,8 +1,8 @@
class QueueNoPdf < Prawn::Document
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(printer_settings, queue)
self.page_width = PrintSetting.where("name = ?","Queue No").first.page_width
self.page_height = PrintSetting.where("name = ?","Queue No").first.page_height
self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height
self.margin = 5
self.price_width = 35
self.qty_width = 20

View File

@@ -2,8 +2,8 @@ class ReceiptBillPdf < 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, :description_width, :price_num_width
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status)
self.page_width = PrintSetting.where("name = ?","Receipt Bill").first.page_width
self.page_height = PrintSetting.where("name = ?","Receipt Bill").first.page_height
self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height
self.margin = 5
self.price_width = 40
self.qty_width = 20

View File

@@ -0,0 +1,58 @@
class ProductImageUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
# include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
storage :file
# storage :fog
def root
Rails.root.join 'public/'
end
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"image/product_images"
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
# def cache_dir
# '/tmp/images'
# end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url(*args)
# # For Rails 3.1+ asset pipeline compatibility:
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
#
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
# Process files as they are uploaded:
# process scale: [200, 300]
#
# def scale(width, height)
# # do something
# end
# Create different versions of your uploaded files:
# version :thumb do
# process resize_to_fit: [50, 50]
# end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_whitelist
%w(jpg jpeg gif png)
end
# Override the filename of the uploaded files:
# Avoid using model.id or version_name here, see uploader/store.rb for details.
# def filename
# "something.jpg" if original_filename
# end
end

View File

@@ -35,6 +35,7 @@ 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
json.attributes attr_format
json.options item.item_options

View File

@@ -30,7 +30,7 @@
<div class="col-md-12">
<div class="card" id="origami" onclick="location.href='<%= origami_root_path %>'">
<div class="card-content">
<span class="card-title">Origami</span>
<span class="card-title">Cashier</span>
</div>
</div>
</div>
@@ -66,8 +66,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#admin">Administrator
<span class="glyphicon glyphicon-plus"></span></a>
Administrator
</h4>
</div>
<div id="admin" class="panel-collapse collapse in">
@@ -105,7 +104,7 @@
</ul>
<ul class="col-md-4">
<li>OQS</li><br>
<li>Origami</li><br>
<li>Cashier</li><br>
<li>CRM</li>
</ul>
</div>
@@ -115,8 +114,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#manager">Manager
<span class="glyphicon glyphicon-plus"></span></a>
Manager
</h4>
</div>
<div id="admin" class="panel-collapse collapse in">
@@ -152,7 +150,7 @@
</ul>
<ul class="col-md-4">
<li>OQS</li><br>
<li>Origami</li><br>
<li>Cashier</li><br>
<li>CRM</li>
</ul>
</div>
@@ -162,8 +160,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#supervisor">Supervisor
<span class="glyphicon glyphicon-plus"></span></a>
Supervisor
</h4>
</div>
<div id="supervisor" class="panel-collapse collapse in">
@@ -185,14 +182,13 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#cashier">Cashier
<span class="glyphicon glyphicon-plus"></span></a>
Cashier
</h4>
</div>
<div id="cashier" class="panel-collapse collapse in">
<div class="panel-body">
<ul class="">
<li class="">Orgami Panel except Edit and Void</li>
<li class="">Cashier Panel except Edit and Void</li>
<li class="">Sale and Order</li>
<li class="">and Queue in CRM</li>
</ul>
@@ -203,8 +199,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#accountant">Accountant
<span class="glyphicon glyphicon-plus"></span></a>
Accountant
</h4>
</div>
<div id="accountant" class="panel-collapse collapse in">
@@ -223,11 +218,11 @@
</div>
</div> <!-- end col-md-4 -->
<div class="footer">
<div class="footer" style="background-color: inherit">
<div class="card">
<div class="page-header center-text">
<h4 class="footer-header">
<%= shop.name %>
<%= shop.name %>
</h4>
</div>
<div class="center-text">
@@ -256,7 +251,7 @@
font-weight: 400;
text-transform: uppercase;
transition: color 0.3s ease;
line-height: 48px;
/*line-height: 48px;*/
}
.card .card-content {
@@ -264,7 +259,7 @@
border-radius: 0 0 2px 2px;
background-clip: padding-box;
box-sizing: border-box;
height: 120px;
/*height: 120px;*/
transition: color 0.3s ease;
text-align: center;
}

View File

@@ -29,108 +29,113 @@
<% @employees.each do |employee| %>
<div data-formid="#form_<%= employee.emp_id %>" class="empBtn card card-inverse card-primary mb-3 text-center" style="">
<form id="form_<%=employee.emp_id%>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH"></form>
<div data-formid="#form_<%= employee.emp_id %>" class="empBtn card card-inverse card-primary mb-3 text-center" style="">
<form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH"></form>
<div class="card-block">
<h4 class="card-title">
<%= employee.name %>
</h4>
<div class="card-content">
(<%= employee.emp_id%>)
(<%= employee.emp_id %>)
</div>
<div class="card-footer">
<small><%= employee.role %></small>
<small><%= employee.role %></small>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
<div class="col-md-4 col-lg-4" >
<div class="col-md-4 col-lg-4">
<div class="card" style="max-height:550px; overflow:auto;padding: 15px">
<h4 class="card-title">Role Features</h4>
<!-- <p><strong>Note:</strong> The <strong>data-parent</strong> attribute makes sure that all collapsible elements under the specified parent will be closed when one of the collapsible item is shown.</p> -->
<!-- <p><strong>Note:</strong> The <strong>data-parent</strong> attribute makes sure that all collapsible elements under the specified parent will be closed when one of the collapsible item is shown.</p> -->
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#admin">Administrator <span class="glyphicon glyphicon-plus"></span></a>
</h4>
</div>
<div id="admin" class="panel-collapse collapse in">
<div class="panel-body">
<ul class="">
<li class="">All Accept</li>
</ul>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#admin">Administrator
<span class="glyphicon glyphicon-plus"></span></a>
</h4>
</div>
<div id="admin" class="panel-collapse collapse in">
<div class="panel-body">
<ul class="">
<li class="">All Accept</li>
</ul>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#manager">Manager <span class="glyphicon glyphicon-plus"></span></a>
</h4>
</div>
<div id="manager" class="panel-collapse collapse">
<div class="panel-body">
<ul class="">
<li class="">All Accept except Membership and Payment Settings</li>
</ul>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#manager">Manager
<span class="glyphicon glyphicon-plus"></span></a>
</h4>
</div>
<div id="manager" class="panel-collapse collapse">
<div class="panel-body">
<ul class="">
<li class="">All Accept except Membership and Payment Settings</li>
</ul>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#supervisor">Supervisor <span class="glyphicon glyphicon-plus"></span></a>
</h4>
</div>
<div id="supervisor" class="panel-collapse collapse">
<div class="panel-body">
<ul class="">
<li class="">Void</li>
<li class="">FOC</li>
<li class="">Edit</li>
<li class="">Credit </li>
<li class="">and Payment </li>
</ul>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#supervisor">Supervisor
<span class="glyphicon glyphicon-plus"></span></a>
</h4>
</div>
<div id="supervisor" class="panel-collapse collapse">
<div class="panel-body">
<ul class="">
<li class="">Void</li>
<li class="">FOC</li>
<li class="">Edit</li>
<li class="">Credit</li>
<li class="">and Payment</li>
</ul>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#cashier">Cashier <span class="glyphicon glyphicon-plus"></span></a>
</h4>
</div>
<div id="cashier" class="panel-collapse collapse">
<div class="panel-body">
<ul class="">
<li class="">Orgami Panel except Edit and Void</li>
<li class="">Sale and Order </li>
<li class="">and Queue in CRM</li>
</ul>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#cashier">Cashier
<span class="glyphicon glyphicon-plus"></span></a>
</h4>
</div>
<div id="cashier" class="panel-collapse collapse">
<div class="panel-body">
<ul class="">
<li class="">Orgami Panel except Edit and Void</li>
<li class="">Sale and Order</li>
<li class="">and Queue in CRM</li>
</ul>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#accountant">Accountant <span class="glyphicon glyphicon-plus"></span></a>
</h4>
</div>
<div id="accountant" class="panel-collapse collapse">
<div class="panel-body">
<ul class="">
<li class="">Daily Sale Report</li>
<li class="">Sale Item Report</li>
<li class="">Receipt No Report</li>
<li class="">ShiftSale Report</li>
</ul>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#accountant">Accountant
<span class="glyphicon glyphicon-plus"></span></a>
</h4>
</div>
<div id="accountant" class="panel-collapse collapse">
<div class="panel-body">
<ul class="">
<li class="">Daily Sale Report</li>
<li class="">Sale Item Report</li>
<li class="">Receipt No Report</li>
<li class="">ShiftSale Report</li>
</ul>
</div>
</div>
</div>
</div> <!-- end accordion id -->
</div>
</div> <!-- end col-md-4 -->
@@ -140,6 +145,7 @@
.panel-body {
padding: 5px !important;
}
/*.card-columns {
column-count: 4;
display: inline-block;
@@ -148,6 +154,7 @@
float: right;
}
@media (min-width: 34em) {
.card-columns {
-webkit-column-count: 2;
@@ -181,25 +188,25 @@
}
</style>
<script type="text/javascript">
$(document).on('turbolinks:load', function() {
$(".empBtn").click(function(event){
event.preventDefault();
console.log($(this).data("formid"));
var item = $(this).data("formid");
$(item).submit();
$(document).on('turbolinks:load', function () {
$(".empBtn").click(function (event) {
event.preventDefault();
console.log($(this).data("formid"));
var item = $(this).data("formid");
$(item).submit();
});
// Add minus icon for collapse element which is open by default
$(".collapse.in").each(function(){
$(this).siblings(".panel-heading").find(".glyphicon").addClass("glyphicon-minus").removeClass("glyphicon-plus");
});
// Toggle plus minus icon on show hide of collapse element
$(".collapse").on('show.bs.collapse', function(){
$(this).parent().find(".glyphicon").removeClass("glyphicon-plus").addClass("glyphicon-minus");
}).on('hide.bs.collapse', function(){
$(this).parent().find(".glyphicon").removeClass("glyphicon-minus").addClass("glyphicon-plus");
});
});
});
// Add minus icon for collapse element which is open by default
$(".collapse.in").each(function () {
$(this).siblings(".panel-heading").find(".glyphicon").addClass("glyphicon-minus").removeClass("glyphicon-plus");
});
// Toggle plus minus icon on show hide of collapse element
$(".collapse").on('show.bs.collapse', function () {
$(this).parent().find(".glyphicon").removeClass("glyphicon-plus").addClass("glyphicon-minus");
}).on('hide.bs.collapse', function () {
$(this).parent().find(".glyphicon").removeClass("glyphicon-minus").addClass("glyphicon-plus");
});
});
</script>
@@ -207,6 +214,6 @@ $(document).on('turbolinks:load', function() {

View File

@@ -28,6 +28,8 @@
<li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li>
<hr class="hr_advance" />
<li><%= link_to "Employees", settings_employees_path, :tabindex =>"-1" %></li>
<li><%= link_to "Commissions", origami_commissions_path , :tabindex =>"-1" %></li>
<li><%= link_to "Commissioners", origami_commissioners_path , :tabindex =>"-1" %></li>
<hr class="hr_advance" />
<li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li>
<hr class="hr_advance" />
@@ -59,7 +61,7 @@
<a href="<%= oqs_root_path %>" role="button" aria-haspopup="true" aria-expanded="false">&nbsp;&nbsp;&nbsp;OQS</a>
</li>
<li class="navbar-nav mr-auto">
<a href="<%= origami_root_path %>" role="button" aria-haspopup="true" aria-expanded="false">&nbsp;&nbsp;&nbsp;Origami</a>
<a href="<%= origami_root_path %>" role="button" aria-haspopup="true" aria-expanded="false">&nbsp;&nbsp;&nbsp;Cashier</a>
</li>
<li class="navbar-nav mr-auto">
<a href="<%= crm_customers_path %>" role="button" aria-haspopup="true" aria-expanded="false">&nbsp;&nbsp;&nbsp;CRM</a>

View File

@@ -0,0 +1,2 @@
json.extract! commissioner, :id, :created_at, :updated_at
json.url commissioner_url(commissioner, format: :json)

View File

@@ -0,0 +1,18 @@
<div class="col-md-3">
<%= simple_form_for([:origami, @commissioner]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= 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"} %><br/>
<%= f.input :commission_type %>
<label><%= f.check_box :is_active %> Active </label>
</div>
<div class="form-actions">
<%= link_to 'Back', origami_commissioners_path, class: 'btn btn-success' %>
<%= f.button :submit, class: 'btn btn-info' %>
</div>
<% end %>
</div>

View File

@@ -0,0 +1,10 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li>
<li>Edit</li>
</ul>
</div>
<%= render 'form', commissioner: @commissioner %>
</div>

View File

@@ -0,0 +1,44 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li>Commissioner</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commissioner_path ,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Employee Name</th>
<th>Commission type</th>
<th>Active</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @commissioners.each do |commissioner| %>
<tr>
<td><%= commissioner.name %></td>
<td>
<% if Employee.exists? %>
<% employee = Employee.where('emp_id=?',commissioner.emp_id) %>
<%= employee[0].name %>
<% end %>
</td>
<td><%= commissioner.commission_type %></td>
<td><%= commissioner.is_active %></td>
<td><%= link_to 'Show', origami_commissioner_path(commissioner) %></td>
<td><%= link_to 'Edit', edit_origami_commissioner_path(commissioner) %></td>
<td><%= link_to 'Destroy', origami_commissioner_path(commissioner), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1 @@
json.array! @commissioners, partial: 'commissioners/commissioner', as: :commissioner

View File

@@ -0,0 +1,10 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li>
<li>New</li>
</ul>
</div>
<%= render 'form', commissioner: @commissioner %>
</div>

View File

@@ -0,0 +1,51 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li>
<span style="float: right">
</span>
</ul>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Commissioner</h4>
<table class="table">
<tbody>
<tr>
<td style="width:20%">Name</td>
<td><%= @commissioner.name %></td>
</tr>
<tr>
<td style="width:20%">Employee Name</td>
<td>
<% if Employee.exists? %>
<% employee = Employee.where('emp_id=?', @commissioner.emp_id) %>
<%= employee[0].name %>
<% end %>
</td>
</tr>
<tr>
<td style="width:20%">Commission Type</td>
<td><%= @commissioner.commission_type %></td>
</tr>
<tr>
<td style="width:20%">Active</td>
<td><%= @commissioner.is_active %></td>
</tr>
<tr>
<td style="width:20%">Created By</td>
<td><%= Employee.find(@commissioner.created_by).name %></td>
</tr>
</tbody>
</table>
<%= link_to 'Back', origami_commissioners_path, class: 'btn btn-success' %>
<%= link_to 'Edit', edit_origami_commissioner_path(@commissioner), class: 'btn btn-info' %>
<%= link_to 'Destroy', origami_commissioner_path(@commissioner), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
</div>
</div>
</div>

View File

@@ -0,0 +1 @@
json.partial! "commissioners/commissioner", commissioner: @commissioner

View File

@@ -0,0 +1,2 @@
json.extract! commission, :id, :created_at, :updated_at
json.url commission_url(commission, format: :json)

View File

@@ -0,0 +1,17 @@
<div class="col-md-3">
<%= simple_form_for([:origami,@commission]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.label :product_id %>
<%= f.collection_select :product_id, Product.all.order('name asc'), :id, :name, {prompt: "Select a Product"}, {class: "form-control"} %><br/>
<%= f.input :amount %>
<%= f.input :commission_type, :collection => [:percentage, :net_amount] %>
<label><%= f.check_box :is_active %> Active </label>
</div>
<div class="form-actions">
<%= link_to 'Back', origami_commissions_path, class: 'btn btn-success' %>
<%= f.button :submit, class: 'btn btn-info' %>
</div>
<% end %>
</div>

View File

@@ -0,0 +1,10 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_commissions_path %>">Commissions</a></li>
<li>Edit</li>
</ul>
</div>
<%= render 'form', commission: @commission %>
</div>

View File

@@ -0,0 +1,44 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li>Commissions</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commission_path ,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Product Name</th>
<th>Amount</th>
<th>Commission type</th>
<th>Active</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @commissions.each do |commission| %>
<tr>
<td>
<% if Product.exists? %>
<% product = Product.find(commission.product_id) %>
<%= product.name %>
<% end %>
</td>
<td><%= commission.amount %></td>
<td><%= commission.commission_type %></td>
<td><%= commission.is_active %></td>
<td><%= link_to 'Show', origami_commission_path(commission) %></td>
<td><%= link_to 'Edit', edit_origami_commission_path(commission) %></td>
<td><%= link_to 'Destroy', origami_commission_path(commission), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1 @@
json.array! @commissions, partial: 'commissions/commission', as: :commission

View File

@@ -0,0 +1,10 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_commissions_path %>">Commissions</a></li>
<li>New</li>
</ul>
</div>
<%= render 'form', commission: @commission %>
</div>

View File

@@ -0,0 +1,46 @@
<p id="notice"><%= notice %></p>
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_commissions_path %>">Commissions</a></li>
<span style="float: right">
</span>
</ul>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Commission</h4>
<table class="table">
<tbody>
<tr>
<td style="width:20%">Product Name</td>
<td>
<% if Product.exists? %>
<% product = Product.find(@commission.product_id) %>
<%= product.name %>
<% end %>
</td>
</tr>
<tr>
<td style="width:20%">Amount</td>
<td><%= @commission.amount %></td>
</tr>
<tr>
<td style="width:20%">Commission Type</td>
<td><%= @commission.commission_type %></td>
</tr>
<tr>
<td style="width:20%">Active</td>
<td><%= @commission.is_active %></td>
</tr>
</tbody>
</table>
<%= link_to 'Back', origami_commissions_path, class: 'btn btn-success' %>
<%= link_to 'Edit', edit_origami_commission_path(@commission), class: 'btn btn-info' %>
<%= link_to 'Destroy', origami_commission_path(@commission), method: :delete, class: 'btn btn-danger', data: {confirm: 'Are you sure?'} %>
</div>
</div>
</div>

View File

@@ -0,0 +1 @@
json.partial! "commissions/commission", commission: @commission

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
<%= simple_form_for(@product_commission) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>

View File

@@ -0,0 +1,2 @@
json.extract! product_commission, :id, :created_at, :updated_at
json.url product_commission_url(product_commission, format: :json)

View File

@@ -0,0 +1,6 @@
<h1>Editing Product Commission</h1>
<%= render 'form', product_commission: @product_commission %>
<%= link_to 'Show', @product_commission %> |
<%= link_to 'Back', product_commissions_path %>

View File

@@ -0,0 +1,25 @@
<p id="notice"><%= notice %></p>
<h1>Product Commissions</h1>
<table>
<thead>
<tr>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @product_commissions.each do |product_commission| %>
<tr>
<td><%= link_to 'Show', product_commission %></td>
<td><%= link_to 'Edit', edit_product_commission_path(product_commission) %></td>
<td><%= link_to 'Destroy', product_commission, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New Product Commission', new_product_commission_path %>

View File

@@ -0,0 +1 @@
json.array! @product_commissions, partial: 'product_commissions/product_commission', as: :product_commission

View File

@@ -0,0 +1,5 @@
<h1>New Product Commission</h1>
<%= render 'form', product_commission: @product_commission %>
<%= link_to 'Back', product_commissions_path %>

View File

@@ -0,0 +1,4 @@
<p id="notice"><%= notice %></p>
<%= link_to 'Edit', edit_product_commission_path(@product_commission) %> |
<%= link_to 'Back', product_commissions_path %>

View File

@@ -0,0 +1 @@
json.partial! "product_commissions/product_commission", product_commission: @product_commission

View File

@@ -303,7 +303,6 @@
<!-- Waiter Buttons -->
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
<% if @room.bookings.length >= 1 %>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<!-- <button type="button" class="btn btn-primary btn-block" >Add Order</button> -->
<button type="button" id="customer" class="btn btn-primary btn-block" disabled>Customer</button>

View File

@@ -1,16 +1,33 @@
<%= simple_form_for([:settings,@settings_product]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<div class="col-md-8">
<div class="form-group">
<%= f.input :item_code, :input_html => { :id => 'item_code' } %>
<%= f.input :name %>
<%= f.input :alt_name %>
<%= f.input :unit_price %>
<%= f.input :image_path %>
<%= f.input :description %>
<%= f.input :information %>
<label><%= f.check_box :taxable %>Taxable</label>
</div>
</div>
<label>Product Image</label>
<div class="col-md-4">
<div class="panel padding-10">
<div class="form-group">
<div class="menu-item-img">
<% if f.object.image_path? %>
<p><%= f.object.name %></p>
<%= image_tag f.object.image_path.url, :class => "img-thumbnail" %>
<% else %>
<p>Sample Image</p>
<%= image_tag "/image/menu_images/default.png", :class => "img-thumbnail" %>
<% end %>
</div>
<%= f.file_field :image_path, :class => "img-thumbnail" %>
</div>
</div>
<div class="form-actions">
<%= f.button :submit %>

View File

@@ -0,0 +1,32 @@
<%= simple_form_for([:settings,@promotion,@promotion_product]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<div class="div-border">
<div class="row">
<div class="col-md-12"><%= f.input :item_code %></div>
</div>
<% if @promotion.promo_type == Promotion::PROMO_TYPE1 %>
<div class="row">
<div class="col-md-12"><%= f.input :min_qty %></div>
</div>
<% elsif @promotion.promo_type == Promotion::PROMO_TYPE2 %>
<div class="row">
<div class="col-md-12"><%= f.input :net_off %></div>
</div>
<% elsif @promotion.promo_type == Promotion::PROMO_TYPE3 %>
<div class="row">
<div class="col-md-12"><%= f.input :net_price %></div>
</div>
<% elsif @promotion.promo_type == Promotion::PROMO_TYPE4 %>
<div class="row">
<div class="col-md-12"><%= f.input :percentage %></div>
</div>
<% end %>
</div>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>

View File

@@ -0,0 +1,2 @@
json.extract! promotion, :id, :created_at, :updated_at
json.url promotion_url(promotion, format: :json)

View File

@@ -0,0 +1,11 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= edit_settings_promotion_path(@promotion) %>">Promotions</a></li>
<li>Promotion Products</li>
<li>Edit</li>
</ul>
</div>
<%= render 'form', promotion_products: @promotion_product %>
</div>

View File

@@ -0,0 +1,47 @@
<p id="notice"><%= notice %></p>
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_promotions_path %>">Promotions</a></li>
<li>PromotionProducts</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_promotion_promotion_product_path,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Promotion Code</th>
<th>Item Code</th>
<th>Minimum Quantity</th>
<th>Net Off</th>
<th>Net Price</th>
<th>Percentage</th>
<th>Created At</th>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
<% @promotion_products.each do |pro| %>
<tr>
<td><%= link_to pro.promotion.promo_code, settings_promotion_promotion_path(pro.promotion) %></td>
<td><%= pro.item_code %></td>
<td><%= pro.min_qty %></td>
<td><%= pro.net_off rescue "-" %></td>
<td><%= pro.net_price rescue "-" %></td>
<td><%= pro.percentage %></td>
<td><%= pro.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
<td><%= link_to 'Edit', edit_settings_promotion_promotion_product_path(pro) %></td>
<td><%= link_to 'Destroy', settings_promotion_promotion_product_path(pro), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1 @@
json.array! @promotions, partial: 'promotions/promotion', as: :promotion

View File

@@ -0,0 +1,15 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= edit_settings_promotion_path(@promotion) %>">Promotion</a></li>
<!-- <li><a href="<%= settings_promotion_promotion_products_path %>">Promotion Products</a></li> -->
<li>New</li>
</ul>
</div>
<%= render 'form', promotion_products: @promotion_product %>
</div>
<script>
$("#promotion_promo_code").val(Math.random().toString(36).slice(5) + Math.random().toString(36).slice(5));
</script>

View File

@@ -0,0 +1,28 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_promotion_path(@promotion) %>">Promotion</a></li>
<li>Promotion Products</li>
</ul>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Promotion Product</h4>
<table class="table">
<tbody>
<tr><td style="width:20%">Promotion Code</td><td><%= @promotion_product.promo_code %></td></tr>
<tr><td style="width:20%">Item Code</td><td><%= @promotion_product.item_code %></td></tr>
<tr><td style="width:20%">Min Qty</td><td><%= @promotion_product.min_qty %></td></tr>
<tr><td style="width:20%">Net off</td><td><%= @promotion_product.net_off %></td></tr>
<tr><td style="width:20%">Net Price</td><td><%= @promotion_product.net_price %></td></tr>
<tr><td style="width:20%">Percentage</td><td><%= @promotion_product.percentage %></td></tr>
<tr><td style="width:20%"><%= link_to 'Edit', edit_settings_promotion_product_path(@promotion_product) %></td><td><%= link_to 'Destroy', settings_promotion_product_path(@promotion_product), method: :delete, data: { confirm: 'Are you sure?' } %></td></tr>
</tbody>
</table>
</div>
</div>

View File

@@ -0,0 +1 @@
json.partial! "promotions/promotion", promotion: @promotion

View File

@@ -1,4 +1,4 @@
<%= simple_form_for([:settings,@promotion]) do |f| %>
<%= simple_nested_form_for([:settings,@promotion]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
@@ -32,13 +32,28 @@
<div class="row">
<div class="col-md-6">
<%= f.input :promo_type,input_html: { class: "" },
collection: %w{Quantity Net_off Net_price Percentage},:class => 'form-control' ,:label => "" %>
collection: %w{Quantity Net_off Net_price Percentage},:class => 'form-control' ,:label => "Promotion Type" %>
</div>
</div>
<div class="row">
<div class="col-md-6"><%= f.input :original_product,collection: MenuItem.order("name desc"),input_html: { selected: 2 } %></div>
<div class="col-md-6"><%= f.input :min_qty %></div>
</div>
<br>
<p><%= f.link_to_add "Add Product", :promotion_products, :class => 'btn btn-primary' %></p>
<br>
<%= f.fields_for :promotion_products do |p| %>
<div class="row">
<div class="col-md-1"><%= p.input :item_code , :class => "form-control" %></div>
<div class="col-md-1"><%= p.input :min_qty , :class => "form-control" %></div>
<div class="col-md-1"><%= p.input :net_off , :class => "form-control" %></div>
<div class="col-md-1"><%= p.input :net_price , :class => "form-control" %></div>
<div class="col-md-1"><%= p.input :percentage , :class => "form-control" %></div>
<div class="col-md-1" style='padding-top:30px;'><%= p.link_to_remove "X"%></div>
</div>
<% end %>
</div>
</div>

View File

@@ -1,4 +1,28 @@
<p id="notice"><%= notice %></p>
<%= link_to 'Edit', edit_promotion_path(@promotion) %> |
<%= link_to 'Back', promotions_path %>
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_promotions_path %>">Promotions</a></li>
</ul>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Promotion</h4>
<table class="table">
<tbody>
<tr><td style="width:20%">Promotion code</td><td><%= @promotion.promo_code %></td></tr>
<tr><td style="width:20%">Promotion Start Date</td><td><%= @promotion.promo_start_date %></td></tr>
<tr><td style="width:20%">Promotion End Date</td><td><%= @promotion.promo_end_date %></td></tr>
<tr><td style="width:20%">Promotion Start Hour</td><td><%= @promotion.promo_start_hour %></td></tr>
<tr><td style="width:20%">Promotion Start Hour</td><td><%= @promotion.promo_end_hour %></td></tr>
<tr><td style="width:20%"><%= link_to 'Edit', edit_settings_promotion_path(@promotion) %></td><td><%= link_to 'Destroy', settings_promotion_path(@promotion), method: :delete, data: { confirm: 'Are you sure?' } %></td></tr>
</tbody>
</table>
</div>
</div>

View File

@@ -16,6 +16,8 @@
<%= f.input :is_sub_item, :class => "form-control" %>
<%= f.input :unit, :collection => Lookup.collection_of("unit") ,:class => "form-control" %>
<%= f.input :item_attributes, :collection => @item_attributes, :input_html => { :multiple => true }, :class => "form-control item_attributes" %>
<%= f.input :item_options, :collection => @item_options, :input_html => { :multiple => true }, :class => "form-control item_options" %>

View File

@@ -16,13 +16,13 @@ $(function(){
<%
@settings_menu_item.item_sets.each do |set|
%>
$("#simple_menu_item_item_sets option[value='" + <%= set.id %> + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'});
$("#set_menu_item_item_sets option[value='" + <%= set.id %> + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'});
<%
end
%>
// After loaded
$("#simple_menu_item_item_sets").on('click', 'option', function(e){
$("#set_menu_item_item_sets").on('click', 'option', function(e){
if($(this).attr("selected")){
$(this).removeAttr("selected");
$(this).css({'color':'#000','background':'#fff'});

View File

@@ -16,6 +16,8 @@
<%= f.input :is_sub_item, :class => "form-control" %>
<%= f.input :unit, :collection => Lookup.collection_of("unit") ,:class => "form-control" %>
<%= f.input :item_attributes, :collection => @item_attributes, :input_html => { :multiple => true }, :class => "form-control item_attributes" %>
<%= f.input :item_options, :collection => @item_options, :input_html => { :multiple => true }, :class => "form-control item_options" %>