/
var
/
www
/
vhosts
/
nabawater
/
backend
/
views
/
today-special
/
/var/www/vhosts/nabawater/backend/views/today-special
mkdir
upload
Name
Size
Mode
Actions
create.php
952
0644
edit
dl
rm
index.php
5549
0644
edit
dl
rm
update.php
954
0644
edit
dl
rm
_form.php
5703
0644
edit
dl
rm
Edit:
/var/www/vhosts/nabawater/backend/views/today-special/_form.php
(5703B)
<?php use backend\components\CActiveForm; use yii\helpers\Html; use common\helpers\UploadHelper; use yii\helpers\Url; /* @var $this \yii\web\View */ /* @var $model \backend\models\TodaySpecial */ /* @var $modelLang \backend\models\TodaySpecialLang */ /* @var $modelUploadForm \backend\models\TodaySpecialUploadForm */ /* @var $modelCity \backend\models\City */ /* @var $modelVendor \backend\models\Vendor */ /* @var $modelItem \backend\models\Item */ $form = CActiveForm::begin()->setModel($model); if (!$model->getIsNewRecord()) { $id = $_GET['id']; } else { $id = ''; } ?> <div class="card-body"> <h4 class="card-title"><?= $this->title; ?></h4> <hr> <div class="row p-lg-2"> <div class="col-md-6"> <?= $form->field($model, 'vendor_id')->dropDownList($modelVendor->getVendorData(), ['class' => 'select2 form-control', 'prompt' => 'Select an Option']); ?> </div> <div class="col-md-6"> <?= $form->field($model, 'item_id')->dropDownList($modelItem->getItemData(), ['class' => 'select2 form-control', 'prompt' => 'Select an Option']); ?> </div> </div> <div class="row p-lg-2"> <div class="col-md-6"> <?= $form->field($modelLang, 'today_special_name')->textInput(); ?> </div> <div class="col-md-5"> <?= $form->field($model, 'url')->textInput(); ?> </div> <div class= "col-md-1"> <span class="mytooltip tooltip-effect-3"> <span class="fa fa-2x fa-exclamation-circle my-lg-1"></span> <span class="tooltip-content tooltip-text"> <?yii::t('backend','Ignore this field to create a Today Special Item by choosing appropriate vendor name below or else give appropriate Item Url to create a Today Special Item.') ?> </span> </span> </div> </div> <div class="row p-lg-2"> <div class="col-md-6"> <?= $form->field($model, 'from_date')->textInput(['class' => 'bootstrapMaterialDatePicker form-control']); ?> </div> <div class="col-md-6"> <?= $form->field($model, 'to_date')->textInput(['class' => 'bootstrapMaterialDatePicker form-control']); ?> </div> </div> <div class ="m-l-5"> <?php if (!$model->getIsNewRecord() && !empty($modelLang->today_special_image_path)) { $uploadHelper = UploadHelper::getInstance(); $url = $modelLang->today_special_image_path; echo Html::img($url, $options = ['alt' => 'Today Special Item Image', 'style' => 'width:100px;height:100px', 'class' => 'img-thumbnail']); } ?> </div> <div class="row p-lg-2"> <div class = "col-md-6"> <?= $form->field($modelUploadForm, 'today_special_image_path')->fileInput(['class' => 'form-control']); ?> </div> <div class="col-md-6"> <?= $form->field($model, 'city_id')->dropDownList($modelCity->getCityData(), ['class' => 'select2 form-control', 'prompt' => 'Select an Option']); ?> </div> </div> <div class ="col-md-4"> <?= $form->field($model, 'today_special_status')->radioList([$model::ACTIVE => 'Active', $model::INACTIVE => 'Inactive']); ?> </div> <div class= "col-md-12 text-center"> <?= Html::submitButton($model->getIsNewRecord() ? 'Create' : 'Update', ['class' => 'btn btn-success']) ?> <?= Html::a('Cancel', ['index'], ['class' => 'btn btn-secondary']); ?> </div> </div> <?php CActiveForm::end(); ?> <script type ="text/javascript"> runOnLoad( function() { $('.select2').select2({ allowClear:true }); $('#todayspecial-item_id').attr("disabled", "disabled" ); $('#todayspecialuploadform-today_special_image_path').after('<a href="#" id="close" class="fa fa-window-close"></a>'); var data = '<?= $id ?>'; $('#todayspecial-vendor_id').on('change', function() { var vendor_id = $(this).val(); if (vendor_id === '') { $('.field-todayspecial-url').show(); $('#todayspecial-item_id').attr("disabled", "disabled" ); $('.mytooltip').show(); } else { $('#todayspecial-item_id').attr("disabled", false ); $('.field-todayspecial-url').hide(); $('.mytooltip').hide(); $('#todayspecial-url').val(""); Core.ajax({ type: "POST", url: '<?= Url::to(['item/get-item']) ?>', data: {id : vendor_id, data: data}, done: function(data) { $('#todayspecial-item_id').html(data); } }); } }); $('#todayspecial-url').on('change', function() { if ($('#todayspecial-url').val() != '') { $('#todayspecialuploadform-today_special_image_path').attr('disabled', true); $('#todayspecial-vendor_id').attr('disabled', true); } else { $('#todayspecialuploadform-today_special_image_path').attr('disabled', false); $('#todayspecial-vendor_id').attr('disabled', false); } }); $('#todayspecialuploadform-today_special_image_path').on('change', function() { $('#todayspecial-url').attr('disabled', true); }); $("#close").on("click", function() { $('#todayspecialuploadform-today_special_image_path').val(''); $('#todayspecial-url').attr('disabled', false); }); $('.bootstrapMaterialDatePicker').bootstrapMaterialDatePicker({ format: 'YYYY-MM-DD HH:mm:ss' }); }); </script>
Save
cmd:
run