Quellcode durchsuchen

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

refactoring
Guillaume Bourgeois vor 4 Jahren
Ursprung
Commit
86182c63ce
6 geänderte Dateien mit 50 neuen und 1 gelöschten Zeilen
  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 Datei anzeigen

@@ -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 Datei anzeigen

@@ -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 Datei anzeigen

@@ -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 Datei anzeigen

@@ -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 Datei anzeigen

@@ -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 Datei anzeigen

@@ -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é.
*

Laden…
Abbrechen
Speichern