echo Html::encode($this->title . ' | Administrator'); ?> </title> <?php // Css $this->registerCssFile($this->theme->baseUrl . '/css/plugins/iCheck/custom.css', ['depends' => BackendAsset::className()]); // $this->registerCssFile($this->theme->baseUrl . '/css/plugins/cropper/cropper.min.css', ['depends' => BackendAsset::className()]); // $this->registerCssFile($this->theme->baseUrl . '/css/plugins/cropper/main.css', ['depends' => BackendAsset::className()]); $this->registerCssFile($this->theme->baseUrl . '/css/animate.css', ['depends' => BackendAsset::className()]); $this->registerCssFile($this->theme->baseUrl . '/css/style.css', ['depends' => BackendAsset::className()]); $this->registerCssFile($this->theme->baseUrl . '/css/letyii.css', ['depends' => BackendAsset::className()]); // Javascript $this->registerJsFile($this->theme->baseUrl . '/js/plugins/metisMenu/jquery.metisMenu.js', ['depends' => BackendAsset::className()]); $this->registerJsFile($this->theme->baseUrl . '/js/plugins/slimscroll/jquery.slimscroll.min.js', ['depends' => BackendAsset::className()]); // iCheck $this->registerJsFile($this->theme->baseUrl . '/js/plugins/iCheck/icheck.min.js', ['depends' => BackendAsset::className()]); $this->registerJs("\r\n \$('.i-checks').iCheck({\r\n checkboxClass: 'icheckbox_square-green',\r\n radioClass: 'iradio_square-green',\r\n });\r\n ", yii\web\View::POS_READY); $this->head(); echo Html::csrfMetaTags(); ?> <link href="<?php echo $this->theme->baseUrl; ?> /css/plugins/chosen/chosen.css" rel="stylesheet"> </head> <body> <?php $this->beginBody(); ?> <div id="wrapper"> <nav class="navbar-default navbar-static-side" role="navigation">
<div class="ibox "> <div class="ibox-title"> <h5><?php echo Yii::t('category', 'Category'); ?> </h5> </div> <div class="ibox-content"> <input type="hidden" id="data_list_category" /> <!--<p class="m-b-lg"> Each list you can customize by standard css styles. Each element is responsive so you can add to it any other element to improve functionality of list. </p>--> <?php echo $tree; ?> </div> </div> </div> </div> <?php } ?> </div> <script type="text/javascript"> </script> <?php $this->registerCssFile($this->theme->baseUrl . '/css/plugins/sweetalert/sweetalert.css', ['depends' => BackendAsset::className()]); $this->registerJsFile($this->theme->baseUrl . '/js/plugins/sweetalert/sweetalert.min.js', ['depends' => BackendAsset::className()]); $this->registerJs("\r\n \$('#saveChanges').hide();\r\n var updateOutputCategory = function (e) {\r\n var list = e.length ? e : \$(e.target),\r\n output = list.data('output');\r\n if (window.JSON) {\r\n \$('#data_list_category').val(window.JSON.stringify(list.nestable('serialize')));\r\n \$('#saveChanges').show();\r\n } else {\r\n console.log('JSON browser support required for this demo.');\r\n }\r\n };\r\n\r\n \$('#nestable_category').nestable({\r\n group: 1\r\n }).on('change', updateOutputCategory);\r\n", yii\web\View::POS_READY); $this->registerJs("\r\n function createCategory(name) {\r\n // Tạo form update\r\n \$('#formDefault').modal('show');\r\n// \$('#formDefault #category-name').val(\$('.dd-item[data-id=' + name + '] .dd-handle:first').text().trim());\r\n \$('#formDefault #category-name').attr('data-name', name);\r\n }\r\n\r\n function updateCategory() {\r\n var id = \$('#formDefault #category-name').attr('data-name');\r\n var name = \$('#formDefault #category-name').val();\r\n var module = '" . Yii::$app->request->get('module') . "';\r\n \$.ajax({\r\n url: '" . Url::to(['/category/ajax/updatecategory']) . "',\r\n type: 'post',\r\n dataType: 'json',\r\n data: {id: id, name: name, module: module},\r\n }).done(function (msg) {\r\n \$('#formDefault #roleDescription').attr('data-name', '');\r\n var stringItem = '<li class=\"dd-item\" data-id=\"' + msg.id + '\"><div class=\"btn-group pull-right\">' +\r\n '<span class=\"btn btn-success btn-xs\" onclick=\"createCategory(\\'' + msg.id + '\\')\"><i class=\"glyphicon glyphicon-plus\"></i></span>' +\r\n '<a class=\"btn btn-info btn-xs\" href=\"" . Url::to(['/category/backend/default/update']) . "?id=' + msg.id + '\"><i class=\"glyphicon glyphicon-pencil\"></i></a>' +\r\n '<span class=\"btn btn-danger btn-xs\" onclick=\"deleteCategory(\\'' + msg.id + '\\')\"><i class=\"glyphicon glyphicon-trash\"></i></span>' +\r\n '</div><div class=\"dd-handle\">' + msg.name + '</div></li>';\r\n if (msg.status == 2) {\r\n if (jQuery.isEmptyObject(id)) {\r\n \$('.dd-list:first').append(stringItem);\r\n } else {\r\n if (\$('.dd-item[data-id=\"' + id + '\"] ul.dd-list').html()) {\r\n \$('.dd-item[data-id=\"' + id + '\"] ul.dd-list:first').append(stringItem);\r\n } else {\r\n \$('.dd-item[data-id=\"' + id + '\"]').append('<ul class=\"dd-list\">' + stringItem + '</ul>');\r\n }\r\n }\r\n } else if (msg.status == 3) {\r\n \$('.ibox-content').html('<div id=\"nestable\" class=\"dd\"><ul class=\"dd-list\">' + stringItem + '</ul></div>');\r\n }\r\n\r\n if (msg.status == 0) {\r\n \$('#msg').show();\r\n \$('#msg').addClass('alert-danger');\r\n \$('#msg').text(msg.message);\r\n \$('#formDefault').modal('hide');\r\n } else {\r\n// \$('#msg').show();\r\n// \$('#msg').addClass('alert-success');\r\n// \$('#msg').text(msg.message);\r\n \$('#formDefault').modal('hide');\r\n }\r\n \$('#formDefault #category-name').val('');\r\n });\r\n }\r\n\r\n function deleteCategory(id) {\r\n if (confirm('" . Yii::t('yii', 'Are you sure you want to delete this item?') . "')) {\r\n \$.ajax({\r\n url: '" . Url::to(['/category/ajax/deletecategory']) . "',\r\n type: 'post',\r\n dataType: 'json',\r\n data: {id: id},\r\n }).done(function (msg) {\r\n \$('.dd-item[data-id=\"' + id + '\"] ul.dd-list').remove();\r\n \$('.dd-item[data-id=\"' + id + '\"]').remove();\r\n });\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n\r\n function changeUrlModule() {\r\n var choseModule = \$('#module option:selected').val();\r\n window.location.href = '" . Url::to(['default']) . "?module=' + choseModule;\r\n }\r\n \r\n function saveChanges(){\r\n var data = \$('#data_list_category').val();\r\n var module = '" . Yii::$app->request->get('module') . "';\r\n \$.ajax({\r\n url: '" . Url::to(['/category/ajax/updatelist']) . "',\r\n type: 'post',\r\n dataType: 'json',\r\n data: {data: data, module: module},\r\n }).done(function (msg) {\r\n \$('#saveChanges').hide();\r\n swal({\r\n title: '" . Yii::t('common', 'Good job!') . "',\r\n text: '" . Yii::t('common', 'Your changes have been saved!') . "',\r\n type: 'success'\r\n });\r\n });\r\n }\r\n", yii\web\View::POS_END);
<?php use yii\helpers\Html; use yii\widgets\Breadcrumbs; use app\assetbundle\BackendAsset; BackendAsset::register($this); $this->beginPage(); ?> <!DOCTYPE html> <html lang="<?php echo Yii::$app->language; ?> "> <head> <meta charset="<?php echo Yii::$app->charset; ?> "/> <meta name="viewport" content="width=device-width, initial-scale=1"> <title><?php echo Html::encode($this->title); ?> </title> <?php // Css $this->registerCssFile($this->theme->baseUrl . '/assets/css/letbootstrap.css', [\yii\bootstrap\BootstrapAsset::className()]); $this->registerCssFile($this->theme->baseUrl . '/assets/css/let.css', [\yii\bootstrap\BootstrapAsset::className()]); // Javascript // $this->registerJsFile($this->theme->baseUrl . '/assets/js/let.js', [\yii\web\JqueryAsset::className()]); ?> <?php
private function registerAssets() { $data = \yii\helpers\Json::encode($this->chartData); Yii::$app->getView()->registerJsFile(Yii::$app->view->theme->baseUrl . '/js/plugins/morris/raphael-2.1.0.min.js', ['depends' => BackendAsset::className()]); Yii::$app->getView()->registerJsFile(Yii::$app->view->theme->baseUrl . '/js/plugins/morris/morris.js', ['depends' => BackendAsset::className()]); Yii::$app->getView()->registerCssFile(Yii::$app->view->theme->baseUrl . '/css/plugins/morris/morris-0.4.3.min.css', ['depends' => BackendAsset::className()]); $this->getView()->registerJs("\r\n \$(function () {\r\n Morris.Line(" . $data . ");\r\n });\r\n ", \yii\web\View::POS_READY); }