Commit 9f115bdf2a5fcb45d53ce8af3abc33ea02cee6c9

Authored by Administrator
1 parent 4c373a79

ашкые

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