working order sidebar in pos 17.0
This commit is contained in:
parent
11f3de2b98
commit
671a9b1ebc
|
|
@ -13,21 +13,17 @@
|
|||
'views/machine_area_views.xml',
|
||||
'views/machine_views.xml',
|
||||
'views/res_partner_view.xml',
|
||||
'views/assets.xml',
|
||||
'data/data.xml',
|
||||
],
|
||||
'qweb': [
|
||||
'static/src/xml/ows_briefing_details.xml',
|
||||
'static/src/xml/ows_briefing_details_edit.xml',
|
||||
'static/src/xml/ows_pos_order_selector.xml',
|
||||
'static/src/xml/ows_machine_sidebar.xml',
|
||||
'static/src/xml/ows_pos_machine_access_view.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'assets': {
|
||||
'point_of_sale.assets': [
|
||||
'static/src/js/machine_access_sidebar.js',
|
||||
'static/src/css/pos.css',
|
||||
'point_of_sale._assets_pos': [
|
||||
|
||||
'open_workshop/static/src/js/product_screen_template_patch.js',
|
||||
'open_workshop/static/src/css/pos.css',
|
||||
'open_workshop/static/src/js/ows_pos_customer_sidebar.js',
|
||||
'open_workshop/static/src/xml/ows_pos_customer_sidebar.xml',
|
||||
'open_workshop/static/src/xml/ows_product_screen.xml',
|
||||
],
|
||||
},
|
||||
'description': """
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
44
static/src/js/ows_pos_customer_sidebar.js
Normal file
44
static/src/js/ows_pos_customer_sidebar.js
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
// @odoo-module
|
||||
|
||||
import { Component } from "@odoo/owl";
|
||||
import { usePos } from "@point_of_sale/app/store/pos_hook";
|
||||
|
||||
export class OwsPosCustomerSidebar extends Component {
|
||||
static template = "open_workshop.OwsPosCustomerSidebar";
|
||||
|
||||
setup() {
|
||||
this.pos = usePos();
|
||||
}
|
||||
|
||||
addOrder() {
|
||||
this.pos.add_new_order();
|
||||
}
|
||||
|
||||
removeCurrentOrder() {
|
||||
const order = this.pos.get_order();
|
||||
if (order) {
|
||||
this.pos.removeOrder(order);
|
||||
}
|
||||
}
|
||||
|
||||
openTicketScreen() {
|
||||
this.pos.showScreen("TicketScreen");
|
||||
}
|
||||
|
||||
getFilteredOrderList() {
|
||||
return this.pos.get_order_list();
|
||||
}
|
||||
|
||||
getDate(order) {
|
||||
const date = new Date(order.creationDate || order.creation_date || Date.now());
|
||||
return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
||||
}
|
||||
|
||||
getPartner(order) {
|
||||
return order.get_partner()?.name || "Kein Kunde";
|
||||
}
|
||||
|
||||
selectOrder(order) {
|
||||
this.pos.set_order(order);
|
||||
}
|
||||
}
|
||||
16
static/src/js/product_screen_template_patch.js
Normal file
16
static/src/js/product_screen_template_patch.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// @odoo-module
|
||||
|
||||
import { ProductScreen } from "@point_of_sale/app/screens/product_screen/product_screen";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { OwsPosCustomerSidebar } from "@open_workshop/js/ows_pos_customer_sidebar";
|
||||
|
||||
export class OwsProductScreen extends ProductScreen {
|
||||
static template = "open_workshop.ProductScreen";
|
||||
static components = {
|
||||
...ProductScreen.components,
|
||||
OwsPosCustomerSidebar,
|
||||
};
|
||||
}
|
||||
|
||||
registry.category("pos_screens").remove("ProductScreen");
|
||||
registry.category("pos_screens").add("ProductScreen", OwsProductScreen);
|
||||
24
static/src/xml/ows_pos_customer_sidebar.xml
Normal file
24
static/src/xml/ows_pos_customer_sidebar.xml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
<t t-name="open_workshop.OwsPosCustomerSidebar" owl="1">
|
||||
<div class="ows-sidebar p-2 bg-light border-end h-100">
|
||||
<div class="ows-sidebar-header mb-2 d-flex justify-content-between align-items-center">
|
||||
<button class="btn btn-secondary" t-on-click="openTicketScreen">Orders</button>
|
||||
<div>
|
||||
<button class="btn btn-sm btn-success me-1" t-on-click="addOrder">+</button>
|
||||
<button class="btn btn-sm btn-danger" t-on-click="removeCurrentOrder">–</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ows-customer-list overflow-auto">
|
||||
<t t-foreach="getFilteredOrderList()" t-as="order" t-key="order.uid">
|
||||
<!--div class="order-entry p-1 rounded mb-1 border"
|
||||
t-att-class="order === pos.get_order() ? 'bg-primary text-white' : 'bg-white'"
|
||||
t-on-click="() => selectOrder(order)"-->
|
||||
<div t-att-class="'order-entry' + (order === pos.get_order() ? ' selected' : '')" t-on-click="() => this.selectOrder(order)">
|
||||
<div><t t-esc="getDate(order)"/> – <t t-esc="getPartner(order)"/></div>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
45
static/src/xml/ows_product_screen.xml
Normal file
45
static/src/xml/ows_product_screen.xml
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
<t t-name="open_workshop.ProductScreen" owl="1">
|
||||
<div class="product-screen d-flex h-100 bg-100" t-att-class="{ 'd-none': !props.isShown }">
|
||||
<div class="custompane d-flex flex-column border-end bg-200">
|
||||
<OwsPosCustomerSidebar />
|
||||
</div>
|
||||
|
||||
<div t-if="!ui.isSmall || pos.mobile_pane === 'left'"
|
||||
t-att-class="{'flex-grow-1': ui.isSmall}"
|
||||
class="leftpane d-flex flex-column border-end bg-200" >
|
||||
<OrderWidget lines="currentOrder.orderlines" t-slot-scope="scope"
|
||||
total="env.utils.formatCurrency(currentOrder.get_total_with_tax())"
|
||||
tax="!env.utils.floatIsZero(currentOrder.get_total_tax()) and env.utils.formatCurrency(currentOrder.get_total_tax()) or ''">
|
||||
<t t-set="line" t-value="scope.line" />
|
||||
<Orderline line="line.getDisplayData()"
|
||||
t-on-click="() => this.selectLine(line)"
|
||||
class="{ ...line.getDisplayClasses(), 'selected' : line.selected }"/>
|
||||
<t t-set-slot="details" />
|
||||
</OrderWidget>
|
||||
<div class="pads border-top">
|
||||
<div class="control-buttons d-flex flex-wrap border-bottom overflow-hidden bg-300" t-if="!ui.isSmall">
|
||||
<t t-foreach="controlButtons" t-as="cb" t-key="cb.name">
|
||||
<t t-component="cb.component" t-key="cb.name"/>
|
||||
</t>
|
||||
</div>
|
||||
<div class="subpads d-flex">
|
||||
<ActionpadWidget partner="partner" actionName="constructor.numpadActionName" actionType="'payment'" onClickMore.bind="displayAllControlPopup" />
|
||||
<Numpad buttons="getNumpadButtons()" onClick.bind="onNumpadClick" class="'w-100'"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rightpane overflow-auto d-flex flex-grow-1 flex-column bg-300 w-60" t-if="!ui.isSmall || pos.mobile_pane === 'right'">
|
||||
<ProductsWidget />
|
||||
<t t-if="ui.isSmall">
|
||||
<div class="product-reminder d-flex justify-content-center align-items-center py-1 text-bg-warning bg-opacity-50 fw-bolder"
|
||||
t-if="currentOrder.get_selected_orderline() and currentOrder.hasJustAddedProduct" t-key="animationKey" >
|
||||
<span><t t-esc="selectedOrderlineQuantity"/> <t t-esc="selectedOrderlineDisplayName"/> <t t-esc="selectedOrderlineTotal"/></span>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
Loading…
Reference in New Issue
Block a user