Merge branch 'adminbsb_material_ui'

This commit is contained in:
Aung Myo
2018-03-15 14:38:27 +06:30
5 changed files with 184 additions and 17 deletions

View File

@@ -180,7 +180,7 @@ $(function() {
image_path = "image/logo.png";
}
}
console.log(menu_items[field].options)
row = '<div class="card custom-card testimonial-card animated fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
@@ -202,7 +202,7 @@ $(function() {
+ price +"' data-instance-code = '"+ code +"' data-instance = '"
+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
+ JSON.stringify(item_attributes) +"' data-options = '"
+ options +"' data-image='"+image_path+"' data-toggle='"
+ JSON.stringify(menu_items[field].options) +"' data-image='"+image_path+"' data-toggle='"
+data_modal+"' data-target='."+data_target+"' data-item-sets = '"
+JSON.stringify(menu_items[field].item_sets)+"'data-instances = '"
+JSON.stringify(menu_items[field].instances)+"'>"
@@ -237,10 +237,10 @@ $(function() {
//instances = $(this).data('instance');
item_sets = $(this).data('item-sets');
instances = $(this).data('instances');
// item_sets = $(data).attr('data-item-sets');
item_options = $(this).data('options');
for(var field in item_sets) {
$('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]);
value = item_sets[field]["instances"];
@@ -283,10 +283,20 @@ $(function() {
});
}
for(var j in item_options) {
value = item_options[j]["values"];
type = item_options[j]["type"];
row = "<h4>"+type+"</h4>"
$(value).each(function(i){
row +="<button class='btn btn- waves-effect option_btn "+ type +"' data-type='"
+type+"' data-value='"+value[i]+"' data-group='set_menu_default'>"+value[i]+"</button>";
});
$(".options-list").append(row);
}
$('.set-item').attr('data-code',instances[0]['code']);
$('.set-item').attr('data-name',instances[0]['name']);
$('.set-item').attr('data-price',instances[0]['price']);
$('.set-item').attr('data-options','[]');
// $('.set-item').attr('data-options','[]');
$('.set-item').attr('data-parent',true);
$('#set_change_qty').val(1);
@@ -371,32 +381,28 @@ $(function() {
customer_display_view(item,"set_add");
attribute_arr = []
option_arr = []
var rowCount = $('.summary-items tbody tr').length+1;
option_arr = []
code = $('.set-item').attr('data-code');
name = $('.set-item').attr('data-name');
price = $('.set-item').attr('data-price');
option = $('.set-item').attr('data-options');
parent = $('.set-item').attr('data-parent');
total = qty * price ;
option_arr.push(option);
row ="<tr class='item_box' data-price ='"
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
+name+ "' data-code='"+item_code+"' data-instance-code='"
+code+"' data-attributes='"
+attribute_arr+"' data-options ='"
+option_arr+"' data-row ='"+rowCount+ "' data-parent ='"+parent+ "'>"
+option+"' data-row ='"+rowCount+ "' data-parent ='"+parent+ "'>"
+'<td class="item-cell-no">'+rowCount+'</td>'
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +'</td>'
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +'-' + option +'</td>'
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
+'<td class="item-cell-price" id="item_price">'
+ parseFloat(total).toFixed(2)
+'</td>'
+'</tr>';
$(".summary-items tbody").append(row);
var rowCount = $('.summary-items tbody tr').length+1;
$(items).each(function(i){
code = $(items[i]).attr('data-code');
@@ -406,15 +412,14 @@ $(function() {
sub_item = $(items[i]).attr('data-sub-item');
option = $(items[i]).attr('data-options');
total = qty * price ;
option_arr.push(option);
row ="<tr class='item_box' data-price ='"
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
+name+ "' data-code='"+item_code+"' data-instance-code='"
+code+"' data-attributes='"
+attribute_arr+"' data-options ='"
+option_arr+"' data-row ='"+rowCount+ "' data-sub-item ='"+sub_item+ "'>"
+option+"' data-row ='"+rowCount+ "' data-sub-item ='"+sub_item+ "'>"
+'<td class="item-cell-no">'+rowCount+'</td>'
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +'</td>'
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +'-' + option +'</td>'
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
+'<td class="item-cell-price" id="item_price">'
+ parseFloat(total).toFixed(2)
@@ -626,8 +631,6 @@ $(function() {
if(group == "set_menu"){
code = $(this).data('code');
value = $(this).data('value');
instance = $(".selected-instance");
$(instance).each(function(i){
@@ -638,6 +641,12 @@ $(function() {
}
});
}
if(group == "set_menu_default"){
option_arr = get_selected_attributes('selected-option');
$('.set-item').attr('data-options',JSON.stringify(option_arr));
$('.set_default_option').text(option_arr);
}
}); //End selecct attribute buttom

View File

@@ -6,6 +6,10 @@ class Settings::MenusController < ApplicationController
# GET /settings/menus.json
def index
@settings_menus = Menu.all.page(params[:page]).per(10)
respond_to do |format|
format.html
format.csv { send_data Menu.to_csv }
end
end
# GET /settings/menus/1

View File

@@ -31,4 +31,29 @@ class Menu < ApplicationRecord
menu.destroy
return false
end
end
def self.to_csv
m_attributes = %w{id name is_active valid_days valid_time_from valid_time_to created_by created_at updated_at}
CSV.generate(headers: true) do |csv|
csv << m_attributes
menu = Menu.all
menu.each do |user|
puts user
csv << m_attributes.map{ |attr| user.send(attr)}
end
end
# mc_attributes = %w{id menu_id code name alt_name order_by created_by menu_category_id is_available created_at updated_at}
# CSV.generate(headers: true) do |csv|
# csv << m_attributes
# csv << mc_attributes
# MenuCategory.all.each do |user|
# puts user
# csv << mc_attributes.map{ |attr| user.send(attr)}
# end
# end
end
end

View File

@@ -1,5 +1,6 @@
require_relative 'boot'
require 'csv'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems

128
data/recent_users.json Normal file
View File

@@ -0,0 +1,128 @@
[
{
"id": 1,
"name": "Administrator",
"role": "administrator",
"emp_id": "999",
"password_digest": "$2a$10$mfWmxBvOHt3NbWrLGOF/POTpnxF7QEtnW99qW818dkrQqVLtjQdrS",
"token_session": null,
"session_expiry": null,
"session_last_login": "2018-03-14 09:41:25 +0630",
"created_by": "SYSTEM DEFAULT",
"created_at": "2017-11-08 09:44:30 +0630",
"updated_at": "2018-03-14 16:02:09 +0630",
"image_path": {"url":null}
},
{
"id": 2,
"name": "Waiter",
"role": "waiter",
"emp_id": "111",
"password_digest": "$2a$10$PjBemEA2yKOcoGAyXjz81OqglrASIF8RTYHVe0vqp3FQ0T4/PzJJG",
"token_session": "662e797ad508ab6c43b1",
"session_expiry": "2018-02-21 01:45:11 +0630",
"session_last_login": "2018-02-20 13:45:11 +0630",
"created_by": "SYSTEM DEFAULT",
"created_at": "2017-11-08 09:44:30 +0630",
"updated_at": "2018-02-20 13:59:17 +0630",
"image_path": {"url":null}
},
{
"id": 3,
"name": "Waiter 2",
"role": "waiter",
"emp_id": "222",
"password_digest": "$2a$10$gXh/Tpbr8EyJSaxsbJYVh.K7Fr4bT0A1i2mWuuZm/FHQ4D/wV1E8e",
"token_session": "61868be9530b753ada84",
"session_expiry": "2018-03-14 05:41:12 +0630",
"session_last_login": "2018-03-13 17:11:12 +0630",
"created_by": "SYSTEM DEFAULT",
"created_at": "2017-11-08 09:44:30 +0630",
"updated_at": "2018-03-13 17:32:47 +0630",
"image_path": {"url":null}
},
{
"id": 4,
"name": "Cashier",
"role": "cashier",
"emp_id": "333",
"password_digest": "$2a$10$fHo.9wOn.yr.2Ke6iuCfou6DjpyHXwQSmZQ.43O7W4SnlmzuoIEF2",
"token_session": "693f6e98bb90b6af9978",
"session_expiry": "2018-03-15 12:36:28 +0630",
"session_last_login": "2018-03-14 16:36:28 +0630",
"created_by": "SYSTEM DEFAULT",
"created_at": "2017-11-08 09:44:30 +0630",
"updated_at": "2018-03-14 17:05:14 +0630",
"image_path": {"url":null}
},
{
"id": 5,
"name": "manager",
"role": "manager",
"emp_id": "888",
"password_digest": "$2a$10$EaU/Sxfsb8Q3kBIAyxSEJ.ZpRC9vxSdVAFvF0WXUvWiAqHyqGggoe",
"token_session": null,
"session_expiry": null,
"session_last_login": "2018-01-16 13:37:05 +0630",
"created_by": null,
"created_at": "2017-11-30 10:03:11 +0630",
"updated_at": "2018-01-16 13:48:02 +0630",
"image_path": {"url":null}
},
{
"id": 6,
"name": "Account",
"role": "account",
"emp_id": "777",
"password_digest": "$2a$10$bJmgIxHefkvxpxJQLQPcpurTJrp8.BwP/kirJRYb1v1thrU3TDzkC",
"token_session": null,
"session_expiry": null,
"session_last_login": "2018-01-16 10:37:22 +0630",
"created_by": null,
"created_at": "2018-01-16 10:23:09 +0630",
"updated_at": "2018-01-16 10:49:24 +0630",
"image_path": {"url":null}
},
{
"id": 7,
"name": "Supervisor",
"role": "supervisor",
"emp_id": "666",
"password_digest": "$2a$10$/WQirOw5nu6kKDiITTVa7.IGeVyxH5JmLp3/Astu/5DlOAoMLn4Ne",
"token_session": null,
"session_expiry": null,
"session_last_login": "2018-01-16 14:28:40 +0630",
"created_by": null,
"created_at": "2018-01-16 10:23:32 +0630",
"updated_at": "2018-01-16 15:32:33 +0630",
"image_path": {"url":null}
},
{
"id": 8,
"name": "123",
"role": "waiter",
"emp_id": "123",
"password_digest": "$2a$10$v8JBsc31XkLRNZ/QhfYBg.wbVT7CyVvk83U..0PsGiz61w0Atl/WW",
"token_session": "4fc9a18a5df511e507fc",
"session_expiry": "2018-02-01 20:08:35 +0630",
"session_last_login": "2018-02-01 14:08:35 +0630",
"created_by": null,
"created_at": "2018-02-01 14:07:16 +0630",
"updated_at": "2018-02-01 17:45:10 +0630",
"image_path": {"url":null}
},
{
"id": 9,
"name": "Cashier 2",
"role": "cashier",
"emp_id": "444",
"password_digest": "$2a$10$5n34O09xmrIHbgvX.uhr9uAaUR8etjaqiicaXr017VWm/qDkjKVue",
"token_session": "0477edce9cf259f280c1",
"session_expiry": "2018-02-20 19:07:50 +0630",
"session_last_login": "2018-02-20 11:37:50 +0630",
"created_by": null,
"created_at": "2018-02-14 17:10:12 +0630",
"updated_at": "2018-02-20 13:37:46 +0630",
"image_path": {"url":null}
}
]