@@ -48,10 +48,16 @@ $this->addBreadcrumb($this->getTitle()) ; | |||
?> | |||
<script> | |||
var appInitValues = { | |||
isAdmin: <?= (int) User::isCurrentAdmin() ?> | |||
}; | |||
</script> | |||
<div class="user-update" id="app-producer-update"> | |||
<div id="nav-params"> | |||
<button v-for="section in sectionsArray" :class="'btn '+((currentSection == section.name) ? 'btn-primary' : 'btn-default')" @click="changeSection(section)"> | |||
<button v-for="section in sectionsArray" v-if="!section.isAdminSection || (section.isAdminSection && isAdmin)" :class="'btn '+((currentSection == section.name) ? 'btn-primary' : 'btn-default')" @click="changeSection(section)"> | |||
{{ section.nameDisplay }} | |||
<span class="glyphicon glyphicon-triangle-bottom"></span> | |||
</button> | |||
@@ -459,7 +465,18 @@ $this->addBreadcrumb($this->getTitle()) ; | |||
->textarea(['rows' => 15]) ?> | |||
</div> | |||
</div> | |||
<?php if(User::isCurrentAdmin()): ?> | |||
<div v-show="currentSection == 'administration'" class="panel panel-default"> | |||
<div class="panel-heading"> | |||
<h3 class="panel-title">Administration</h3> | |||
</div> | |||
<div class="panel-body"> | |||
<?= $form->field($model, 'option_billing_frequency') | |||
->dropDownList(Producer::getBillingFrequencyPopulateDropdown()); ?> | |||
</div> | |||
</div> | |||
<?php endif; ?> | |||
<div class="form-group"> | |||
<?= Html::submitButton('Mettre à jour', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> |
@@ -37,42 +37,57 @@ termes. | |||
var app = new Vue({ | |||
el: '#app-producer-update', | |||
data: { | |||
currentSection: 'general', | |||
sectionsArray: [ | |||
{ | |||
name: 'general', | |||
nameDisplay: 'Général' | |||
}, | |||
{ | |||
name: 'tableau-bord', | |||
nameDisplay: 'Tableau de bord' | |||
}, | |||
{ | |||
name: 'prise-commande', | |||
nameDisplay: 'Prise de commande' | |||
}, | |||
{ | |||
name: 'abonnements', | |||
nameDisplay: 'Abonnements' | |||
}, | |||
{ | |||
name: 'credit-payment', | |||
nameDisplay: 'Crédit' | |||
}, | |||
{ | |||
name: 'infos', | |||
nameDisplay: 'Informations légales' | |||
}, | |||
{ | |||
name: 'logiciels-caisse', | |||
nameDisplay: 'Logiciels de caisse' | |||
}, | |||
{ | |||
name: 'facturation', | |||
nameDisplay: 'Facturation' | |||
} | |||
] | |||
data() { | |||
return Object.assign({ | |||
currentSection: 'general', | |||
sectionsArray: [ | |||
{ | |||
name: 'general', | |||
nameDisplay: 'Général', | |||
isAdminSection: 0 | |||
}, | |||
{ | |||
name: 'tableau-bord', | |||
nameDisplay: 'Tableau de bord', | |||
isAdminSection: 0 | |||
}, | |||
{ | |||
name: 'prise-commande', | |||
nameDisplay: 'Prise de commande', | |||
isAdminSection: 0 | |||
}, | |||
{ | |||
name: 'abonnements', | |||
nameDisplay: 'Abonnements', | |||
isAdminSection: 0 | |||
}, | |||
{ | |||
name: 'credit-payment', | |||
nameDisplay: 'Crédit', | |||
isAdminSection: 0 | |||
}, | |||
{ | |||
name: 'infos', | |||
nameDisplay: 'Informations légales', | |||
isAdminSection: 0 | |||
}, | |||
{ | |||
name: 'logiciels-caisse', | |||
nameDisplay: 'Logiciels de caisse', | |||
isAdminSection: 0 | |||
}, | |||
{ | |||
name: 'facturation', | |||
nameDisplay: 'Facturation', | |||
isAdminSection: 0 | |||
}, | |||
{ | |||
name: 'administration', | |||
nameDisplay: 'Administration', | |||
isAdminSection: 1 | |||
} | |||
] | |||
}, window.appInitValues); | |||
}, | |||
methods: { | |||
changeSection: function(section) { |
@@ -98,6 +98,10 @@ class Producer extends ActiveRecordCommon | |||
const ORDER_ENTRY_POINT_DATE = 'date'; | |||
const ORDER_ENTRY_POINT_POINT_SALE = 'point-sale'; | |||
const BILLING_FREQUENCY_MONTHLY = 'monthly'; | |||
const BILLING_FREQUENCY_QUARTERLY = 'quarterly'; | |||
const BILLING_FREQUENCY_BIANNUAL = 'biannual'; | |||
var $secret_key_payplug; | |||
/** | |||
@@ -253,7 +257,8 @@ class Producer extends ActiveRecordCommon | |||
'document_invoice_prefix', | |||
'document_invoice_first_reference', | |||
'document_delivery_note_prefix', | |||
'document_delivery_note_first_reference' | |||
'document_delivery_note_first_reference', | |||
'option_billing_frequency', | |||
], | |||
'string', | |||
'max' => 255 | |||
@@ -267,7 +272,6 @@ class Producer extends ActiveRecordCommon | |||
'type' => 'number', | |||
'message' => 'Prix libre doit être supérieur ou égal à 0' | |||
], | |||
//[['option_dashboard_date_start', 'option_dashboard_date_end'], 'date', 'format' => 'php:d/m/Y'], | |||
[['option_dashboard_date_start', 'option_dashboard_date_end'], 'safe'], | |||
]; | |||
} | |||
@@ -363,7 +367,8 @@ class Producer extends ActiveRecordCommon | |||
'option_delivery' => 'Proposer la livraison à domicile', | |||
'option_display_export_grid' => 'Afficher l\'export grille dans les distributions', | |||
'document_display_product_description' => 'Documents : afficher la description des produits', | |||
'option_notify_producer_order_summary' => 'Recevoir les récapitulatifs de commande par email' | |||
'option_notify_producer_order_summary' => 'Recevoir les récapitulatifs de commande par email', | |||
'option_billing_frequency' => 'Fréquence de facturation' | |||
]; | |||
} | |||
@@ -832,5 +837,13 @@ class Producer extends ActiveRecordCommon | |||
return $this->isOnlinePaymentActive() && $this->option_online_payment_type == 'order' ; | |||
} | |||
public static function getBillingFrequencyPopulateDropdown() | |||
{ | |||
return [ | |||
self::BILLING_FREQUENCY_MONTHLY => 'Mensuelle', | |||
self::BILLING_FREQUENCY_QUARTERLY => 'Trimestrielle', | |||
self::BILLING_FREQUENCY_BIANNUAL => 'Biannuelle', | |||
]; | |||
} | |||
} | |||
@@ -0,0 +1,27 @@ | |||
<?php | |||
use yii\db\Migration; | |||
use yii\db\Schema; | |||
use common\models\Producer; | |||
/** | |||
* Class m220915_072309_producer_add_option_billing_frequency | |||
*/ | |||
class m220915_072309_producer_add_option_billing_frequency extends Migration | |||
{ | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function safeUp() | |||
{ | |||
$this->addColumn('producer', 'option_billing_frequency', Schema::TYPE_STRING.' DEFAULT \''.Producer::BILLING_FREQUENCY_MONTHLY.'\''); | |||
} | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function safeDown() | |||
{ | |||
$this->dropColumn('producer','option_billing_frequency'); | |||
} | |||
} |