Bladeren bron

[backend] Tiller : page de configuration

dev
Guillaume Bourgeois 5 jaren geleden
bovenliggende
commit
85fff2917e
4 gewijzigde bestanden met toevoegingen van 35 en 3 verwijderingen
  1. +3
    -0
      backend/controllers/ProducerController.php
  2. +20
    -1
      backend/views/producer/update.php
  3. +4
    -0
      backend/web/js/vuejs/producer-update.js
  4. +8
    -2
      common/models/Producer.php

+ 3
- 0
backend/controllers/ProducerController.php Bestand weergeven

@@ -117,6 +117,9 @@ class ProducerController extends BackendController
Yii::$app->getSession()->setFlash('success', 'Paramètres mis à jour.');
return $this->redirect(['update', 'id' => $model->id, 'edit_ok' => true]);
} else {
if($model->load(Yii::$app->request->post())) {
Yii::$app->getSession()->setFlash('error', 'Le formulaire comporte des erreurs.');
}
return $this->render('update', [
'model' => $model,
]);

+ 20
- 1
backend/views/producer/update.php Bestand weergeven

@@ -57,7 +57,9 @@ $this->addBreadcrumb($this->getTitle()) ;
</div>
<div class="user-form">
<?php $form = ActiveForm::begin(); ?>
<?php $form = ActiveForm::begin([
'enableClientValidation' => false,
]); ?>
<div>
<div v-show="currentSection == 'general'" class="panel panel-default">
<div class="panel-heading">
@@ -227,6 +229,23 @@ $this->addBreadcrumb($this->getTitle()) ;
->hint('') ?>
</div>
</div>
<div v-show="currentSection == 'logiciels-caisse'" class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Logiciels de caisse</h3>
</div>
<div class="panel-body">
<?= $form->field($model, 'tiller')
->dropDownList([
0 => 'Non',
1 => 'Oui'
], [])
->label('Synchroniser avec Tiller'); ?>
<?= $form->field($model, 'tiller_provider_token') ; ?>
<?= $form->field($model, 'tiller_restaurant_token') ; ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton('Mettre à jour', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

+ 4
- 0
backend/web/js/vuejs/producer-update.js Bestand weergeven

@@ -59,6 +59,10 @@ var app = new Vue({
{
name: 'infos',
nameDisplay: 'Informations légales'
},
{
name: 'logiciels-caisse',
nameDisplay: 'Logiciels de caisse'
}
]
},

+ 8
- 2
common/models/Producer.php Bestand weergeven

@@ -103,6 +103,9 @@ class Producer extends ActiveRecordCommon
{
return [
[['name','type'], 'required'],
[['tiller_provider_token','tiller_restaurant_token'], 'required', 'when' => function($model) {
return $model->tiller == true ;
}],
[['order_deadline', 'order_delay'], 'integer'],
['order_deadline', 'in', 'range' => [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]],
['order_delay', 'in', 'range' => [1, 2, 3, 4, 5, 6, 7]],
@@ -113,8 +116,8 @@ class Producer extends ActiveRecordCommon
$this->addError($attribute, 'Ce code est déjà utilisé par un autre producteur.');
}
}],
[['description','mentions','gcs','order_infos','slug','secret_key_payplug','background_color_logo','option_behavior_cancel_order'], 'string'],
[['negative_balance', 'credit', 'active','online_payment','user_manage_subscription', 'option_allow_user_gift','use_credit_checked_default'], 'boolean'],
[['description','mentions','gcs','order_infos','slug','secret_key_payplug','background_color_logo','option_behavior_cancel_order','tiller_provider_token','tiller_restaurant_token'], 'string'],
[['negative_balance', 'credit', 'active','online_payment','user_manage_subscription', 'option_allow_user_gift','use_credit_checked_default','tiller'], 'boolean'],
[['name', 'siret', 'logo', 'photo', 'postcode', 'city', 'code','type','credit_functioning','option_behavior_cancel_order'], 'string', 'max' => 255],
[['free_price', 'credit_limit_reminder','credit_limit'], 'double'],
['free_price', 'compare', 'compareValue' => 0, 'operator' => '>=', 'type' => 'number', 'message' => 'Prix libre doit être supérieur ou égal à 0'],
@@ -157,6 +160,9 @@ class Producer extends ActiveRecordCommon
'use_credit_checked_default' => 'Cocher par défaut l\'option "Utiliser mon crédit" lors de la commande de l\'utilisateur',
'background_color_logo' => 'Couleur de fond du logo',
'option_behavior_cancel_order' => 'Comportement lors de la suppression d\'une commande',
'tiller' => 'Tiller',
'tiller_provider_token' => 'Token provider',
'tiller_restaurant_token' => 'Token restaurant',
];
}


Laden…
Annuleren
Opslaan