ソースを参照

[Administration] Utilisateur > édition : indiquer s'il est contact facturation d'un point de vente #957

feature/souke
Guillaume 1年前
コミット
a5670ef10c
4個のファイルの変更78行の追加55行の削除
  1. +2
    -0
      backend/controllers/UserController.php
  2. +62
    -55
      backend/views/user/_form.php
  3. +1
    -0
      backend/views/user/update.php
  4. +13
    -0
      common/logic/PointSale/PointSale/Repository/PointSaleRepository.php

+ 2
- 0
backend/controllers/UserController.php ファイルの表示

@@ -239,6 +239,7 @@ class UserController extends BackendController
{
$userManager = $this->getUserManager();
$producerManager = $this->getProducerManager();
$pointSaleManager = $this->getPointSaleManager();

$model = $this->findModel($id);

@@ -295,6 +296,7 @@ class UserController extends BackendController

return $this->render('update', array_merge($this->initForm($model), [
'model' => $model,
'pointSaleBillingArray' => $pointSaleManager->findByBillingUser($model)
]));
}


+ 62
- 55
backend/views/user/_form.php ファイルの表示

@@ -49,64 +49,71 @@ $producerManager = $this->getProducerManager();

<div class="user-form" id="app-user-form">

<div class="col-md-8">
<?php $form = ActiveForm::begin([
'enableClientValidation' => false
]); ?>
<?= $form->field($model, 'type')
->dropDownList( $userManager->getTypeChoicesArray(), [
'v-model' => 'type'
]) ; ?>
<?= $form->field($model, 'name_legal_person', ['options' => ['v-show' => "type == 'legal-person'"]])->textInput() ?>
<?= $form->field($model, 'lastname')->textInput() ?>
<?= $form->field($model, 'name')->textInput() ?>
<?= $form->field($model, 'phone')->textInput() ?>
<?= $form->field($model, 'email')->textInput() ?>
<?= $form->field($model, 'address')->textarea() ?>
<?php if($producerManager->getConfig('option_export_evoliz')): ?>
<?= $form->field($model, 'evoliz_code')->textInput() ?>
<?php endif; ?>
<?= $form->field($model, 'points_sale')->checkboxlist(
ArrayHelper::map($pointsSaleArray, 'id', function ($pointSale) use ($model) {
$commentUserPointSale = isset($pointSale->userPointSale[0]) ? $pointSale->userPointSale[0]->comment : '';
$html = Html::encode($pointSale->name);
if ($pointSale->restricted_access) {
$html .= '<input type="text" placeholder="Commentaire" class="form-control" name="User[comment_point_sale_' . $pointSale->id . ']" value="' . (($model->id) ? Html::encode($commentUserPointSale) : '') . '" />';
}
return $html;
}), [
'encode' => false
]);
?>
<?= $form->field($model, 'user_groups')->checkboxlist(
ArrayHelper::map($userGroupsArray, 'id', function ($userGroup) use ($model) {
return Html::encode($userGroup->name);
}), [
'encode' => false
]);
?>
<?php /* $form->field($model, 'product_price_percent')
<div class="col-md-8">
<?php $form = ActiveForm::begin([
'enableClientValidation' => false
]); ?>
<?= $form->field($model, 'type')
->dropDownList($userManager->getTypeChoicesArray(), [
'v-model' => 'type'
]); ?>
<?= $form->field($model, 'name_legal_person', ['options' => ['v-show' => "type == 'legal-person'"]])->textInput() ?>
<?= $form->field($model, 'lastname')->textInput() ?>
<?= $form->field($model, 'name')->textInput() ?>
<?= $form->field($model, 'phone')->textInput() ?>
<?= $form->field($model, 'email')->textInput() ?>
<?= $form->field($model, 'address')->textarea() ?>
<?php if ($producerManager->getConfig('option_export_evoliz')): ?>
<?= $form->field($model, 'evoliz_code')->textInput() ?>
<?php endif; ?>
<?= $form->field($model, 'points_sale')->checkboxlist(
ArrayHelper::map($pointsSaleArray, 'id', function ($pointSale) use ($model) {
$commentUserPointSale = isset($pointSale->userPointSale[0]) ? $pointSale->userPointSale[0]->comment : '';
$html = Html::encode($pointSale->name);
if ($pointSale->restricted_access) {
$html .= '<input type="text" placeholder="Commentaire" class="form-control" name="User[comment_point_sale_' . $pointSale->id . ']" value="' . (($model->id) ? Html::encode($commentUserPointSale) : '') . '" />';
}
return $html;
}), [
'encode' => false
]);
?>
<?= $form->field($model, 'user_groups')->checkboxlist(
ArrayHelper::map($userGroupsArray, 'id', function ($userGroup) use ($model) {
return Html::encode($userGroup->name);
}), [
'encode' => false
]);
?>
<?php /* $form->field($model, 'product_price_percent')
->dropDownList( ProductPrice::percentValues(), [])->hint('Pourcentage appliqué aux prix de chaque produit pour cet utilisateur.');*/ ?>

<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Ajouter' : 'Modifier', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>

<?php ActiveForm::end(); ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Ajouter' : 'Modifier', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>

<div class="col-md-4">
<h2>Mot de passe</h2>
<?php $form = ActiveForm::begin(); ?>
<div class="form-group">
<?= Html::submitButton('Envoyer un nouveau mot de passe', ['class' => 'btn btn-primary', 'name' => 'submit_new_password', 'value' => 1]) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php ActiveForm::end(); ?>
</div>

<div class="col-md-4">

<?php if($pointSaleBillingArray && count($pointSaleBillingArray) > 0): ?>
<h3>Facturation</h3>
<?php foreach($pointSaleBillingArray as $pointSale): ?>
<a href="<?= Yii::$app->urlManager->createUrl(['point-sale/update', 'id' => $pointSale->id]) ?>"><?= $pointSale->name ?></a><br />
<?php endforeach; ?>
<?php endif; ?>

<h3>Mot de passe</h3>
<?php $form = ActiveForm::begin(); ?>
<div class="form-group">
<?= Html::submitButton('Envoyer un nouveau mot de passe', ['class' => 'btn btn-primary', 'name' => 'submit_new_password', 'value' => 1]) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>

+ 1
- 0
backend/views/user/update.php ファイルの表示

@@ -50,5 +50,6 @@ $this->addBreadcrumb('Modifier') ;
'model' => $model,
'pointsSaleArray' => $pointsSaleArray,
'userGroupsArray' => $userGroupsArray,
'pointSaleBillingArray' => $pointSaleBillingArray
]) ?>
</div>

+ 13
- 0
common/logic/PointSale/PointSale/Repository/PointSaleRepository.php ファイルの表示

@@ -7,6 +7,7 @@ use common\logic\AbstractRepository;
use common\logic\Distribution\Distribution\Model\Distribution;
use common\logic\PointSale\PointSale\Model\PointSale;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\User\User\Model\User;

class PointSaleRepository extends AbstractRepository
{
@@ -96,4 +97,16 @@ class PointSaleRepository extends AbstractRepository

return $pointSalesArrayDropdown;
}

public function findByBillingUser(User $user)
{
return PointSale::find()
->where([
'id_producer' => GlobalParam::getCurrentProducerId(),
'status' => 1,
'id_user' => $user->id
])->orderBy(
'name ASC'
)->all();
}
}

読み込み中…
キャンセル
保存