Commit aa0917c6 by Junaid Rahman pv

bug fix

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