add city, customer and card model + crud
This commit is contained in:
29
backend/views/card/_form.php
Normal file
29
backend/views/card/_form.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use common\models\Card;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Card */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="card-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'number')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'status')->dropDownList(Card::statuses()) ?>
|
||||
|
||||
<?= $form->field($model, 'type')->dropDownList(Card::types()) ?>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/card', 'Create') : Yii::t('common/card', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
60
backend/views/card/_search.php
Normal file
60
backend/views/card/_search.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use common\models\Card;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\CardSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
<?php
|
||||
|
||||
function mkOptions($options){
|
||||
|
||||
$all = ['' => Yii::t('common/product','All' ) ];
|
||||
|
||||
$o = $all + $options;
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
||||
$typeOptions = mkOptions(Card::types());
|
||||
$statusOptions = mkOptions(Card::statuses());
|
||||
|
||||
|
||||
?>
|
||||
<div class="card-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'number') ?>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'status')->dropDownList($statusOptions) ?>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'type')->dropDownList($typeOptions) ?>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'searchCustomerName')->textInput() ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('common/card', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
21
backend/views/card/create.php
Normal file
21
backend/views/card/create.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Card */
|
||||
|
||||
$this->title = Yii::t('common/card', 'Create Card');
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/card', 'Cards'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="card-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
52
backend/views/card/index.php
Normal file
52
backend/views/card/index.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\models\CardSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = Yii::t('common/card', 'Cards');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="card-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/card', 'Create Card'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
[
|
||||
'attribute' => 'number',
|
||||
'value' => 'number'
|
||||
],
|
||||
[
|
||||
'attribute' => 'status',
|
||||
'value' => 'statusHuman'
|
||||
],
|
||||
[
|
||||
'attribute' => 'type',
|
||||
'value' => 'typeHuman'
|
||||
],
|
||||
[
|
||||
'attribute' => 'customerName',
|
||||
'value' => 'customerName'
|
||||
],
|
||||
'updated_at:datetime',
|
||||
|
||||
[
|
||||
'class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view}{update}'
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
23
backend/views/card/update.php
Normal file
23
backend/views/card/update.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Card */
|
||||
|
||||
$this->title = Yii::t('common/card', 'Update {modelClass}: ', [
|
||||
'modelClass' => 'Card',
|
||||
]) . ' ' . $model->id_card;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/card', 'Cards'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->number, 'url' => ['view', 'id' => $model->id_card]];
|
||||
$this->params['breadcrumbs'][] = Yii::t('common/card', 'Update');
|
||||
?>
|
||||
<div class="card-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
32
backend/views/card/view.php
Normal file
32
backend/views/card/view.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Card */
|
||||
|
||||
$this->title = Yii::t('common/card','Card: ').$model->number;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/card', 'Cards'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="card-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/card', 'Update'), ['update', 'id' => $model->id_card], ['class' => 'btn btn-primary']) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'number',
|
||||
['attribute' => 'status', 'value' => $model->statusHuman],
|
||||
['attribute' => 'type', 'value' => $model->typeHuman],
|
||||
'created_at:datetime',
|
||||
'updated_at:datetime',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user