Sfoglia il codice sorgente

Modification d'un document : figer l'utilisateur #166

dev
parent
commit
0077612481
1 ha cambiato i file con 30 aggiunte e 19 eliminazioni
  1. +30
    -19
      backend/views/document/_form.php

+ 30
- 19
backend/views/document/_form.php Vedi File

@@ -63,25 +63,36 @@ use common\models\Producer;
<?= Html::hiddenInput('idDocument',$model->id, ['id' => 'id-document']) ?>
<?php endif; ?>
<?= $form->field($model, 'name')->label('Nom du document') ?>
<?php $usersArray = User::findBy()->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 $model['name_legal_person'] ;
}
else {
return $model['lastname'] . ' ' . $model['name'];
}
}),
[
'@change' => 'changeUser',
'prompt' => '--',
'v-model' => 'idUser',
]
); ?>

<?php if($action == 'update'): ?>
<?= $form->field($model, 'id_user', [
'template' => '{label} <div>{input}</div>'.$model->user->getUsername(),
])->hiddenInput(); ?>
<?php else: ?>
<?php
$usersArray = User::findBy()->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 $model['name_legal_person'] ;
}
else {
return $model['lastname'] . ' ' . $model['name'];
}
}),
[
'@change' => 'changeUser',
'prompt' => '--',
'v-model' => 'idUser',
]
); ?>
<?php endif; ?>


<?= $form->field($model, 'address')->textarea(['rows' => 2, 'v-model' => 'document.address']) ?>
<?php if ($action == 'update'): ?>
<?= $form->field($model, 'comment')->textarea(['rows' => 2])->hint('Affiché en bas de la facture') ?>

Loading…
Annulla
Salva