not working

This commit is contained in:
gitea 2025-04-13 06:21:31 +00:00
parent 26b48adf92
commit fb96a54c2d
5 changed files with 185 additions and 27 deletions

View File

@ -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',
],
},

View File

@ -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;
}

View File

@ -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("<p>Kein Kunde ausgewählt.</p>");
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());
},
});
});

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="MachineAccessSidebar" owl="1">
<div class="machine-access-sidebar">
<div class="access-content">
<t t-if="partner">
<t t-foreach="machineAreas" t-as="area" t-key="area.id">
<div class="machine-area">
<h5 t-attf-style="color: #{area.color_hex}"><t t-esc="area.name" /></h5>
<ul>
<t t-foreach="area.machines" t-as="machine" t-key="machine.id">
<li>
<span t-esc="machine.name" />
<t t-if="machine.has_access"></t>
<t t-else=""></t>
</li>
</t>
</ul>
</div>
</t>
</t>
<t t-else="">
<p>Kein Kunde ausgewählt.</p>
</t>
</div>
</div>
</t>
</templates>

View File

@ -1,12 +1,14 @@
<odoo>
<data>
<template id="assets" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/open_workshop/static/src/js/partner_access_popup.js"/>
<template id="machine_access_template" name="Maschinenfreigaben Template"
src="/open_workshop/static/src/xml/ows_pos_machine_access_view.xml"/>
<script type="text/javascript" src="/open_workshop/static/src/js/machine_access_sidebar.js"/>
<template id="machine_access_template" name="Maschinenfreigaben Template" src="/open_workshop/static/src/xml/ows_pos_machine_access_view.xml"/>
</xpath>
<xpath expr="//link[@href='/point_of_sale/static/src/css/pos.css']" position="replace">
<link rel="stylesheet" type="text/css" href="/open_workshop/static/src/css/pos.css"/>
</xpath>
</template>
</data>
</odoo>