Commit aa0917c6 by Junaid Rahman pv

bug fix

parent cf846133
...@@ -70,6 +70,15 @@ class WebsiteController extends Controller ...@@ -70,6 +70,15 @@ class WebsiteController extends Controller
$themes = ArrayHelper::map(Theme::find()->all(), 'id', 'name'); $themes = ArrayHelper::map(Theme::find()->all(), 'id', 'name');
if ($model->load(Yii::$app->request->post()) && $model->save()) { if ($model->load(Yii::$app->request->post()) && $model->save()) {
Yii::$app->getSession()->setFlash('success', [
'type' => 'success',
'duration' => 5000,
'icon' => 'fa fa-globe',
'message' => 'New Website Created! ',
'title' => ' Website',
'positonY' => 'top',
'positonX' => 'center'
]);
return $this->render('index', [ return $this->render('index', [
'searchModel' => $searchModel, 'searchModel' => $searchModel,
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
......
...@@ -51,24 +51,26 @@ use yii\web\JsExpression; ...@@ -51,24 +51,26 @@ use yii\web\JsExpression;
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-8">
<?= $form->field($model, 'landmark')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'landmark')->textInput(['maxlength' => true]) ?>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-3">
<?= $form->field($model, 'mobile_no')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'mobile_no')->widget(\yii\widgets\MaskedInput::className(), [
'mask' => '9999999999',
]) ?>
</div> </div>
<div class="col-md-4"> <div class="col-md-2">
<?= $form->field($model, 'toll_free_no')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'toll_free_no')->textInput(['maxlength' => true]) ?>
</div> </div>
<div class="col-md-4"> <div class="col-md-3">
<?= $form->field($model, 'contact_no')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'contact_no')->textInput(['maxlength' => true]) ?>
...@@ -117,8 +119,9 @@ use yii\web\JsExpression; ...@@ -117,8 +119,9 @@ use yii\web\JsExpression;
Upload::className(), Upload::className(),
[ [
'url' => ['/file-storage/upload'], 'url' => ['/file-storage/upload'],
'sortable' => true,
'maxFileSize' => 5000000, // 5 MiB 'maxFileSize' => 5000000, // 5 MiB
'acceptFileTypes' => new JsExpression('/(\.|\/)(gif|jpe?g|png)$/i'), 'acceptFileTypes' => new JsExpression('/(\.|\/)(gif|jpe?g|png)$/i')
]); ]);
?> ?>
......
...@@ -38,7 +38,7 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -38,7 +38,7 @@ $this->params['breadcrumbs'][] = $this->title;
[ [
'attribute' => 'district_id', 'attribute' => 'district_id',
'value' => function ($model) { 'value' => function ($model) {
return $model->category->name; return $model->district->name;
}, },
'filter' => Html::activeDropDownList($searchModel, 'district_id', 'filter' => Html::activeDropDownList($searchModel, 'district_id',
$districts, ['class' => 'form-control', 'prompt' => ' ']), $districts, ['class' => 'form-control', 'prompt' => ' ']),
......
...@@ -80,7 +80,7 @@ class DistrictController extends Controller ...@@ -80,7 +80,7 @@ class DistrictController extends Controller
'positonY' => 'top', 'positonY' => 'top',
'positonX' => 'right' 'positonX' => 'right'
]); ]);
return $this->redirect(['view', 'id' => $model->id]); return $this->redirect(['index', 'model' => $model,]);
} else { } else {
return $this->render('create', [ return $this->render('create', [
'model' => $model, 'model' => $model,
......
...@@ -76,7 +76,7 @@ class StateController extends Controller ...@@ -76,7 +76,7 @@ class StateController extends Controller
'positonY' => 'top', 'positonY' => 'top',
'positonX' => 'right' 'positonX' => 'right'
]); ]);
return $this->redirect(['view', 'id' => $model->id]); return $this->redirect(['index', 'model' => $model,]);
} else { } else {
return $this->render('create', [ return $this->render('create', [
'model' => $model, 'model' => $model,
......
...@@ -38,7 +38,7 @@ class ThemeFileController extends \yii\web\Controller ...@@ -38,7 +38,7 @@ class ThemeFileController extends \yii\web\Controller
$model->file->saveAs($path); $model->file->saveAs($path);
Yii::$app->getSession()->setFlash($model->file_code, [ Yii::$app->getSession()->setFlash($model->file_code, [
'type' => 'warning', 'type' => 'warning',
'duration' => 4000, 'duration' => 3000,
'icon' => 'fa fa-file', 'icon' => 'fa fa-file',
'message' => '' . $model->file_code . ' Uploading...', 'message' => '' . $model->file_code . ' Uploading...',
'showSeparator' => true, 'showSeparator' => true,
...@@ -54,7 +54,7 @@ class ThemeFileController extends \yii\web\Controller ...@@ -54,7 +54,7 @@ class ThemeFileController extends \yii\web\Controller
'message' => ' File successfully Uploaded', 'message' => ' File successfully Uploaded',
'showSeparator' => true, 'showSeparator' => true,
'title' => ' File Upload', 'title' => ' File Upload',
'delay' => 4000, 'delay' => 3000,
'positonY' => 'top', 'positonY' => 'top',
'positonX' => 'right' 'positonX' => 'right'
]); ]);
...@@ -100,6 +100,7 @@ class ThemeFileController extends \yii\web\Controller ...@@ -100,6 +100,7 @@ class ThemeFileController extends \yii\web\Controller
return $this->render('editor', [ return $this->render('editor', [
'model' => $model, 'model' => $model,
'theme_id'=>$model->theme_id,
]); ]);
} }
...@@ -120,8 +121,12 @@ class ThemeFileController extends \yii\web\Controller ...@@ -120,8 +121,12 @@ class ThemeFileController extends \yii\web\Controller
'positonY' => 'top', 'positonY' => 'top',
'positonX' => 'right' 'positonX' => 'right'
]); ]);
}
return $this->redirect(['theme/files', 'id' => $model->theme_id]); return $this->redirect(['theme/files', 'id' => $model->theme_id]);
}else{
return $this->render(['editor', 'id' => $model->id ,'theme_id' => $model->theme_id]);
}
} }
protected function findModel($id) protected function findModel($id)
......
...@@ -13,13 +13,15 @@ use yii\widgets\ActiveForm; ...@@ -13,13 +13,15 @@ use yii\widgets\ActiveForm;
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
<table class="table"> <table class="table">
<tr> <thead>
<th>File Name</th> <tr >
<th>Options</th> <th style="text-align: center">File Name</th>
<th style="text-align: center">Options</th>
</tr> </tr>
</thead>
<?php foreach ($categoryFiles as $value) { ?> <?php foreach ($categoryFiles as $value) { ?>
<tbody style="text-align: center">
<tr> <tr>
<td><?= $value['name'] ?></td> <td><?= $value['name'] ?></td>
...@@ -36,22 +38,22 @@ use yii\widgets\ActiveForm; ...@@ -36,22 +38,22 @@ use yii\widgets\ActiveForm;
?> ?>
<td> <td>
<div class="form-group"> <div class="form-group ">
<?php $form = ActiveForm::begin(['action' => '../theme-file/delete?id=' . $fileModel->id]); ?> <?php $form = ActiveForm::begin(['action' => '../theme-file/editor?id=' . $fileModel->id]); ?>
<?= $form->field($fileModel, <?= $form->field($fileModel,
'theme_id')->hiddenInput(['value' => $model->id])->label(false) ?> 'theme_id')->hiddenInput(['value' => $model->id])->label(false) ?>
<?= Html::a(' Edit ', ['theme-file/editor', 'id' => $fileModel->id], <?= Html::submitButton(Yii::t('backend', ' Edit'),
['class' => 'btn btn-primary fa fa-edit',]) ?>
<?= Html::submitButton(Yii::t('backend', ' Delete'),
[ [
'class' => 'btn btn-primary fa fa-trash', 'class' => 'btn btn-primary fa fa-edit',
'onclick' => 'return confirm("Are you sure?")'
]) ?> ]) ?>
<?php ActiveForm::end(); ?>
<?php ActiveForm::end(); ?>
</div>
</td>
<td>
<div class="form-group">
<?php $form = ActiveForm::begin(['action' => '../theme-file/delete?id=' . $fileModel->id]); ?> <?php $form = ActiveForm::begin(['action' => '../theme-file/delete?id=' . $fileModel->id]); ?>
<?= $form->field($fileModel, <?= $form->field($fileModel,
...@@ -103,6 +105,7 @@ use yii\widgets\ActiveForm; ...@@ -103,6 +105,7 @@ use yii\widgets\ActiveForm;
<?php } ?> <?php } ?>
</tr> </tr>
</tbody>
<?php } ?> <?php } ?>
......
...@@ -5,12 +5,13 @@ ...@@ -5,12 +5,13 @@
* Date: 22-09-2016 * Date: 22-09-2016
* Time: 02:37 PM * Time: 02:37 PM
*/ */
/**@var $theme_id integer */
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\Breadcrumbs;
$this->title = Yii::t('backend', 'Editor'); $this->title = Yii::t('backend', 'Editor');
$this->params['breadcrumbs'][] = ['label' => 'Themes', 'url' => ['theme/index']]; $this->params['breadcrumbs'][] = ['label' => 'Themes', 'url' => ['theme/index']];
$this->params['breadcrumbs'][] = ['label' => 'Theme Files', 'url' => ['theme/files?id='.$theme_id]];
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
?> ?>
...@@ -29,7 +30,8 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -29,7 +30,8 @@ $this->params['breadcrumbs'][] = $this->title;
// ], // ],
// 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], // 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
// ]) ?> --> // ]) ?> -->
<?= $form->field($model,
'theme_id')->hiddenInput(['value' => $theme_id])->label(false) ?>
<?= Html::submitButton(Yii::t('backend', 'Update'), <?= Html::submitButton(Yii::t('backend', 'Update'),
[ [
'class' => 'btn btn-success' 'class' => 'btn btn-success'
......
...@@ -86,6 +86,11 @@ class Business extends \yii\db\ActiveRecord ...@@ -86,6 +86,11 @@ class Business extends \yii\db\ActiveRecord
[['domain_name', 'name', 'address', 'mobile_no', 'email'], 'required'], [['domain_name', 'name', 'address', 'mobile_no', 'email'], 'required'],
[['description'], 'string'], [['description'], 'string'],
[['domain_name'], 'string', 'max' => 255], [['domain_name'], 'string', 'max' => 255],
[
['domain_name'],
'match',
'pattern' => '/^[a-zA-Z0-9][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9]{0,1}\.([a-zA-Z]{1,6}|[a-zA-Z0-9-]{1,30}\.[a-zA-Z]{2,3})$/'
],
[['name', 'mobile_no', 'toll_free_no', 'fax'], 'string', 'max' => 512], [['name', 'mobile_no', 'toll_free_no', 'fax'], 'string', 'max' => 512],
[['slug', 'address', 'email', 'logo_base_url', 'logo_path'], 'string', 'max' => 1024], [['slug', 'address', 'email', 'logo_base_url', 'logo_path'], 'string', 'max' => 1024],
[['landmark'], 'string', 'max' => 500], [['landmark'], 'string', 'max' => 500],
...@@ -105,7 +110,7 @@ class Business extends \yii\db\ActiveRecord ...@@ -105,7 +110,7 @@ class Business extends \yii\db\ActiveRecord
'targetClass' => District::className(), 'targetClass' => District::className(),
'targetAttribute' => ['district_id' => 'id'] 'targetAttribute' => ['district_id' => 'id']
], ],
['logo', 'file', 'extensions' => 'jpeg, gif, png'], ['logo', 'safe'],
]; ];
} }
......
...@@ -51,6 +51,7 @@ class Website extends \yii\db\ActiveRecord ...@@ -51,6 +51,7 @@ class Website extends \yii\db\ActiveRecord
return [ return [
[['business_id', 'theme_id', 'status', 'expiry_date', 'created_at', 'updated_at'], 'integer'], [['business_id', 'theme_id', 'status', 'expiry_date', 'created_at', 'updated_at'], 'integer'],
[['domain_name'], 'required'], [['domain_name'], 'required'],
[['domain_name','business_id'], 'unique'],
[['domain_name'], 'string', 'max' => 255], [['domain_name'], 'string', 'max' => 255],
[ [
['domain_name'], ['domain_name'],
......
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