update order and request bill

This commit is contained in:
Thein Lin Kyaw
2019-12-11 17:56:39 +06:30
parent 26edf23b46
commit 58117d0f48
28 changed files with 336 additions and 448 deletions

View File

@@ -6,21 +6,21 @@ if item.is_available
attr_format = []
# Format for attributes json
if item.item_attributes.count > 0
item_attributes = @item_attributes.select{ |x| item.item_attributes.include?(x.id.to_s) }
attr_format = item_attributes.group_by {|att| att.attribute_type }.map { |type, values| {type: type, values: values.map(&:name)} }
item_attributes = item.item_attributes.map(&:to_s)
attr_format = @item_attributes.select { |x| item_attributes.include?(x.id.to_s) }.group_by {|att| att.attribute_type.strip }.map { |type, values| {type: type, values: values.map { |x| x.name.strip } } }
end
# Format for option json
opt_format = []
# Format for attributes json
if item.item_options.count > 0
item_options = @item_options.select{ |x| item.item_options.include?(x.id.to_s) }
opt_format = item_options.group_by {|opt| opt.option_type }.map { |type, values| {type: type, values: values.map(&:name)} }
item_options = item.item_options.map(&:to_s)
opt_format = @item_options.select { |x| item_options.include?(x.id.to_s) }.group_by {|opt| opt.option_type.strip }.map { |type, values| {type: type, values: values.map { |x| x.name.strip } } }
end
#Menu Item Information
json.id item.id
json.code item.item_code
json.code item.item_code
json.name item.name
json.alt_name item.alt_name
if !request_url.nil? && request_url != '' && !item.image_path.nil?
@@ -44,7 +44,7 @@ if item.is_available
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.map { |i| {id: i.id} }
json.instances its.menu_item_instances.map { |i| {id: i.id} }
end
json.attributes attr_format
@@ -64,7 +64,8 @@ if item.is_available
json.instances item.menu_item_instances do |is|
if is.is_available
# Convert id to name for attributes
instance_attr = @item_attributes.select{ |x| item.item_attributes.include?(x.id) }.pluck(:name)
item_attributes = is.item_attributes.map(&:to_s)
instance_attr = @item_attributes.select{ |x| item_attributes.include?(x.id.to_s) }.pluck(:name)
json.id is.id
json.code is.item_instance_code

View File

@@ -31,15 +31,13 @@ json.is_sub_item item.is_sub_item
json.unit item.unit
# Item Sets of Menu Item
json.item_sets item.item_sets.includes(:menu_item_instances) do |its|
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
json.instances its.menu_item_instances.map { |i| {id: i.id} }
end
json.attributes attr_format

View File

@@ -41,21 +41,21 @@ if (menu.menu_categories)
attr_format = []
# Format for attributes json
if item.item_attributes.count > 0
item_attributes = @item_attributes.select{ |x| item.item_attributes.include?(x.id.to_s) }
attr_format = item_attributes.group_by {|att| att.attribute_type }.map { |type, values| {type: type, values: values.map(&:name)} }
item_attributes = item.item_attributes.map(&:to_s)
attr_format = @item_attributes.select { |x| item_attributes.include?(x.id.to_s) }.group_by {|att| att.attribute_type.strip }.map { |type, values| {type: type, values: values.map { |x| x.name.strip } } }
end
# Format for option json
opt_format = []
# Format for attributes json
if item.item_options.count > 0
item_options = @item_options.select{ |x| item.item_options.include?(x.id.to_s) }
opt_format = item_options.group_by {|opt| opt.option_type }.map { |type, values| {type: type, values: values.map(&:name)} }
item_options = item.item_options.map(&:to_s)
opt_format = @item_options.select { |x| item_options.include?(x.id.to_s) }.group_by {|opt| opt.option_type.strip }.map { |type, values| {type: type, values: values.map { |x| x.name.strip } } }
end
#Menu Item Information
json.id item.id
json.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
@@ -69,15 +69,14 @@ if (menu.menu_categories)
json.unit item.unit
# Item Sets of Menu Item
json.item_sets item.item_sets.map { |its|
{ id: its.id,
name: its.name,
alt_name: its.alt_name,
min_selectable_qty: its.min_selectable_qty,
max_selectable_qty: its.max_selectable_qty,
instances: its.menu_item_instances.map { |i| {id: i.id} }
}
}
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.map { |i| {id: i.id} }
end
json.attributes attr_format
json.options opt_format
@@ -85,7 +84,8 @@ if (menu.menu_categories)
json.instances item.menu_item_instances do |is|
if is.is_available
# Convert id to name for attributes
instance_attr = @item_attributes.select{ |x| item.item_attributes.include?(x.id) }.pluck(:name)
item_attributes = is.item_attributes.map(&:to_s)
instance_attr = @item_attributes.select{ |x| item_attributes.include?(x.id.to_s) }.pluck(:name)
json.id is.id
json.code is.item_instance_code

View File

@@ -11,7 +11,7 @@
<%= f.input :seater %>
<%= f.input :order_by %>
<%= f.input :is_active %>
<% if @settings_room.dining_charges.length == 0 %>
<% if @settings_room.dining_charge.nil? %>
<% if @settings_room.id != nil %>
<div class="">
<div class="">
@@ -20,33 +20,31 @@
</div>
<% end %>
<% else %>
<% @settings_room.dining_charges.each do |dc| %>
<% dc = @settings_room.dining_charge %>
<div class="card">
<div class="col-md-">
<table class="table">
<tr><td colspan="2">
<div class="col-md-10"><b><u>Dining Charge</u></b></div></td>
</tr>
<tr>
<td class="align-right">Item code :</td>
<td class="align-left"><%= dc.item_code %></td>
<td class="align-right">Unit price : </td>
<td class="align-left"><%= dc.unit_price %></td>
<td class="align-right">Charge type : </td>
<td class="align-left"><%= dc.charge_type %></td>
<td>
<%= link_to 'Edit Charges', edit_settings_zone_room_dining_charge_path(@zone,@settings_room,dc),:class => 'btn bg-deep-purple' %>
<!-- <button class="btn btn-primary" src="<%= edit_settings_zone_room_dining_charge_path(@zone,@settings_room,dc) %>">Edit Charge</button> -->
</td>
</tr>
</table>
</div>
<div class="col-md-">
<table class="table">
<tr><td colspan="2">
<div class="col-md-10"><b><u>Dining Charge</u></b></div></td>
</tr>
<tr>
<td class="align-right">Item code :</td>
<td class="align-left"><%= dc.item_code %></td>
<td class="align-right">Unit price : </td>
<td class="align-left"><%= dc.unit_price %></td>
<td class="align-right">Charge type : </td>
<td class="align-left"><%= dc.charge_type %></td>
<td>
<%= link_to 'Edit Charges', edit_settings_zone_room_dining_charge_path(@zone,@settings_room,dc),:class => 'btn bg-deep-purple' %>
<!-- <button class="btn btn-primary" src="<%= edit_settings_zone_room_dining_charge_path(@zone,@settings_room,dc) %>">Edit Charge</button> -->
</td>
</tr>
</table>
</div>
<% end %>
</div>
<% end %>
</div>
@@ -62,7 +60,7 @@
<div class="body">
<h5><i class="material-icons md-18">view_headline <%= t("views.right_panel.header.page_detail") %></i></h5>
<p>
1) <%= t("views.right_panel.detail.name") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.room_txt") %> <%= t("views.right_panel.detail.name_txt2") %> <br>
1) <%= t("views.right_panel.detail.name") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.room_txt") %> <%= t("views.right_panel.detail.name_txt2") %> <br>
2) <%= t("views.right_panel.detail.status") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.status_txt") %> <br>
3) <%= t("views.right_panel.detail.seater") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.seat_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.room_txt") %> <br>
4) <%= t("views.right_panel.detail.order_by") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.order_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.room_txt") %> <br>
@@ -78,7 +76,6 @@
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.zone_txt") %> <%= t("views.right_panel.detail.detail_txt") %> <br>
</p>
</div>
</div>
</div>
</div>
</div>

View File

@@ -11,14 +11,14 @@
<%= f.input :seater %>
<%= f.input :order_by %>
<%= f.input :is_active %>
<% if @settings_table.dining_charges.length == 0 %>
<% if @settings_table.dining_charge.nil? %>
<% if @settings_table.id != nil %>
<div class="col-md-">
<%= link_to 'Add For Extra Charges', new_settings_zone_table_dining_charge_path(@zone,@settings_table),:class => 'btn bg-deep-purple' %>
</div>
<% end %>
<% else %>
<% @settings_table.dining_charges.each do |dc| %>
<% dc = @settings_table.dining_charge %>
<div class="card">
<div class="body">
<span class="card-title"><b><u>Dining Charge</u></b></span>
@@ -48,7 +48,6 @@
</table>
</div>
</div>
<% end %>
<% end %>
</div>
@@ -64,7 +63,7 @@
<div class="body">
<h5><i class="material-icons md-18">view_headline <%= t("views.right_panel.header.page_detail") %></i></h5>
<p>
1) <%= t("views.right_panel.detail.name") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.table_txt") %> <%= t("views.right_panel.detail.name_txt2") %> <br>
1) <%= t("views.right_panel.detail.name") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.table_txt") %> <%= t("views.right_panel.detail.name_txt2") %> <br>
2) <%= t("views.right_panel.detail.status") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.status_txt") %> <br>
3) <%= t("views.right_panel.detail.seater") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.seat_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.table_txt") %> <br>
4) <%= t("views.right_panel.detail.order_by") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.order_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.table_txt") %> <br>
@@ -81,8 +80,6 @@
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.zone_txt") %> <br>
</p>
</div>
</div>
</div>
</div>
</div>

View File

@@ -53,43 +53,42 @@
<span class="hidden" id="delete_text">
<h6>Are you sure you want to delete this row ?</h6>
<h6>This action can't be undo. </h6>
</span>
<h6>This action can't be undo. </h6>
</span>
</td>
</tr>
</tbody>
</table>
<% @table.dining_charges.each do |dc| %>
<div class="card">
<div class="body">
<h4 class="card-title">Dining Charge</h4>
<table class="table">
<thead>
<th>Item Code</th>
<th>Unit Price</th>
<th>Charge Type</th>
<th>Free Time</th>
<th>Charges Block</th>
<th>Time Rounding</th>
<th>Actions</th>
</thead>
<tbody>
<tr>
<td><%= dc.item_code %></td>
<td><%= dc.unit_price %></td>
<td><%= dc.charge_type %></td>
<td><%= (dc.minimum_free_time).utc.strftime("%H:%M") %></td>
<td><%= (dc.charge_block).utc.strftime("%H:%M") %></td>
<td><%= dc.time_rounding %></td>
<td><%= link_to 'Edit Charges', edit_settings_zone_table_dining_charge_path(@zone,@settings_table,dc),:class => 'btn bg-deep-purple' %>
<!-- <button class="btn btn-primary" src="<%= edit_settings_zone_table_dining_charge_path(@zone,@settings_table,dc) %>">Edit Charge</button> -->
</td>
</tr>
</tbody>
</table>
</div>
<% dc = @table.dining_charge %>
<div class="card">
<div class="body">
<h4 class="card-title">Dining Charge</h4>
<table class="table">
<thead>
<th>Item Code</th>
<th>Unit Price</th>
<th>Charge Type</th>
<th>Free Time</th>
<th>Charges Block</th>
<th>Time Rounding</th>
<th>Actions</th>
</thead>
<tbody>
<tr>
<td><%= dc.item_code %></td>
<td><%= dc.unit_price %></td>
<td><%= dc.charge_type %></td>
<td><%= (dc.minimum_free_time).utc.strftime("%H:%M") %></td>
<td><%= (dc.charge_block).utc.strftime("%H:%M") %></td>
<td><%= dc.time_rounding %></td>
<td><%= link_to 'Edit Charges', edit_settings_zone_table_dining_charge_path(@zone,@settings_table,dc),:class => 'btn bg-deep-purple' %>
<!-- <button class="btn btn-primary" src="<%= edit_settings_zone_table_dining_charge_path(@zone,@settings_table,dc) %>">Edit Charge</button> -->
</td>
</tr>
</tbody>
</table>
</div>
<% end %>
</div>
</div>
</div>
</div>
@@ -98,7 +97,7 @@
<div class="body">
<h5><i class="material-icons md-18">view_headline <%= t("views.right_panel.header.page_detail") %></i></h5>
<p>
1) <%= t("views.right_panel.detail.name") %> - <%= t("views.right_panel.detail.table_txt") %> <%= t("views.right_panel.detail.name_txt") %> <%= t("views.right_panel.detail.table_txt") %><br>
1) <%= t("views.right_panel.detail.name") %> - <%= t("views.right_panel.detail.table_txt") %> <%= t("views.right_panel.detail.name_txt") %> <%= t("views.right_panel.detail.table_txt") %><br>
2) <%= t("views.right_panel.detail.status") %> - <%= t("views.right_panel.detail.table_txt") %> <%= t("views.right_panel.detail.status_txt") %> <br>
3) <%= t("views.right_panel.detail.seater") %> - <%= t("views.right_panel.detail.seat_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.table_txt") %> <br>
4) <%= t("views.right_panel.detail.order_by") %> - <%= t("views.right_panel.detail.order_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.table_txt") %> <br>
@@ -118,8 +117,6 @@
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.zone_txt") %> <br>
</p>
</div>
</div>
</div>
</div>
</div>