?> | ?> | ||||
<script> | |||||
var appInitValues = { | |||||
isAdmin: <?= (int) User::isCurrentAdmin() ?> | |||||
}; | |||||
</script> | |||||
<div class="user-update" id="app-producer-update"> | <div class="user-update" id="app-producer-update"> | ||||
<div id="nav-params"> | <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 }} | {{ section.nameDisplay }} | ||||
<span class="glyphicon glyphicon-triangle-bottom"></span> | <span class="glyphicon glyphicon-triangle-bottom"></span> | ||||
</button> | </button> | ||||
->textarea(['rows' => 15]) ?> | ->textarea(['rows' => 15]) ?> | ||||
</div> | </div> | ||||
</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"> | <div class="form-group"> | ||||
<?= Html::submitButton('Mettre à jour', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | <?= Html::submitButton('Mettre à jour', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> |
var app = new Vue({ | var app = new Vue({ | ||||
el: '#app-producer-update', | 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: { | methods: { | ||||
changeSection: function(section) { | changeSection: function(section) { |
const ORDER_ENTRY_POINT_DATE = 'date'; | const ORDER_ENTRY_POINT_DATE = 'date'; | ||||
const ORDER_ENTRY_POINT_POINT_SALE = 'point-sale'; | 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; | var $secret_key_payplug; | ||||
/** | /** | ||||
'document_invoice_prefix', | 'document_invoice_prefix', | ||||
'document_invoice_first_reference', | 'document_invoice_first_reference', | ||||
'document_delivery_note_prefix', | 'document_delivery_note_prefix', | ||||
'document_delivery_note_first_reference' | |||||
'document_delivery_note_first_reference', | |||||
'option_billing_frequency', | |||||
], | ], | ||||
'string', | 'string', | ||||
'max' => 255 | 'max' => 255 | ||||
'type' => 'number', | 'type' => 'number', | ||||
'message' => 'Prix libre doit être supérieur ou égal à 0' | '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'], | [['option_dashboard_date_start', 'option_dashboard_date_end'], 'safe'], | ||||
]; | ]; | ||||
} | } | ||||
'option_delivery' => 'Proposer la livraison à domicile', | 'option_delivery' => 'Proposer la livraison à domicile', | ||||
'option_display_export_grid' => 'Afficher l\'export grille dans les distributions', | 'option_display_export_grid' => 'Afficher l\'export grille dans les distributions', | ||||
'document_display_product_description' => 'Documents : afficher la description des produits', | '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' | |||||
]; | ]; | ||||
} | } | ||||
return $this->isOnlinePaymentActive() && $this->option_online_payment_type == 'order' ; | 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', | |||||
]; | |||||
} | |||||
} | } | ||||
<?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'); | |||||
} | |||||
} |