Browse Source

Modification d'un document : affichage d'infos au niveau de chaque ProductOrder (username, date distribution, point de vente) #166

refactoring
Guillaume Bourgeois 5 years ago
parent
commit
86182c63ce
6 changed files with 50 additions and 1 deletions
  1. +3
    -0
      backend/controllers/DocumentController.php
  2. +6
    -1
      backend/views/document/_form.php
  3. +11
    -0
      backend/web/css/screen.css
  4. +13
    -0
      backend/web/sass/document/_form.scss
  5. +12
    -0
      common/models/Order.php
  6. +5
    -0
      common/models/User.php

+ 3
- 0
backend/controllers/DocumentController.php View File

@@ -286,6 +286,9 @@ class DocumentController extends BackendController
$ordersArray[$order->id] = array_merge(
$order->getAttributes(),
[
'username' => $order->getUsername(),
'distribution_date' => isset($order->distribution) ? date('d/m/Y', strtotime($order->distribution->date)) : null,
'point_sale_name' => isset($order->pointSale) ? $order->pointSale->name : null,
'productOrder' => $productsOrderArray,
]
);

+ 6
- 1
backend/views/document/_form.php View File

@@ -204,7 +204,12 @@ use common\models\Producer;
<template v-for="order in ordersArray">
<tr v-for="productOrder in order.productOrder">
<td class="col-md-4">
{{ productsArray[productOrder.id_product].name }}
<div class="product-name">{{ productsArray[productOrder.id_product].name }}</div>
<ul class="product-order-meta">
<li>{{ order.username }}</li>
<li v-if="order.distribution_date">{{ order.distribution_date }}</li>
<li v-if="order.point_sale_name">{{ order.point_sale_name }}</li>
</ul>
</td>
<td class="col-md-2">{{ formatPrice(productOrder.price) }}</td>
<td class="col-md-2">{{ productOrder.quantity }}</td>

+ 11
- 0
backend/web/css/screen.css View File

@@ -2340,3 +2340,14 @@ termes.
.document-form #block-add-product .total .btn {
float: right;
}
/* line 32, ../sass/document/_form.scss */
.document-form #block-list-products ul.product-order-meta {
padding: 0px;
margin: 0px;
padding-left: 20px;
}
/* line 37, ../sass/document/_form.scss */
.document-form #block-list-products ul.product-order-meta li {
color: gray;
font-size: 11px;
}

+ 13
- 0
backend/web/sass/document/_form.scss View File

@@ -27,4 +27,17 @@
}
}
}

#block-list-products {
ul.product-order-meta {
padding: 0px ;
margin: 0px ;
padding-left: 20px ;

li {
color: gray ;
font-size: 11px ;
}
}
}
}

+ 12
- 0
common/models/Order.php View File

@@ -842,4 +842,16 @@ class Order extends ActiveRecordCommon
</div>';
}

public function getUsername()
{
$username = '' ;
if($this->user) {
$username = $this->user->getUsername() ;
}
if(strlen($this->username)) {
$username = $this->username ;
}
return $username ;
}

}

+ 5
- 0
common/models/User.php View File

@@ -687,6 +687,11 @@ class User extends ActiveRecordCommon implements IdentityInterface
return $address;
}

public function getUsername()
{
return $this->lastname.' '.$this->name ;
}

/**
* Retourne l'ID de l'utilisateur courant connecté.
*

Loading…
Cancel
Save