Bladeren bron

[Administration] Listes utilisateurs : ordre + select2 #700

refactoring
Guillaume Bourgeois 2 jaren geleden
bovenliggende
commit
a51246bcf1
6 gewijzigde bestanden met toevoegingen van 16 en 39 verwijderingen
  1. +9
    -4
      backend/assets/AppAsset.php
  2. +1
    -3
      backend/views/access/index.php
  3. +1
    -1
      backend/views/distribution/index.php
  4. +2
    -11
      backend/views/document/_form.php
  5. +2
    -13
      backend/views/point-sale/_form.php
  6. +1
    -7
      backend/views/subscription/_form.php

+ 9
- 4
backend/assets/AppAsset.php Bestand weergeven

@@ -54,15 +54,20 @@ class AppAsset extends \common\components\MyAssetBundle
public function __construct() {
parent::__construct() ;

$dirJquery = 'js/jquery-ui-1.12.1.custom';
$dirSelect2 = 'js/select2-4.0.13';

// css
$this->addAsset('css','js/jquery-ui-1.12.1.custom/jquery-ui.min.css');
$this->addAsset('css','js/jquery-ui-1.12.1.custom/jquery-ui.theme.min.css') ;
$this->addAsset('css',$dirJquery.'/jquery-ui.min.css');
$this->addAsset('css',$dirJquery.'/jquery-ui.theme.min.css') ;
$this->addAsset('css',$dirSelect2.'/css/select2.min.css') ;
$this->addAsset('css','css/site.css') ;
$this->addAsset('css','css/screen.css') ;
// js
$this->addAsset('js','js/jquery-ui-1.12.1.custom/jquery-ui.min.js') ;
$this->addAsset('js',$dirJquery.'/jquery-ui.min.js') ;
$this->addAsset('js',$dirSelect2.'/js/select2.min.js') ;
$this->addAsset('js','js/backend.js') ;
}
}

+ 1
- 3
backend/views/access/index.php Bestand weergeven

@@ -53,9 +53,7 @@ $this->setTitle('Accès') ;
</div>
<div class="panel-body">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($modelAccessUserProducerForm, 'id_user')
->dropDownList(ArrayHelper::map($usersArray, 'id', function($model) { return $model->lastname.' '.$model->name; }))
->label(''); ?>
<?= $form->field($modelAccessUserProducerForm, 'id_user')->dropDownList(User::populateDropdownList(), ['class' => 'select2'])->label(''); ?>
<?= Html::submitButton('Ajouter', ['class' => 'btn btn-success']) ?>
<?php ActiveForm::end(); ?>
</div>

+ 1
- 1
backend/views/distribution/index.php Bestand weergeven

@@ -591,7 +591,7 @@ $this->setPageTitle('Distributions') ;
<label class="control-label" for="select-id-user">
Utilisateur
</label>
<select class="form-control" v-model="order.id_user" @change="userChange">
<select class="form-control select2-order-form" v-model="order.id_user" @change="userChange">
<option value="0">--</option>
<option v-for="user in users" :value="user.id_user">
<template v-if="user.name_legal_person && user.name_legal_person.length">

+ 2
- 11
backend/views/document/_form.php Bestand weergeven

@@ -69,24 +69,15 @@ use common\models\Producer;
'template' => '{label} <div>{input}</div>' . $model->user->getUsername(),
])->hiddenInput(); ?>
<?php else: ?>
<?php
$usersArray = User::findBy()->orderBy('type DESC, name_legal_person ASC, lastname ASC, name ASC')->all();
?>
<?= $form->field($model, 'id_user', [
'template' => '{label} <a href="' . Yii::$app->urlManager->createUrl(['user/create']) . '" class="btn btn-xs btn-default">Nouvel utilisateur <span class="glyphicon glyphicon-plus"></span></a><div>{input}</div>{hint}',
])
->dropDownList(
ArrayHelper::map($usersArray, 'user_id', function ($model) {
if (isset($model['name_legal_person']) && strlen($model['name_legal_person'])) {
return 'Personne morale / ' . $model['name_legal_person'];
} else {
return $model['lastname'] . ' ' . $model['name'];
}
}),
User::populateDropdownList(),
[
'@change' => 'changeUser',
'prompt' => '--',
'v-model' => 'idUser',
'class' => 'select2'
]
); ?>
<?php endif; ?>

+ 2
- 13
backend/views/point-sale/_form.php Bestand weergeven

@@ -59,19 +59,8 @@ use common\models\ProductPrice ;
<?= $form->field($model, 'id_user', [
'template' => '{label} <a href="' . Yii::$app->urlManager->createUrl(['user/create']) . '" class="btn btn-xs btn-default">Nouvel utilisateur <span class="glyphicon glyphicon-plus"></span></a><div>{input}</div>{hint}',
])
->dropDownList(
ArrayHelper::map(User::findBy()->orderBy('type DESC')->all(), 'user_id', function ($model) {
if(strlen($model['name_legal_person'])) {
return 'Personne morale / '.$model['name_legal_person'] ;
}
else {
return $model['lastname'] . ' ' . $model['name'];
}
}),
[
'prompt' => '--',
]
)->hint('Utilisé lors de la facturation'); ?>
->dropDownList(User::populateDropdownList(), ['class' => 'select2'])
->hint('Utilisé lors de la facturation'); ?>

<?php
$addHintCredit = '';

+ 1
- 7
backend/views/subscription/_form.php Bestand weergeven

@@ -53,13 +53,7 @@ use common\helpers\GlobalParam ;
<?= $form->field($model, 'id')->hiddenInput() ?>
<?php endif; ?>
<div class="col-md-5" id="bloc-select-user">
<?= $form->field($model, 'id_user')->dropDownList( ArrayHelper::map(User::find()->joinWith('userProducer')->where('user_producer.id_producer = '.GlobalParam::getCurrentProducerId())->andWhere('user_producer.active = 1')->orderBy('lastname ASC, name ASC')->all(), 'id', function($model, $defaultValue) {
if (isset($model['name_legal_person']) && strlen($model['name_legal_person'])) {
return 'Personne morale / '.$model['name_legal_person'];
} else {
return $model['lastname'] . ' ' . $model['name'];
}
}), ['prompt' => '--','class' => 'form-control user-id', ]) ?>
<?= $form->field($model, 'id_user')->dropDownList(User::populateDropdownList(), ['class' => 'select2']); ?>
</div>
<div class="col-md-1" id="or-user">
<span>OU</span>

Laden…
Annuleren
Opslaan