소스 검색

[backend] Distributions : Lors ajout / modification d'une commande, sélection automatique du point de vente favoris pour un utilisateur donné.

refactoring
부모
커밋
fdced130d9
4개의 변경된 파일20개의 추가작업 그리고 8개의 파일을 삭제
  1. +8
    -0
      backend/controllers/DistributionController.php
  2. +7
    -7
      backend/views/distribution/index.php
  3. +4
    -0
      backend/web/js/vuejs/distribution-index.js
  4. +1
    -1
      common/models/User.php

+ 8
- 0
backend/controllers/DistributionController.php 파일 보기

@@ -291,6 +291,14 @@ class DistributionController extends BackendController
// utilisateurs
$usersArray = User::findBy()->all() ;
foreach($usersArray as &$user) {
$userObject = User::findOne(['id' => $user['user_id']]) ;
$favoritePointSale = $userObject->getFavoritePointSale() ;
if($favoritePointSale) {
$user['id_point_sale_favorite'] = $favoritePointSale->id ;
}
}
$json['users'] = $usersArray ;
// une production de la semaine activée ou non

+ 7
- 7
backend/views/distribution/index.php 파일 보기

@@ -455,12 +455,6 @@ $this->setPageTitle('Distributions') ;
</ul>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="control-label" for="select-id-point-sale">Point de vente</label>
<select class="form-control" id="select-id-point-sale" v-model="order.id_point_sale">
<option v-for="pointSale in pointsSale" v-if="pointSale.pointSaleDistribution[0].delivery == 1" :value="pointSale.id">{{ pointSale.name }}</option>
</select>
</div>
<div class="form-group">
<a v-if="producer.credit && order.id_user > 0" class="btn btn-xs btn-primary btn-credit" :href="baseUrl+'/user/credit?id='+user.id_user" v-for="user in users" v-if="user.id_user == order.id_user">{{ parseFloat(user.credit).toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+'&nbsp;€' }}</a>
<label class="control-label" for="select-id-user">
@@ -468,10 +462,16 @@ $this->setPageTitle('Distributions') ;
</label>
<select class="form-control" v-model="order.id_user">
<option value="0">--</option>
<option v-for="user in users" :value="user.id_user">{{ user.lastname +' '+ user.name }}</option>
<option v-for="user in users" :value="user.id_user" @click="userChange" :data-id-point-sale-favorite="user.id_point_sale_favorite">{{ user.lastname +' '+ user.name }}</option>
</select>
<input v-model="order.username" type="text" class="form-control" placeholder="Ou saisissez ici le nom de l'utilisateur" />
</div>
<div class="form-group">
<label class="control-label" for="select-id-point-sale">Point de vente</label>
<select class="form-control" id="select-id-point-sale" v-model="order.id_point_sale">
<option v-for="pointSale in pointsSale" v-if="pointSale.pointSaleDistribution[0].delivery == 1" :value="pointSale.id">{{ pointSale.name }}</option>
</select>
</div>
<div class="form-group">
<label class="control-label" for="textarea-comment">Commentaire</label>
<textarea class="form-control" id="textarea-comment" v-model="order.comment"></textarea>

+ 4
- 0
backend/web/js/vuejs/distribution-index.js 파일 보기

@@ -512,6 +512,10 @@ Vue.component('order-form',{
var theQuantity = parseFloat(this.order.productOrder[id_product].quantity) + parseFloat(quantity) ;
Vue.set(this.order.productOrder, id_product, {quantity: theQuantity, unit: this.order.productOrder[id_product].unit});
}
},
userChange: function(event) {
var idPointSaleFavorite = event.currentTarget.getAttribute('data-id-point-sale-favorite') ;
this.order.id_point_sale = idPointSaleFavorite ;
}
}
}) ;

+ 1
- 1
common/models/User.php 파일 보기

@@ -608,7 +608,7 @@ class User extends ActiveRecordCommon implements IdentityInterface
}
}
if($pointSale) {
if(isset($pointSale)) {
return $pointSale ;
}

Loading…
취소
저장