Browse Source

Commandes : système de statut de commande

feature/rotating_product
Guillaume Bourgeois 5 months ago
parent
commit
262f14eeb9
21 changed files with 335 additions and 174 deletions
  1. +4
    -5
      backend/controllers/DistributionController.php
  2. +1
    -1
      backend/controllers/SubscriptionController.php
  3. +11
    -11
      backend/views/distribution/index.php
  4. +1
    -1
      backend/views/producer/update.php
  5. +37
    -2
      backend/views/user/orders.php
  6. +119
    -95
      backend/web/css/screen.css
  7. +27
    -0
      backend/web/sass/_adminlte.scss
  8. +1
    -1
      console/commands/ClosingOrdersController.php
  9. +30
    -0
      console/migrations/m240528_072445_init_order_status_history.php
  10. +3
    -0
      domain/Distribution/Distribution/DistributionBuilder.php
  11. +2
    -0
      domain/Distribution/Distribution/Event/DistributionActiveEvent.php
  12. +0
    -1
      domain/Order/Order/OrderBuilder.php
  13. +50
    -1
      domain/Order/Order/OrderManager.php
  14. +9
    -0
      domain/Order/Order/OrderRepository.php
  15. +8
    -0
      domain/Order/Order/OrderRepositoryQuery.php
  16. +12
    -0
      domain/Order/Order/OrderSolver.php
  17. +3
    -2
      domain/Subscription/Subscription/Event/DistributionObserver.php
  18. +0
    -48
      domain/Subscription/Subscription/OrderManager.php
  19. +12
    -0
      domain/User/User/UserRepository.php
  20. +1
    -2
      producer/views/order/_form.php
  21. +4
    -4
      producer/views/order/history.php

+ 4
- 5
backend/controllers/DistributionController.php View File

$productOrderModule = $this->getProductOrderModule(); $productOrderModule = $this->getProductOrderModule();
$userProducerModule = $this->getUserProducerModule(); $userProducerModule = $this->getUserProducerModule();




if ($ordersArray) { if ($ordersArray) {
foreach ($ordersArray as &$order) { foreach ($ordersArray as &$order) {


'isCreditFunctioningMandatory' => $orderModule->getRepository()->isOrderCreditFunctioningMandatory($order), 'isCreditFunctioningMandatory' => $orderModule->getRepository()->isOrderCreditFunctioningMandatory($order),
'isCreditFunctioningUser' => $orderModule->getRepository()->isOrderCreditFunctioningUser($order), 'isCreditFunctioningUser' => $orderModule->getRepository()->isOrderCreditFunctioningUser($order),
'debitCredit' => false, 'debitCredit' => false,
'deliveryNote' => $order->deliveryNote ? $order->deliveryNote->getAttributes() : null
'deliveryNote' => $order->deliveryNote ? $order->deliveryNote->getAttributes() : null,
'labelDeleteAction' => $orderModule->getSolver()->getLabelDeleteAction($order)
]); ]);
} }
} }
*/ */
public function actionAjaxProcessAddSubscriptions(string $date) public function actionAjaxProcessAddSubscriptions(string $date)
{ {
$ordersArray = $this->getSubscriptionModule()->getOrderManager()
->createAllOrdersFromSubscriptions($date, true);
$ordersArray = $this->getOrderModule()->getManager()
->createAllOrdersFromSubscriptions($date, $this->getUserCurrent(), true);


if($ordersArray && count($ordersArray)) { if($ordersArray && count($ordersArray)) {
return Ajax::responseSuccess('Les abonnements ont bien été importés.'); return Ajax::responseSuccess('Les abonnements ont bien été importés.');

+ 1
- 1
backend/controllers/SubscriptionController.php View File

->deleteOrdersIncomingDistributionsFromSubscription($subscription, $this->getUserCurrent()); ->deleteOrdersIncomingDistributionsFromSubscription($subscription, $this->getUserCurrent());
} }
foreach ($matchedDistributionsArray as $distribution) { foreach ($matchedDistributionsArray as $distribution) {
$subscriptionModule->createOrderFromSubscription($subscription, $distribution->date);
$subscriptionModule->createOrderFromSubscription($subscription, $distribution->date, $this->getUserCurrent());
} }
$this->setFlash('success', 'Commandes ' . ($update ? 're-' : '') . 'générées dans les distributions futures.'); $this->setFlash('success', 'Commandes ' . ($update ? 're-' : '') . 'générées dans les distributions futures.');
return $this->redirect(['subscription/index']); return $this->redirect(['subscription/index']);

+ 11
- 11
backend/views/distribution/index.php View File

<th class="column-checkbox" v-if="idActivePointSale > 0"> <th class="column-checkbox" v-if="idActivePointSale > 0">
<input type="checkbox" v-model="checkboxSelectAllOrders" @change="selectAllOrdersEvent" /> <input type="checkbox" v-model="checkboxSelectAllOrders" @change="selectAllOrdersEvent" />
</th> </th>
<th class="column-state">Statut</th>
<th class="column-origin">Origine</th> <th class="column-origin">Origine</th>
<th class="column-state">État</th>
<th class="column-user">Utilisateur</th> <th class="column-user">Utilisateur</th>
<th class="column-point-sale" v-if="idActivePointSale == 0">Point de vente</th> <th class="column-point-sale" v-if="idActivePointSale == 0">Point de vente</th>
<th class="column-amount">Montant</th> <th class="column-amount">Montant</th>
<td class="column-checkbox" v-if="idActivePointSale > 0"> <td class="column-checkbox" v-if="idActivePointSale > 0">
<input type="checkbox" v-model="order.selected" /> <input type="checkbox" v-model="order.selected" />
</td> </td>
<td class="column-origin">
<label class="label label-success" v-if="order.origin == 'user'">client</label>
<label class="label label-default" v-else-if="order.origin == 'auto'">auto</label>
<label class="label label-warning" v-else>admin</label>
</td>
<td class="column-state"> <td class="column-state">
<span class="label label-danger" v-if="order.date_delete"><span class="glyphicon glyphicon-trash"></span></span>
<span class="label label-warning" v-if="order.date_update"><span class="glyphicon glyphicon-pencil"></span></span>
<span class="label label-success" v-if="!order.date_update && !order.date_delete"><span class="glyphicon glyphicon-check"></span></span>
<span class="label label-danger" v-if="order.order_status_alias == 'canceled'"><span class="glyphicon glyphicon-trash"></span></span>
<span class="label label-warning" v-if="order.order_status_alias == 'ordered' && order.date_update"><span class="glyphicon glyphicon-pencil"></span></span>
<span class="label label-success" v-if="order.order_status_alias == 'ordered' && !order.date_update"><span class="glyphicon glyphicon-check"></span></span>
</td>
<td class="column-origin">
<label class="label label-success outline" v-if="order.origin == 'user'">Utilisateur</label>
<label class="label label-default outline" v-else-if="order.origin == 'auto'">Abonnement</label>
<label class="label label-warning outline" v-else>Producteur</label>
</td> </td>
<td class="column-user"> <td class="column-user">
<a v-if="order.user" :href="baseUrl+'/user/view?id='+order.id_user" target="_blank" :class="order.user.trust_alert ? 'user-trust-alert' : ''" :title="order.user.trust_alert ? order.user.trust_alert_comment : ''"> <a v-if="order.user" :href="baseUrl+'/user/view?id='+order.id_user" target="_blank" :class="order.user.trust_alert ? 'user-trust-alert' : ''" :title="order.user.trust_alert ? order.user.trust_alert_comment : ''">
</div> </div>
</td> </td>
<td class="column-state-payment"> <td class="column-state-payment">
<template v-if="!order.date_delete">
<template v-if="order.order_status_alias == 'ordered'">
<a href="javascript:void(0);" @click="orderPaymentModalClick" :data-id-order="order.id"> <a href="javascript:void(0);" @click="orderPaymentModalClick" :data-id-order="order.id">
<order-state-payment :order="order" :producer="producer"></order-state-payment> <order-state-payment :order="order" :producer="producer"></order-state-payment>
</a> </a>
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="javascript:void(0);" class="" :data-id-order="order.id" @click="deleteOrderClick"><span class="glyphicon glyphicon-trash"></span> Supprimer</a></li>
<li><a href="javascript:void(0);" class="" :data-id-order="order.id" @click="deleteOrderClick"><span class="glyphicon glyphicon-trash"></span> {{ order.labelDeleteAction }}</a></li>
<li v-if="order.id_subscription > 0"><a class="" :href="baseUrl+'/subscription/update?id='+order.id_subscription"><span class="glyphicon glyphicon-repeat"></span> Modifier l'abonnement lié</a></li> <li v-if="order.id_subscription > 0"><a class="" :href="baseUrl+'/subscription/update?id='+order.id_subscription"><span class="glyphicon glyphicon-repeat"></span> Modifier l'abonnement lié</a></li>
<li v-else><a class="add-subscription" :href="baseUrl+'/subscription/create?idOrder='+order.id"><span class="glyphicon glyphicon-plus"></span><span class="glyphicon glyphicon-repeat"></span>Créer un abonnement</a></li> <li v-else><a class="add-subscription" :href="baseUrl+'/subscription/create?idOrder='+order.id"><span class="glyphicon glyphicon-plus"></span><span class="glyphicon glyphicon-repeat"></span>Créer un abonnement</a></li>
</ul> </ul>

+ 1
- 1
backend/views/producer/update.php View File

<?= $form->field($model, 'option_behavior_cancel_order') <?= $form->field($model, 'option_behavior_cancel_order')
->dropDownList([ ->dropDownList([
Producer::BEHAVIOR_DELETE_ORDER_DELETE => 'Suppression de la commande', Producer::BEHAVIOR_DELETE_ORDER_DELETE => 'Suppression de la commande',
Producer::BEHAVIOR_DELETE_ORDER_STATUS => 'Passage de la commande en statut "supprimé"',
Producer::BEHAVIOR_DELETE_ORDER_STATUS => 'Passage de la commande en statut "annulée"',
], []); ?> ], []); ?>
</div> </div>
</div> </div>

+ 37
- 2
backend/views/user/orders.php View File

//'filterModel' => $searchModel, //'filterModel' => $searchModel,
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'columns' => [ 'columns' => [
[
'label' => 'Statut',
'format' => 'raw',
'value' => function ($order) use ($orderModule) {
if($orderModule->getSolver()->isOrderStatusOrdered($order)) {
if($order->date_update) {
return '<span class="label label-warning">Modifiée</span>';
}
else {
return '<span class="label label-success">Validée</span>';
}
}
elseif($orderModule->getSolver()->isOrderStatusCanceled($order)) {
return '<span class="label label-danger">Annulée</span>';
}
elseif($orderModule->getSolver()->isOrderStatusDeleted($order)) {
return '<span class="label label-danger">Supprimée</span>';
}
}
],
[
'label' => 'Origine',
'format' => 'raw',
'value' => function ($order) {
if($order->origin == 'user') {
return '<span class="label label-success outline">Utilisateur</span>';
}
elseif($order->origin == 'auto') {
return '<span class="label label-default outline">Abonnement</span>';
}
else {
return '<span class="label label-warning outline">Producteur</span>';
}
}
],
[ [
'attribute' => 'distribution.date', 'attribute' => 'distribution.date',
'label' => 'Date', 'label' => 'Date',
'value' => function ($user) {
return date('d/m/Y',strtotime($user->distribution->date));
'value' => function ($order) {
return date('d/m/Y',strtotime($order->distribution->date));
} }
], ],
[ [

+ 119
- 95
backend/web/css/screen.css View File

font-size: 11px; font-size: 11px;
padding: 0px 7px; padding: 0px 7px;
} }
/* line 11, ../sass/_adminlte.scss */
/* line 12, ../sass/_adminlte.scss */
body.skin-black .label.outline {
background-color: white !important;
}
/* line 16, ../sass/_adminlte.scss */
body.skin-black .label.label-default.outline {
color: #444 !important;
border: solid 1px #444;
}
/* line 21, ../sass/_adminlte.scss */
body.skin-black .label.label-success.outline {
color: #00a65a !important;
border: solid 1px #00a65a;
}
/* line 26, ../sass/_adminlte.scss */
body.skin-black .label.label-warning.outline {
color: #f39c12 !important;
border: solid 1px #f39c12;
}
/* line 31, ../sass/_adminlte.scss */
body.skin-black .label.label-danger.outline {
color: #dd4b39 !important;
border: solid 1px #dd4b39;
}
/* line 38, ../sass/_adminlte.scss */
body.skin-black .ui-tooltip { body.skin-black .ui-tooltip {
white-space: pre-wrap; white-space: pre-wrap;
} }
/* line 16, ../sass/_adminlte.scss */
/* line 43, ../sass/_adminlte.scss */
body.skin-black .user-without-account { body.skin-black .user-without-account {
color: gray; color: gray;
font-style: italic; font-style: italic;
} }
/* line 22, ../sass/_adminlte.scss */
/* line 49, ../sass/_adminlte.scss */
body.skin-black .main-header .logo { body.skin-black .main-header .logo {
background-color: white; background-color: white;
font-family: 'highvoltageregular'; font-family: 'highvoltageregular';
font-size: 23px; font-size: 23px;
position: relative; position: relative;
} }
/* line 28, ../sass/_adminlte.scss */
/* line 55, ../sass/_adminlte.scss */
body.skin-black .main-header .logo:hover, body.skin-black .main-header .logo:focus { body.skin-black .main-header .logo:hover, body.skin-black .main-header .logo:focus {
background-color: white; background-color: white;
text-decoration: none; text-decoration: none;
} }
/* line 33, ../sass/_adminlte.scss */
/* line 60, ../sass/_adminlte.scss */
body.skin-black .main-header .logo img { body.skin-black .main-header .logo img {
position: relative; position: relative;
max-width: 300px; max-width: 300px;
max-height: 300px; max-height: 300px;
height: auto; height: auto;
} }
/* line 41, ../sass/_adminlte.scss */
/* line 68, ../sass/_adminlte.scss */
body.skin-black .main-header .logo .logo-lg img { body.skin-black .main-header .logo .logo-lg img {
width: 90px; width: 90px;
top: -2px; top: -2px;
} }
/* line 47, ../sass/_adminlte.scss */
/* line 74, ../sass/_adminlte.scss */
body.skin-black .main-header .logo .logo-mini img { body.skin-black .main-header .logo .logo-mini img {
width: 50px; width: 50px;
} }
/* line 52, ../sass/_adminlte.scss */
/* line 79, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar { body.skin-black .main-header .navbar {
display: block; display: block;
background-color: white; background-color: white;
padding: 0px; padding: 0px;
} }
/* line 57, ../sass/_adminlte.scss */
/* line 84, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .producer-panel { body.skin-black .main-header .navbar .producer-panel {
position: relative; position: relative;
float: left; float: left;
padding-left: 50px; padding-left: 50px;
margin-left: 7px; margin-left: 7px;
} }
/* line 64, ../sass/_adminlte.scss */
/* line 91, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .producer-panel.without-logo { body.skin-black .main-header .navbar .producer-panel.without-logo {
padding-left: 10px; padding-left: 10px;
} }
/* line 68, ../sass/_adminlte.scss */
/* line 95, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .producer-panel .logo { body.skin-black .main-header .navbar .producer-panel .logo {
position: absolute; position: absolute;
top: 5px; top: 5px;
text-align: center; text-align: center;
overflow: hidden; overflow: hidden;
} }
/* line 80, ../sass/_adminlte.scss */
/* line 107, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .producer-panel .logo .img-logo { body.skin-black .main-header .navbar .producer-panel .logo .img-logo {
position: absolute; position: absolute;
top: 50%; top: 50%;
max-width: 35px; max-width: 35px;
max-height: 35px; max-height: 35px;
} }
/* line 90, ../sass/_adminlte.scss */
/* line 117, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .producer-panel .title { body.skin-black .main-header .navbar .producer-panel .title {
position: relative; position: relative;
top: 2px; top: 2px;
text-transform: uppercase; text-transform: uppercase;
} }
/* line 95, ../sass/_adminlte.scss */
/* line 122, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .producer-panel .title a { body.skin-black .main-header .navbar .producer-panel .title a {
color: #333; color: #333;
} }
/* line 98, ../sass/_adminlte.scss */
/* line 125, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .producer-panel .title a:hover { body.skin-black .main-header .navbar .producer-panel .title a:hover {
text-decoration: underline; text-decoration: underline;
} }
/* line 103, ../sass/_adminlte.scss */
/* line 130, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .producer-panel .title .producer-id { body.skin-black .main-header .navbar .producer-panel .title .producer-id {
color: gray; color: gray;
font-size: 13px; font-size: 13px;
} }
/* line 110, ../sass/_adminlte.scss */
/* line 137, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .sidebar-toggle { body.skin-black .main-header .navbar .sidebar-toggle {
color: #333; color: #333;
} }
/* line 114, ../sass/_adminlte.scss */
/* line 141, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .link-support { body.skin-black .main-header .navbar .link-support {
float: left; float: left;
padding: 15px 15px; padding: 15px 15px;
border-right: solid 1px #e0e0e0; border-right: solid 1px #e0e0e0;
color: #333; color: #333;
} }
/* line 120, ../sass/_adminlte.scss */
/* line 147, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .link-support:hover { body.skin-black .main-header .navbar .link-support:hover {
text-decoration: none; text-decoration: none;
color: #F39C12; color: #F39C12;
} }
/* line 126, ../sass/_adminlte.scss */
/* line 153, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .navbar-custom-menu .nav { body.skin-black .main-header .navbar .navbar-custom-menu .nav {
display: block; display: block;
} }
/* line 130, ../sass/_adminlte.scss */
/* line 157, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .navbar-custom-menu .navbar-nav > li > a, body.skin-black .main-header .navbar .navbar-custom-menu .navbar-nav > li > a,
body.skin-black .main-header .navbar .navbar-right > li > a { body.skin-black .main-header .navbar .navbar-right > li > a {
border-left: solid 1px #e0e0e0; border-left: solid 1px #e0e0e0;
color: #333; color: #333;
} }
/* line 136, ../sass/_adminlte.scss */
/* line 163, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .nav > li > a:hover, body.skin-black .main-header .navbar .nav > li > a:active, body.skin-black .main-header .navbar .nav > li > a:focus, body.skin-black .main-header .navbar .nav > li > a:hover, body.skin-black .main-header .navbar .nav > li > a:active, body.skin-black .main-header .navbar .nav > li > a:focus,
body.skin-black .main-header .navbar .nav .open > a, body.skin-black .main-header .navbar .nav .open > a:hover, body.skin-black .main-header .navbar .nav .open > a:focus, body.skin-black .main-header .navbar .nav .open > a, body.skin-black .main-header .navbar .nav .open > a:hover, body.skin-black .main-header .navbar .nav .open > a:focus,
body.skin-black .main-header .navbar .nav > .active > a { body.skin-black .main-header .navbar .nav > .active > a {
color: #F39C12; color: #F39C12;
} }
/* line 142, ../sass/_adminlte.scss */
/* line 169, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .dropdown-menu { body.skin-black .main-header .navbar .dropdown-menu {
-moz-box-shadow: 0px 0px 4px gray; -moz-box-shadow: 0px 0px 4px gray;
-webkit-box-shadow: 0px 0px 4px gray; -webkit-box-shadow: 0px 0px 4px gray;
box-shadow: 0px 0px 4px gray; box-shadow: 0px 0px 4px gray;
} }
/* line 147, ../sass/_adminlte.scss */
/* line 174, ../sass/_adminlte.scss */
body.skin-black .main-header .logo, body.skin-black .main-header .navbar .sidebar-toggle { body.skin-black .main-header .logo, body.skin-black .main-header .navbar .sidebar-toggle {
border-right: solid 1px #e0e0e0; border-right: solid 1px #e0e0e0;
} }
/* line 151, ../sass/_adminlte.scss */
/* line 178, ../sass/_adminlte.scss */
body.skin-black .main-header .link-control-sidebar { body.skin-black .main-header .link-control-sidebar {
display: none; display: none;
} }
/* line 156, ../sass/_adminlte.scss */
/* line 183, ../sass/_adminlte.scss */
body.skin-black .main-header .notifications-menu ul.menu { body.skin-black .main-header .notifications-menu ul.menu {
max-height: 300px; max-height: 300px;
} }
/* line 159, ../sass/_adminlte.scss */
/* line 186, ../sass/_adminlte.scss */
body.skin-black .main-header .notifications-menu ul.menu li a { body.skin-black .main-header .notifications-menu ul.menu li a {
padding-top: 4px; padding-top: 4px;
padding-bottom: 4px; padding-bottom: 4px;
} }
/* line 163, ../sass/_adminlte.scss */
/* line 190, ../sass/_adminlte.scss */
body.skin-black .main-header .notifications-menu ul.menu li a h5 { body.skin-black .main-header .notifications-menu ul.menu li a h5 {
margin-bottom: 2px; margin-bottom: 2px;
} }
/* line 166, ../sass/_adminlte.scss */
/* line 193, ../sass/_adminlte.scss */
body.skin-black .main-header .notifications-menu ul.menu li a h5 small { body.skin-black .main-header .notifications-menu ul.menu li a h5 small {
float: right; float: right;
} }
/* line 171, ../sass/_adminlte.scss */
/* line 198, ../sass/_adminlte.scss */
body.skin-black .main-header .notifications-menu ul.menu li a p { body.skin-black .main-header .notifications-menu ul.menu li a p {
margin-left: 10px; margin-left: 10px;
} }
/* line 182, ../sass/_adminlte.scss */
/* line 209, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .nav li.producer-menu .dropdown-menu { body.skin-black .main-header .navbar .nav li.producer-menu .dropdown-menu {
width: 400px; width: 400px;
} }
/* line 186, ../sass/_adminlte.scss */
/* line 213, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .nav li.producer-menu .search-producer { body.skin-black .main-header .navbar .nav li.producer-menu .search-producer {
margin: 10px; margin: 10px;
width: 94%; width: 94%;
} }
/* line 191, ../sass/_adminlte.scss */
/* line 218, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .nav li.producer-menu .li-alert-no-results { body.skin-black .main-header .navbar .nav li.producer-menu .li-alert-no-results {
display: none; display: none;
} }
/* line 194, ../sass/_adminlte.scss */
/* line 221, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .nav li.producer-menu .li-alert-no-results .alert { body.skin-black .main-header .navbar .nav li.producer-menu .li-alert-no-results .alert {
margin-bottom: 0px; margin-bottom: 0px;
margin-left: 10px; margin-left: 10px;
margin-right: 10px; margin-right: 10px;
padding: 15px 15px 10px 15px; padding: 15px 15px 10px 15px;
} }
/* line 202, ../sass/_adminlte.scss */
/* line 229, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .nav li.producer-menu .label { body.skin-black .main-header .navbar .nav li.producer-menu .label {
position: relative; position: relative;
top: -2px; top: -2px;
left: 0px; left: 0px;
} }
/* line 208, ../sass/_adminlte.scss */
/* line 235, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .nav li.producer-menu #link-display-producers-offline { body.skin-black .main-header .navbar .nav li.producer-menu #link-display-producers-offline {
color: #F39C12; color: #F39C12;
} }
/* line 212, ../sass/_adminlte.scss */
/* line 239, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .nav li.producer-menu .offline { body.skin-black .main-header .navbar .nav li.producer-menu .offline {
display: none; display: none;
} }
/* line 216, ../sass/_adminlte.scss */
/* line 243, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .nav li.producer-menu a { body.skin-black .main-header .navbar .nav li.producer-menu a {
color: #333; color: #333;
} }
/* line 220, ../sass/_adminlte.scss */
/* line 247, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .nav li.producer-menu .producer-id { body.skin-black .main-header .navbar .nav li.producer-menu .producer-id {
position: relative; position: relative;
top: 4px; top: 4px;
font-size: 12px; font-size: 12px;
float: right; float: right;
} }
/* line 231, ../sass/_adminlte.scss */
/* line 258, ../sass/_adminlte.scss */
body.skin-black .sidebar .sidebar-menu > li.header { body.skin-black .sidebar .sidebar-menu > li.header {
color: #899397; color: #899397;
} }
/* line 235, ../sass/_adminlte.scss */
/* line 262, ../sass/_adminlte.scss */
body.skin-black .sidebar .label { body.skin-black .sidebar .label {
padding-top: 5px; padding-top: 5px;
position: relative; position: relative;
top: -3px; top: -3px;
} }
/* line 242, ../sass/_adminlte.scss */
/* line 269, ../sass/_adminlte.scss */
body.skin-black .sidebar-menu > li.active > a { body.skin-black .sidebar-menu > li.active > a {
border-color: #F39C12; border-color: #F39C12;
} }
/* line 247, ../sass/_adminlte.scss */
/* line 274, ../sass/_adminlte.scss */
body.skin-black section.sidebar .user-panel { body.skin-black section.sidebar .user-panel {
text-align: center; text-align: center;
} }
/* line 250, ../sass/_adminlte.scss */
/* line 277, ../sass/_adminlte.scss */
body.skin-black section.sidebar .user-panel .image { body.skin-black section.sidebar .user-panel .image {
margin-bottom: 3px; margin-bottom: 3px;
} }
/* line 254, ../sass/_adminlte.scss */
/* line 281, ../sass/_adminlte.scss */
body.skin-black section.sidebar .user-panel .title { body.skin-black section.sidebar .user-panel .title {
font-weight: bold; font-weight: bold;
color: white; color: white;
} }
/* line 261, ../sass/_adminlte.scss */
/* line 288, ../sass/_adminlte.scss */
body.skin-black .content-wrapper { body.skin-black .content-wrapper {
background-color: #f5f5f5; background-color: #f5f5f5;
} }
/* line 264, ../sass/_adminlte.scss */
/* line 291, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .content-header { body.skin-black .content-wrapper .content-header {
background-color: #F5F5F5; background-color: #F5F5F5;
padding-bottom: 15px; padding-bottom: 15px;
border-bottom: solid 1px #e0e0e0; border-bottom: solid 1px #e0e0e0;
border-top: solid 1px #e0e0e0; border-top: solid 1px #e0e0e0;
} }
/* line 270, ../sass/_adminlte.scss */
/* line 297, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .content-header .btn { body.skin-black .content-wrapper .content-header .btn {
padding: 3px 6px; padding: 3px 6px;
font-size: 10px; font-size: 10px;
font-family: Arial; font-family: Arial;
text-transform: uppercase; text-transform: uppercase;
} }
/* line 277, ../sass/_adminlte.scss */
/* line 304, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .content-header h1 { body.skin-black .content-wrapper .content-header h1 {
font-family: 'myriadpro-light'; font-family: 'myriadpro-light';
font-size: 20px; font-size: 20px;
} }
/* line 283, ../sass/_adminlte.scss */
/* line 310, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .col-no-padding-left { body.skin-black .content-wrapper .col-no-padding-left {
padding-left: 0px; padding-left: 0px;
} }
/* line 287, ../sass/_adminlte.scss */
/* line 314, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .col-no-padding-right { body.skin-black .content-wrapper .col-no-padding-right {
padding-right: 0px; padding-right: 0px;
} }
/* line 291, ../sass/_adminlte.scss */
/* line 318, ../sass/_adminlte.scss */
body.skin-black .content-wrapper a { body.skin-black .content-wrapper a {
color: #e08e0b; color: #e08e0b;
} }
/* line 294, ../sass/_adminlte.scss */
/* line 321, ../sass/_adminlte.scss */
body.skin-black .content-wrapper a.disable { body.skin-black .content-wrapper a.disable {
pointer-events: none; pointer-events: none;
cursor: default; cursor: default;
} }
/* line 300, ../sass/_adminlte.scss */
/* line 327, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .label { body.skin-black .content-wrapper .label {
padding-top: 4px; padding-top: 4px;
padding-bottom: 1px; padding-bottom: 1px;
} }
/* line 305, ../sass/_adminlte.scss */
/* line 332, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .btn { body.skin-black .content-wrapper .btn {
color: white; color: white;
} }
/* line 309, ../sass/_adminlte.scss */
/* line 336, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .btn-default { body.skin-black .content-wrapper .btn-default {
color: #333; color: #333;
background-color: white; background-color: white;
} }
/* line 314, ../sass/_adminlte.scss */
/* line 341, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .btn-primary { body.skin-black .content-wrapper .btn-primary {
background-color: #F39C12; background-color: #F39C12;
color: white; color: white;
border-color: #F39C12; border-color: #F39C12;
} }
/* line 321, ../sass/_adminlte.scss */
/* line 348, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .nav.nav-tabs .badge { body.skin-black .content-wrapper .nav.nav-tabs .badge {
margin-left: 4px; margin-left: 4px;
background-color: #e0e0e0; background-color: #e0e0e0;
color: #444; color: #444;
} }
/* line 328, ../sass/_adminlte.scss */
/* line 355, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .tab-content { body.skin-black .content-wrapper .tab-content {
border-left: solid 1px #ddd; border-left: solid 1px #ddd;
border-bottom: solid 1px #ddd; border-bottom: solid 1px #ddd;
padding: 30px 15px 15px 15px; padding: 30px 15px 15px 15px;
background-color: white; background-color: white;
} }
/* line 336, ../sass/_adminlte.scss */
/* line 363, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .alert { body.skin-black .content-wrapper .alert {
position: relative; position: relative;
} }
/* line 339, ../sass/_adminlte.scss */
/* line 366, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .alert a { body.skin-black .content-wrapper .alert a {
color: white; color: white;
} }
/* line 342, ../sass/_adminlte.scss */
/* line 369, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .alert a.btn { body.skin-black .content-wrapper .alert a.btn {
color: #333; color: #333;
text-decoration: none; text-decoration: none;
} }
/* line 347, ../sass/_adminlte.scss */
/* line 374, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .alert .close { body.skin-black .content-wrapper .alert .close {
font-size: 30px; font-size: 30px;
position: absolute; position: absolute;
color: white; color: white;
opacity: 0.6; opacity: 0.6;
} }
/* line 356, ../sass/_adminlte.scss */
/* line 383, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .alert .close:hover { body.skin-black .content-wrapper .alert .close:hover {
opacity: 1; opacity: 1;
} }
/* line 361, ../sass/_adminlte.scss */
/* line 388, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .alert.alert-dark { body.skin-black .content-wrapper .alert.alert-dark {
background-color: #ece4d8; background-color: #ece4d8;
color: black; color: black;
} }
/* line 368, ../sass/_adminlte.scss */
/* line 395, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .small-box h3 { body.skin-black .content-wrapper .small-box h3 {
font-size: 28px; font-size: 28px;
font-family: 'Source Sans Pro',sans-serif; font-family: 'Source Sans Pro',sans-serif;
} }
/* line 373, ../sass/_adminlte.scss */
/* line 400, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .small-box .icon { body.skin-black .content-wrapper .small-box .icon {
top: -2px; top: -2px;
} }
/* line 377, ../sass/_adminlte.scss */
/* line 404, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .small-box .small-box-footer { body.skin-black .content-wrapper .small-box .small-box-footer {
color: white; color: white;
padding-top: 6px; padding-top: 6px;
padding-bottom: 2px; padding-bottom: 2px;
} }
/* line 386, ../sass/_adminlte.scss */
/* line 413, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .callout h4 .fa { body.skin-black .content-wrapper .callout h4 .fa {
margin-right: 7px; margin-right: 7px;
} }
/* line 389, ../sass/_adminlte.scss */
/* line 416, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .callout a { body.skin-black .content-wrapper .callout a {
color: white; color: white;
} }
/* line 392, ../sass/_adminlte.scss */
/* line 419, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .callout .btn { body.skin-black .content-wrapper .callout .btn {
color: #333; color: #333;
text-decoration: none; text-decoration: none;
} }
/* line 399, ../sass/_adminlte.scss */
/* line 426, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .table th { body.skin-black .content-wrapper .table th {
font-size: 13px; font-size: 13px;
} }
/* line 402, ../sass/_adminlte.scss */
/* line 429, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .table th.column-actions, body.skin-black .content-wrapper .table td.column-actions { body.skin-black .content-wrapper .table th.column-actions, body.skin-black .content-wrapper .table td.column-actions {
width: 172px; width: 172px;
text-align: right; text-align: right;
} }
/* line 406, ../sass/_adminlte.scss */
/* line 433, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .table td.text-small, body.skin-black .content-wrapper .table th.text-small { body.skin-black .content-wrapper .table td.text-small, body.skin-black .content-wrapper .table th.text-small {
font-size: 12px; font-size: 12px;
} }
/* line 410, ../sass/_adminlte.scss */
/* line 437, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .table.table-bordered > thead > tr > th, body.skin-black .content-wrapper .table.table-bordered > tbody > tr > th, body.skin-black .content-wrapper .table.table-bordered > tfoot > tr > th, body.skin-black .content-wrapper .table.table-bordered > thead > tr > td, body.skin-black .content-wrapper .table.table-bordered > tbody > tr > td, body.skin-black .content-wrapper .table.table-bordered > tfoot > tr > td { body.skin-black .content-wrapper .table.table-bordered > thead > tr > th, body.skin-black .content-wrapper .table.table-bordered > tbody > tr > th, body.skin-black .content-wrapper .table.table-bordered > tfoot > tr > th, body.skin-black .content-wrapper .table.table-bordered > thead > tr > td, body.skin-black .content-wrapper .table.table-bordered > tbody > tr > td, body.skin-black .content-wrapper .table.table-bordered > tfoot > tr > td {
border: 1px solid #ddd; border: 1px solid #ddd;
} }
/* line 419, ../sass/_adminlte.scss */
/* line 446, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .table.table-bordered > thead > tr > th, body.skin-black .content-wrapper .table.table-bordered > thead > tr > td { body.skin-black .content-wrapper .table.table-bordered > thead > tr > th, body.skin-black .content-wrapper .table.table-bordered > thead > tr > td {
border-bottom-width: 2px; border-bottom-width: 2px;
} }
/* line 425, ../sass/_adminlte.scss */
/* line 452, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .pagination > .active > a, body.skin-black .content-wrapper .pagination > .active > span, body.skin-black .content-wrapper .pagination > .active > a:hover, body.skin-black .content-wrapper .pagination > .active > span:hover, body.skin-black .content-wrapper .pagination > .active > a:focus, body.skin-black .content-wrapper .pagination > .active > span:focus { body.skin-black .content-wrapper .pagination > .active > a, body.skin-black .content-wrapper .pagination > .active > span, body.skin-black .content-wrapper .pagination > .active > a:hover, body.skin-black .content-wrapper .pagination > .active > span:hover, body.skin-black .content-wrapper .pagination > .active > a:focus, body.skin-black .content-wrapper .pagination > .active > span:focus {
background-color: #F39C12; background-color: #F39C12;
border: solid 1px #F39C12; border: solid 1px #F39C12;
color: white; color: white;
} }
/* line 431, ../sass/_adminlte.scss */
/* line 458, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .pagination > li > a, body.skin-black .content-wrapper .pagination > li > span { body.skin-black .content-wrapper .pagination > li > a, body.skin-black .content-wrapper .pagination > li > span {
color: #F39C12; color: #F39C12;
} }
/* line 433, ../sass/_adminlte.scss */
/* line 460, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .pagination > li > a:hover, body.skin-black .content-wrapper .pagination > li > span:hover { body.skin-black .content-wrapper .pagination > li > a:hover, body.skin-black .content-wrapper .pagination > li > span:hover {
color: #c87f0a; color: #c87f0a;
} }
/* line 438, ../sass/_adminlte.scss */
/* line 465, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .submenu { body.skin-black .content-wrapper .submenu {
margin-bottom: 25px; margin-bottom: 25px;
} }
/* line 442, ../sass/_adminlte.scss */
/* line 469, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .form-actions { body.skin-black .content-wrapper .form-actions {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
z-index: 10; z-index: 10;
border-top: solid 1px #e0e0e0; border-top: solid 1px #e0e0e0;
} }
/* line 455, ../sass/_adminlte.scss */
/* line 482, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .form-actions a, body.skin-black .content-wrapper .form-actions button { body.skin-black .content-wrapper .form-actions a, body.skin-black .content-wrapper .form-actions button {
margin-left: 10px; margin-left: 10px;
} }
/* line 460, ../sass/_adminlte.scss */
/* line 487, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .form-buttons { body.skin-black .content-wrapper .form-buttons {
margin-top: 25px; margin-top: 25px;
text-align: right; text-align: right;
} }
/* line 467, ../sass/_adminlte.scss */
/* line 494, ../sass/_adminlte.scss */
body.skin-black .main-footer a { body.skin-black .main-footer a {
color: #F39C12; color: #F39C12;
} }
/* line 472, ../sass/_adminlte.scss */
/* line 499, ../sass/_adminlte.scss */
body.skin-black .gridview-pagesize { body.skin-black .gridview-pagesize {
float: right; float: right;
margin-bottom: 8px; margin-bottom: 8px;
} }
/* line 477, ../sass/_adminlte.scss */
/* line 504, ../sass/_adminlte.scss */
body.skin-black #yii-debug-toolbar { body.skin-black #yii-debug-toolbar {
bottom: 64px; bottom: 64px;
} }


/* line 482, ../sass/_adminlte.scss */
/* line 509, ../sass/_adminlte.scss */
body.login-page { body.login-page {
background: none; background: none;
background-color: white; background-color: white;
} }
/* line 486, ../sass/_adminlte.scss */
/* line 513, ../sass/_adminlte.scss */
body.login-page .login-box .login-logo { body.login-page .login-box .login-logo {
text-align: center; text-align: center;
font-family: 'worksans_bold'; font-family: 'worksans_bold';
} }
/* line 490, ../sass/_adminlte.scss */
/* line 517, ../sass/_adminlte.scss */
body.login-page .login-box .login-logo img { body.login-page .login-box .login-logo img {
width: 150px; width: 150px;
} }
/* line 496, ../sass/_adminlte.scss */
/* line 523, ../sass/_adminlte.scss */
body.login-page .login-box .login-box-body, body.login-page .login-box .login-box-body,
body.login-page .login-box .login-box-body input#loginform-email, body.login-page .login-box .login-box-body input#loginform-email,
body.login-page .login-box .login-box-body input#loginform-password, body.login-page .login-box .login-box-body input#loginform-password,
body.login-page .login-box .login-box-body .btn-primary { body.login-page .login-box .login-box-body .btn-primary {
font-size: 14px; font-size: 14px;
} }
/* line 503, ../sass/_adminlte.scss */
/* line 530, ../sass/_adminlte.scss */
body.login-page .login-box .login-box-body .btn-primary { body.login-page .login-box .login-box-body .btn-primary {
background-color: #F39C12; background-color: #F39C12;
border-color: #F39C12; border-color: #F39C12;
padding: 5px 10px; padding: 5px 10px;
margin-bottom: 15px; margin-bottom: 15px;
} }
/* line 509, ../sass/_adminlte.scss */
/* line 536, ../sass/_adminlte.scss */
body.login-page .login-box .login-box-body .btn-primary:active { body.login-page .login-box .login-box-body .btn-primary:active {
background-color: #f4a62a; background-color: #f4a62a;
border-color: #F39C12; border-color: #F39C12;
} }
/* line 515, ../sass/_adminlte.scss */
/* line 542, ../sass/_adminlte.scss */
body.login-page .login-box .login-box-body a { body.login-page .login-box .login-box-body a {
color: #F39C12; color: #F39C12;
} }
/* line 517, ../sass/_adminlte.scss */
/* line 544, ../sass/_adminlte.scss */
body.login-page .login-box .login-box-body a:hover { body.login-page .login-box .login-box-body a:hover {
color: #f4a62a; color: #f4a62a;
} }
/* line 522, ../sass/_adminlte.scss */
/* line 549, ../sass/_adminlte.scss */
body.login-page .login-box .login-box-body .checkbox label input { body.login-page .login-box .login-box-body .checkbox label input {
position: relative; position: relative;
top: 0px; top: 0px;

+ 27
- 0
backend/web/sass/_adminlte.scss View File

padding: 0px 7px; padding: 0px 7px;
} }


// Labels
.label {
&.outline {
background-color: white !important;
}

&.label-default.outline {
color: #444 !important;
border: solid 1px #444;
}

&.label-success.outline {
color: #00a65a !important;
border: solid 1px #00a65a;
}

&.label-warning.outline {
color: #f39c12 !important;
border: solid 1px #f39c12;
}

&.label-danger.outline {
color: #dd4b39 !important;
border: solid 1px #dd4b39;
}
}

// Gestion des retours à la ligne (à cause de la difficulté à gérer du HTMl dans les tooltip) // Gestion des retours à la ligne (à cause de la difficulté à gérer du HTMl dans les tooltip)
.ui-tooltip { .ui-tooltip {
white-space: pre-wrap; white-space: pre-wrap;

+ 1
- 1
console/commands/ClosingOrdersController.php View File



[$date, $hour] = $this->getDateHour(); [$date, $hour] = $this->getDateHour();
$arrayProducers = $producerModule->getRepository()->findProducers(); $arrayProducers = $producerModule->getRepository()->findProducers();
$userSystem = $userModule->getRepository()->findOneUserById(User::ID_USER_SYSTEM)
$userSystem = $userModule->getRepository()->findOneUserById(User::ID_USER_SYSTEM);


foreach($arrayProducers as $producer) { foreach($arrayProducers as $producer) {
\Yii::$app->logic->setProducerContext($producer); \Yii::$app->logic->setProducerContext($producer);

+ 30
- 0
console/migrations/m240528_072445_init_order_status_history.php View File

<?php

use domain\Order\Order\OrderModule;
use domain\Order\OrderStatus\OrderStatus;
use domain\Producer\Producer\ProducerModule;
use domain\User\User\UserModule;
use yii\db\Migration;
use yii\db\Schema;

/**
* Class m240528_072445_init_order_status_history
*/
class m240528_072445_init_order_status_history extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->execute("UPDATE `order` SET order_status_alias = IF(`order`.date_delete IS NULL, 'ordered', 'deleted')");
}

/**
* {@inheritdoc}
*/
public function safeDown()
{

}
}

+ 3
- 0
domain/Distribution/Distribution/DistributionBuilder.php View File



namespace domain\Distribution\Distribution; namespace domain\Distribution\Distribution;


use common\helpers\GlobalParam;
use domain\Distribution\Distribution\Event\DistributionActiveEvent; use domain\Distribution\Distribution\Event\DistributionActiveEvent;
use domain\Distribution\PointSaleDistribution\PointSaleDistribution; use domain\Distribution\PointSaleDistribution\PointSaleDistribution;
use domain\Distribution\PointSaleDistribution\PointSaleDistributionBuilder; use domain\Distribution\PointSaleDistribution\PointSaleDistributionBuilder;
use domain\Product\Product\Product; use domain\Product\Product\Product;
use domain\Product\Product\ProductRepository; use domain\Product\Product\ProductRepository;
use domain\Product\Product\ProductSolver; use domain\Product\Product\ProductSolver;
use domain\User\User\User;
use domain\User\UserProducer\UserProducerRepository; use domain\User\UserProducer\UserProducerRepository;
use domain\_\AbstractBuilder; use domain\_\AbstractBuilder;


if ($active) { if ($active) {
$distributionActiveEvent = new DistributionActiveEvent(); $distributionActiveEvent = new DistributionActiveEvent();
$distributionActiveEvent->distribution = $distribution; $distributionActiveEvent->distribution = $distribution;
$distributionActiveEvent->userAction = GlobalParam::getCurrentUser();
$distribution->trigger(Distribution::EVENT_ACTIVE, $distributionActiveEvent); $distribution->trigger(Distribution::EVENT_ACTIVE, $distributionActiveEvent);
} }
} }

+ 2
- 0
domain/Distribution/Distribution/Event/DistributionActiveEvent.php View File

namespace domain\Distribution\Distribution\Event; namespace domain\Distribution\Distribution\Event;


use domain\Distribution\Distribution\Distribution; use domain\Distribution\Distribution\Distribution;
use domain\User\User\User;
use yii\base\Event; use yii\base\Event;


class DistributionActiveEvent extends Event class DistributionActiveEvent extends Event
{ {
public Distribution $distribution; public Distribution $distribution;
public User $userAction;
} }

+ 0
- 1
domain/Order/Order/OrderBuilder.php View File

$order = new Order(); $order = new Order();
$order->populateDistribution($distribution); $order->populateDistribution($distribution);
$order->date = date('Y-m-d H:i:s'); $order->date = date('Y-m-d H:i:s');
$order->status = 'tmp-order';
$order->id_user = 0; $order->id_user = 0;


return $order; return $order;

+ 50
- 1
domain/Order/Order/OrderManager.php View File

use domain\Producer\Producer\Producer; use domain\Producer\Producer\Producer;
use domain\Producer\Producer\ProducerSolver; use domain\Producer\Producer\ProducerSolver;
use domain\Subscription\Subscription\Subscription; use domain\Subscription\Subscription\Subscription;
use domain\Subscription\Subscription\SubscriptionRepository;
use domain\Subscription\Subscription\SubscriptionSolver;
use domain\User\User\User; use domain\User\User\User;


class OrderManager extends AbstractService implements ManagerInterface class OrderManager extends AbstractService implements ManagerInterface
protected OrderRepository $orderRepository; protected OrderRepository $orderRepository;
protected DistributionSolver $distributionSolver; protected DistributionSolver $distributionSolver;
protected OrderSolver $orderSolver; protected OrderSolver $orderSolver;
protected SubscriptionSolver $subscriptionSolver;
protected SubscriptionRepository $subscriptionRepository;


public function loadDependencies(): void public function loadDependencies(): void
{ {
$this->orderRepository = $this->loadService(OrderRepository::class); $this->orderRepository = $this->loadService(OrderRepository::class);
$this->distributionSolver = $this->loadService(DistributionSolver::class); $this->distributionSolver = $this->loadService(DistributionSolver::class);
$this->orderSolver = $this->loadService(OrderSolver::class); $this->orderSolver = $this->loadService(OrderSolver::class);
$this->subscriptionSolver = $this->loadService(SubscriptionSolver::class);
$this->subscriptionRepository = $this->loadService(SubscriptionRepository::class);
} }


public function changeOrderStatus(Order $order, string $orderStatusAlias, User $user) public function changeOrderStatus(Order $order, string $orderStatusAlias, User $user)


if (count($matchedDistributionsArray)) { if (count($matchedDistributionsArray)) {
foreach ($matchedDistributionsArray as $distribution) { foreach ($matchedDistributionsArray as $distribution) {
$orderArray[] = $this->subscriptionOrderManager->createOrderFromSubscription($subscription, $distribution->date);
$orderArray[] = $this->createOrderFromSubscription($subscription, $distribution->date, $userAction);
} }
} }




return $countOrdersDeleted; return $countOrdersDeleted;
} }

public function createOrderFromSubscription(Subscription $subscription, string $date, User $userAction, bool $force = false): ?Order
{
$now = date('Y-m-d');
$distributionDate = date('Y-m-d', strtotime($date));
$distribution = $this->distributionRepository->findOneDistribution($distributionDate);

if ($distribution
&& $distribution->active
&& ($distributionDate > $now || $force)
&& count($subscription->productSubscription)
&& $subscription->pointSale) {

$order = $this->orderBuilder->createOrder($distribution);
$this->changeOrderStatus($order, OrderStatus::ALIAS_ORDERED, $userAction);
$this->orderBuilder->updateOrderFromSubscription($order, $subscription);

return $order;
}

return null;
}

public function createAllOrdersFromSubscriptions(string $date, User $userAction, bool $force = false): array
{
$ordersSubscriptionsArray = [];
$distribution = $this->distributionRepository->findOneDistribution(date('Y-m-d', strtotime($date)));

if ($distribution) {
$orderArray = $this->orderRepository->findOrdersByDistribution($distribution);
$subscriptionArray = $this->subscriptionRepository->findSubscriptionsByDate($date);
foreach ($subscriptionArray as $subscription) {
if (!$this->subscriptionSolver->hasOrderAlreadyExist($subscription, $orderArray)) {
$order = $this->createOrderFromSubscription($subscription, $date, $userAction, $force);
if ($order) {
$ordersSubscriptionsArray[] = $order;
}
}
}
}

return $ordersSubscriptionsArray;
}
} }

+ 9
- 0
domain/Order/Order/OrderRepository.php View File

use domain\User\User\User; use domain\User\User\User;
use domain\User\UserProducer\UserProducerRepository; use domain\User\UserProducer\UserProducerRepository;
use domain\_\AbstractRepository; use domain\_\AbstractRepository;
use phpDocumentor\Reflection\Types\Parent_;
use yii\helpers\Html; use yii\helpers\Html;


class OrderRepository extends AbstractRepository class OrderRepository extends AbstractRepository
]; ];
} }


public function defaultStatus(): void
{
parent::defaultStatus();
$this->query->filterIsOrderStatusNotDeleted();
}

public function findOneOrderById(int $id) public function findOneOrderById(int $id)
{ {
return $this->createDefaultQuery() return $this->createDefaultQuery()


public function countGlobalOrdersByDateAndOrigin(\DateTime $date, string $origin = Order::ORIGIN_USER) public function countGlobalOrdersByDateAndOrigin(\DateTime $date, string $origin = Order::ORIGIN_USER)
{ {
// @TODO : pourquoi on utilise pas createDefaultQuery() ?
return $this->createQuery() return $this->createQuery()
->filterIsOrderStatusNotDeleted()
->filterByDate($date) ->filterByDate($date)
->filterByOrigin($origin) ->filterByOrigin($origin)
->count(); ->count();

+ 8
- 0
domain/Order/Order/OrderRepositoryQuery.php View File

return $this; return $this;
} }


public function filterIsOrderStatusNotDeleted()
{
$this->andWhere('order_status_alias != :status_deleted')
->params([':status_deleted' => OrderStatus::ALIAS_DELETED]);

return $this;
}

public function filterByUser(User $user): self public function filterByUser(User $user): self
{ {
$this->andWhere(['order.id_user' => $user->id]); $this->andWhere(['order.id_user' => $user->id]);

+ 12
- 0
domain/Order/Order/OrderSolver.php View File

use domain\Order\ProductOrder\ProductOrderSolver; use domain\Order\ProductOrder\ProductOrderSolver;
use domain\Payment\Payment; use domain\Payment\Payment;
use domain\Payment\PaymentSolver; use domain\Payment\PaymentSolver;
use domain\Producer\Producer\Producer;
use domain\Producer\Producer\ProducerSolver; use domain\Producer\Producer\ProducerSolver;
use domain\Product\Product\Product; use domain\Product\Product\Product;
use domain\User\User\User; use domain\User\User\User;
{ {
return $order->getOrderStatusAlias() == OrderStatus::ALIAS_DELETED; return $order->getOrderStatusAlias() == OrderStatus::ALIAS_DELETED;
} }

public function getLabelDeleteAction(Order $order): string
{
$optionBehaviorCancelOrder = $this->producerSolver->getConfig('option_behavior_cancel_order');

if($optionBehaviorCancelOrder == Producer::BEHAVIOR_DELETE_ORDER_STATUS && $this->isOrderStatusValid($order)) {
return 'Annuler';
}

return 'Supprimer';
}
} }

+ 3
- 2
domain/Subscription/Subscription/Event/DistributionObserver.php View File



use domain\Distribution\Distribution\Distribution; use domain\Distribution\Distribution\Distribution;
use domain\Distribution\Distribution\Event\DistributionActiveEvent; use domain\Distribution\Distribution\Event\DistributionActiveEvent;
use domain\Order\Order\OrderModule;
use justcoded\yii2\eventlistener\observers\Observer; use justcoded\yii2\eventlistener\observers\Observer;
use domain\Subscription\Subscription\SubscriptionModule; use domain\Subscription\Subscription\SubscriptionModule;


public static function onDistributionActive(DistributionActiveEvent $event): void public static function onDistributionActive(DistributionActiveEvent $event): void
{ {
$distribution = $event->distribution; $distribution = $event->distribution;
$subscriptionModule = SubscriptionModule::getInstance();
$orderModule = OrderModule::getInstance();


$subscriptionModule->getOrderManager()->createAllOrdersFromSubscriptions($distribution->date);
$orderModule->getManager()->createAllOrdersFromSubscriptions($event->distribution->date, $event->userAction);
} }
} }

+ 0
- 48
domain/Subscription/Subscription/OrderManager.php View File

$this->subscriptionRepository = $this->loadService(SubscriptionRepository::class); $this->subscriptionRepository = $this->loadService(SubscriptionRepository::class);
$this->subscriptionSolver = $this->loadService(SubscriptionSolver::class); $this->subscriptionSolver = $this->loadService(SubscriptionSolver::class);
} }

/**
* Ajoute l'abonnement' pour une date donnée.
*/
public function createOrderFromSubscription(Subscription $subscription, string $date, bool $force = false): ?Order
{
$now = date('Y-m-d');
$distributionDate = date('Y-m-d', strtotime($date));
$distribution = $this->distributionRepository->findOneDistribution($distributionDate);

if ($distribution
&& $distribution->active
&& ($distributionDate > $now || $force)
&& count($subscription->productSubscription)
&& $subscription->pointSale) {

$order = $this->orderBuilder->createOrder($distribution);
$this->orderBuilder->updateOrderFromSubscription($order, $subscription);

return $order;
}

return null;
}

/**
* Ajoute les commandes pour une date donnée à partir des abonnements.
*/
public function createAllOrdersFromSubscriptions(string $date, bool $force = false): array
{
$ordersSubscriptionsArray = [];
$distribution = $this->distributionRepository->findOneDistribution(date('Y-m-d', strtotime($date)));

if ($distribution) {
$orderArray = $this->orderRepository->findOrdersByDistribution($distribution);
$subscriptionArray = $this->subscriptionRepository->findSubscriptionsByDate($date);
foreach ($subscriptionArray as $subscription) {
if (!$this->subscriptionSolver->hasOrderAlreadyExist($subscription, $orderArray)) {
$order = $this->createOrderFromSubscription($subscription, $date, $force);
if ($order) {
$ordersSubscriptionsArray[] = $order;
}
}
}
}

return $ordersSubscriptionsArray;
}
} }

+ 12
- 0
domain/User/User/UserRepository.php View File

use domain\Producer\Producer\Producer; use domain\Producer\Producer\Producer;
use domain\User\UserProducer\UserProducerRepository; use domain\User\UserProducer\UserProducerRepository;
use domain\_\AbstractRepository; use domain\_\AbstractRepository;
use yii\base\ErrorException;
use yii\db\Query; use yii\db\Query;


class UserRepository extends AbstractRepository class UserRepository extends AbstractRepository
{ {
return $this->countUsersStatusUserOnline() + $this->countUsersStatusProducerOnline(); return $this->countUsersStatusUserOnline() + $this->countUsersStatusProducerOnline();
} }

public function findOneUserSystem(): User
{
$userSystem = $this->findOneUserById(User::ID_USER_SYSTEM);

if(!$userSystem) {
throw new ErrorException("L'utilisateur système n'existe pas dans la base de données.");
}

return $userSystem;
}
} }

+ 1
- 2
producer/views/order/_form.php View File

?> ?>
<div id="bar-fixed" class="<?php if($producer->credit): ?>credit<?php else: ?>no-credit<?php endif; ?>"> <div id="bar-fixed" class="<?php if($producer->credit): ?>credit<?php else: ?>no-credit<?php endif; ?>">
<div class="container"> <div class="container">
<?php if (isset($model->id) && !$model->date_delete): ?>
<?php if (isset($model->id) && $orderModule->getSolver()->isOrderStatusValid($model)): ?>
<a href="<?php echo \Yii::$app->urlManager->createUrl(['order/cancel', 'id' => $model->id]); ?>" class="btn btn-danger cancel-order">Annuler ma commande</a> <a href="<?php echo \Yii::$app->urlManager->createUrl(['order/cancel', 'id' => $model->id]); ?>" class="btn btn-danger cancel-order">Annuler ma commande</a>
<?php endif; ?> <?php endif; ?>
<span id="total-order-bottom"><span></span> €</span> <span id="total-order-bottom"><span></span> €</span>
<?= Html::submitButton('<span class="glyphicon glyphicon-comment"></span> Commentaire', ['class' => 'btn btn-default btn-comment', 'data-placement' => 'top', 'data-toggle' => 'tooltip', 'data-original-title' => 'Ajouter un commentaire']) ?> <?= Html::submitButton('<span class="glyphicon glyphicon-comment"></span> Commentaire', ['class' => 'btn btn-default btn-comment', 'data-placement' => 'top', 'data-toggle' => 'tooltip', 'data-original-title' => 'Ajouter un commentaire']) ?>
<?php <?php
if($producer->credit): if($producer->credit):
$linkCredit = '<a class="info-credit" href="'.Yii::$app->urlManager->createUrl(['site/credit']) .'" data-toggle="tooltip" data-placement="bottom" title="En savoir plus sur le Crédit"><span class="glyphicon glyphicon-info-sign"></span></a>' ; ; $linkCredit = '<a class="info-credit" href="'.Yii::$app->urlManager->createUrl(['site/credit']) .'" data-toggle="tooltip" data-placement="bottom" title="En savoir plus sur le Crédit"><span class="glyphicon glyphicon-info-sign"></span></a>' ; ;

+ 4
- 4
producer/views/order/history.php View File

'value' => function($order) use ($orderModule) { 'value' => function($order) use ($orderModule) {
$html = '' ; $html = '' ;
if($order->date_delete) {
if($orderModule->getSolver()->isOrderStatusCanceled($order)) {
$html .= '<span class="badge text-bg-danger">Annulée</span>' ; $html .= '<span class="badge text-bg-danger">Annulée</span>' ;
} }
else { else {
if($orderModule->getState($order) == Order::STATE_DELIVERED) {
if($orderModule->getRepository()->getState($order) == Order::STATE_DELIVERED) {
$html .= '<span class="badge text-bg-success">Livrée</span>' ; $html .= '<span class="badge text-bg-success">Livrée</span>' ;
} }
elseif($orderModule->getState($order) == Order::STATE_PREPARATION) {
elseif($orderModule->getRepository()->getState($order) == Order::STATE_PREPARATION) {
$html .= '<span class="badge text-bg-warning">En préparation</span>' ; $html .= '<span class="badge text-bg-warning">En préparation</span>' ;
} }
elseif($orderModule->getState($order) == Order::STATE_OPEN) {
elseif($orderModule->getRepository()->getState($order) == Order::STATE_OPEN) {
$html .= '<span class="badge text-bg-secondary">À venir</span>' ; $html .= '<span class="badge text-bg-secondary">À venir</span>' ;
} }
} }

Loading…
Cancel
Save