Merge branch 'adminbsb_material_ui' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2017-11-09 18:31:16 +06:30
19 changed files with 76 additions and 50 deletions

View File

@@ -80,7 +80,7 @@ GEM
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
httparty (0.15.6) httparty (0.15.6)
multi_xml (>= 0.5.2) multi_xml (>= 0.5.2)
i18n (0.9.0) i18n (0.9.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
jbuilder (2.7.0) jbuilder (2.7.0)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
@@ -117,7 +117,7 @@ GEM
mime-types (3.1) mime-types (3.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521) mime-types-data (3.2016.0521)
mini_mime (0.1.4) mini_mime (1.0.0)
mini_portile2 (2.3.0) mini_portile2 (2.3.0)
minitest (5.10.3) minitest (5.10.3)
momentjs-rails (2.17.1) momentjs-rails (2.17.1)

View File

@@ -86,8 +86,8 @@ ruby 2.4.1p111
1. Layout 1. Layout
1. 2-Column => Main Content - col-9, Infomation - col-3 1. 2-Column => Main Content - col-9, Information - col-3
2. 3-Column => Sub Lint - col-2, Main Content - col-7, Infomation - col-3 2. 3-Column => Sub Lint - col-2, Main Content - col-7, Information - col-3
> Pixel > Pixel

View File

@@ -198,7 +198,7 @@ $(document).on('turbolinks:load', function() {
$("#completed_count").text(parseInt($("#completed_count").text()) + data.length); $("#completed_count").text(parseInt($("#completed_count").text()) + data.length);
swal({ swal({
title: "Infomation !", title: "Information !",
text: 'Order has been successfully created', text: 'Order has been successfully created',
confirmButtonColor: "green", confirmButtonColor: "green",
confirmButtonText: "Yes!", confirmButtonText: "Yes!",

View File

@@ -55,7 +55,7 @@ class HomeController < ApplicationController
render :index render :index
end end
else else
redirect_to origami_root_path, :notice => "Username and Password dosn't match!" redirect_to origami_root_path, :notice => "Username and Password doesn't match!"
end end
end end

View File

@@ -13,7 +13,7 @@ class MenuItem < ApplicationRecord
has_many :menu_item_sets has_many :menu_item_sets
has_many :item_sets, through: :menu_item_sets has_many :item_sets, through: :menu_item_sets
validates_presence_of :name, :type, :min_qty, :taxable validates_presence_of :name, :type, :min_qty, :taxable,:account_id
default_scope { order('item_code asc') } default_scope { order('item_code asc') }
@@ -53,13 +53,12 @@ class MenuItem < ApplicationRecord
end end
def self.deleteRecursive(menu_item) def self.deleteRecursive(menu_item)
# find the sub menu item of current item # find the sub menu item of current item
sub_menu_items = MenuItem.where("menu_item_id=?",menu_item.id) sub_menu_items = MenuItem.where("id=?",menu_item.id)
if sub_menu_items.length != 0 if sub_menu_items.length != 0
sub_menu_items.each do |subitem| sub_menu_items.each do |subitem|
if deleteRecursive(subitem) # if deleteRecursive(subitem)
end # end
end end
# find the instances of current menu item # find the instances of current menu item
instances = MenuItemInstance.where("menu_item_id=?",menu_item.id) instances = MenuItemInstance.where("menu_item_id=?",menu_item.id)

View File

@@ -1,12 +1,17 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="page-header">
<div class="col-md-6"> <ol class="breadcrumb">
<h2>CREDIT PAYMENT</h2> <li class="breadcrumb-item"><a href="<%=origami_root_path %>"><%= t :home %></a></li>
</div> <!-- <li class="breadcrumb-item"><a href="/origami/sale/<%=@sale_id %>/payment"><%= t("views.btn.payment") %></a></li> -->
<li class="breadcrumb-item active"><%= t("views.right_panel.details.credit") %></li>
<span class="float-right">
<%= link_to t('.back',:default => t("views.btn.back")),'/origami/sale/'+@sale_id +'/payment'%>
</span>
</ol>
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-5 col-md-5 col-sm-3"> <div class="col-lg-5 col-md-5 col-sm-3">
<div class="card" style="margin-top:10px;padding-top:20px;"> <div class="card m-t-10 p-l-20" style="padding-top:20px;">
<div class="card-block"> <div class="card-block">
<div class="rebate-form"> <div class="rebate-form">
<!-- <div class="row"> --> <!-- <div class="row"> -->
@@ -104,10 +109,10 @@
</div> </div>
</div> </div>
<!--
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn bg-default m-l-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button> <button type="button" class="btn bg-default m-l-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button>
</div> </div> -->
</div> </div>
</div> </div>
<script> <script>
@@ -163,14 +168,14 @@
$('#credit_pay').on('click',function(){ $('#credit_pay').on('click',function(){
var amount = $('#amount').text(); var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value"))){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$.ajax({type: "POST", $.ajax({type: "POST",
url: "<%= origami_payment_credit_path %>", url: "<%= origami_payment_credit_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id, data: "amount="+ amount + "&sale_id="+ sale_id,
success:function(result){ success:function(result){
if(result){ if(result){
swal({ swal({
title: "Infomation!", title: "Information!",
text: "Payment Success", text: "Payment Success",
type: "success" type: "success"
}, function () { }, function () {
@@ -180,7 +185,11 @@
} }
}); });
}else{ }else{
swal("Alert","Paid Amount is over!","error"); if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
} }
}) })
</script> </script>

View File

@@ -387,7 +387,7 @@
success:function(result){ success:function(result){
$("#loading_wrapper").hide(); $("#loading_wrapper").hide();
swal({ swal({
title: "Infomation!", title: "Information!",
text: result.status, text: result.status,
}, function () { }, function () {
if(result.table_type == "Table"){ if(result.table_type == "Table"){
@@ -410,7 +410,7 @@
// Selected Items // Selected Items
var sale_items = get_selected_sale_items(); var sale_items = get_selected_sale_items();
if(sale_items.length == 0){ if(sale_items.length == 0){
//swal("Infomation!", "You have no selected item!"); //swal("Information!", "You have no selected item!");
swal ( "Oops" , "You have no selected item!" , "error" ); swal ( "Oops" , "You have no selected item!" , "error" );
} }
@@ -430,7 +430,7 @@
data: params, data: params,
success: function(result){ success: function(result){
swal({ swal({
title: "Infomation!", title: "Information!",
text: result.status, text: result.status,
type: "success", type: "success",
}, function () { }, function () {
@@ -453,7 +453,7 @@
url: "/origami/" + sale_id + "/remove_all_discount", url: "/origami/" + sale_id + "/remove_all_discount",
success: function(result){ success: function(result){
swal({ swal({
title: "Infomation!", title: "Information!",
text: result.status, text: result.status,
type: "success", type: "success",
}, function () { }, function () {
@@ -497,7 +497,7 @@
btn_color = 'red' btn_color = 'red'
} }
swal({ swal({
title: "Infomation!", title: "Information!",
text: result.status, text: result.status,
confirmButtonText: 'OK', confirmButtonText: 'OK',
confirmButtonColor: btn_color, confirmButtonColor: btn_color,

View File

@@ -507,7 +507,7 @@
// data: 'order_id='+ order_id, // data: 'order_id='+ order_id,
success: function (result) { success: function (result) {
if (!result.status) { if (!result.status) {
swal("Infomation!", result.error_message); swal("Information!", result.error_message);
} }
else { else {
location.reload(); location.reload();

View File

@@ -158,7 +158,7 @@ $(document).on('click', '.cashier_number', function(event){
$('#jcb_pay').on('click',function(){ $('#jcb_pay').on('click',function(){
var amount = $('#amount').text(); var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) ){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
//start member discount 5% by pay card //start member discount 5% by pay card
var sub_total = $('#sub-total').text(); var sub_total = $('#sub-total').text();
var member_id = $('#membership_id').text(); var member_id = $('#membership_id').text();
@@ -179,7 +179,7 @@ $('#jcb_pay').on('click',function(){
success:function(result){ success:function(result){
if(result){ if(result){
swal({ swal({
title: "Infomation!", title: "Information!",
text: "Payment Successfully", text: "Payment Successfully",
},function () { },function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id + "/payment";
@@ -188,7 +188,11 @@ $('#jcb_pay').on('click',function(){
} }
}); });
}else{ }else{
swal ( "Oops" , "Paid Amount is over!" , "error" ); if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
} }
}) })
</script> </script>

View File

@@ -155,7 +155,7 @@
$('#master_pay').on('click',function(){ $('#master_pay').on('click',function(){
var amount = $('#amount').text(); var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) ){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
//start member discount 5% by pay card //start member discount 5% by pay card
var sub_total = $('#sub-total').text(); var sub_total = $('#sub-total').text();
var member_id = $('#membership_id').text(); var member_id = $('#membership_id').text();
@@ -176,7 +176,7 @@
success:function(result){ success:function(result){
if(result){ if(result){
swal({ swal({
title: "Infomation!", title: "Information!",
text: "Payment Successfully", text: "Payment Successfully",
},function () { },function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id + "/payment";
@@ -185,7 +185,11 @@
} }
}); });
}else{ }else{
swal ( "Oops" , "Paid Amount is over!" , "error" ); if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
} }
}) })
</script> </script>

View File

@@ -155,7 +155,7 @@
$('#mpu_pay').on('click',function(){ $('#mpu_pay').on('click',function(){
var amount = $('#amount').text(); var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) ){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
//start member discount 5% by pay card //start member discount 5% by pay card
var sub_total = $('#sub-total').text(); var sub_total = $('#sub-total').text();
var member_id = $('#membership_id').text(); var member_id = $('#membership_id').text();
@@ -177,7 +177,7 @@
success:function(result){ success:function(result){
if(result){ if(result){
swal({ swal({
title: "Infomation!", title: "Information!",
text: "Payment Successfully", text: "Payment Successfully",
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id + "/payment";
@@ -186,7 +186,11 @@
} }
}); });
}else{ }else{
swal ( "Oops" , "Paid Amount is over!" , "error" ); if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
} }
}) })
</script> </script>

View File

@@ -294,7 +294,7 @@
data: params, data: params,
success:function(result){ success:function(result){
swal({ swal({
title: "Infomation!", title: "Information!",
text: "Success", text: "Success",
}, function () { }, function () {
if(result.table_type == "Table"){ if(result.table_type == "Table"){

View File

@@ -403,7 +403,7 @@
$( "#loading_wrapper" ).hide(); $( "#loading_wrapper" ).hide();
if($('#balance').text() < 0){ if($('#balance').text() < 0){
swal({ swal({
title: "Infomation!", title: "Information!",
text: 'Changed amount ' + $('#balance').text() * (-1), text: 'Changed amount ' + $('#balance').text() * (-1),
}, function () { }, function () {
window.location.href = '/origami'; window.location.href = '/origami';
@@ -411,7 +411,7 @@
}else{ }else{
$('#pay').text("Pay"); $('#pay').text("Pay");
swal({ swal({
title: "Infomation!", title: "Information!",
text: 'Thank You !', text: 'Thank You !',
}, function () { }, function () {
window.location.href = '/origami'; window.location.href = '/origami';
@@ -424,7 +424,7 @@
$('#void').on('click',function () { $('#void').on('click',function () {
swal({ swal({
title: "Infomation!", title: "Information!",
text: 'Are you sure want to Void !', text: 'Are you sure want to Void !',
}, function () { }, function () {
var sale_id = $('#sale_id').text(); var sale_id = $('#sale_id').text();
@@ -472,7 +472,7 @@
if (cash > 0) { if (cash > 0) {
swal({ swal({
title: "Infomation!", title: "Information!",
text: 'Thank You !', text: 'Thank You !',
}, function () { }, function () {
window.location.href = '/origami'; window.location.href = '/origami';

View File

@@ -174,7 +174,7 @@
success: function(result){ success: function(result){
if(result.status == true){ if(result.status == true){
swal({ swal({
title: "Infomation!", title: "Information!",
text: result.status, text: result.status,
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment" window.location.href = '/origami/sale/'+ sale_id + "/payment"

View File

@@ -524,7 +524,7 @@ $('#request_bills').click(function() {
success:function(result){ success:function(result){
if(!result.status){ if(!result.status){
$.confirm({ $.confirm({
title: 'Infomation!', title: 'Information!',
content: result.error_message, content: result.error_message,
buttons: { buttons: {
confirm: { confirm: {

View File

@@ -143,7 +143,7 @@
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price, data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price,
success: function (result) { success: function (result) {
swal({ swal({
title: "Infomation!", title: "Information!",
text: "Qty and Price was successfully Updated", text: "Qty and Price was successfully Updated",
}, function () { }, function () {
location.reload(); location.reload();

View File

@@ -155,7 +155,9 @@
$('#visa_pay').on('click',function(){ $('#visa_pay').on('click',function(){
var amount = $('#amount').text(); var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value"))){ console.log(amount);
console.log($("#validamount").attr("value"));
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
//start member discount 5% by pay card //start member discount 5% by pay card
var sub_total = $('#sub-total').text(); var sub_total = $('#sub-total').text();
var member_id = $('#membership_id').text(); var member_id = $('#membership_id').text();
@@ -176,7 +178,7 @@
success:function(result){ success:function(result){
if(result){ if(result){
swal({ swal({
title: "Infomation!", title: "Information!",
text: "Payment Successfully", text: "Payment Successfully",
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id + "/payment";
@@ -185,7 +187,11 @@
} }
}); });
}else{ }else{
swal ( "Oops" , "Paid Amount is over!" , "error" ); if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
} }
}) })
</script> </script>

View File

@@ -4,7 +4,7 @@
<li class="breadcrumb-item"><a href="<%= print_settings_path %>"><%= t("views.right_panel.header.print_settings") %></a></li> <li class="breadcrumb-item"><a href="<%= print_settings_path %>"><%= t("views.right_panel.header.print_settings") %></a></li>
<li class="breadcrumb-item active"><%= t :details %></li> <li class="breadcrumb-item active"><%= t :details %></li>
<span class="float-right"> <span class="float-right">
<%= link_to t('.back', :default => t("views.btn.back")), settings_employees_path %> <%= link_to t('.back', :default => t("views.btn.back")), print_settings_path %>
</span> </span>
</ol> </ol>
</div> </div>

View File

@@ -1,10 +1,10 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= settings_payment_method_setting_path %>"><%= t("en.payment_methods") %></a></li> <li class="breadcrumb-item"><a href="<%= settings_payment_method_settings_path %>"><%= t("en.payment_methods") %></a></li>
<li class="breadcrumb-item active"><%= t :details %></li> <li class="breadcrumb-item active"><%= t :details %></li>
<span class="float-right"> <span class="float-right">
<%= link_to t('.back', :default => t("views.btn.back")), settings_payment_method_setting_path %> <%= link_to t('.back', :default => t("views.btn.back")), settings_payment_method_settings_path %>
</span> </span>
</ol> </ol>
</div> </div>