From fb96a54c2d5d9345038a2aded35ea985a656327d Mon Sep 17 00:00:00 2001 From: gitea Date: Sun, 13 Apr 2025 06:21:31 +0000 Subject: [PATCH] not working --- __manifest__.py | 4 +- static/src/css/pos.css | 77 ++++++++++++++++++----- static/src/js/machine_access_sidebar.js | 81 +++++++++++++++++++++++++ static/src/xml/ows_machine_sidebar.xml | 28 +++++++++ views/assets.xml | 22 ++++--- 5 files changed, 185 insertions(+), 27 deletions(-) create mode 100644 static/src/js/machine_access_sidebar.js create mode 100644 static/src/xml/ows_machine_sidebar.xml diff --git a/__manifest__.py b/__manifest__.py index 0309876..8728ada 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -14,19 +14,21 @@ 'views/machine_views.xml', 'views/res_partner_view.xml', 'views/assets.xml', - 'views/machine_product_training_views.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/partner_access_popup.js', + 'static/src/js/machine_access_sidebar.js', + 'static/src/css/pos.css', #'static/src/js/debug.js', ], }, diff --git a/static/src/css/pos.css b/static/src/css/pos.css index 7d66d73..8969f4e 100644 --- a/static/src/css/pos.css +++ b/static/src/css/pos.css @@ -366,7 +366,8 @@ td { .pos .new-order-button{ text-align: center; - width : 60%; + width : 100%; + background : #d3d3d3; /* overflow: auto; */ } @@ -401,6 +402,7 @@ td { height: 35px; line-height: 35px; border-bottom: solid 1px rgb(196, 196, 196); + border-right: solid 0px eeeeee; box-shadow: none; -webkit-flex-shrink: 0; flex-shrink: 0; @@ -408,6 +410,7 @@ td { .pos .order-button .order-sequence{ font-size: 16px; + width: 99% font-weight: 800; vertical-align: middle; } @@ -429,7 +432,7 @@ td { font-size: 18px; text-align: center; line-height: 36px; - width: 43%; + width: 45%; } .pos .order-button:not(.square) > .fa { font-size: 16px; @@ -451,6 +454,7 @@ td { display: flex; -webkit-flex: 1; flex: 1; + direction: rtl; } .pos .orders { @@ -463,6 +467,7 @@ td { scrollbar-color: gray gray; box-sizing: border-box; height: calc(100% - 2 * 48px); /* The pixels is the value of top */ + direction: rtl;; } /* c) The session buttons */ @@ -540,8 +545,9 @@ td { } /* ********* Contains everything below the bar ********* */ .pos .pos-content { - width: calc(100% - 220px); /* 200px is the value of the left property */ - left: 220px; + width: 80%; /* 200px is the value of the left property */ + left: 20%; + right: 0%; position: absolute; top: 48px; @@ -1764,18 +1770,6 @@ td { width: 50%; float: right; } -.pos .clientlist-screen .client-details-briefing_fablab{ - border: solid 3px green; - margin: 5px; -} -.pos .clientlist-screen .client-details-briefing_wood{ - border: solid 3px red; - margin: 5px; -} -.pos .clientlist-screen .client-details-briefing_metal{ - border: solid 3px blue; - margin: 5px; -} .pos .clientlist-screen .client-detail{ line-height: 24px; } @@ -1867,6 +1861,7 @@ td { padding-top: 8px; font-size: 16px; text-align: left; + width: 99%; max-width: 500px; -webkit-transform: translate3d(0,0,0); } @@ -2538,3 +2533,53 @@ td { .pos .not-supported-browser img{ border-collapse: separate; } + +/* Open Workshop specific styles */ +.pos { + display: flex; + flex-direction: row; + height: 100%; + width: 100%; +} + +.pos .order-selector { + position: absolute; + top: 48px; + left: 0; + width: 10%; + height: calc(100% - 48px); + z-index: 10; +} + +.pos .machine-access-sidebar { + position: absolute; + top: 48px; /* unter der Topbar */ + bottom: 0; + height: calc(100% - 48px); + left: 10%; /* Platz für Order-Selector */ + right: 0; + width: 10%; + background: #d3d3d3; + overflow-y: auto; + border-right: 3px solid #787878; + z-index: 20; +} + +.pos .machine-access-sidebar .access-content { + position: relative; + top: 45px; /* unter der Topbar */ + background : #eeeeee; +} + +.pos .machine-access-sidebar h5 { + margin-top: 1em; + margin-bottom: 0.5em; +} + +.pos .machine-access-sidebar ul { + padding-left: 1em; +} + +.pos .machine-access-sidebar li { + margin-bottom: 0.3em; +} \ No newline at end of file diff --git a/static/src/js/machine_access_sidebar.js b/static/src/js/machine_access_sidebar.js new file mode 100644 index 0000000..9598aa7 --- /dev/null +++ b/static/src/js/machine_access_sidebar.js @@ -0,0 +1,81 @@ +odoo.define('machine_access_sidebar', function (require) { + "use strict"; + + var rpc = require('web.rpc'); + var screens = require('point_of_sale.screens'); + var chrome = require('point_of_sale.chrome'); + var core = require('web.core'); + var QWeb = core.qweb; + + console.log("✅ machine_access_sidebar.js geladen"); + + var MachineAccessSidebar = screens.ScreenWidget.extend({ + template: 'MachineAccessSidebar', + + init: function(parent, options) { + this._super(parent, options); + this.partner = null; + }, + + show: function() { + this._super(); + this.render_access(); + }, + + set_partner: function(partner) { + console.log("🔁 Sidebar bekommt neuen Partner:", partner); + this.partner = partner; + this.render_access(); + }, + + render_access: function() { + var self = this; + var partner = this.partner || this.pos.get_order().get_client(); + if (!partner) { + this.$('.access-content').html("

Kein Kunde ausgewählt.

"); + return; + } + + rpc.query({ + model: 'ows.machine', + method: 'get_access_list_grouped', + args: [partner.id], + }).then(function (result) { + console.log("📥 Sidebar: Maschinenfreigaben geladen:", result); + var html = QWeb.render('PartnerMachineAccessList', { + areas: result || [], + }); + self.$('.access-content').html(html); + }); + }, + }); + + chrome.Chrome.include({ + build_widgets: function () { + this._super(); + var sidebar = new MachineAccessSidebar(this, {}); + this.sidebar_widget = sidebar; + sidebar.appendTo(this.$el); + + var self = this; + + function bind_order_events(order) { + if (order) { + order.bind('change:client', {}, function () { + sidebar.set_partner(order.get_client()); + }); + sidebar.set_partner(order.get_client()); + } + } + + this.pos.bind('change:selectedOrder', this, function () { + bind_order_events(this.pos.get_order()); + }); + + bind_order_events(this.pos.get_order()); + }, + }); + + + +}); diff --git a/static/src/xml/ows_machine_sidebar.xml b/static/src/xml/ows_machine_sidebar.xml new file mode 100644 index 0000000..ca8e81e --- /dev/null +++ b/static/src/xml/ows_machine_sidebar.xml @@ -0,0 +1,28 @@ + + + +
+
+ + +
+
+
    + +
  • + + + +
  • +
    +
+
+
+
+ +

Kein Kunde ausgewählt.

+
+
+
+
+
diff --git a/views/assets.xml b/views/assets.xml index 7f4624b..0e6bc8c 100644 --- a/views/assets.xml +++ b/views/assets.xml @@ -1,12 +1,14 @@ -