fitness-web/frontend/views/contract/_make_contract.php

151 lines
3.8 KiB
PHP

<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\TicketType;
use common\components\Helper;
use frontend\components\HtmlHelper;
use kartik\widgets\DatePicker;
use common\models\Transfer;
use common\models\Discount;
use frontend\assets\ContractMakeAsset;
/* @var $this yii\web\View */
/* @var $model common\models\Contract */
/* @var $form yii\widgets\ActiveForm */
?>
<?php
ContractMakeAsset::register($this);
$types = TicketType::findAll(['status' => TicketType::STATUS_ACTIVE ,'installment_enabled' => '1']);
$typeOptions = TicketType::modelsToArray($types);
$types = HtmlHelper::mkTicketTypeOptions($types);
$discounts = Discount::readTicketDiscounts();
$discountOptions = Discount::modelsToArray($discounts,[]);
$discounts = ['' => ''] + HtmlHelper::mkDiscountOptions($discounts);
$options = [];
$options['ticket_types'] = $typeOptions;
$options['discounts'] = $discountOptions;
$this->registerJs(' contract_make.init( '. json_encode($options) .' );');
?>
<h1>Szerződés létrehozása</h1>
<div class="contract-form">
<?php $form = ActiveForm::begin(); ?>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'name')->textInput() ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'mothername')->textInput() ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'birthdate')->widget(DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
]) ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'birthplace')->textInput() ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'zip')->textInput() ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'city')->textInput() ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'address')->textInput() ?>
</div>
<div class="col-md-6">
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'bank_name')->textInput() ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'bank_account')->textInput() ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'phone')->textInput() ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'email')->textInput() ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'ticket_type')->dropDownList($types) ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'started_at')->widget(\kartik\date\DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'payment_method')->dropDownList(Transfer::paymentMethods()) ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'id_discount')->dropDownList( $discounts ) ?>
</div>
</div>
<p>
Figyelem: A szerződés létrehozásakor a szerződés első bérlete bekerül a vásálró kosarába.
</p>
<table class="table table-striped">
<tr>
<td>Bérlet ára</td>
<td class="ticket-price"></td>
</tr>
<tr>
<td>Összesen</td>
<td class="ticket-total"></td>
</tr>
</table>
<div class="form-group">
<?= Html::submitButton( Yii::t('common/contract', 'Szerződés és első bérlet létrehozása') , ['class' => 'btn btn-success' ]) ?>
</div>
<?php ActiveForm::end(); ?>
</div>