/
var
/
www
/
vhosts
/
nabawater
/
backend
/
views
/
branch
/
/var/www/vhosts/nabawater/backend/views/branch
mkdir
upload
Name
Size
Mode
Actions
create.php
1078
0644
edit
dl
rm
files.php
391
0644
edit
dl
rm
image-uplaod.php
491
0644
edit
dl
rm
index.php
15518
0644
edit
dl
rm
update.php
1219
0755
edit
dl
rm
_form.php
20805
0755
edit
dl
rm
_timeslot.php
33762
0644
edit
dl
rm
Edit:
/var/www/vhosts/nabawater/backend/views/branch/_form.php
(20805B)
<?php use backend\components\CActiveForm; use yii\helpers\Html; use backend\models\Configuration; use common\helpers\Com; use common\helpers\UploadHelper; use yii\helpers\Url; use backend\models\AdminUser; use backend\models\Vendor; /* @var $this \yii\web\View */ /* @var $model \backend\models\Branch */ /* @var $modelLang \backend\models\BranchLang */ $form = CActiveForm::begin()->setModel($model); $modelBranchDeliveryArea->delivery_area_id = (!empty($modelBranchDeliveryAreaData['delivery_area_id'])) ? explode(',', $modelBranchDeliveryAreaData['delivery_area_id']) : ''; ?> <h4 class="card-title"><?= $this->title; ?></h4> <hr> <div class="ui-tabs"> <ul class="nav nav-tabs" role="tablist"> <?php $i = 1; foreach ($appLanguages as $langCode => $langName): $isActive = Com::isSiteLang($langCode); ?> <li class="nav-item"> <a href="#<?= $langCode; ?>" data-toggle="tab" role="tab" id="li_<?= $i ?>" class="<?= $isActive ? 'nav-link active' : 'nav-link' ?>"><?= $langName ?></a> </li> <?php $i++; endforeach; ?> </ul> <div class="tab-content tabcontent-border"> <?php foreach ($appLanguages as $langCode => $langName): $isActive = Com::isSiteLang($langCode); ?> <div id="<?= $langCode ?>" role="tabpanel" class="tab-pane <?= $isActive ? 'active' : '' ?>"> <!-- <div class="p-lg-2"> ?php if (!$model->getIsNewRecord()) { $uploadHelper = UploadHelper::getInstance(); $url = isset($modelLang->branch_image_path[$langCode]) ? $uploadHelper->get($modelLang->branch_image_path[$langCode], false) : $uploadHelper->get(false, false); echo Html::img($url, $options = ['alt' => 'Branch Image', 'style' => 'width:100px;height:100px', 'class' => 'img-responsive img-thumbnail']); } ?> </div> --> <div class="row p-lg-2"> <!-- <div class="col-md-6"> ?= $form->field($modelUploadForm, 'branch_image_path', ['lang' => $langCode])->fileInput(['class' => 'form-control'])->label('Branch Image'); ?> </div> --><div class=" col-md-6"> <?= $form->field($modelLang, 'branch_name', ['lang' => $langCode])->textInput(); ?> </div> </div> </div> <?php endforeach; ?> </div> </div> <div class="col-md-12 p-lg-2"> <?= $form->field($modelBranchLang, 'branch_address_line1')->textInput(['placeholder' => 'Search Location', 'autocomplete' => 'off']); ?> </div> <div class ="row p-lg-2"> <div class="col-md-6"> <?= $form->field($modelBranchLang, 'branch_address_line2')->textInput(); ?> </div> <div class="col-md-6"> <?= $form->field($model, 'branch_type')->dropDownList($model->getBranchUserTypeStatus(), ['prompt' => yii::t('backend','Select Approval Status'), 'class' => 'select2 form-control']); ?> </div> </div> <div class="col-md-12 p-lg-2"> <?= $form->field($modelBranchDeliveryArea, 'delivery_area_id', ['options' => ['class' => 'form-group']])->dropDownList($modelDeliveryArea->getDeliveryAreas(), ['prompt' => 'Please select a restaurant', 'multiple' => true, 'class' => 'select2 multiple form-control']); ?> </div> <?= $form->field($model, 'vendor_id')->hiddenInput(['value' => Vendor::DEFAULT_VENDOR_ID]); ?> <div class="row p-lg-2"> <div class="col-md-6"> <?= $form->field($model, 'contact_number', ['options' => ['class' => 'form-group']])->textInput(['class' => 'form-control']); ?> </div> <div class="col-md-6"> <?= $form->field($model, 'contact_email', ['options' => ['class' => 'form-group']])->textInput(['class' => 'form-control']); ?> </div> </div> <div class="hide"> <?= $form->field($model, 'pickup_time')->hiddenInput(['value' => 0]); ?> <?= $form->field($model, 'preparation_time')->hiddenInput(['value' => 0]); ?> <?= $form->field($model, 'order_type')->hiddenInput(['value' => 1]); ?> <?= $form->field($modelBranchLang, 'area')->hiddenInput(); ?> <?= $form->field($modelBranchLang, 'city')->hiddenInput(); ?> <?= $form->field($modelBranchLang, 'country')->hiddenInput(); ?> </div> <div class ="row p-lg-2"> <div class="col-md-6"> <?= $form->field($model, 'latitude')->textInput(['readonly' => true]); ?> </div> <div class="col-md-6"> <?= $form->field($model, 'longitude')->textInput(['readonly' => true]); ?> </div> </div> <div class ="row p-lg-2"> <?php if ($model->isNewRecord) { ?> <div class="col-md-6"> <?= $form->field($model, 'password')->passwordInput(); ?> </div> <div class="col-md-6"> <?= $form->field($model, 'confirm_password')->passwordInput(); ?> </div> <?php } ?> </div> <div class="row p-lg-2"> <div class="col-md-6"> <?php $approve_view = false; if($model->getIsNewRecord() && AdminUser::isVendor() || $model->getIsNewRecord() && AdminUser::isBranch()) { $model->approve_status = 1; $approve_view = 'true'; } ?> <?php //$approve_view = false; if(!$model->getIsNewRecord() && AdminUser::isVendor() || !$model->getIsNewRecord() && AdminUser::isBranch()) { $model->approve_status = $model->approve_status; $approve_view = 'true'; } ?> <?= $form->field($model, 'approve_status')->dropDownList($model->getApprovalStatus(), ['prompt' => yii::t('backend','Select Approval Status'), 'class' => 'select2 form-control', 'disabled' => $approve_view]); ?> </div> <div class="col-md-6"> <?= $form->field($model, 'branch_availability_status')->dropDownList($model->getBranchAvailabilityStatus(), ['prompt' => yii::t('backend','Select Approval Status'), 'class' => 'select2 form-control']); ?> </div> </div> <div class ="row p-lg-2"> <div class="col-md-6"> <?= $form->field($model, 'assigned_stock')->textInput(); ?> </div> <div class="col-md-6"> <?= $form->field($model, 'no_of_vehicles')->textInput(); ?> </div> </div> <div class="row p-lg-2"> <div class="col-md-6"> <?= $form->field($model, 'vehicles_capacity')->textInput(); ?> </div> <div class ="col-md-6"> <?= $form->field($model, 'delivery_time')->textInput(); ?> </div> </div> <div class="row p-lg-2"> <div class ="col-md-6"> <?= $form->field($model, 'minimum_cart_value')->textInput(); ?> </div> <div class ="col-md-6"> <?= $form->field($model, 'branch_status')->radioList([$model::ACTIVE => yii::t('backend','Active'), $model::INACTIVE => yii::t('backend','Inactive')]); ?> </div> </div> <?php /* <div class="row p-lg-2"> <div class="col-md-6"> <div class="img_upload_listing"> <table class="first_child"> </table> <a class="img-upload-button img-upload" data-toggle="modal" data-target="#image-modal"> <i class="fa fa-plus-circle" aria-hidden="true"></i> <span><?= yii::t('frontend',' Add') ?></span> </a> <?php $item_image = $modelImage->branch_image_path; if (count((array)$item_image) > 0) { $i = 0; if ($item_image != '') { $i++; if (!empty($item_image)) { echo '<table class="first_child2">'; foreach (explode(',',$item_image) as $key => $img) { if(empty($img)){ continue; } echo $this->render('image-uplaod', [ 'path' => '/'.ltrim($img,'/'), 'i' => $key, 'id' => 1, ]) ; } echo '</table>'; } } } ?> </div> </div> </div> */ ?> <div class="form-group remove-image-contaner"> <?php if(!empty($modelmultiimage)) { foreach($modelmultiimage as $modelmultiimage1){ $uploadHelper = UploadHelper::getInstance(); $url = isset($modelmultiimage1->branch_image_path) ? $uploadHelper->get($modelmultiimage1->branch_image_path, false) : ''; ?> <a href="javascript:void(0)" class="remove-image-click" id="<?php echo $modelmultiimage1->branch_image_id; ?>" onclick="deleteimage(<?php echo $modelmultiimage1->branch_image_id; ?>)"> <?php echo Html::img($url, $options = ['alt' => 'Branch Image', 'class' => 'img-responsive img-thumbnail']); ?> <span class="close-remove fa fa-times-circle"></span> </a> <?php } } ?> </div> <div class= "col-md-12 text-center"> <?= Html::submitButton($model->getIsNewRecord() ? yii::t('backend','Create') : yii::t('backend','Update'), ['class' => 'btn btn-success']) ?> <?= Html::a(yii::t('backend','Cancel'), ['index'], ['class' => 'btn btn-secondary']); ?> </div> <?php CActiveForm::end(); $this->registerJsFile( sprintf( 'https://maps.googleapis.com/maps/api/js?key=%s&callback=initMap&libraries=places', Configuration::get(Configuration::MAP_KEY) ) ) ?> <div class="modal upload_popup_modal fade" tabindex="-1" role="dialog" id="image-modal"> <div class="modal-dialog sm" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> </button> <h4 class="modal-title"><?= yii::t('frontend','Drop order image') ?></h4> </div> <div class="modal-body"> <?php $form = CActiveForm::begin([ 'action' => ['image'], 'options' => ['class' => 'dropzone'] ])->setModel($modelImage); ?> <div class="fallback"> <?= $form->field($modelImage, 'branch_image_path')->fileInput() ?> </div> <?php CActiveForm::end(); ?> </div> <div class="modal-footer"> <button class="btn btn-primary" data-dismiss="modal" aria-label="Close"><?= yii::t('frontend','Done') ?></button> </div> </div> </div> </div> <script type="text/html" id="item-image-row"> <?= $this->render('image-uplaod', [ 'path' => '<%= path %>', 'i' => '<%= i %>', 'id' => 0, ]) ?> </script> <script type ="text/javascript"> document.addEventListener("DOMContentLoaded", function () { Dropzone.autoDiscover = false; }); runOnLoad(function () { var dropZone = new Dropzone('form.dropzone', { paramName: 'BranchImage[branch_image_path]' }); dropZone.on("complete", function (file) { if (file.status !== 'success') { return false; } let row = _.template($('#item-image-row').html()); $con=row({ path: '/' + file.xhr.response, i: $('.item-image-table tbody tr').length + 1 }); $('.first_child').append(row({ path: '/' + file.xhr.response, i: $('.item-image-table tbody tr').length + 1 })); }); $('#image-modal').on('hidden.bs.modal', function () { dropZone.removeAllFiles(); }); }); function removeItemImage($row) { $row = $($row).closest('tr'); $row.fadeOut(function () { setTimeout(function () { $row.remove(); }, 500); }); } function deleteimage(id) { Core.ajax({ url : '<?= Url::to(['branch/imagedel']) ?>', data : { id : id}, done : function (json) { if ( parseInt(json.status) === 1 ) { $('#'+id).remove(); Core.success(json.msg); return; } Core.handleInvalidServerResponse(json); } }); } runOnLoad (function () { $(".select2").select2(); }); var infowindow = null; var map = null; var marker = null; var city = null; var country = null; var area = null; var route = null; function initMap() { var norway = {lat: <?=Com::APP_LATITUDE ?>, lng: <?= Com::APP_LONGITUDE ?>}; map = new google.maps.Map(document.getElementById('map'), { zoom: 10, center: norway }); var input = document.getElementById('branchlang-branch_address_line1'); var searchBox = new google.maps.places.SearchBox(input); var geocoder = new google.maps.Geocoder; infowindow = new google.maps.InfoWindow; google.maps.event.addListener(searchBox, 'places_changed', function () { searchBox.set('map', null); var places = searchBox.getPlaces(); city = document.getElementById("branchlang-city"); country = document.getElementById("branchlang-country"); area = document.getElementById("branchlang-area"); route = document.getElementById("branchlang-branch_address_line1"); city.value = ''; area.value = ''; country.value = ''; addMarker(places); }); if(document.getElementById("branch-latitude").value != 0) { var lat = document.getElementById("branch-latitude").value; var lng = document.getElementById("branch-longitude").value; var points = {lat:parseFloat(lat) , lng: parseFloat(lng)}; geocoder.geocode({'location': points}, function(results, status){ if(status == google.maps.GeocoderStatus.OK) { if(results[0]) { marker = new google.maps.Marker({ position: points, map: map, draggable: true }); infowindow.setContent(results[0].formatted_address); infowindow.open(map, marker); map.setCenter(points); } } google.maps.event.addListener(marker, 'dragend', function (event) { var latlng = this.getPosition(); geocodeLatLng(geocoder, map, infowindow, latlng, marker); }); google.maps.event.addListener(map, 'click', function(event) { var latlng = event.latLng; marker.setPosition(latlng); geocodeLatLng(geocoder, map, infowindow, latlng, marker); }); }); } function addMarker(places) { var bounds = new google.maps.LatLngBounds(); var i, place; for (i = 0; place = places[i]; i++) { (function (place) { try { marker.setMap(null); } catch (e) { } marker = new google.maps.Marker({ map: map, title: place.name, position: place.geometry.location, draggable: true }); infowindow.setContent(place.formatted_address); infowindow.open(map, marker); var i = 0; var data = place.address_components; document.getElementById("branch-latitude").value = place.geometry.location.lat(); document.getElementById("branch-longitude").value = place.geometry.location.lng(); for (i; i < (data).length; i++) { var type = data[i].types; if (type == 'street_number') { route.value = data[i].long_name; } else if (type == 'route') { route.value += ',' + data[i].long_name; } else if (type == 'locality,political') { area.value = data[i].long_name; } else if (type == 'administrative_area_level_2,political') { if (type !== '') { city.value = data[i].long_name; } } else if (type == 'country,political') { country.value = data[i].long_name; } else if (type == 'country,political') { country.value = data[i].long_name; } } marker.bindTo('map', searchBox, 'map'); google.maps.event.addListener(marker, 'map_changed', function () { if (!this.getMap()) { this.unbindAll(); } }); bounds.extend(place.geometry.location); }(place)); } map.fitBounds(bounds); searchBox.set('map', map); map.setZoom(Math.min(map.getZoom(), 8)); google.maps.event.addListener(marker, 'dragend', function (event) { var latlng = this.getPosition(); geocodeLatLng(geocoder, map, infowindow, latlng, marker); }); } } function geocodeLatLng(geocoder, map, infowindow, latlng, marker) { var coord = {lat: latlng.lat(), lng: latlng.lng()}; document.getElementById("branch-latitude").value = latlng.lat(); document.getElementById("branch-longitude").value = latlng.lng(); document.getElementById("branchlang-branch_address_line1").value = ''; document.getElementById("branchlang-city").value = ''; geocoder.geocode({'location': coord}, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[0]) { marker.position = coord; marker.map = map; marker.draggable = true; infowindow.setContent(results[0].formatted_address); } infowindow.open(map, marker); var i = 0; var result = results[0].address_components; city = document.getElementById("branchlang-city"); country = document.getElementById("branchlang-country"); area = document.getElementById("branchlang-area"); route = document.getElementById("branchlang-branch_address_line1"); for (i; i < (result).length; i++) { var type = result[i].types; if (type == 'street_number') { route.value = result[i].long_name; } else if (type == 'route') { route.value += ',' + result[i].long_name; } else if (type == 'locality,political') { area.value = result[i].long_name; } else if (type == 'administrative_area_level_2,political') { if (type !== '') { city.value = result[i].long_name; } } else if (type == 'country,political') { country.value = result[i].long_name; } else if (type == 'country,political') { country.value = result[i].long_name; } } } }); } </script>
Save
cmd:
run