Commit 788e30a1 by Junaid Rahman pv

modified tables and added extra functions

parent 1e394749
......@@ -12,48 +12,142 @@ use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(); ?>
<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, 'category_id')->textInput() ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'district_id')->textInput() ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $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]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'address')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $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]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $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]) ?>
</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]) ?>
<?= $form->field($model, 'latitude')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'logitude')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'latitude')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'status')->textInput() ?>
</div>
</div>
<?= $form->field($model, 'created_at')->textInput() ?>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'updated_at')->textInput() ?>
<?= $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']) ?>
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend',
'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
</div>
</div>
<?php ActiveForm::end(); ?>
......
......@@ -12,7 +12,6 @@ $this->params['breadcrumbs'][] = $this->title;
?>
<div class="business-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
......
......@@ -24,7 +24,7 @@ $this->params['breadcrumbs'][] = $this->title;
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
//'id',
'category_id',
'district_id',
'domain_name',
......
......@@ -2,6 +2,8 @@
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use common\models\State;
/* @var $this yii\web\View */
/* @var $model common\models\District */
......@@ -12,20 +14,43 @@ use yii\widgets\ActiveForm;
<?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, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'state_id')->dropDownList(ArrayHelper::map(State::find()->all(), 'id', 'name')) ?>
<?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'status')->textInput() ?>
<?php echo $form->field($model, 'name')->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() ?>
<?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']) ?>
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend',
'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
</div>
</div>
<?php ActiveForm::end(); ?>
......
......@@ -12,7 +12,6 @@ $this->params['breadcrumbs'][] = $this->title;
?>
<div class="district-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
......
......@@ -24,11 +24,18 @@ $this->params['breadcrumbs'][] = $this->title;
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
//'id',
'state_id',
'name',
'slug',
'status',
[
'class'=>\common\grid\EnumColumn::className(),
'attribute'=>'status',
'enum'=>[
Yii::t('backend', 'In Active'),
Yii::t('backend', 'Active')
],
],
// 'created_at',
// 'updated_at',
......
......@@ -12,18 +12,36 @@ use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'slug')->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">
<?= $form->field($model, 'status')->textInput() ?>
<?php echo $form->field($model, 'name')->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() ?>
<?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']) ?>
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend',
'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
</div>
</div>
<?php ActiveForm::end(); ?>
......
......@@ -12,8 +12,6 @@ $this->params['breadcrumbs'][] = $this->title;
?>
<div class="state-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
......
......@@ -24,11 +24,18 @@ $this->params['breadcrumbs'][] = $this->title;
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
//'id',
'name',
'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',
['class' => 'yii\grid\ActionColumn'],
......
......@@ -3,6 +3,8 @@
namespace common\models;
use Yii;
use yii\behaviors\SluggableBehavior;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "{{%business}}".
......@@ -34,6 +36,9 @@ use Yii;
*/
class Business extends \yii\db\ActiveRecord
{
const STATUS_ACTIVE = 1;
const STATUS_IN_ACTIVE = 0;
/**
* @inheritdoc
*/
......@@ -45,6 +50,23 @@ class Business extends \yii\db\ActiveRecord
/**
* @inheritdoc
*/
public function behaviors()
{
return [
[
'class' => SluggableBehavior::className(),
'attribute' => 'name',
'immutable' => true
],
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at'
]
];
}
public function rules()
{
return [
......@@ -116,4 +138,12 @@ class Business extends \yii\db\ActiveRecord
{
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 @@
namespace common\models;
use Yii;
use yii\behaviors\SluggableBehavior;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "{{%district}}".
......@@ -20,6 +22,9 @@ use Yii;
*/
class District extends \yii\db\ActiveRecord
{
const STATUS_ACTIVE = 1;
const STATUS_IN_ACTIVE = 0;
/**
* @inheritdoc
*/
......@@ -28,6 +33,22 @@ class District extends \yii\db\ActiveRecord
return '{{%district}}';
}
public function behaviors()
{
return [
[
'class' => SluggableBehavior::className(),
'attribute' => 'name',
'immutable' => true
],
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at'
]
];
}
/**
* @inheritdoc
*/
......@@ -81,4 +102,12 @@ class District extends \yii\db\ActiveRecord
{
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 @@
namespace common\models;
use Yii;
use yii\behaviors\SluggableBehavior;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "{{%state}}".
......@@ -18,6 +20,9 @@ use Yii;
*/
class State extends \yii\db\ActiveRecord
{
const STATUS_ACTIVE = 1;
const STATUS_IN_ACTIVE = 0;
/**
* @inheritdoc
*/
......@@ -26,6 +31,22 @@ class State extends \yii\db\ActiveRecord
return '{{%state}}';
}
public function behaviors()
{
return [
[
'class' => SluggableBehavior::className(),
'attribute' => 'name',
'immutable' => true
],
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at'
]
];
}
/**
* @inheritdoc
*/
......@@ -69,4 +90,12 @@ class State extends \yii\db\ActiveRecord
{
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