Subversion Repositories SmartDukaan

Rev

Rev 1977 | Rev 5941 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1977 Rev 5145
Line 71... Line 71...
71
    return false;
71
    return false;
72
  });
72
  });
73
 
73
 
74
  var count_item_rows =  $('.summarypage-row').length;
74
  var count_item_rows =  $('.summarypage-row').length;
75
  var total_column = $('.column-score-total').length;
75
  var total_column = $('.column-score-total').length;
76
  //alert($('.column-score-total').length);
-
 
77
  //alert($('.summary-dropdown').length);
-
 
78
  //alert($('.product-1').length);
-
 
79
  var cols_row = count_item_rows - total_column;
76
  var cols_row = count_item_rows - total_column;
80
  $(".summary-dropdown").change(function(){
77
  $(".summary-dropdown").change(function(){
81
    var product_values = '';
78
    var product_values = '';
82
    var item_Value = this.value;
79
    var item_Value = this.value;
83
    var item_data = Array();
80
    var item_data = Array();
84
    var importance_data = Array();
81
    var importance_data = Array();
85
    var column_count = $('.summary-column').length;
82
    var column_count = $('.summary-column').length;
86
    
83
    
87
    SelectID = this.id;
84
    SelectID = this.id;
88
    
85
    
89
    
-
 
90
    //var selected = $("#colorselector option:selected");
-
 
91
	//var itemid = selected.val();
-
 
92
	
-
 
93
    
-
 
94
    for(i = 0; i < total_column; i++){
86
    for(i = 0; i < total_column; i++){
95
    	item_data[i] = Array();
87
    	item_data[i] = Array();
96
      var Scores = '';
88
      var Scores = '';
97
      var k = i + 1;
89
      var k = i + 1;
98
      var j = 0;
90
      var j = 0;
Line 102... Line 94...
102
          Scores += items_html+'::';
94
          Scores += items_html+'::';
103
        }
95
        }
104
        item_data[i][j] = parseFloat(items_html);
96
        item_data[i][j] = parseFloat(items_html);
105
        j++;
97
        j++;
106
      });
98
      });
107
      //item_data[i] = Scores;
-
 
108
      //alert(item_data[i]);
-
 
109
      //product_values += item_data[i].split(',')+'---';
-
 
110
    }
99
    }
111
    //alert(item_data);
-
 
112
    //var items = 'itemvalue='+item_Value+'&column='+column_count+'&data='+product_values;
-
 
113
    var items_total = 'itemvalue='+item_Value+'&column='+column_count+'&total='+total_column+'&data='+product_values;
100
    var items_total = 'itemvalue='+item_Value+'&column='+column_count+'&total='+total_column+'&data='+product_values;
114
//alert(items_total);
-
 
-
 
101
 
115
var i = 0;
102
var i = 0;
116
$('.summary-dropdown').each(function(){
103
$('.summary-dropdown').each(function(){
117
    importance_data[i] = parseInt($(this).val());
104
    importance_data[i] = parseInt($(this).val());
118
    i++;
105
    i++;
119
  });
106
  });
120
//alert(importance_data);
-
 
-
 
107
 
121
var item = "";
108
var item = "";
122
for(i = 0; i < total_column; i++){
109
for(i = 0; i < total_column; i++){
123
	//alert(item_data[i]);
-
 
124
	//alert(importance_data);
-
 
125
	
-
 
126
    var commulative_weighted_score = 0.0;
110
    var commulative_weighted_score = 0.0;
127
    var commulative_weights = 0.0;
111
    var commulative_weights = 0.0;
128
 
112
 
129
    
113
    
130
    for (var j = 0; j < importance_data.length; j++){ 
114
    for (var j = 0; j < importance_data.length; j++){ 
Line 138... Line 122...
138
        }
122
        }
139
		if(importance_data[j] == 3){
123
		if(importance_data[j] == 3){
140
        	commulative_weighted_score += item_data[i][j]*15;
124
        	commulative_weighted_score += item_data[i][j]*15;
141
        	commulative_weights += 15;
125
        	commulative_weights += 15;
142
        }
126
        }
143
		//alert(very_important_slides_score + "  " + very_important_slides_count);
-
 
144
		//alert(not_so_important_slides_score + " " + not_so_important_slides_count);
-
 
145
		//alert(regular_slides_score + " " + regular_slides_count);
-
 
146
     } 
127
     } 
147
    var weighted_score = commulative_weighted_score/commulative_weights;
128
    var weighted_score = commulative_weighted_score/commulative_weights;
148
    //alert("weighted score is " + weighted_score);
-
 
149
    weighted_score = Math.round(weighted_score*Math.pow(10,1))/Math.pow(10,1);
129
    weighted_score = Math.round(weighted_score*Math.pow(10,1))/Math.pow(10,1);
150
    
130
    
151
    item += weighted_score + ' / 10::';
131
    item += weighted_score + ' / 10::';
152
    //alert(item);
-
 
153
}
-
 
154
//item = '9.8/10::9.8/10';
-
 
155
 
-
 
156
    /*$.ajax({
-
 
157
      type: "POST",
-
 
158
      url: "test.php",
-
 
159
      data: items,
-
 
160
      success: function(item){
-
 
161
        var items_break = item.split('::');
-
 
162
        for(i = 0; i < items_break.length; i++){
-
 
163
          var incre = i+1;
-
 
164
          var class_name = '.features-color-'+incre;
-
 
165
          $('#'+SelectID).parent().parent().parent().find(class_name).html(items_break[i]);
-
 
166
        }
-
 
167
      }
-
 
168
    });*/
-
 
169
/*
-
 
170
  $.ajax({
-
 
171
      type: "POST",
-
 
172
      url: "test.php",
-
 
173
      data: items_total,
-
 
174
      success: function(item){
-
 
175
        var items_break = '';
-
 
176
        items_break = item.split('::');
-
 
177
        for(i = 0; i < items_break.length; i++){
-
 
178
          var incre = i+1;
-
 
179
          var class_name = '.score-total-'+incre;
-
 
180
          $(class_name).html(items_break[i]);
-
 
181
        }
-
 
182
      }
-
 
183
    });
-
 
184
  });
-
 
185
  $('.scroller-columns').hide();
-
 
186
  $('.comparision-page-title').hide();
-
 
187
*/
-
 
188
  //item = '9.8/10::9.8/10::';
-
 
189
  var items_break = '';
-
 
190
  items_break = item.split('::');
-
 
191
  for(i = 0; i < items_break.length; i++){
-
 
192
    var incre = i+1;
-
 
193
    var class_name = '.score-total-'+incre;
-
 
194
    $(class_name).html(items_break[i]);
-
 
195
 
-
 
196
  }
-
 
197
  });
-
 
198
  $('.scroller-columns').hide();
-
 
199
  $('.comparision-page-title').hide();
-
 
200
 
-
 
201
}
132
}
202
 
133
 
203
 
-
 
204
 
-
 
205
/*
-
 
206
  
-
 
207
 function renderComparison(){
-
 
208
  var SelectID;
-
 
209
  var subtract;
-
 
210
  var check = 0;
-
 
211
  var count = $('.comparision-product-column').length;
-
 
212
  if(count < 4) {
-
 
213
    if(count == 3) {
-
 
214
      subtract = 6;
-
 
215
    } else if(count == 2) {
-
 
216
      subtract = 3;
-
 
217
    } else {
-
 
218
      subtract = 0;
-
 
219
    }
-
 
220
    var parentWidth = $('#comparision-right').width();
-
 
221
    var width = (parentWidth - subtract)/count;
-
 
222
    var newWidth = parseInt(width);
-
 
223
    $('.product-name').width(newWidth);
-
 
224
    $('.comparision-product-column').width(newWidth);
-
 
225
  }
-
 
226
  var styleTrack = $('.jspTrack').attr('style');
-
 
227
  $('.jspTrackbottom').attr('style', styleTrack);
-
 
228
  var styleDrag = $('.jspDrag').attr('style');
-
 
229
  $('.jspDragbottom').attr('style', styleDrag);
-
 
230
  $('.ui-state-default').click(function(){
-
 
231
    var aID = $("li.ui-state-active").children('a:first').attr('href');
-
 
232
    var array = aID.split("#");
-
 
233
    var displayID = array[1];
-
 
234
    var new_aID = $(this).children('a:first').attr('href');
-
 
235
    var new_array = new_aID.split("#");
-
 
236
    var new_displayID = new_array[1];
-
 
237
    $('.'+displayID).each(function(){
-
 
238
      this.style.display = 'none';
-
 
239
      $(this).removeClass("comparision-block").addClass('comparision-hide');
-
 
240
    });
-
 
241
    if(new_displayID == 'vtab-summary') {
-
 
242
      $('#comparision-right').removeClass("product-comparision-internal").addClass('product-comparision-home');
-
 
243
      $('.scroller-columns').hide();
-
 
244
      $('#comparision-summary-content').show();
-
 
245
      $('.comparision-page-title').hide();
-
 
246
    } else {
-
 
247
      $('#comparision-right').removeClass("product-comparision-home").addClass('product-comparision-internal');
-
 
248
      $('.scroller-columns').show();
-
 
249
      $('#comparision-summary-content').hide();
-
 
250
      $('.comparision-page-title').show();
-
 
251
    }
-
 
252
    $('.comparision-page-title').html(this.title);
-
 
253
    $('.ui-state-active').removeClass("ui-tabs-selected ui-state-active");
-
 
254
    $(this).addClass("ui-tabs-selected ui-state-active");
-
 
255
    $('.'+new_displayID).each(function() {
-
 
256
      var new_count = $('.'+new_displayID).length;
-
 
257
      if(new_count !== count) {
-
 
258
        $('.comparision-product-column').each(function(){
-
 
259
          var check_childern = $(this).find('.'+new_displayID).html();
-
 
260
          if(check_childern == null && check == 0) {
-
 
261
            $(this).append("<div class='"+new_displayID+" comparision-hide comparision-empty-column'><div class='featureslisting'><ul><li class='mainFeature'>No features listed for this category.</li></ul></div></div>");
-
 
262
            check = 1;
-
 
263
          }
-
 
264
        });
-
 
265
      }
-
 
266
      $(this).removeClass("comparision-hide").addClass('comparision-block');
-
 
267
      check = 0;
-
 
268
      this.style.display = 'block';
-
 
269
    });
-
 
270
    return false;
-
 
271
  });
-
 
272
  $('.comparision-hide').each(function(){
-
 
273
    this.style.display = 'none';
-
 
274
  });
-
 
275
  var count_item_rows =  $('.summarypage-row').length;
-
 
276
  var total_column = $('.column-score-total').length;
-
 
277
  //alert($('.column-score-total').length);
-
 
278
  //alert($('.summary-dropdown').length);
-
 
279
  //alert($('.product-1').length);
-
 
280
  var cols_row = count_item_rows - total_column;
-
 
281
  $(".summary-dropdown").change(function(){
-
 
282
    var product_values = '';
-
 
283
    var item_Value = this.value;
-
 
284
    var item_data = Array();
-
 
285
    var importance_data = Array();
-
 
286
    var column_count = $('.summary-column').length;
-
 
287
    
-
 
288
    SelectID = this.id;
-
 
289
    
-
 
290
    
-
 
291
    //var selected = $("#colorselector option:selected");
-
 
292
	//var itemid = selected.val();
-
 
293
	
-
 
294
    
-
 
295
    for(i = 0; i < total_column; i++){
-
 
296
    	item_data[i] = Array();
-
 
297
      var Scores = '';
-
 
298
      var k = i + 1;
-
 
299
      var j = 0;
-
 
300
      $('.product-'+k).each(function(){
-
 
301
        var items_html = $(this).html();
-
 
302
        if(items_html !== null) {
-
 
303
          Scores += items_html+'::';
-
 
304
        }
-
 
305
        item_data[i][j] = parseFloat(items_html);
-
 
306
        j++;
-
 
307
      });
-
 
308
      //item_data[i] = Scores;
-
 
309
      //alert(item_data[i]);
-
 
310
      //product_values += item_data[i].split(',')+'---';
-
 
311
    }
-
 
312
    //alert(item_data);
-
 
313
    //var items = 'itemvalue='+item_Value+'&column='+column_count+'&data='+product_values;
-
 
314
    var items_total = 'itemvalue='+item_Value+'&column='+column_count+'&total='+total_column+'&data='+product_values;
-
 
315
//alert(items_total);
-
 
316
var i = 0;
-
 
317
$('.summary-dropdown').each(function(){
-
 
318
    importance_data[i] = parseInt($(this).val());
-
 
319
    i++;
-
 
320
  });
-
 
321
//alert(importance_data);
-
 
322
var item = "";
-
 
323
for(i = 0; i < total_column; i++){
-
 
324
	//alert(item_data[i]);
-
 
325
	//alert(importance_data);
-
 
326
	
-
 
327
    var very_important_slides_score = 0.0;
-
 
328
    var regular_slides_score = 0.0;
-
 
329
    var not_so_important_slides_score = 0.0;
-
 
330
    var very_important_slides_count = 0;
-
 
331
    var regular_slides_count = 0;
-
 
332
    var not_so_important_slides_count = 0;
-
 
333
   
-
 
334
    for (var j = 0; j < importance_data.length; j++){ 
-
 
335
        if(importance_data[j] == 1){
-
 
336
        	very_important_slides_score += item_data[i][j];
-
 
337
        	very_important_slides_count += 1;
-
 
338
        }
-
 
339
        if(importance_data[j] == 2){
-
 
340
        	regular_slides_score += item_data[i][j];
-
 
341
        	regular_slides_count += 1;        	
-
 
342
        }
-
 
343
		if(importance_data[j] == 3){
-
 
344
        	not_so_important_slides_score += item_data[i][j];
-
 
345
        	not_so_important_slides_count += 1;
-
 
346
		}
-
 
347
		//alert(very_important_slides_score + "  " + very_important_slides_count);
-
 
348
		//alert(not_so_important_slides_score + " " + not_so_important_slides_count);
-
 
349
		//alert(regular_slides_score + " " + regular_slides_count);
-
 
350
     } 
-
 
351
    var weighted_score = (55*very_important_slides_score/very_important_slides_count + 30*regular_slides_score/regular_slides_count + 15*not_so_important_slides_score/not_so_important_slides_count)/100;
-
 
352
    //alert("weighted score is " + weighted_score);
-
 
353
    weighted_score = Math.round(weighted_score*Math.pow(10,1))/Math.pow(10,1);
-
 
354
    
-
 
355
    item += weighted_score + '/10::';
-
 
356
    //alert(item);
-
 
357
}
-
 
358
//item = '9.8/10::9.8/10';
-
 
359
 
-
 
360
 
-
 
361
  //item = '9.8/10::9.8/10::';
-
 
362
  var items_break = '';
134
  var items_break = '';
363
  items_break = item.split('::');
135
  items_break = item.split('::');
364
  for(i = 0; i < items_break.length; i++){
136
  for(i = 0; i < items_break.length; i++){
365
    var incre = i+1;
137
    var incre = i+1;
366
    var class_name = '.score-total-'+incre;
138
    var class_name = '.score-total-'+incre;
Line 370... Line 142...
370
  });
142
  });
371
  $('.scroller-columns').hide();
143
  $('.scroller-columns').hide();
372
  $('.comparision-page-title').hide();
144
  $('.comparision-page-title').hide();
373
 
145
 
374
}
146
}
375
*/
-
 
376
147