Kaynağa Gözat

Affichage des informations du producteur

refactoring
Guillaume Bourgeois 5 yıl önce
ebeveyn
işleme
d976e84205
5 değiştirilmiş dosya ile 29 ekleme ve 26 silme
  1. +7
    -0
      producer/controllers/OrderController.php
  2. +9
    -6
      producer/views/order/order.php
  3. +3
    -8
      producer/web/css/screen.css
  4. +6
    -2
      producer/web/js/vuejs/order-order.js
  5. +4
    -10
      producer/web/sass/order/_order.scss

+ 7
- 0
producer/controllers/OrderController.php Dosyayı Görüntüle

@@ -40,6 +40,7 @@ namespace producer\controllers;

use common\models\ProductDistribution ;
use common\models\User ;
use common\models\Producer ;
use DateTime;

class OrderController extends ProducerBaseController
@@ -590,6 +591,7 @@ class OrderController extends ProducerBaseController
$format = 'Y-m-d' ;
$dateObject = DateTime::createFromFormat($format, $date);
// Distributions
$distributionsArray = Distribution::searchAll([
'active' => 1
], [
@@ -598,6 +600,11 @@ class OrderController extends ProducerBaseController
]) ;
$json['distributions'] = $distributionsArray ;
// Producteur
$json['producer'] = Producer::searchOne([
'id' => $this->getProducer()->id
]) ;
if($dateObject && $dateObject->format($format) === $date) {
// distribution
$distribution = Distribution::initDistribution($date) ;

+ 9
- 6
producer/views/order/order.php Dosyayı Görüntüle

@@ -43,7 +43,7 @@ $this->setTitle('Commander') ;
?>

<div id="app-order-order">
<div class="col-md-9">
<div :class="(producer.order_infos.length) ? 'col-md-9' : 'col-md-12'">
<div id="steps">
<ul>
<li id="step-date" :class="'col-md-3 '+((step == 'date') ? 'active' : '')">
@@ -158,7 +158,7 @@ $this->setTitle('Commander') ;
</tr>
<tr>
<td colspan="3"></td>
<td>{{ priceTotal() }}</td>
<td class="price-total">{{ priceTotal() }}</td>
</tr>
</tbody>
</table>
@@ -175,13 +175,16 @@ $this->setTitle('Commander') ;
</div>
</div>
</div>
<div id="summary" class="col-md-3" v-if="date">
<div id="infos" class="col-md-3" v-if="producer.order_infos.length">
<div class="panel panel-default">
<div class="panel-heading">
Résumé
Informations
</div>
<div class="panel-body">
<span class="glyphicon glyphicon-time"></span> {{ dateFormat }}
{{ producer.order_infos }}
<!--<span class="glyphicon glyphicon-time"></span> {{ dateFormat }}
<div v-if="pointSaleActive">
<span class="glyphicon glyphicon-map-marker"></span>
{{ pointSaleActive.name }}
@@ -197,7 +200,7 @@ $this->setTitle('Commander') ;
<div class="products" v-if="products.length && oneProductOrdered()">
<span class="glyphicon glyphicon-euro"></span>
{{ priceTotal() }}
</div>
</div>-->
</div>
</div>
</div>

+ 3
- 8
producer/web/css/screen.css Dosyayı Görüntüle

@@ -1242,14 +1242,9 @@ termes.
text-align: center;
}
/* line 72, ../sass/order/_order.scss */
.order-order #app-order-order #summary .glyphicon {
margin-right: 11px;
}
/* line 76, ../sass/order/_order.scss */
.order-order #app-order-order #summary .products ul {
padding-left: 30px;
position: relative;
top: -19px;
.order-order #app-order-order #infos .panel-body {
padding-top: 0px;
white-space: pre-line;
}

/**

+ 6
- 2
producer/web/js/vuejs/order-order.js Dosyayı Görüntüle

@@ -3,6 +3,7 @@ var app = new Vue({
el: '#app-order-order',
data: {
step: 'date',
producer: null,
date: null,
dateFormat: null,
pointsSale: [],
@@ -73,10 +74,10 @@ var app = new Vue({
},
formatPrice: function(price) {
var isNumberRegExp = new RegExp(/^[-+]?[0-9]+(\.[0-9]+)*$/);
if(isNumberRegExp.test(price)) {
if(isNumberRegExp.test(price) && price > 0) {
return Number(price).toFixed(2).replace('.',',')+' €' ;
}
return '' ;
return '--' ;
},
getPointSale: function(idPointSale) {
for(var key in this.pointsSale) {
@@ -88,6 +89,8 @@ var app = new Vue({
init: function() {
axios.get("ajax-infos",{params: {date : this.getDate()}})
.then(response => {
this.producer = response.data.producer ;
this.calendar.attrs = [] ;
var distributions = response.data.distributions ;
if(distributions.length) {
@@ -151,6 +154,7 @@ var app = new Vue({
price += this.products[key].quantity_form * this.products[key].price ;
}
}
return this.formatPrice(price) ;
}
}

+ 4
- 10
producer/web/sass/order/_order.scss Dosyayı Görüntüle

@@ -68,16 +68,10 @@
}
}
#summary {
.glyphicon {
margin-right: 11px ;
}
.products {
ul {
padding-left: 30px ;
position: relative ;
top: -19px ;
}
#infos {
.panel-body {
padding-top: 0px ;
white-space: pre-line ;
}
}
}

Yükleniyor…
İptal
Kaydet