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

@@ -318,8 +318,6 @@ class DistributionController extends BackendController
$productOrderModule = $this->getProductOrderModule();
$userProducerModule = $this->getUserProducerModule();



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

@@ -407,7 +405,8 @@ class DistributionController extends BackendController
'isCreditFunctioningMandatory' => $orderModule->getRepository()->isOrderCreditFunctioningMandatory($order),
'isCreditFunctioningUser' => $orderModule->getRepository()->isOrderCreditFunctioningUser($order),
'debitCredit' => false,
'deliveryNote' => $order->deliveryNote ? $order->deliveryNote->getAttributes() : null
'deliveryNote' => $order->deliveryNote ? $order->deliveryNote->getAttributes() : null,
'labelDeleteAction' => $orderModule->getSolver()->getLabelDeleteAction($order)
]);
}
}
@@ -705,8 +704,8 @@ class DistributionController extends BackendController
*/
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)) {
return Ajax::responseSuccess('Les abonnements ont bien été importés.');

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

@@ -270,7 +270,7 @@ class SubscriptionController extends BackendController
->deleteOrdersIncomingDistributionsFromSubscription($subscription, $this->getUserCurrent());
}
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.');
return $this->redirect(['subscription/index']);

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

@@ -356,8 +356,8 @@ $this->setPageTitle('Distributions') ;
<th class="column-checkbox" v-if="idActivePointSale > 0">
<input type="checkbox" v-model="checkboxSelectAllOrders" @change="selectAllOrdersEvent" />
</th>
<th class="column-state">Statut</th>
<th class="column-origin">Origine</th>
<th class="column-state">État</th>
<th class="column-user">Utilisateur</th>
<th class="column-point-sale" v-if="idActivePointSale == 0">Point de vente</th>
<th class="column-amount">Montant</th>
@@ -373,15 +373,15 @@ $this->setPageTitle('Distributions') ;
<td class="column-checkbox" v-if="idActivePointSale > 0">
<input type="checkbox" v-model="order.selected" />
</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">
<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 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 : ''">
@@ -413,7 +413,7 @@ $this->setPageTitle('Distributions') ;
</div>
</td>
<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">
<order-state-payment :order="order" :producer="producer"></order-state-payment>
</a>
@@ -516,7 +516,7 @@ $this->setPageTitle('Distributions') ;
<span class="caret"></span>
</button>
<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-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>

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

@@ -311,7 +311,7 @@ $this->addBreadcrumb($this->getTitle());
<?= $form->field($model, 'option_behavior_cancel_order')
->dropDownList([
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>

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

@@ -62,11 +62,46 @@ $this->addBreadcrumb('Commandes') ;
//'filterModel' => $searchModel,
'dataProvider' => $dataProvider,
'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',
'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

@@ -1547,50 +1547,74 @@ body.skin-black .badge-environment-beta {
font-size: 11px;
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 {
white-space: pre-wrap;
}
/* line 16, ../sass/_adminlte.scss */
/* line 43, ../sass/_adminlte.scss */
body.skin-black .user-without-account {
color: gray;
font-style: italic;
}
/* line 22, ../sass/_adminlte.scss */
/* line 49, ../sass/_adminlte.scss */
body.skin-black .main-header .logo {
background-color: white;
font-family: 'highvoltageregular';
font-size: 23px;
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 {
background-color: white;
text-decoration: none;
}
/* line 33, ../sass/_adminlte.scss */
/* line 60, ../sass/_adminlte.scss */
body.skin-black .main-header .logo img {
position: relative;
max-width: 300px;
max-height: 300px;
height: auto;
}
/* line 41, ../sass/_adminlte.scss */
/* line 68, ../sass/_adminlte.scss */
body.skin-black .main-header .logo .logo-lg img {
width: 90px;
top: -2px;
}
/* line 47, ../sass/_adminlte.scss */
/* line 74, ../sass/_adminlte.scss */
body.skin-black .main-header .logo .logo-mini img {
width: 50px;
}
/* line 52, ../sass/_adminlte.scss */
/* line 79, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar {
display: block;
background-color: white;
padding: 0px;
}
/* line 57, ../sass/_adminlte.scss */
/* line 84, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .producer-panel {
position: relative;
float: left;
@@ -1598,11 +1622,11 @@ body.skin-black .main-header .navbar .producer-panel {
padding-left: 50px;
margin-left: 7px;
}
/* line 64, ../sass/_adminlte.scss */
/* line 91, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .producer-panel.without-logo {
padding-left: 10px;
}
/* line 68, ../sass/_adminlte.scss */
/* line 95, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .producer-panel .logo {
position: absolute;
top: 5px;
@@ -1617,7 +1641,7 @@ body.skin-black .main-header .navbar .producer-panel .logo {
text-align: center;
overflow: hidden;
}
/* line 80, ../sass/_adminlte.scss */
/* line 107, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .producer-panel .logo .img-logo {
position: absolute;
top: 50%;
@@ -1626,131 +1650,131 @@ body.skin-black .main-header .navbar .producer-panel .logo .img-logo {
max-width: 35px;
max-height: 35px;
}
/* line 90, ../sass/_adminlte.scss */
/* line 117, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .producer-panel .title {
position: relative;
top: 2px;
text-transform: uppercase;
}
/* line 95, ../sass/_adminlte.scss */
/* line 122, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .producer-panel .title a {
color: #333;
}
/* line 98, ../sass/_adminlte.scss */
/* line 125, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .producer-panel .title a:hover {
text-decoration: underline;
}
/* line 103, ../sass/_adminlte.scss */
/* line 130, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .producer-panel .title .producer-id {
color: gray;
font-size: 13px;
}
/* line 110, ../sass/_adminlte.scss */
/* line 137, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .sidebar-toggle {
color: #333;
}
/* line 114, ../sass/_adminlte.scss */
/* line 141, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .link-support {
float: left;
padding: 15px 15px;
border-right: solid 1px #e0e0e0;
color: #333;
}
/* line 120, ../sass/_adminlte.scss */
/* line 147, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .link-support:hover {
text-decoration: none;
color: #F39C12;
}
/* line 126, ../sass/_adminlte.scss */
/* line 153, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .navbar-custom-menu .nav {
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-right > li > a {
border-left: solid 1px #e0e0e0;
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 .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 {
color: #F39C12;
}
/* line 142, ../sass/_adminlte.scss */
/* line 169, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .dropdown-menu {
-moz-box-shadow: 0px 0px 4px gray;
-webkit-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 {
border-right: solid 1px #e0e0e0;
}
/* line 151, ../sass/_adminlte.scss */
/* line 178, ../sass/_adminlte.scss */
body.skin-black .main-header .link-control-sidebar {
display: none;
}
/* line 156, ../sass/_adminlte.scss */
/* line 183, ../sass/_adminlte.scss */
body.skin-black .main-header .notifications-menu ul.menu {
max-height: 300px;
}
/* line 159, ../sass/_adminlte.scss */
/* line 186, ../sass/_adminlte.scss */
body.skin-black .main-header .notifications-menu ul.menu li a {
padding-top: 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 {
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 {
float: right;
}
/* line 171, ../sass/_adminlte.scss */
/* line 198, ../sass/_adminlte.scss */
body.skin-black .main-header .notifications-menu ul.menu li a p {
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 {
width: 400px;
}
/* line 186, ../sass/_adminlte.scss */
/* line 213, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .nav li.producer-menu .search-producer {
margin: 10px;
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 {
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 {
margin-bottom: 0px;
margin-left: 10px;
margin-right: 10px;
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 {
position: relative;
top: -2px;
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 {
color: #F39C12;
}
/* line 212, ../sass/_adminlte.scss */
/* line 239, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .nav li.producer-menu .offline {
display: none;
}
/* line 216, ../sass/_adminlte.scss */
/* line 243, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .nav li.producer-menu a {
color: #333;
}
/* line 220, ../sass/_adminlte.scss */
/* line 247, ../sass/_adminlte.scss */
body.skin-black .main-header .navbar .nav li.producer-menu .producer-id {
position: relative;
top: 4px;
@@ -1758,100 +1782,100 @@ body.skin-black .main-header .navbar .nav li.producer-menu .producer-id {
font-size: 12px;
float: right;
}
/* line 231, ../sass/_adminlte.scss */
/* line 258, ../sass/_adminlte.scss */
body.skin-black .sidebar .sidebar-menu > li.header {
color: #899397;
}
/* line 235, ../sass/_adminlte.scss */
/* line 262, ../sass/_adminlte.scss */
body.skin-black .sidebar .label {
padding-top: 5px;
position: relative;
top: -3px;
}
/* line 242, ../sass/_adminlte.scss */
/* line 269, ../sass/_adminlte.scss */
body.skin-black .sidebar-menu > li.active > a {
border-color: #F39C12;
}
/* line 247, ../sass/_adminlte.scss */
/* line 274, ../sass/_adminlte.scss */
body.skin-black section.sidebar .user-panel {
text-align: center;
}
/* line 250, ../sass/_adminlte.scss */
/* line 277, ../sass/_adminlte.scss */
body.skin-black section.sidebar .user-panel .image {
margin-bottom: 3px;
}
/* line 254, ../sass/_adminlte.scss */
/* line 281, ../sass/_adminlte.scss */
body.skin-black section.sidebar .user-panel .title {
font-weight: bold;
color: white;
}
/* line 261, ../sass/_adminlte.scss */
/* line 288, ../sass/_adminlte.scss */
body.skin-black .content-wrapper {
background-color: #f5f5f5;
}
/* line 264, ../sass/_adminlte.scss */
/* line 291, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .content-header {
background-color: #F5F5F5;
padding-bottom: 15px;
border-bottom: 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 {
padding: 3px 6px;
font-size: 10px;
font-family: Arial;
text-transform: uppercase;
}
/* line 277, ../sass/_adminlte.scss */
/* line 304, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .content-header h1 {
font-family: 'myriadpro-light';
font-size: 20px;
}
/* line 283, ../sass/_adminlte.scss */
/* line 310, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .col-no-padding-left {
padding-left: 0px;
}
/* line 287, ../sass/_adminlte.scss */
/* line 314, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .col-no-padding-right {
padding-right: 0px;
}
/* line 291, ../sass/_adminlte.scss */
/* line 318, ../sass/_adminlte.scss */
body.skin-black .content-wrapper a {
color: #e08e0b;
}
/* line 294, ../sass/_adminlte.scss */
/* line 321, ../sass/_adminlte.scss */
body.skin-black .content-wrapper a.disable {
pointer-events: none;
cursor: default;
}
/* line 300, ../sass/_adminlte.scss */
/* line 327, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .label {
padding-top: 4px;
padding-bottom: 1px;
}
/* line 305, ../sass/_adminlte.scss */
/* line 332, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .btn {
color: white;
}
/* line 309, ../sass/_adminlte.scss */
/* line 336, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .btn-default {
color: #333;
background-color: white;
}
/* line 314, ../sass/_adminlte.scss */
/* line 341, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .btn-primary {
background-color: #F39C12;
color: white;
border-color: #F39C12;
}
/* line 321, ../sass/_adminlte.scss */
/* line 348, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .nav.nav-tabs .badge {
margin-left: 4px;
background-color: #e0e0e0;
color: #444;
}
/* line 328, ../sass/_adminlte.scss */
/* line 355, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .tab-content {
border-left: solid 1px #ddd;
border-bottom: solid 1px #ddd;
@@ -1859,20 +1883,20 @@ body.skin-black .content-wrapper .tab-content {
padding: 30px 15px 15px 15px;
background-color: white;
}
/* line 336, ../sass/_adminlte.scss */
/* line 363, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .alert {
position: relative;
}
/* line 339, ../sass/_adminlte.scss */
/* line 366, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .alert a {
color: white;
}
/* line 342, ../sass/_adminlte.scss */
/* line 369, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .alert a.btn {
color: #333;
text-decoration: none;
}
/* line 347, ../sass/_adminlte.scss */
/* line 374, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .alert .close {
font-size: 30px;
position: absolute;
@@ -1882,83 +1906,83 @@ body.skin-black .content-wrapper .alert .close {
color: white;
opacity: 0.6;
}
/* line 356, ../sass/_adminlte.scss */
/* line 383, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .alert .close:hover {
opacity: 1;
}
/* line 361, ../sass/_adminlte.scss */
/* line 388, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .alert.alert-dark {
background-color: #ece4d8;
color: black;
}
/* line 368, ../sass/_adminlte.scss */
/* line 395, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .small-box h3 {
font-size: 28px;
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 {
top: -2px;
}
/* line 377, ../sass/_adminlte.scss */
/* line 404, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .small-box .small-box-footer {
color: white;
padding-top: 6px;
padding-bottom: 2px;
}
/* line 386, ../sass/_adminlte.scss */
/* line 413, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .callout h4 .fa {
margin-right: 7px;
}
/* line 389, ../sass/_adminlte.scss */
/* line 416, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .callout a {
color: white;
}
/* line 392, ../sass/_adminlte.scss */
/* line 419, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .callout .btn {
color: #333;
text-decoration: none;
}
/* line 399, ../sass/_adminlte.scss */
/* line 426, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .table th {
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 {
width: 172px;
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 {
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 {
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 {
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 {
background-color: #F39C12;
border: solid 1px #F39C12;
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 {
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 {
color: #c87f0a;
}
/* line 438, ../sass/_adminlte.scss */
/* line 465, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .submenu {
margin-bottom: 25px;
}
/* line 442, ../sass/_adminlte.scss */
/* line 469, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .form-actions {
position: fixed;
bottom: 0;
@@ -1972,71 +1996,71 @@ body.skin-black .content-wrapper .form-actions {
z-index: 10;
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 {
margin-left: 10px;
}
/* line 460, ../sass/_adminlte.scss */
/* line 487, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .form-buttons {
margin-top: 25px;
text-align: right;
}
/* line 467, ../sass/_adminlte.scss */
/* line 494, ../sass/_adminlte.scss */
body.skin-black .main-footer a {
color: #F39C12;
}
/* line 472, ../sass/_adminlte.scss */
/* line 499, ../sass/_adminlte.scss */
body.skin-black .gridview-pagesize {
float: right;
margin-bottom: 8px;
}
/* line 477, ../sass/_adminlte.scss */
/* line 504, ../sass/_adminlte.scss */
body.skin-black #yii-debug-toolbar {
bottom: 64px;
}

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

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

@@ -7,6 +7,33 @@ body.skin-black {
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)
.ui-tooltip {
white-space: pre-wrap;

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

@@ -50,7 +50,7 @@ class ClosingOrdersController extends Controller

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

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

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

@@ -0,0 +1,30 @@
<?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

@@ -2,6 +2,7 @@

namespace domain\Distribution\Distribution;

use common\helpers\GlobalParam;
use domain\Distribution\Distribution\Event\DistributionActiveEvent;
use domain\Distribution\PointSaleDistribution\PointSaleDistribution;
use domain\Distribution\PointSaleDistribution\PointSaleDistributionBuilder;
@@ -16,6 +17,7 @@ use domain\PointSale\PointSale\PointSaleRepository;
use domain\Product\Product\Product;
use domain\Product\Product\ProductRepository;
use domain\Product\Product\ProductSolver;
use domain\User\User\User;
use domain\User\UserProducer\UserProducerRepository;
use domain\_\AbstractBuilder;

@@ -196,6 +198,7 @@ class DistributionBuilder extends AbstractBuilder
if ($active) {
$distributionActiveEvent = new DistributionActiveEvent();
$distributionActiveEvent->distribution = $distribution;
$distributionActiveEvent->userAction = GlobalParam::getCurrentUser();
$distribution->trigger(Distribution::EVENT_ACTIVE, $distributionActiveEvent);
}
}

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

@@ -3,9 +3,11 @@
namespace domain\Distribution\Distribution\Event;

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

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

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

@@ -100,7 +100,6 @@ class OrderBuilder extends AbstractBuilder
$order = new Order();
$order->populateDistribution($distribution);
$order->date = date('Y-m-d H:i:s');
$order->status = 'tmp-order';
$order->id_user = 0;

return $order;

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

@@ -13,6 +13,8 @@ use domain\Order\OrderStatusHistory\OrderStatusHistoryManager;
use domain\Producer\Producer\Producer;
use domain\Producer\Producer\ProducerSolver;
use domain\Subscription\Subscription\Subscription;
use domain\Subscription\Subscription\SubscriptionRepository;
use domain\Subscription\Subscription\SubscriptionSolver;
use domain\User\User\User;

class OrderManager extends AbstractService implements ManagerInterface
@@ -26,6 +28,8 @@ class OrderManager extends AbstractService implements ManagerInterface
protected OrderRepository $orderRepository;
protected DistributionSolver $distributionSolver;
protected OrderSolver $orderSolver;
protected SubscriptionSolver $subscriptionSolver;
protected SubscriptionRepository $subscriptionRepository;

public function loadDependencies(): void
{
@@ -38,6 +42,8 @@ class OrderManager extends AbstractService implements ManagerInterface
$this->orderRepository = $this->loadService(OrderRepository::class);
$this->distributionSolver = $this->loadService(DistributionSolver::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)
@@ -95,7 +101,7 @@ class OrderManager extends AbstractService implements ManagerInterface

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

@@ -120,4 +126,47 @@ class OrderManager extends AbstractService implements ManagerInterface

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

@@ -27,6 +27,7 @@ use domain\Subscription\Subscription\Subscription;
use domain\User\User\User;
use domain\User\UserProducer\UserProducerRepository;
use domain\_\AbstractRepository;
use phpDocumentor\Reflection\Types\Parent_;
use yii\helpers\Html;

class OrderRepository extends AbstractRepository
@@ -91,6 +92,12 @@ class OrderRepository extends AbstractRepository
];
}

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

public function findOneOrderById(int $id)
{
return $this->createDefaultQuery()
@@ -100,7 +107,9 @@ class OrderRepository extends AbstractRepository

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

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

@@ -68,6 +68,14 @@ class OrderRepositoryQuery extends AbstractRepositoryQuery
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
{
$this->andWhere(['order.id_user' => $user->id]);

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

@@ -10,6 +10,7 @@ use domain\Order\OrderStatusHistory\OrderStatusHistory;
use domain\Order\ProductOrder\ProductOrderSolver;
use domain\Payment\Payment;
use domain\Payment\PaymentSolver;
use domain\Producer\Producer\Producer;
use domain\Producer\Producer\ProducerSolver;
use domain\Product\Product\Product;
use domain\User\User\User;
@@ -586,4 +587,15 @@ class OrderSolver extends AbstractService implements SolverInterface
{
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

@@ -4,6 +4,7 @@ namespace domain\Subscription\Subscription\Event;

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

@@ -19,8 +20,8 @@ class DistributionObserver extends Observer
public static function onDistributionActive(DistributionActiveEvent $event): void
{
$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

@@ -27,52 +27,4 @@ class OrderManager extends AbstractManager
$this->subscriptionRepository = $this->loadService(SubscriptionRepository::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

@@ -7,6 +7,7 @@ use domain\PointSale\PointSale\PointSale;
use domain\Producer\Producer\Producer;
use domain\User\UserProducer\UserProducerRepository;
use domain\_\AbstractRepository;
use yii\base\ErrorException;
use yii\db\Query;

class UserRepository extends AbstractRepository
@@ -300,4 +301,15 @@ class UserRepository extends AbstractRepository
{
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

@@ -269,12 +269,11 @@ $orderModule = OrderModule::getInstance();
?>
<div id="bar-fixed" class="<?php if($producer->credit): ?>credit<?php else: ?>no-credit<?php endif; ?>">
<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>
<?php endif; ?>
<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']) ?>
<?php
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>' ; ;

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

@@ -121,17 +121,17 @@ $this->setTitle('Mes commandes') ;
'value' => function($order) use ($orderModule) {
$html = '' ;
if($order->date_delete) {
if($orderModule->getSolver()->isOrderStatusCanceled($order)) {
$html .= '<span class="badge text-bg-danger">Annulée</span>' ;
}
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>' ;
}
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>' ;
}
elseif($orderModule->getState($order) == Order::STATE_OPEN) {
elseif($orderModule->getRepository()->getState($order) == Order::STATE_OPEN) {
$html .= '<span class="badge text-bg-secondary">À venir</span>' ;
}
}

Loading…
Cancel
Save