Commit 788e30a1 by Junaid Rahman pv

modified tables and added extra functions

parent 1e394749
...@@ -12,48 +12,142 @@ use yii\widgets\ActiveForm; ...@@ -12,48 +12,142 @@ use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(); ?> <?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'category_id')->textInput() ?> <div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="info">
<div class="page-header">
<h3>Info</h3>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'district_id')->textInput() ?> <?= $form->field($model, 'category_id')->textInput() ?>
<?= $form->field($model, 'domain_name')->textInput(['maxlength' => true]) ?> </div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'district_id')->textInput() ?>
<?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?> </div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'address')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'domain_name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'landmark')->textInput(['maxlength' => true]) ?> </div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'mobile_no')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'toll_free_no')->textInput(['maxlength' => true]) ?> </div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'contact_no')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'fax')->textInput(['maxlength' => true]) ?> </div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'address')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'description')->textarea(['rows' => 6]) ?> </div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'logo_base_url')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'landmark')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'logo_path')->textInput(['maxlength' => true]) ?> </div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'latitude')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'mobile_no')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'logitude')->textInput(['maxlength' => true]) ?> </div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'status')->textInput() ?> <?= $form->field($model, 'toll_free_no')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'created_at')->textInput() ?> </div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'updated_at')->textInput() ?> <?= $form->field($model, 'contact_no')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'fax')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'description')->textarea(['rows' => 6]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'logo_base_url')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'logo_path')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'latitude')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'logitude')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'status')->dropDownList($model::statuses()) ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend',
'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div> </div>
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
......
...@@ -12,7 +12,6 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -12,7 +12,6 @@ $this->params['breadcrumbs'][] = $this->title;
?> ?>
<div class="business-create"> <div class="business-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [ <?= $this->render('_form', [
'model' => $model, 'model' => $model,
......
...@@ -24,7 +24,7 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -24,7 +24,7 @@ $this->params['breadcrumbs'][] = $this->title;
'columns' => [ 'columns' => [
['class' => 'yii\grid\SerialColumn'], ['class' => 'yii\grid\SerialColumn'],
'id', //'id',
'category_id', 'category_id',
'district_id', 'district_id',
'domain_name', 'domain_name',
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use common\models\State;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\District */ /* @var $model common\models\District */
...@@ -12,20 +14,43 @@ use yii\widgets\ActiveForm; ...@@ -12,20 +14,43 @@ use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(); ?> <?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'state_id')->textInput() ?> <div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="info">
<div class="page-header">
<h3>Info</h3>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'state_id')->dropDownList(ArrayHelper::map(State::find()->all(), 'id', 'name')) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?php echo $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?php echo $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'status')->dropDownList($model::statuses()) ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend',
'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
</div>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'status')->textInput() ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div> </div>
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
......
...@@ -12,7 +12,6 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -12,7 +12,6 @@ $this->params['breadcrumbs'][] = $this->title;
?> ?>
<div class="district-create"> <div class="district-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [ <?= $this->render('_form', [
'model' => $model, 'model' => $model,
......
...@@ -24,11 +24,18 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -24,11 +24,18 @@ $this->params['breadcrumbs'][] = $this->title;
'columns' => [ 'columns' => [
['class' => 'yii\grid\SerialColumn'], ['class' => 'yii\grid\SerialColumn'],
'id', //'id',
'state_id', 'state_id',
'name', 'name',
'slug', 'slug',
'status', [
'class'=>\common\grid\EnumColumn::className(),
'attribute'=>'status',
'enum'=>[
Yii::t('backend', 'In Active'),
Yii::t('backend', 'Active')
],
],
// 'created_at', // 'created_at',
// 'updated_at', // 'updated_at',
......
...@@ -12,18 +12,36 @@ use yii\widgets\ActiveForm; ...@@ -12,18 +12,36 @@ use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(); ?> <?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> <div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="info">
<div class="page-header">
<h3>Info</h3>
</div>
<div class="row">
<div class="col-md-6">
<?php echo $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?php echo $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'status')->dropDownList($model::statuses()) ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend',
'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
</div>
<?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'status')->textInput() ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div> </div>
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
......
...@@ -12,8 +12,6 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -12,8 +12,6 @@ $this->params['breadcrumbs'][] = $this->title;
?> ?>
<div class="state-create"> <div class="state-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [ <?= $this->render('_form', [
'model' => $model, 'model' => $model,
]) ?> ]) ?>
......
...@@ -24,11 +24,18 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -24,11 +24,18 @@ $this->params['breadcrumbs'][] = $this->title;
'columns' => [ 'columns' => [
['class' => 'yii\grid\SerialColumn'], ['class' => 'yii\grid\SerialColumn'],
'id', //'id',
'name', 'name',
'slug', 'slug',
'status', [
'created_at', 'class'=>\common\grid\EnumColumn::className(),
'attribute'=>'status',
'enum'=>[
Yii::t('backend', 'In Active'),
Yii::t('backend', 'Active')
],
],
//'created_at',
// 'updated_at', // 'updated_at',
['class' => 'yii\grid\ActionColumn'], ['class' => 'yii\grid\ActionColumn'],
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
namespace common\models; namespace common\models;
use Yii; use Yii;
use yii\behaviors\SluggableBehavior;
use yii\behaviors\TimestampBehavior;
/** /**
* This is the model class for table "{{%business}}". * This is the model class for table "{{%business}}".
...@@ -34,6 +36,9 @@ use Yii; ...@@ -34,6 +36,9 @@ use Yii;
*/ */
class Business extends \yii\db\ActiveRecord class Business extends \yii\db\ActiveRecord
{ {
const STATUS_ACTIVE = 1;
const STATUS_IN_ACTIVE = 0;
/** /**
* @inheritdoc * @inheritdoc
*/ */
...@@ -45,6 +50,23 @@ class Business extends \yii\db\ActiveRecord ...@@ -45,6 +50,23 @@ class Business extends \yii\db\ActiveRecord
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function behaviors()
{
return [
[
'class' => SluggableBehavior::className(),
'attribute' => 'name',
'immutable' => true
],
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at'
]
];
}
public function rules() public function rules()
{ {
return [ return [
...@@ -116,4 +138,12 @@ class Business extends \yii\db\ActiveRecord ...@@ -116,4 +138,12 @@ class Business extends \yii\db\ActiveRecord
{ {
return new \common\models\query\BusinessQuery(get_called_class()); return new \common\models\query\BusinessQuery(get_called_class());
} }
public static function statuses()
{
return [
self::STATUS_ACTIVE => Yii::t('common', 'Active'),
self::STATUS_IN_ACTIVE => Yii::t('common', 'In Active'),
];
}
} }
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
namespace common\models; namespace common\models;
use Yii; use Yii;
use yii\behaviors\SluggableBehavior;
use yii\behaviors\TimestampBehavior;
/** /**
* This is the model class for table "{{%district}}". * This is the model class for table "{{%district}}".
...@@ -20,6 +22,9 @@ use Yii; ...@@ -20,6 +22,9 @@ use Yii;
*/ */
class District extends \yii\db\ActiveRecord class District extends \yii\db\ActiveRecord
{ {
const STATUS_ACTIVE = 1;
const STATUS_IN_ACTIVE = 0;
/** /**
* @inheritdoc * @inheritdoc
*/ */
...@@ -28,6 +33,22 @@ class District extends \yii\db\ActiveRecord ...@@ -28,6 +33,22 @@ class District extends \yii\db\ActiveRecord
return '{{%district}}'; return '{{%district}}';
} }
public function behaviors()
{
return [
[
'class' => SluggableBehavior::className(),
'attribute' => 'name',
'immutable' => true
],
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at'
]
];
}
/** /**
* @inheritdoc * @inheritdoc
*/ */
...@@ -81,4 +102,12 @@ class District extends \yii\db\ActiveRecord ...@@ -81,4 +102,12 @@ class District extends \yii\db\ActiveRecord
{ {
return new \common\models\query\DistrictQuery(get_called_class()); return new \common\models\query\DistrictQuery(get_called_class());
} }
public static function statuses()
{
return [
self::STATUS_ACTIVE => Yii::t('common', 'Active'),
self::STATUS_IN_ACTIVE => Yii::t('common', 'In Active'),
];
}
} }
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
namespace common\models; namespace common\models;
use Yii; use Yii;
use yii\behaviors\SluggableBehavior;
use yii\behaviors\TimestampBehavior;
/** /**
* This is the model class for table "{{%state}}". * This is the model class for table "{{%state}}".
...@@ -18,6 +20,9 @@ use Yii; ...@@ -18,6 +20,9 @@ use Yii;
*/ */
class State extends \yii\db\ActiveRecord class State extends \yii\db\ActiveRecord
{ {
const STATUS_ACTIVE = 1;
const STATUS_IN_ACTIVE = 0;
/** /**
* @inheritdoc * @inheritdoc
*/ */
...@@ -26,6 +31,22 @@ class State extends \yii\db\ActiveRecord ...@@ -26,6 +31,22 @@ class State extends \yii\db\ActiveRecord
return '{{%state}}'; return '{{%state}}';
} }
public function behaviors()
{
return [
[
'class' => SluggableBehavior::className(),
'attribute' => 'name',
'immutable' => true
],
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at'
]
];
}
/** /**
* @inheritdoc * @inheritdoc
*/ */
...@@ -69,4 +90,12 @@ class State extends \yii\db\ActiveRecord ...@@ -69,4 +90,12 @@ class State extends \yii\db\ActiveRecord
{ {
return new \common\models\query\StateQuery(get_called_class()); return new \common\models\query\StateQuery(get_called_class());
} }
public static function statuses()
{
return [
self::STATUS_ACTIVE => Yii::t('common', 'Active'),
self::STATUS_IN_ACTIVE => Yii::t('common', 'In Active'),
];
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment