Przeglądaj źródła

[Administration] Gestion des accessoires

feature/rotating_product
Guillaume Bourgeois 4 miesięcy temu
rodzic
commit
95967a5ed6
5 zmienionych plików z 139 dodań i 118 usunięć
  1. +18
    -6
      backend/views/distribution/index.php
  2. +88
    -88
      backend/web/css/screen.css
  3. +14
    -5
      backend/web/js/vuejs/distribution-index.js
  4. +16
    -16
      backend/web/sass/distribution/_index.scss
  5. +3
    -3
      domain/Product/Accessory/Accessory.php

+ 18
- 6
backend/views/distribution/index.php Wyświetl plik

@@ -130,6 +130,7 @@ $this->setPageTitle('Distributions') ;
<td>Actif</td>
<td>Nom</td>
<td class="quantity-ordered">Commandé</td>
<td class="quantity-remaining">Reste</td>
<td class="quantity-max">Maximum</td>
</tr>
</thead>
@@ -143,9 +144,18 @@ $this->setPageTitle('Distributions') ;
</td>
<td>{{ product.name }}</td>
<td class="quantity-ordered">
<span v-if="isProductMaximumQuantityExceeded(product)" class="glyphicon glyphicon-alert"></span>
{{ product.quantity_ordered ? product.quantity_ordered + ' '+ ((product.unit == 'piece') ? ' p.' : ' '+(product.unit == 'g' || product.unit == 'kg') ? 'kg' : 'litre(s)') : '&empty;' }}
</td>

<td class="quantity-remaining">
<span class="infinite" v-if="(getProductQuantityRemainingGlobal(product) === null)">&infin;</span>
<span class="negative" v-else-if="getProductQuantityRemainingGlobal(product) <= 0">
{{ getProductQuantityRemainingGlobal(product) }} {{ product.unit == 'piece' ? ' p.' : ' '+(product.unit == 'g' || product.unit == 'kg') ? 'kg' : 'litre(s)' }}
<span class="glyphicon glyphicon-alert" v-if="getProductQuantityRemainingGlobal(product) < 0"></span>
</span>
<span class="has-quantity" v-else>{{ getProductQuantityRemainingGlobal(product) }} {{ product.unit == 'piece' ? ' p.' : ' '+(product.unit == 'g' || product.unit == 'kg') ? 'kg' : 'litre(s)' }}</span>
</td>

<td class="quantity-max">
<div class="input-group">
<input type="text" class="form-control quantity-max" placeholder="&infin;" :data-id-product="product.id" v-model="getProductDistribution(product).quantity_max" @keyup="productQuantityMaxChange" />
@@ -745,12 +755,14 @@ $this->setPageTitle('Distributions') ;
</span>
</div>
</td>
<td class="quantity-remaining infinite" v-if="(getProductQuantityRemaining(order, product) === null) || order.productOrder[product.id].unit != product.unit">&infin;</td>
<td class="quantity-remaining negative" v-else-if="getProductQuantityRemaining(order, product) <= 0">
{{ getProductQuantityRemaining(order, product) }} {{ order.productOrder[product.id].unit == 'piece' ? ' p.' : ' '+(order.productOrder[product.id].unit == 'g' || order.productOrder[product.id].unit == 'kg') ? 'kg' : 'litre(s)' }}
<span class="glyphicon glyphicon-alert" v-if="getProductQuantityRemaining(order, product) < 0"></span>
<td class="quantity-remaining">
<span class="infinite" v-if="(getProductQuantityRemaining(order, product) === null) || order.productOrder[product.id].unit != product.unit">&infin;</span>
<span class="negative" v-else-if="getProductQuantityRemaining(order, product) <= 0">
{{ getProductQuantityRemaining(order, product) }} {{ order.productOrder[product.id].unit == 'piece' ? ' p.' : ' '+(order.productOrder[product.id].unit == 'g' || order.productOrder[product.id].unit == 'kg') ? 'kg' : 'litre(s)' }}
<span class="glyphicon glyphicon-alert" v-if="getProductQuantityRemaining(order, product) < 0"></span>
</span>
<span class="has-quantity" v-else>{{ getProductQuantityRemaining(order, product) }} {{ order.productOrder[product.id].unit == 'piece' ? ' p.' : ' '+(order.productOrder[product.id].unit == 'g' || order.productOrder[product.id].unit == 'kg') ? 'kg' : 'litre(s)' }}</span>
</td>
<td class="quantity-remaining has-quantity" v-else>{{ getProductQuantityRemaining(order, product) }} {{ order.productOrder[product.id].unit == 'piece' ? ' p.' : ' '+(order.productOrder[product.id].unit == 'g' || order.productOrder[product.id].unit == 'kg') ? 'kg' : 'litre(s)' }}</td>
</tr>
</tbody>
</table>

+ 88
- 88
backend/web/css/screen.css Wyświetl plik

@@ -2400,120 +2400,136 @@ termes.
.distribution-index #calendar .vc-day.is-not-in-month .vc-highlights * {
opacity: 1 !important;
}
/* line 97, ../sass/distribution/_index.scss */
/* line 96, ../sass/distribution/_index.scss */
.distribution-index table td.quantity-remaining {
text-align: right;
}
/* line 99, ../sass/distribution/_index.scss */
.distribution-index table td.quantity-remaining .has-quantity, .distribution-index table td.quantity-remaining .infinite {
color: #00A65A;
}
/* line 103, ../sass/distribution/_index.scss */
.distribution-index table td.quantity-remaining .negative {
color: #DD4B39;
}
/* line 107, ../sass/distribution/_index.scss */
.distribution-index table td.quantity-remaining .infinite, .distribution-index table td.quantity-remaining .empty {
font-size: 18px;
}
/* line 113, ../sass/distribution/_index.scss */
.distribution-index #products td.quantities {
width: 100px;
text-align: right;
}
/* line 102, ../sass/distribution/_index.scss */
/* line 118, ../sass/distribution/_index.scss */
.distribution-index #products input.quantity-max {
width: 50px;
text-align: center;
display: inline;
}
/* line 110, ../sass/distribution/_index.scss */
/* line 126, ../sass/distribution/_index.scss */
.distribution-index #infos-top .col-md-4 {
padding: 0px;
}
/* line 116, ../sass/distribution/_index.scss */
/* line 132, ../sass/distribution/_index.scss */
.distribution-index #infos-top .info-box {
min-height: 96px;
height: 96px;
}
/* line 120, ../sass/distribution/_index.scss */
/* line 136, ../sass/distribution/_index.scss */
.distribution-index #infos-top .info-box .info-box-icon {
height: 96px;
width: 50px;
line-height: 96px;
}
/* line 125, ../sass/distribution/_index.scss */
/* line 141, ../sass/distribution/_index.scss */
.distribution-index #infos-top .info-box .info-box-icon i.fa {
font-size: 30px;
}
/* line 130, ../sass/distribution/_index.scss */
/* line 146, ../sass/distribution/_index.scss */
.distribution-index #infos-top .info-box .info-box-content {
margin-left: 55px;
}
/* line 133, ../sass/distribution/_index.scss */
/* line 149, ../sass/distribution/_index.scss */
.distribution-index #infos-top .info-box .info-box-content .info-box-text {
font-size: 12px;
}
/* line 136, ../sass/distribution/_index.scss */
/* line 152, ../sass/distribution/_index.scss */
.distribution-index #infos-top .info-box .info-box-content .info-box-text .btn {
font-size: 12px;
text-transform: uppercase;
}
/* line 142, ../sass/distribution/_index.scss */
/* line 158, ../sass/distribution/_index.scss */
.distribution-index #infos-top .info-box .info-box-content .info-box-number {
font-size: 14px;
}
/* line 149, ../sass/distribution/_index.scss */
/* line 165, ../sass/distribution/_index.scss */
.distribution-index #infos-top #info-box-distribution .btn-active-week {
float: right;
}
/* line 155, ../sass/distribution/_index.scss */
/* line 171, ../sass/distribution/_index.scss */
.distribution-index #infos-top #summary-ca-weight .normal {
font-weight: normal;
}
/* line 165, ../sass/distribution/_index.scss */
/* line 181, ../sass/distribution/_index.scss */
.distribution-index #modal-products table.table thead tr td {
font-weight: bold;
}
/* line 171, ../sass/distribution/_index.scss */
/* line 187, ../sass/distribution/_index.scss */
.distribution-index #modal-products table.table td.quantity-ordered,
.distribution-index #modal-products table.table td.quantity-max {
text-align: center;
}
/* line 176, ../sass/distribution/_index.scss */
/* line 192, ../sass/distribution/_index.scss */
.distribution-index #modal-products table.table td.quantity-ordered {
width: 50px;
}
/* line 180, ../sass/distribution/_index.scss */
/* line 196, ../sass/distribution/_index.scss */
.distribution-index #modal-products table.table td.quantity-max {
width: 120px;
}
/* line 183, ../sass/distribution/_index.scss */
/* line 199, ../sass/distribution/_index.scss */
.distribution-index #modal-products table.table td.quantity-max input {
text-align: center;
min-width: 50px;
}
/* line 188, ../sass/distribution/_index.scss */
/* line 204, ../sass/distribution/_index.scss */
.distribution-index #modal-products table.table td.quantity-max .limit-quantity-accessories {
margin-top: 7px;
font-size: 12px;
}
/* line 192, ../sass/distribution/_index.scss */
/* line 208, ../sass/distribution/_index.scss */
.distribution-index #modal-products table.table td.quantity-max .limit-quantity-accessories .quantity {
font-weight: bold;
}
/* line 200, ../sass/distribution/_index.scss */
/* line 216, ../sass/distribution/_index.scss */
.distribution-index #orders {
position: relative;
}
/* line 205, ../sass/distribution/_index.scss */
/* line 221, ../sass/distribution/_index.scss */
.distribution-index #orders .panel-heading .buttons .btn {
position: relative;
top: -19px;
float: right;
margin-left: 10px;
}
/* line 214, ../sass/distribution/_index.scss */
/* line 230, ../sass/distribution/_index.scss */
.distribution-index #orders #wrapper-nav-points-sale {
margin-bottom: 10px;
}
/* line 217, ../sass/distribution/_index.scss */
/* line 233, ../sass/distribution/_index.scss */
.distribution-index #orders #wrapper-nav-points-sale ul#nav-points-sale {
margin: 0px;
padding: 0px;
list-style-type: none;
}
/* line 222, ../sass/distribution/_index.scss */
/* line 238, ../sass/distribution/_index.scss */
.distribution-index #orders #wrapper-nav-points-sale ul#nav-points-sale li {
float: left;
margin-right: 10px;
margin-bottom: 10px;
}
/* line 228, ../sass/distribution/_index.scss */
/* line 244, ../sass/distribution/_index.scss */
.distribution-index #orders #wrapper-nav-points-sale ul#nav-points-sale li a .label {
background-color: white;
border: solid 1px #e0e0e0;
@@ -2521,7 +2537,7 @@ termes.
-webkit-border-radius: 10px;
border-radius: 10px;
}
/* line 239, ../sass/distribution/_index.scss */
/* line 255, ../sass/distribution/_index.scss */
.distribution-index #orders #buttons-top-orders {
background-color: #F5F5F5;
padding: 10px 20px;
@@ -2531,15 +2547,15 @@ termes.
border-radius: 5px;
margin-bottom: 20px;
}
/* line 250, ../sass/distribution/_index.scss */
/* line 266, ../sass/distribution/_index.scss */
.distribution-index #orders #buttons-top-orders .right {
float: right;
}
/* line 254, ../sass/distribution/_index.scss */
/* line 270, ../sass/distribution/_index.scss */
.distribution-index #orders #buttons-top-orders .dropdown {
display: inline-block;
}
/* line 259, ../sass/distribution/_index.scss */
/* line 275, ../sass/distribution/_index.scss */
.distribution-index #orders .point-sale-totals {
background-color: white;
padding: 10px 20px;
@@ -2549,30 +2565,30 @@ termes.
border-radius: 5px;
margin-bottom: 20px;
}
/* line 266, ../sass/distribution/_index.scss */
/* line 282, ../sass/distribution/_index.scss */
.distribution-index #orders .point-sale-totals .title {
color: gray;
font-size: 13px;
margin-right: 13px;
text-transform: uppercase;
}
/* line 276, ../sass/distribution/_index.scss */
/* line 292, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-user {
position: relative;
}
/* line 279, ../sass/distribution/_index.scss */
/* line 295, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-user:hover .shortcuts {
display: block;
}
/* line 283, ../sass/distribution/_index.scss */
/* line 299, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-user a {
color: #333;
}
/* line 286, ../sass/distribution/_index.scss */
/* line 302, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-user a:hover {
text-decoration: underline;
}
/* line 291, ../sass/distribution/_index.scss */
/* line 307, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-user .shortcuts {
display: none;
float: right;
@@ -2580,19 +2596,19 @@ termes.
top: 1px;
right: 1px;
}
/* line 299, ../sass/distribution/_index.scss */
/* line 315, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-user .user-trust-alert {
color: red;
}
/* line 304, ../sass/distribution/_index.scss */
/* line 320, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-delivery-note {
position: relative;
}
/* line 308, ../sass/distribution/_index.scss */
/* line 324, ../sass/distribution/_index.scss */
.distribution-index #orders table td.tiller {
width: 60px;
}
/* line 311, ../sass/distribution/_index.scss */
/* line 327, ../sass/distribution/_index.scss */
.distribution-index #orders table td.tiller label {
font-size: 12px;
cursor: pointer;
@@ -2600,88 +2616,88 @@ termes.
top: -2px;
font-weight: normal;
}
/* line 320, ../sass/distribution/_index.scss */
/* line 336, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions {
position: relative;
text-align: right;
}
/* line 324, ../sass/distribution/_index.scss */
/* line 340, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .wrapper-button-dropdown {
display: inline-block;
}
/* line 328, ../sass/distribution/_index.scss */
/* line 344, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .dropdown-menu {
left: -70px;
width: 227px;
}
/* line 333, ../sass/distribution/_index.scss */
/* line 349, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .modal-form-order,
.distribution-index #orders table td.column-actions .modal-payment {
text-align: left;
}
/* line 338, ../sass/distribution/_index.scss */
/* line 354, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .add-subscription {
position: relative;
}
/* line 341, ../sass/distribution/_index.scss */
/* line 357, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .add-subscription .glyphicon-plus {
position: absolute;
top: 4px;
right: 4px;
font-size: 7px;
}
/* line 350, ../sass/distribution/_index.scss */
/* line 366, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-state-payment {
width: 133px;
}
/* line 356, ../sass/distribution/_index.scss */
/* line 372, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-credit a.positive {
color: green;
}
/* line 359, ../sass/distribution/_index.scss */
/* line 375, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-credit a.negative {
color: red;
}
/* line 365, ../sass/distribution/_index.scss */
/* line 381, ../sass/distribution/_index.scss */
.distribution-index #orders table .state-payment-mobile {
display: none;
}
/* line 369, ../sass/distribution/_index.scss */
/* line 385, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-payment {
position: relative;
}
/* line 372, ../sass/distribution/_index.scss */
/* line 388, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-payment div.btn-group {
width: 125px;
}
/* line 378, ../sass/distribution/_index.scss */
/* line 394, ../sass/distribution/_index.scss */
.distribution-index #orders table tr.view ul {
list-style-type: none;
margin-left: 0px;
padding-left: 15px;
}
/* line 388, ../sass/distribution/_index.scss */
/* line 404, ../sass/distribution/_index.scss */
.distribution-index #orders table tr.view .comment {
margin-top: 20px;
}
/* line 392, ../sass/distribution/_index.scss */
/* line 408, ../sass/distribution/_index.scss */
.distribution-index #orders table tr.view .delivery {
margin-top: 20px;
}
/* line 401, ../sass/distribution/_index.scss */
/* line 417, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container {
width: 100%;
padding: 0px;
}
/* line 405, ../sass/distribution/_index.scss */
/* line 421, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-body {
padding-right: 15px;
}
/* line 408, ../sass/distribution/_index.scss */
/* line 424, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-body table {
margin-bottom: 150px;
}
/* line 413, ../sass/distribution/_index.scss */
/* line 429, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-footer {
border-top-color: #f4f4f4;
position: fixed;
@@ -2693,64 +2709,64 @@ termes.
text-align: center;
border-top: solid 1px #e0e0e0;
}
/* line 425, ../sass/distribution/_index.scss */
/* line 441, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-footer .actions-form button {
float: none;
}
/* line 429, ../sass/distribution/_index.scss */
/* line 445, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-footer .actions-form div.right {
float: right;
}
/* line 436, ../sass/distribution/_index.scss */
/* line 452, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .btn-credit {
float: right;
}
/* line 442, ../sass/distribution/_index.scss */
/* line 458, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products .product-ordered td {
background-color: #e9e9e9;
}
/* line 446, ../sass/distribution/_index.scss */
/* line 462, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products .product-ordered input.input-quantity {
font-size: 16px;
font-weight: bold;
}
/* line 452, ../sass/distribution/_index.scss */
/* line 468, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price {
width: 150px;
}
/* line 455, ../sass/distribution/_index.scss */
/* line 471, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price input {
text-align: center;
}
/* line 459, ../sass/distribution/_index.scss */
/* line 475, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price .input-group-addon {
background-color: #eee;
}
/* line 463, ../sass/distribution/_index.scss */
/* line 479, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price .invoice-price {
margin-top: 8px;
}
/* line 465, ../sass/distribution/_index.scss */
/* line 481, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price .invoice-price .label-invoice-price {
font-size: 11px;
font-weight: bold;
color: gray;
}
/* line 473, ../sass/distribution/_index.scss */
/* line 489, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity {
width: 165px;
}
/* line 476, ../sass/distribution/_index.scss */
/* line 492, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity input {
text-align: center;
color: black;
}
/* line 481, ../sass/distribution/_index.scss */
/* line 497, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity .form-control {
border-right: 0px none;
padding-right: 4px;
}
/* line 486, ../sass/distribution/_index.scss */
/* line 502, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity .input-group-addon {
padding: 5px;
padding-left: 0px;
@@ -2758,22 +2774,6 @@ termes.
border-left: 0px none;
border-right: 0px none;
}
/* line 495, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining {
text-align: right;
}
/* line 498, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.quantity-remaining, .distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite {
color: #00A65A;
}
/* line 502, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.negative {
color: #DD4B39;
}
/* line 506, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite, .distribution-index .modal-form-order table.table-products td.quantity-remaining.empty {
font-size: 18px;
}
/* line 513, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .actions-form button {
margin-left: 15px;

+ 14
- 5
backend/web/js/vuejs/distribution-index.js Wyświetl plik

@@ -294,6 +294,18 @@ if($(selector).length) {
}
});
},
getProductQuantityRemainingGlobal: function(product) {
var app = this;

var productQuantityRemaining = product.quantity_remaining;

// format
if (productQuantityRemaining && product.unit != 'piece') {
productQuantityRemaining = productQuantityRemaining.toFixed(2);
}

return productQuantityRemaining;
},
initCountActiveProducts: function () {
this.countActiveProducts = 0;
for (var i = 0; i < this.products.length; i++) {
@@ -377,11 +389,8 @@ if($(selector).length) {
return false;
},
isProductMaximumQuantityExceeded: function (product) {
return
this.getProductDistribution(product)
&& this.getProductDistribution(product).quantity_max
&& product.quantity_ordered
&& product.quantity_ordered > this.getProductDistribution(product).quantity_max;
return product.quantity_remaining
&& product.quantity_remaining < 0;
},
pointSaleActiveClick: function (event) {
var idPointSale = event.currentTarget.getAttribute('data-id-point-sale');

+ 16
- 16
backend/web/sass/distribution/_index.scss Wyświetl plik

@@ -93,6 +93,22 @@ termes.
}
}

table td.quantity-remaining {
text-align: right;

.has-quantity, .infinite {
color: #00A65A;
}

.negative {
color: #DD4B39;
}

.infinite, .empty {
font-size: 18px;
}
}

#products {
td.quantities {
width: 100px;
@@ -491,22 +507,6 @@ termes.
border-right: 0px none;
}
}

td.quantity-remaining {
text-align: right;

&.quantity-remaining, &.infinite {
color: #00A65A;
}

&.negative {
color: #DD4B39;
}

&.infinite, &.empty {
font-size: 18px;
}
}
}

.actions-form {

+ 3
- 3
domain/Product/Accessory/Accessory.php Wyświetl plik

@@ -20,7 +20,7 @@ class Accessory extends ActiveRecordCommon
public function rules()
{
return [
[['name', 'id_producer'], 'required'],
[['name', 'id_producer', 'quantity'], 'required'],
[['name'], 'string', 'max' => 255],
[['quantity', 'id_producer'], 'integer'],
[['selected_products_ids'], 'safe'],
@@ -65,12 +65,12 @@ class Accessory extends ActiveRecordCommon
return $this;
}

public function getQuantity(): ?int
public function getQuantity(): int
{
return $this->quantity;
}

public function setQuantity(?int $quantity): self
public function setQuantity(int $quantity): self
{
$this->quantity = $quantity;
return $this;

Ładowanie…
Anuluj
Zapisz