Browse Source

[backend] Génération de bons de livraison pour chaque utilisateur

refactoring
Guillaume 4 years ago
parent
commit
846a8dd59a
10 changed files with 248 additions and 58 deletions
  1. +111
    -0
      backend/controllers/DistributionController.php
  2. +13
    -15
      backend/views/distribution/index.php
  3. +2
    -2
      backend/views/document/_download_product_line.php
  4. +9
    -5
      backend/views/document/download.php
  5. +4
    -0
      backend/views/producer/update.php
  6. +37
    -33
      backend/web/css/screen.css
  7. +48
    -1
      backend/web/js/vuejs/distribution-index.js
  8. +4
    -0
      backend/web/sass/distribution/_index.scss
  9. +3
    -2
      common/models/Producer.php
  10. +17
    -0
      console/migrations/m200429_074111_producer_option_display_price_delivery_note.php

+ 111
- 0
backend/controllers/DistributionController.php View File



use backend\controllers\BackendController; use backend\controllers\BackendController;
use common\helpers\GlobalParam; use common\helpers\GlobalParam;
use common\models\DeliveryNote;
use common\models\Distribution; use common\models\Distribution;
use common\models\Document;
use common\models\Product; use common\models\Product;
use common\models\Producer; use common\models\Producer;
use common\models\Order; use common\models\Order;
return $return ; return $return ;
} }


public function actionAjaxValidateDeliveryNotes($idOrders)
{
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

if (strlen($idOrders)) {
$idOrders = json_decode($idOrders, true);

if (is_array($idOrders) && count($idOrders) > 0) {
foreach($idOrders as $idOrder) {
$order = Order::searchOne([
'id' => (int)$idOrder
]);

if($order && $order->distribution->id_producer == GlobalParam::getCurrentProducerId()) {
$deliveryNote = DeliveryNote::searchOne([
'id' => (int) $order->id_delivery_note
]) ;

if($deliveryNote && $deliveryNote->isStatusDraft()) {
$deliveryNote->changeStatus(Document::STATUS_VALID);
$deliveryNote->save();
}
}
}

return [
'return' => 'success',
'alert' => [
'type' => 'success',
'message' => 'Bon(s) de livraison validé(s)'
]
] ;
}
}

return [
'return' => 'error',
'alert' => [
'type' => 'danger',
'message' => 'Une erreur est survenue lors de la validation des bons de livraison'
]
];
}

public function actionAjaxGenerateDeliveryNoteEachUser($idOrders)
{
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

if (strlen($idOrders)) {
$idOrders = json_decode($idOrders, true);

if (is_array($idOrders) && count($idOrders) > 0) {

foreach ($idOrders as $idOrder) {
$order = Order::searchOne([
'id' => (int)$idOrder
]);

if($order && $order->distribution->id_producer == GlobalParam::getCurrentProducerId()) {

$deliveryNote = null ;
$idDeliveryNote = $order->id_delivery_note ;
if($idDeliveryNote) {
$deliveryNote = DeliveryNote::searchOne([
'id' => (int) $idDeliveryNote
]);
}

// on regénére le document si c'est un brouillon
if($deliveryNote && $deliveryNote->isStatusDraft()) {
$deliveryNote->delete() ;
$deliveryNote = null ;
}

if(!$deliveryNote) {
$deliveryNote = new DeliveryNote() ;
$deliveryNote->id_producer = GlobalParam::getCurrentProducerId();
$deliveryNote->id_user = $order->id_user;
$deliveryNote->name = 'Bon de livraison ' . $order->getUsername() . ' (' . date('d/m/Y', strtotime($order->distribution->date)) . ')';
$deliveryNote->address = $order->user->getFullAddress() ;
$deliveryNote->save();
}

if($deliveryNote) {
$order->id_delivery_note = $deliveryNote->id;
$order->save();
}
}
}
}

return [
'return' => 'success',
'alert' => [
'type' => 'success',
'message' => 'Bon(s) de livraison généré(s)'
]
] ;
}

return [
'return' => 'error',
'alert' => [
'type' => 'danger',
'message' => 'Une erreur est survenue lors de la génération du bon de livraison.'
]
];
}

public function actionAjaxGenerateDeliveryNote($idOrders) public function actionAjaxGenerateDeliveryNote($idOrders)
{ {
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

+ 13
- 15
backend/views/distribution/index.php View File



<div id="buttons-top-orders"> <div id="buttons-top-orders">
<div class="right"> <div class="right">
<a v-if="idActivePointSale > 0" @click="generateDeliveryNote" href="javascript:void(0);" class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-plus"></span>
<span v-if="deliveryNoteExist(idActivePointSale)">Regénérer le bon de livraison</span>
<span v-else>Générer un bon de livraison</span>
</a>
<div class="dropdown">
<button class="btn btn-default btn-xs dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span class="glyphicon glyphicon-file"></span> Documents
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li><a v-if="idActivePointSale > 0" @click="generateDeliveryNote" href="javascript:void(0);" >Générer un bon de livraison pour ce point de vente</a></li>
<li><a @click="generateDeliveryNoteEachUser" href="javascript:void(0);">Générer un bon de livraison pour chaque client</a></li>
<li><a @click="validateDeliveryNotes" href="javascript:void(0);">Valider les bons de livraisons</a></li>
</ul>
</div>
<button id="btn-add-subscriptions" @click="addSubscriptions" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span> Importer les abonnements</button> <button id="btn-add-subscriptions" @click="addSubscriptions" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span> Importer les abonnements</button>
<template v-if="producer.tiller == true"> <template v-if="producer.tiller == true">
<button v-if="tillerIsSynchro" id="btn-tiller" class="btn btn-success btn-xs" disabled><span class="glyphicon glyphicon-refresh"></span> Synchronisé avec Tiller</button> <button v-if="tillerIsSynchro" id="btn-tiller" class="btn btn-success btn-xs" disabled><span class="glyphicon glyphicon-refresh"></span> Synchronisé avec Tiller</button>
<button id="btn-add-order" @click="openModalFormOrderCreate" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-plus"></span> Ajouter une commande</button> <button id="btn-add-order" @click="openModalFormOrderCreate" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-plus"></span> Ajouter une commande</button>
</div> </div>
<div class="left"> <div class="left">
<a v-if="deliveryNoteExist(idActivePointSale)" :href="UrlManager.getBaseUrl()+'delivery-note/update?id='+deliveryNotes[idActivePointSale].id" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-file"></span> Bon de livraison</a>
<!--<div v-if="idActivePointSale > 0" class="btn-group">
<button type="button" class="btn btn-success btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Action groupée <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a @click="generateDeliveryNote" href="javascript:void(0);">Générer un bon de livraison</a></li>
</ul>
</div>-->
<a v-if="false && deliveryNoteExist(idActivePointSale)" :href="UrlManager.getBaseUrl()+'delivery-note/update?id='+deliveryNotes[idActivePointSale].id" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-file"></span> Bon de livraison</a>
</div> </div>
<div class="clr"></div> <div class="clr"></div>
</div> </div>
</td> </td>
<td class="column-delivery-note"> <td class="column-delivery-note">
<a v-if="order.id_delivery_note" class="btn btn-default btn-xs" :href="UrlManager.getBaseUrl()+'delivery-note/update?id='+order.id_delivery_note"> <a v-if="order.id_delivery_note" class="btn btn-default btn-xs" :href="UrlManager.getBaseUrl()+'delivery-note/update?id='+order.id_delivery_note">
<span class="glyphicon glyphicon-file"></span> BL
<span class="glyphicon glyphicon-file"></span> BL #{{ order.id_delivery_note }}
</a> </a>
</td> </td>
</tr> </tr>

+ 2
- 2
backend/views/document/_download_product_line.php View File

<br /><small><?= Html::encode($productOrder->product->description) ?></small> <br /><small><?= Html::encode($productOrder->product->description) ?></small>
<?php endif; ?> <?php endif; ?>
</td> </td>
<?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
<?php if($displayPrices): ?>
<td class="align-center"><?= Price::format($productOrder->getPrice()) ?></td> <td class="align-center"><?= Price::format($productOrder->getPrice()) ?></td>
<?php endif; ?> <?php endif; ?>
<td class="align-center"><?= $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'] ?></td> <td class="align-center"><?= $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'] ?></td>
<td class="align-center"><?= Product::strUnit($productOrder->unit, 'wording') ?></td> <td class="align-center"><?= Product::strUnit($productOrder->unit, 'wording') ?></td>
<?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
<?php if($displayPrices): ?>
<?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?> <?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?>
<td class="align-center"><?= $productOrder->taxRate->value * 100 ?> %</td> <td class="align-center"><?= $productOrder->taxRate->value * 100 ?> %</td>
<?php endif; ?> <?php endif; ?>

+ 9
- 5
backend/views/document/download.php View File

<?php <?php


$displayPrices = Yii::$app->controller->getClass() != 'DeliveryNote' || (Yii::$app->controller->getClass() == 'DeliveryNote' && Producer::getConfig('document_display_prices_delivery_note')) ;

?> ?>


<div class="document-download"> <div class="document-download">
<thead> <thead>
<tr> <tr>
<th class="align-left">Produit</th> <th class="align-left">Produit</th>
<?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
<?php if($displayPrices): ?>
<?php if(GlobalParam::getCurrentProducer()->taxRate->value == 0): ?> <?php if(GlobalParam::getCurrentProducer()->taxRate->value == 0): ?>
<th>Prix unitaire</th> <th>Prix unitaire</th>
<?php else: ?> <?php else: ?>
<?php endif; ?> <?php endif; ?>
<th>Quantité</th> <th>Quantité</th>
<th>Unité</th> <th>Unité</th>
<?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
<?php if($displayPrices): ?>
<?php if(GlobalParam::getCurrentProducer()->taxRate->value == 0): ?> <?php if(GlobalParam::getCurrentProducer()->taxRate->value == 0): ?>
<th>Prix</th> <th>Prix</th>
<?php else: ?> <?php else: ?>
<strong><?= Html::encode($order->getUsername()) ; ?></strong> <strong><?= Html::encode($order->getUsername()) ; ?></strong>
le <?= date('d/m/Y', strtotime($order->date)) ?> le <?= date('d/m/Y', strtotime($order->date)) ?>
</td> </td>
<?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
<?php if($displayPrices): ?>
<td class="align-center"></td> <td class="align-center"></td>
<?php endif; ?> <?php endif; ?>
<td></td> <td></td>
<td></td> <td></td>
<?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
<?php if($displayPrices): ?>
<?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?> <?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?>
<td class="align-center"></td> <td class="align-center"></td>
<?php endif; ?> <?php endif; ?>
<?= $this->render('_download_product_line', [ <?= $this->render('_download_product_line', [
'productOrder' => $productOrder, 'productOrder' => $productOrder,
'displayOrders' => true, 'displayOrders' => true,
'displayPrices' => $displayPrices
]) ?> ]) ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php foreach($product as $productOrder): ?> <?php foreach($product as $productOrder): ?>
<?= $this->render('_download_product_line', [ <?= $this->render('_download_product_line', [
'productOrder' => $productOrder, 'productOrder' => $productOrder,
'displayPrices' => $displayPrices
]) ?> ]) ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>
<?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
<?php if($displayPrices): ?>
<?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?> <?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?>
<tr> <tr>
<td class="align-right" colspan="5"><strong>Total HT</strong></td> <td class="align-right" colspan="5"><strong>Total HT</strong></td>

+ 4
- 0
backend/views/producer/update.php View File

0 => 'Non', 0 => 'Non',
1 => 'Oui' 1 => 'Oui'
]) ; ?> ]) ; ?>
<?= $form->field($model, 'document_display_prices_delivery_note')->dropDownList([
0 => 'Non',
1 => 'Oui'
]) ; ?>
<?= $form->field($model, 'document_infos_bottom') <?= $form->field($model, 'document_infos_bottom')
->textarea(['rows' => 15]) ?> ->textarea(['rows' => 15]) ?>
<?= $form->field($model, 'document_infos_quotation') <?= $form->field($model, 'document_infos_quotation')

+ 37
- 33
backend/web/css/screen.css View File

.distribution-index #orders #buttons-top-orders .right { .distribution-index #orders #buttons-top-orders .right {
float: right; float: right;
} }
/* line 237, ../sass/distribution/_index.scss */
/* line 234, ../sass/distribution/_index.scss */
.distribution-index #orders #buttons-top-orders .dropdown {
display: inline-block;
}
/* line 241, ../sass/distribution/_index.scss */
.distribution-index #orders table td.tiller { .distribution-index #orders table td.tiller {
width: 60px; width: 60px;
} }
/* line 240, ../sass/distribution/_index.scss */
/* line 244, ../sass/distribution/_index.scss */
.distribution-index #orders table td.tiller label { .distribution-index #orders table td.tiller label {
font-size: 12px; font-size: 12px;
cursor: pointer; cursor: pointer;
top: -2px; top: -2px;
font-weight: normal; font-weight: normal;
} }
/* line 249, ../sass/distribution/_index.scss */
/* line 253, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions { .distribution-index #orders table td.column-actions {
position: relative; position: relative;
text-align: right; text-align: right;
} }
/* line 253, ../sass/distribution/_index.scss */
/* line 257, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .dropdown-menu { .distribution-index #orders table td.column-actions .dropdown-menu {
top: 0px; top: 0px;
right: 0px; right: 0px;
} }
/* line 258, ../sass/distribution/_index.scss */
/* line 262, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .modal-form-order, .distribution-index #orders table td.column-actions .modal-form-order,
.distribution-index #orders table td.column-actions .modal-payment { .distribution-index #orders table td.column-actions .modal-payment {
text-align: left; text-align: left;
} }
/* line 263, ../sass/distribution/_index.scss */
/* line 267, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .add-subscription { .distribution-index #orders table td.column-actions .add-subscription {
position: relative; position: relative;
} }
/* line 266, ../sass/distribution/_index.scss */
/* line 270, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .add-subscription .glyphicon-plus { .distribution-index #orders table td.column-actions .add-subscription .glyphicon-plus {
position: absolute; position: absolute;
top: 4px; top: 4px;
right: 4px; right: 4px;
font-size: 7px; font-size: 7px;
} }
/* line 275, ../sass/distribution/_index.scss */
/* line 279, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-state-payment { .distribution-index #orders table td.column-state-payment {
width: 120px; width: 120px;
} }
/* line 280, ../sass/distribution/_index.scss */
/* line 284, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-payment div.btn-group { .distribution-index #orders table td.column-payment div.btn-group {
width: 125px; width: 125px;
} }
/* line 286, ../sass/distribution/_index.scss */
/* line 290, ../sass/distribution/_index.scss */
.distribution-index #orders table tr.view ul { .distribution-index #orders table tr.view ul {
list-style-type: none; list-style-type: none;
margin-left: 0px; margin-left: 0px;
padding-left: 15px; padding-left: 15px;
} }
/* line 296, ../sass/distribution/_index.scss */
/* line 300, ../sass/distribution/_index.scss */
.distribution-index #orders table tr.view .comment { .distribution-index #orders table tr.view .comment {
margin-top: 20px; margin-top: 20px;
} }
/* line 305, ../sass/distribution/_index.scss */
/* line 309, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container { .distribution-index .modal-form-order .modal-container {
width: 100%; width: 100%;
padding: 0px; padding: 0px;
} }
/* line 309, ../sass/distribution/_index.scss */
/* line 313, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-body { .distribution-index .modal-form-order .modal-container .modal-body {
padding-right: 15px; padding-right: 15px;
} }
/* line 311, ../sass/distribution/_index.scss */
/* line 315, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-body table { .distribution-index .modal-form-order .modal-container .modal-body table {
margin-bottom: 150px; margin-bottom: 150px;
} }
/* line 316, ../sass/distribution/_index.scss */
/* line 320, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-footer { .distribution-index .modal-form-order .modal-container .modal-footer {
border-top-color: #f4f4f4; border-top-color: #f4f4f4;
position: fixed; position: fixed;
text-align: center; text-align: center;
border-top: solid 1px #e0e0e0; border-top: solid 1px #e0e0e0;
} }
/* line 328, ../sass/distribution/_index.scss */
/* line 332, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-footer .actions-form button { .distribution-index .modal-form-order .modal-container .modal-footer .actions-form button {
float: none; float: none;
} }
/* line 335, ../sass/distribution/_index.scss */
/* line 339, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .btn-credit { .distribution-index .modal-form-order .btn-credit {
float: right; float: right;
} }
/* line 341, ../sass/distribution/_index.scss */
/* line 345, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products .product-ordered td { .distribution-index .modal-form-order table.table-products .product-ordered td {
background-color: #e9e9e9; background-color: #e9e9e9;
} }
/* line 345, ../sass/distribution/_index.scss */
/* line 349, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products .product-ordered input { .distribution-index .modal-form-order table.table-products .product-ordered input {
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: bold;
} }
/* line 351, ../sass/distribution/_index.scss */
/* line 355, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price { .distribution-index .modal-form-order table.table-products td.price {
width: 150px; width: 150px;
} }
/* line 353, ../sass/distribution/_index.scss */
/* line 357, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price input { .distribution-index .modal-form-order table.table-products td.price input {
text-align: center; text-align: center;
} }
/* line 358, ../sass/distribution/_index.scss */
/* line 362, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity { .distribution-index .modal-form-order table.table-products td.quantity {
width: 165px; width: 165px;
} }
/* line 361, ../sass/distribution/_index.scss */
/* line 365, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity input { .distribution-index .modal-form-order table.table-products td.quantity input {
text-align: center; text-align: center;
color: black; color: black;
} }
/* line 366, ../sass/distribution/_index.scss */
/* line 370, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity .form-control { .distribution-index .modal-form-order table.table-products td.quantity .form-control {
border-right: 0px none; border-right: 0px none;
padding-right: 4px; padding-right: 4px;
} }
/* line 371, ../sass/distribution/_index.scss */
/* line 375, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity .input-group-addon { .distribution-index .modal-form-order table.table-products td.quantity .input-group-addon {
padding: 5px; padding: 5px;
padding-left: 0px; padding-left: 0px;
border-left: 0px none; border-left: 0px none;
border-right: 0px none; border-right: 0px none;
} }
/* line 380, ../sass/distribution/_index.scss */
/* line 384, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining { .distribution-index .modal-form-order table.table-products td.quantity-remaining {
text-align: right; text-align: right;
} }
/* line 383, ../sass/distribution/_index.scss */
/* line 387, ../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 { .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; color: #00A65A;
} }
/* line 387, ../sass/distribution/_index.scss */
/* line 391, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.negative { .distribution-index .modal-form-order table.table-products td.quantity-remaining.negative {
color: #DD4B39; color: #DD4B39;
} }
/* line 391, ../sass/distribution/_index.scss */
/* line 395, ../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 { .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; font-size: 18px;
} }
/* line 398, ../sass/distribution/_index.scss */
/* line 402, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .actions-form button { .distribution-index .modal-form-order .actions-form button {
margin-left: 15px; margin-left: 15px;
} }
/* line 406, ../sass/distribution/_index.scss */
/* line 410, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon { .distribution-index .modal-payment .info-box .info-box-icon {
width: 50px; width: 50px;
} }
/* line 409, ../sass/distribution/_index.scss */
/* line 413, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon i { .distribution-index .modal-payment .info-box .info-box-icon i {
font-size: 30px; font-size: 30px;
} }
/* line 414, ../sass/distribution/_index.scss */
/* line 418, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-content { .distribution-index .modal-payment .info-box .info-box-content {
margin-left: 50px; margin-left: 50px;
} }

+ 48
- 1
backend/web/js/vuejs/distribution-index.js View File

return false ; return false ;
}, },
generateDeliveryNote: function() { generateDeliveryNote: function() {

if(!this.oneOrderSelected()) { if(!this.oneOrderSelected()) {
this.selectAllOrders(true) ; this.selectAllOrders(true) ;
} }
else { else {
appAlerts.alert('danger','Veuillez sélectionner au moins une commande pour générer un bon de livraison') ; appAlerts.alert('danger','Veuillez sélectionner au moins une commande pour générer un bon de livraison') ;
} }
},
generateDeliveryNoteEachUser: function() {
if(!this.oneOrderSelected()) {
this.selectAllOrders(true) ;
}


if(this.oneOrderSelected()) {
var app = this ;
var idOrders = {} ;
for(var key in this.orders) {
if(this.orders[key].selected == true) {
idOrders[key] = this.orders[key].id ;
}
}
axios.get(UrlManager.getBaseUrlAbsolute()+"distribution/ajax-generate-delivery-note-each-user",{params: {
idOrders: JSON.stringify(idOrders)
}})
.then(function(response) {
appAlerts.alertResponse(response) ;
app.init(app.idActivePointSale) ;
}) ;
}
else {
appAlerts.alert('danger','Veuillez sélectionner au moins une commande pour générer un bon de livraison') ;
}
},
validateDeliveryNotes: function() {
if(!this.oneOrderSelected()) {
this.selectAllOrders(true) ;
}
if(this.oneOrderSelected()) {
var app = this ;
var idOrders = {} ;
for(var key in this.orders) {
if(this.orders[key].selected == true) {
idOrders[key] = this.orders[key].id ;
}
}
axios.get(UrlManager.getBaseUrlAbsolute()+"distribution/ajax-validate-delivery-notes",{params: {
idOrders: JSON.stringify(idOrders)
}})
.then(function(response) {
appAlerts.alertResponse(response) ;
app.init(app.idActivePointSale) ;
}) ;
}
else {
appAlerts.alert('danger','Veuillez sélectionner au moins une commande pour valider un bon de livraison') ;
}
}, },
deliveryNoteExist: function(idPointSale) { deliveryNoteExist: function(idPointSale) {
return typeof this.deliveryNotes[this.idActivePointSale] != 'undefined' ; return typeof this.deliveryNotes[this.idActivePointSale] != 'undefined' ;

+ 4
- 0
backend/web/sass/distribution/_index.scss View File

.right { .right {
float: right; float: right;
} }

.dropdown {
display: inline-block ;
}
} }


table { table {

+ 3
- 2
common/models/Producer.php View File

}], }],
[['description', 'mentions', 'gcs', 'order_infos', 'slug', 'secret_key_payplug', 'background_color_logo', 'option_behavior_cancel_order', 'tiller_provider_token', 'tiller_restaurant_token', 'status', [['description', 'mentions', 'gcs', 'order_infos', 'slug', 'secret_key_payplug', 'background_color_logo', 'option_behavior_cancel_order', 'tiller_provider_token', 'tiller_restaurant_token', 'status',
'document_infos_bottom', 'document_infos_quotation', 'document_infos_invoice', 'document_infos_delivery_note', 'address'], 'string'], 'document_infos_bottom', 'document_infos_quotation', 'document_infos_invoice', 'document_infos_delivery_note', 'address'], 'string'],
[['negative_balance', 'credit', 'active', 'online_payment', 'user_manage_subscription', 'option_allow_user_gift', 'use_credit_checked_default', 'tiller', 'document_display_orders_invoice', 'document_display_orders_delivery_note'], 'boolean'],
[['negative_balance', 'credit', 'active', 'online_payment', 'user_manage_subscription', 'option_allow_user_gift', 'use_credit_checked_default', 'tiller', 'document_display_orders_invoice', 'document_display_orders_delivery_note', 'document_display_prices_delivery_note'], 'boolean'],
[['name', 'siret', 'logo', 'photo', 'postcode', 'city', 'code', 'type', 'credit_functioning', 'option_behavior_cancel_order', 'document_quotation_prefix', 'document_quotation_first_reference', 'document_invoice_prefix', 'document_invoice_first_reference', 'document_delivery_note_prefix', 'document_delivery_note_first_reference'], 'string', 'max' => 255], [['name', 'siret', 'logo', 'photo', 'postcode', 'city', 'code', 'type', 'credit_functioning', 'option_behavior_cancel_order', 'document_quotation_prefix', 'document_quotation_first_reference', 'document_invoice_prefix', 'document_invoice_first_reference', 'document_delivery_note_prefix', 'document_delivery_note_first_reference'], 'string', 'max' => 255],
[['free_price', 'credit_limit_reminder', 'credit_limit'], 'double'], [['free_price', 'credit_limit_reminder', 'credit_limit'], 'double'],
['free_price', 'compare', 'compareValue' => 0, 'operator' => '>=', 'type' => 'number', 'message' => 'Prix libre doit être supérieur ou égal à 0'], ['free_price', 'compare', 'compareValue' => 0, 'operator' => '>=', 'type' => 'number', 'message' => 'Prix libre doit être supérieur ou égal à 0'],
'document_infos_delivery_note' => 'Informations affichées en bas des bons de livraison', 'document_infos_delivery_note' => 'Informations affichées en bas des bons de livraison',
'address' => 'Adresse', 'address' => 'Adresse',
'document_display_orders_invoice' => 'Afficher le détail des commandes dans les factures', 'document_display_orders_invoice' => 'Afficher le détail des commandes dans les factures',
'document_display_orders_delivery_note' => 'Afficher le détail des commandes dans les bons de commande',
'document_display_orders_delivery_note' => 'Afficher le détail des commandes dans les bons de livraison',
'document_display_prices_delivery_note' => 'Afficher le chiffrage dans les bons de livraison',
]; ];
} }



+ 17
- 0
console/migrations/m200429_074111_producer_option_display_price_delivery_note.php View File

<?php

use yii\db\Migration;
use yii\db\Schema;

class m200429_074111_producer_option_display_price_delivery_note extends Migration
{
public function safeUp()
{
$this->addColumn('producer', 'document_display_prices_delivery_note', Schema::TYPE_BOOLEAN) ;
}

public function safeDown()
{
$this->dropColumn('producer', 'document_display_prices_delivery_note') ;
}
}

Loading…
Cancel
Save