[IMP] pos_restaurant: floor screen order number & current floor
Previously, when a table was selected on a floor plan other than the first, clicking on back brought you to the first floor plan, not the one of the previously selected table. Now, when you click on the back button, you return to the floor plan corresponding to the previous table. Also, the order number is now displayed on the floor screen button. closes odoo/odoo#138013 Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<templates id="template" xml:space="preserve">
|
||||
<t t-name="point_of_sale.Orderline">
|
||||
<t t-set="line" t-value="props.line" />
|
||||
<li class="orderline w-100 p-2 lh-sm cursor-pointer" t-att-class="props.class">
|
||||
<li class="orderline p-2 lh-sm cursor-pointer" t-attf-class="{{ line.comboParent ? 'border-start border-3 ms-4' : '' }}" t-att-class="props.class">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="product-name d-inline-block flex-grow-1 fw-bolder pe-1 text-truncate">
|
||||
<span t-esc="line.productName"/>
|
||||
@@ -19,10 +19,6 @@
|
||||
<li t-if="line.discount !== '0'">
|
||||
With a <em><t t-esc="line.discount" />% </em> discount
|
||||
</li>
|
||||
<li t-if="line.comboParent" class="combo-parent-name">
|
||||
<i class="fa fa-th-large me-2" role="img" aria-label="Combo" title="Combo"/>
|
||||
<t t-esc="line.comboParent" />
|
||||
</li>
|
||||
<t t-slot="default" />
|
||||
<li t-if="line.customerNote" class="customer-note w-50 p-2 my-1 rounded text-bg-warning text-warning bg-opacity-25 text-break">
|
||||
<i class="fa fa-sticky-note me-1" role="img" aria-label="Customer Note" title="Customer Note"/>
|
||||
|
||||
@@ -40,26 +40,11 @@ registry.category("web_tour.tours").add("PosComboPriceTaxIncludedTour", {
|
||||
combo.confirm(),
|
||||
...ProductScreen.check.selectedOrderlineHas("Office Combo"),
|
||||
...ProductScreen.do.clickOrderline("Combo Product 3"),
|
||||
...ProductScreen.check.selectedOrderlineHas(
|
||||
"Combo Product 3",
|
||||
"1.0",
|
||||
"12.92",
|
||||
"Office Combo"
|
||||
),
|
||||
...ProductScreen.check.selectedOrderlineHas("Combo Product 3", "1.0", "12.92"),
|
||||
...ProductScreen.do.clickOrderline("Combo Product 5"),
|
||||
...ProductScreen.check.selectedOrderlineHas(
|
||||
"Combo Product 5",
|
||||
"1.0",
|
||||
"17.87",
|
||||
"Office Combo"
|
||||
),
|
||||
...ProductScreen.check.selectedOrderlineHas("Combo Product 5", "1.0", "17.87"),
|
||||
...ProductScreen.do.clickOrderline("Combo Product 8"),
|
||||
...ProductScreen.check.selectedOrderlineHas(
|
||||
"Combo Product 8",
|
||||
"1.0",
|
||||
"28.81",
|
||||
"Office Combo"
|
||||
),
|
||||
...ProductScreen.check.selectedOrderlineHas("Combo Product 8", "1.0", "28.81"),
|
||||
|
||||
// check that you cannot change the quantity of a combo product
|
||||
...ProductScreen.do.pressNumpad("2"),
|
||||
|
||||
@@ -318,7 +318,7 @@ class Check {
|
||||
},
|
||||
];
|
||||
}
|
||||
selectedOrderlineHas(name, quantity, price, comboParent) {
|
||||
selectedOrderlineHas(name, quantity, price) {
|
||||
return [
|
||||
...adaptForMobile(
|
||||
Order.hasLine({
|
||||
@@ -326,7 +326,6 @@ class Check {
|
||||
productName: name,
|
||||
quantity,
|
||||
price,
|
||||
comboParent,
|
||||
})
|
||||
),
|
||||
{
|
||||
|
||||
-4
@@ -27,7 +27,6 @@ export function hasLine({
|
||||
quantity,
|
||||
price,
|
||||
customerNote,
|
||||
comboParent,
|
||||
} = {}) {
|
||||
let trigger = `.order-container .orderline${withClass}`;
|
||||
if (withoutClass) {
|
||||
@@ -45,9 +44,6 @@ export function hasLine({
|
||||
if (customerNote) {
|
||||
trigger += `:has(.info-list .customer-note:contains("${customerNote}"))`;
|
||||
}
|
||||
if (comboParent) {
|
||||
trigger += `:has(.info-list .combo-parent-name:contains("${comboParent}"))`;
|
||||
}
|
||||
const args = JSON.stringify(arguments[0]);
|
||||
return [
|
||||
{
|
||||
|
||||
@@ -19,23 +19,12 @@ patch(CartPage.prototype, {
|
||||
const service = this.selfOrder.config.self_ordering_service_mode;
|
||||
const takeAway = this.selfOrder.currentOrder.take_away;
|
||||
|
||||
if (this.sendInProgress) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.selfOrder.table && service === "table" && !takeAway) {
|
||||
this.state.selectTable = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode === "meal" && isOnlinePayment && order.isSavedOnServer) {
|
||||
if (!order) {
|
||||
this.selfOrder.notification.add(_t("The current order is invalid."), {
|
||||
type: "danger",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.checkAndOpenPaymentPage(order);
|
||||
} else if (mode === "meal" && !isOnlinePayment && order.isSavedOnServer) {
|
||||
this.router.navigate("confirmation", {
|
||||
|
||||
@@ -36,7 +36,7 @@ export class FloorScreen extends Component {
|
||||
this.pos = usePos();
|
||||
this.popup = useService("popup");
|
||||
this.orm = useService("orm");
|
||||
const floor = this.props.floor || this.pos.floors[0];
|
||||
const floor = this.pos.currentFloor;
|
||||
this.state = useState({
|
||||
selectedFloorId: floor ? floor.id : null,
|
||||
selectedTableIds: [],
|
||||
@@ -334,6 +334,7 @@ export class FloorScreen extends Component {
|
||||
}
|
||||
}
|
||||
selectFloor(floor) {
|
||||
this.pos.currentFloor = floor;
|
||||
this.state.selectedFloorId = floor.id;
|
||||
this.state.floorBackground = this.activeFloor.background_color;
|
||||
this.state.selectedTableIds = [];
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<t t-name="pos_restaurant.FloorScreen">
|
||||
<div class="floor-screen screen h-100 position-relative d-flex flex-column flex-nowrap m-0 bg-100 text-start overflow-hidden">
|
||||
<EditBar t-if="pos.isEditMode" selectedTables="selectedTables" nbrFloors="nbrFloors"
|
||||
<EditBar t-if="pos.isEditMode" selectedTables="selectedTables" nbrFloors="nbrFloors"
|
||||
floorMapScrollTop="state.floorMapScrollTop" isColorPicker="state.isColorPicker" toggleColorPicker.bind="toggleColorPicker"
|
||||
createTable.bind="createTable" duplicateTableOrFloor.bind="duplicateTableOrFloor" renameTable.bind="renameTable"
|
||||
changeSeatsNum.bind="changeSeatsNum" changeToCircle.bind="changeToCircle" changeToSquare.bind="changeToSquare"
|
||||
@@ -12,8 +12,9 @@
|
||||
/>
|
||||
<div class="floor-selector d-flex text-center bg-100 fs-3 w-100 h-54">
|
||||
<t t-foreach="pos.floors" t-as="floor" t-key="floor.id">
|
||||
<button class="button button-floor btn p-3 rounded-0 flex-fill border-start shadow-none" t-attf-class="{{ floor.id === state.selectedFloorId ? 'btn-primary border-start-0' : 'btn-light' }}" t-on-click="() => this.selectFloor(floor)">
|
||||
<button class="button button-floor btn p-3 rounded-0 flex-fill border-start shadow-none d-flex align-items-center justify-content-center" t-attf-class="{{ floor.id === state.selectedFloorId ? 'btn-primary border-start-0' : 'btn-light' }}" t-on-click="() => this.selectFloor(floor)">
|
||||
<t t-esc="floor.name" />
|
||||
<span t-if="activeFloor.id !== floor.id and floor.changes_count > 0" class="mx-1 badge bg-danger text-white rounded-pill py-1 px-2 fs-5" t-esc="floor.changes_count"/>
|
||||
</button>
|
||||
</t>
|
||||
<button class="button button-add btn btn-secondary p-3 ms-auto rounded-0" t-ref="add-floor-ref" t-on-click="addFloor">
|
||||
|
||||
@@ -48,12 +48,16 @@ patch(PosBus.prototype, {
|
||||
}
|
||||
}
|
||||
|
||||
for (const floor of this.pos.floors) {
|
||||
floor.changes_count = 0;
|
||||
}
|
||||
for (const table of data) {
|
||||
const table_obj = this.pos.tables_by_id[table.id];
|
||||
if (table_obj) {
|
||||
table_obj.order_count = table.orders;
|
||||
table_obj.changes_count = table.changes;
|
||||
table_obj.skip_changes = table.skip_changes;
|
||||
table_obj.floor.changes_count += table.changes;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -34,6 +34,7 @@ patch(PosStore.prototype, {
|
||||
this.setActivityListeners();
|
||||
this.showScreen("FloorScreen", { floor: this.table?.floor || null });
|
||||
}
|
||||
this.currentFloor = this.floors?.length > 0 ? this.floors[0] : null;
|
||||
},
|
||||
setActivityListeners() {
|
||||
IDLE_TIMER_SETTER = this.setIdleTimer.bind(this);
|
||||
|
||||
@@ -91,7 +91,7 @@ export class OrderWidget extends Component {
|
||||
);
|
||||
}
|
||||
|
||||
get leftButtonName() {
|
||||
get leftButton() {
|
||||
const order = this.selfOrder.currentOrder;
|
||||
const back =
|
||||
order.isSavedOnServer || this.router.activeSlot === "cart" || order.lines.length === 0;
|
||||
@@ -102,7 +102,7 @@ export class OrderWidget extends Component {
|
||||
};
|
||||
}
|
||||
|
||||
leftButton() {
|
||||
onClickleftButton() {
|
||||
const order = this.selfOrder.currentOrder;
|
||||
|
||||
if (
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
t-att-class="{
|
||||
'shadow-lg border-top' : !props.removeTopClasses
|
||||
}">
|
||||
<button t-attf-class="btn btn-secondary btn-lg h-auto w-auto opacity-75 px-4 d-sm-none" t-att-class="leftButtonName.icon" t-on-click="leftButton">
|
||||
<button t-attf-class="btn btn-secondary btn-lg h-auto w-auto opacity-75 px-4 d-sm-none" t-att-class="leftButton.icon" t-on-click="onClickleftButton">
|
||||
<span class="px-1"/><!-- Spacer -->
|
||||
</button>
|
||||
<button t-attf-class="btn btn-secondary btn-lg d-none d-sm-inline text-nowrap" t-on-click="leftButton" t-esc="leftButtonName.name" />
|
||||
<button t-attf-class="btn btn-secondary btn-lg d-none d-sm-inline text-nowrap" t-on-click="onClickleftButton" t-esc="leftButton.name" />
|
||||
<div class="d-flex align-items-center flex-grow-1 w-100 w-md-auto">
|
||||
<div class="to-order">
|
||||
<span t-if="!this.selfOrder.currentOrder.isSavedOnServer">To Order</span>
|
||||
|
||||
@@ -75,13 +75,4 @@ export class ConfirmationPage extends Component {
|
||||
|
||||
return this.state.onReload;
|
||||
}
|
||||
|
||||
get showPayMessage() {
|
||||
const config = this.selfOrder.config;
|
||||
const paymentMethods = this.selfOrder.pos_payment_methods.filter((p) =>
|
||||
config.self_ordering_mode === "mobile" ? p.is_online_payment : !p.is_online_payment
|
||||
);
|
||||
|
||||
return paymentMethods.length === 0 && config.self_ordering_pay_after === "each";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,9 +70,7 @@ export class LandingPage extends Component {
|
||||
}
|
||||
|
||||
return (
|
||||
routeName === "products" &&
|
||||
this.draftOrder.length > 0 &&
|
||||
this.selfOrder.config.self_ordering_pay_after === "each"
|
||||
this.draftOrder.length > 0 && this.selfOrder.config.self_ordering_pay_after === "each"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,9 @@
|
||||
<div t-if="selfOrder.custom_links.length" class="d-flex gap-3 flex-grow-1">
|
||||
<t t-foreach="selfOrder.custom_links" t-as="link" t-key="link.id">
|
||||
<a type="button"
|
||||
t-if="!hideBtn(link)"
|
||||
t-on-click="(event) => this.clickCustomLink(link)"
|
||||
t-attf-class="btn btn-lg btn-{{link.style}} {{ hideBtn(link) ? 'd-none' : ''}}">
|
||||
t-attf-class="btn btn-lg btn-{{link.style}}">
|
||||
<t t-esc="link.name"/>
|
||||
</a>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user