Browse Source

Aug 23: [FIX] Bug fixed 'pos_restaurant_web_menu'

pull/332/merge
Cybrosys Technologies 8 months ago
parent
commit
9ded3f2098
  1. 2
      pos_restaurant_web_menu/__manifest__.py
  2. 8
      pos_restaurant_web_menu/doc/RELEASE_NOTES.md
  3. 7
      pos_restaurant_web_menu/static/src/css/pos_restaurant_web_menu.css
  4. 23
      pos_restaurant_web_menu/static/src/js/pos_restaurant_web_menu.js
  5. 9
      pos_restaurant_web_menu/views/pos_restaurant_web_menu_templates.xml

2
pos_restaurant_web_menu/__manifest__.py

@ -21,7 +21,7 @@
#############################################################################
{
'name': 'POS Restaurant Web Menu',
'version': '16.0.1.0.0',
'version': '16.0.1.0.1',
'category': 'Point of Sale',
'summary': 'This module help to view Pos Restaurant Website Menu',
'description': """This module create pos restaurant website menu for

8
pos_restaurant_web_menu/doc/RELEASE_NOTES.md

@ -4,3 +4,11 @@
#### Version 16.0.1.0.0
#### ADD
- Initial commit for POS Restaurant Web Menu
#### 23.08.2024
#### Version 16.0.1.0.1
#### UPDATE
- Update the order menu screen scroll option
- Update the feature for delete the order line

7
pos_restaurant_web_menu/static/src/css/pos_restaurant_web_menu.css

@ -32,3 +32,10 @@
display: block;
margin-bottom: 20px;
}
}
.pos-cart-table{
overflow-y: scroll;
height: 500px;
margin-bottom: 40px;
}

23
pos_restaurant_web_menu/static/src/js/pos_restaurant_web_menu.js

@ -9,6 +9,7 @@ odoo.define('pos_restaurant_web_menu.web_menu', function (require) {
var core = require('web.core');
var qweb = core.qweb;
var count=0;
var rowCounter = 1;
var cart_item = [];
var PosWebMenu = PublicWidget.Widget.extend({
selector:'.pos_web_menu_container',
@ -17,7 +18,8 @@ odoo.define('pos_restaurant_web_menu.web_menu', function (require) {
'click .add_to_cart_pos': '_onClick',
'click .o_pos_web_menu_button': '_view_cart',
'click .pos_web_order': '_make_an_order',
'click .button_back': 'back'
'click .button_back': 'back',
'click .order-line': '_onClickCancel'
},
// Back button for pos web menu
back: function(ev){
@ -38,7 +40,8 @@ odoo.define('pos_restaurant_web_menu.web_menu', function (require) {
}).then(function (data) {
amount = data['lst_price']
cart_item.push(data)
self.$el.find("tbody").append("<tr id='demo'><td><span>"+data['display_name']+"</span></td><td><span>"+data['currency']+ amount+"</span></td><td><input type='text' width='30%' class='form-control' placeholder='Add internal note..' /></td><tr>");
self.$el.find("tbody").append("<tr class=" + parseInt(product_id) + " id='demo_" + rowCounter + "'><td><span>"+data['display_name']+"</span></td><td><span>"+data['currency']+ amount+"</span></td><td><input type='text' width='30%' class='form-control' placeholder='Add internal note..' /></td><td><button class='order-line' id=" + rowCounter + " style='width: 30px; height: 37px; background-color: white;border-color: #e5cece; color: #9fbabb; border-radius: 5px;'><i class='fa fa-times' id=" + rowCounter + " aria-hidden='true'></i></button></td><tr>");
rowCounter++;
});
self.$el.find(".cart_products").text((cart_item.length+1));
},
@ -83,6 +86,22 @@ odoo.define('pos_restaurant_web_menu.web_menu', function (require) {
this.$el.find(".pos_web_front_page").hide();
this.$el.find(".pos_web_product_page").show();
},
// Click the button to delete the order line from the cart
_onClickCancel: function(ev){
var orderline = ev.target.attributes.id.value
const element = document.getElementById('demo_' + orderline);
const className = element.className;
var rawline = this.$el.find("#demo_" + orderline).remove();
var cart_count = this.$el.find(".cart_products").text()
this.$el.find(".cart_products").text((cart_count - 1))
var num = 0
for(var i=0; i < cart_item.length; i++){
if (cart_item[i].id == className){
num = i
}
}
cart_item.splice(num, 1);
}
});
PublicWidget.registry.PosWebMenu = PosWebMenu;
return PosWebMenu;

9
pos_restaurant_web_menu/views/pos_restaurant_web_menu_templates.xml

@ -112,12 +112,14 @@
<h2>Pos Cart</h2>
<hr/>
</div>
<div class="pos-cart-table" >
<table class="table-striped table">
<thead style="font-size: 13px;">
<tr>
<th>product</th>
<th>Price</th>
<th>Note</th>
<th/>
</tr>
</thead>
<tbody>
@ -126,6 +128,7 @@
</span>
</tbody>
</table>
</div>
<div class="order_details"
style="margin-left: 20px;display:flex;">
<label for="tables_id"
@ -149,7 +152,8 @@
<div class="order_details"
style="margin-left: 20px;display:flex;">
<label for="customers"
style="margin-right: 10px;">Choose Customers:
style="margin-right: 10px;">Choose
Customers:
</label>
<select name="customer_id" id="customer_id"
class="form-select"
@ -164,7 +168,8 @@
Order
</button>
<br/>
<div id="alert" class="alert alert-warning" style="display:none" role="alert"/>
<div id="alert" class="alert alert-warning"
style="display:none" role="alert"/>
</div>
</div>
</main>

Loading…
Cancel
Save