Commit 9f115bdf2a5fcb45d53ce8af3abc33ea02cee6c9

Authored by Administrator
1 parent 4c373a79

ашкые

css/style.css
... ... @@ -2564,4 +2564,20 @@ hr.inline{
2564 2564 .send_sto_form .error{
2565 2565 color: red;
2566 2566 font-weight: normal;
  2567 +}
  2568 +
  2569 +
  2570 +#select-filter-form .col3{
  2571 + position: relative;
  2572 +}
  2573 +.active-select{
  2574 + font-size: 15px;
  2575 + font-weight: bold;
  2576 + color: #b2adb2;
  2577 + height: 15px;
  2578 + width: 15px;
  2579 + position: absolute;
  2580 + top: 5px;
  2581 + right: 17px;
  2582 + cursor: pointer;
2567 2583 }
2568 2584 \ No newline at end of file
... ...
protected/controllers/AjaxStoFilterController.php
... ... @@ -14,7 +14,9 @@ class AjaxStoFilterController extends Controller
14 14  
15 15 public function actionFilter(){
16 16  
17   - if(!empty(Yii::app()->request->getParam('StoFilter'))){
  17 + $post = Yii::app()->request->getParam('StoFilter');
  18 +
  19 + if(!empty($post)){
18 20  
19 21  
20 22 $form = new StoFilter();
... ... @@ -25,7 +27,10 @@ class AjaxStoFilterController extends Controller
25 27 $filter['transmission'] = $form->searchFilter('transmission');
26 28 $filter['fuel_type'] = $form->searchFilter('fuel_type');
27 29  
28   - if(!empty( Yii::app()->request->getParam('StoFilter')['model']) && !empty( Yii::app()->request->getParam('StoFilter')['engine']) && !empty( Yii::app()->request->getParam('StoFilter')['drive_unit']) && !empty( Yii::app()->request->getParam('StoFilter')['transmission'])&& !empty( Yii::app()->request->getParam('StoFilter')['fuel_type'])){
  30 +
  31 +
  32 +
  33 + if(!empty( $post['model']) && !empty( $post['engine']) && !empty( $post['drive_unit']) && !empty( $post['transmission'])&& !empty( $post['fuel_type'])){
29 34  
30 35 foreach($form->searchFilter('id') as $key => $val){
31 36  
... ... @@ -47,11 +52,11 @@ class AjaxStoFilterController extends Controller
47 52  
48 53  
49 54 public function actionRenderPriceList(){
50   - if(!empty(Yii::app()->request->getParam('id')) && !empty(Yii::app()->request->getParam('dist'))){
  55 + $id = Yii::app()->request->getParam('id');
  56 + $dist = Yii::app()->request->getParam('dist');
51 57  
  58 + if(!empty($id) && !empty($dist)){
52 59  
53   - $id = Yii::app()->request->getParam('id');
54   - $dist = Yii::app()->request->getParam('dist');
55 60  
56 61  
57 62 $names = new StoRequireName();
... ...
protected/modules/admin/controllers/StoFilterController.php
... ... @@ -38,7 +38,7 @@ class StoFilterController extends AdminController
38 38  
39 39 $count = $objPHPExcel->getSheetCount();
40 40  
41   - $fullArray = [];
  41 + $fullArray = array();
42 42 for($i =0; $i<$count; $i++){
43 43  
44 44 $objPHPExcel->setActiveSheetIndex($i);
... ... @@ -94,7 +94,7 @@ class StoFilterController extends AdminController
94 94 $mask_pause = 'НЕОБХІДНІ';
95 95 $mask_optional_start = 'НАЗВА';
96 96  
97   - $dist = [];
  97 + $dist = array();
98 98  
99 99 $requireParamsArea = false;
100 100  
... ... @@ -208,9 +208,16 @@ class StoFilterController extends AdminController
208 208  
209 209 public function saveFile(){
210 210 $path = dirname(Yii::app()->basePath).'/uploads/parser';
  211 + $path2 = dirname(Yii::app()->basePath).'/images/action';
211 212  
212 213 $uploadfile = $path .'/'.basename($_FILES['files']['name']);
  214 + if(!is_dir($path)) {
  215 + mkdir($path, 0777, true);
  216 + }
213 217  
  218 + if(!is_dir($path2)) {
  219 + mkdir($path2, 0777, true);
  220 + }
214 221 if (move_uploaded_file($_FILES['files']['tmp_name'], $uploadfile)) {
215 222 return $uploadfile;
216 223 } else {
... ...
protected/views/stoFilter/index.php
... ... @@ -27,7 +27,7 @@ $cs-&gt;registerScriptFile(&#39;/css/bootstrap/js/bootstrap.min.js&#39;);
27 27 <div class="row">
28 28 <div class="col3">
29 29 <select id="brand" name="StoFilter[brand]">
30   - <option disabled selected>Марка</option>
  30 + <option class="default" disabled selected>Марка</option>
31 31 <?php foreach($brands as $brand):?>
32 32 <option value="<?= $brand->brand ?>"><?= $brand->brand ?></option>
33 33 <?php endforeach;?>
... ... @@ -35,17 +35,12 @@ $cs-&gt;registerScriptFile(&#39;/css/bootstrap/js/bootstrap.min.js&#39;);
35 35 </div>
36 36 <div class="col3">
37 37 <select id="model" disabled name="StoFilter[model]">
38   - <option disabled selected>Модель</option>
  38 + <option class="default" disabled selected>Модель</option>
39 39 </select>
40 40 </div>
41 41 <div class="col3">
42 42 <select id="engine" disabled name="StoFilter[engine]">
43   - <option disabled selected>Двигатель</option>
44   - <option >Двигатель</option>
45   - <option >Двигатель</option>
46   - <option >Двигатель</option>
47   - <option >Двигатель</option>
48   - <option >Двигатель</option>
  43 + <option class="default" disabled selected>Двигатель</option>
49 44 </select>
50 45 </div>
51 46  
... ... @@ -53,17 +48,17 @@ $cs-&gt;registerScriptFile(&#39;/css/bootstrap/js/bootstrap.min.js&#39;);
53 48 <div class="row">
54 49 <div class="col3">
55 50 <select id="drive_unit" disabled name="StoFilter[drive_unit]">
56   - <option disabled selected>Привод</option>
  51 + <option class="default" disabled selected>Привод</option>
57 52 </select>
58 53 </div>
59 54 <div class="col3">
60 55 <select id="transmission" disabled name="StoFilter[transmission]">
61   - <option disabled selected>Коробка</option>
  56 + <option class="default" disabled selected>Коробка</option>
62 57 </select>
63 58 </div>
64 59 <div class="col3">
65 60 <select id="fuel_type" disabled name="StoFilter[fuel_type]">
66   - <option disabled selected>Тип топлива</option>
  61 + <option class="default" disabled selected>Тип топлива</option>
67 62 </select>
68 63 </div>
69 64  
... ... @@ -71,7 +66,7 @@ $cs-&gt;registerScriptFile(&#39;/css/bootstrap/js/bootstrap.min.js&#39;);
71 66 <div class="row">
72 67 <div class="col3">
73 68 <select id="mileage" disabled name="mileage">
74   - <option disabled selected>Пробег</option>
  69 + <option class="default" disabled selected>Пробег</option>
75 70 </select>
76 71 </div>
77 72 </div>
... ... @@ -142,10 +137,20 @@ $cs-&gt;registerScriptFile(&#39;/css/bootstrap/js/bootstrap.min.js&#39;);
142 137  
143 138  
144 139  
  140 + $('body').on('click', '.active-select', function(){
  141 +
  142 +
  143 +
  144 + $(this).siblings('select').find('.default').attr('selected','selected').trigger('change');
  145 +
  146 + });
  147 +
145 148 var insertOptions = function(result, id){
146 149  
147 150 var select = $("#"+id);
148 151  
  152 +
  153 +
149 154 select.prop("disabled", false);
150 155  
151 156 var data_select = select.val();
... ... @@ -157,13 +162,19 @@ $cs-&gt;registerScriptFile(&#39;/css/bootstrap/js/bootstrap.min.js&#39;);
157 162 select.append(options);
158 163  
159 164 for(property in result[id]){
160   - if(data_select ==property ){
  165 +
  166 +
  167 + if(data_select ==property.trim() ){
  168 +
  169 + select.parent('.col3').append('<div class="active-select">X</div>');
  170 +
161 171 select.append($('<option>', {
162 172 value: property,
163 173 text : property,
164 174 selected: true
165 175 }));
166 176 } else {
  177 +
167 178 select.append($('<option>', {
168 179 value: property,
169 180 text : property
... ... @@ -247,6 +258,7 @@ $cs-&gt;registerScriptFile(&#39;/css/bootstrap/js/bootstrap.min.js&#39;);
247 258  
248 259 var result = JSON.parse(data);
249 260  
  261 + $('body').find('.active-select').remove();
250 262  
251 263 if(Object.keys(result.model).length){
252 264 insertOptions(result, 'model');
... ...