diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js
index c4a81194..1ddde0e4 100755
--- a/app/assets/javascripts/addorder.js
+++ b/app/assets/javascripts/addorder.js
@@ -368,8 +368,7 @@ $(function() {
if (items.length >= min_qty) {
item = get_set_item(items);
- console.log(item)
- // customer_display_view(item,"add");
+ customer_display_view(item,"set_add");
attribute_arr = []
option_arr = []
@@ -405,6 +404,7 @@ $(function() {
price = $(items[i]).attr('data-price');
option = $(items[i]).attr('data-options');
sub_item = $(items[i]).attr('data-sub-item');
+ option = $(items[i]).attr('data-options');
total = qty * price ;
option_arr.push(option);
row ="
1) {
- qty = parseInt($(item_row[j]).children('#item_qty').text()) + qty;
- }else{
- qty = parseInt($(item_row[j]).children('#item_qty').text()) + 1;
- }
-
- $(item_row[j]).children('#item_qty').text(qty);
- parseFloat($(item_row[j]).children('#item_price').text(parseFloat(price*qty).toFixed(2)));
- append =1;
+ instance_name = items[i].instance;
+ if (instance_name == "undefined"){
+ instance = '';
}else{
- if (qty > 1) {
- qty = qty;
- }else{
- qty = 1;
- }
- }
- });
- if (append===0) {
- row ="
"
- +'| '+rowCount+' | '
- +'' + items[i].name+ ' ' + instance + ' ' + option_name +' | '
- +'' + qty + ' | '
- +''
- + parseFloat(price).toFixed(2)
- +' | '
- +'
';
- $(".second_display_items tbody").append(row);
-
+ instance = "("+items[i].instance+")";
+ }
+
+ d_option = items[i].options;
+ if (d_option){
+ option_name = "-"+items[i].options;
+ }else{
+ option_name = '';
+ }
+
+ var rowCount = $('.second_display_items tbody tr').length+1;
+ var item_row = $('.second_display_items tbody tr');
+
+ $(item_row).each(function(j){
+ var item_code = $(item_row[j]).attr('data-code');
+ var instance_code = $(item_row[j]).attr('data-instance-code');
+ var r_option = $(item_row[j]).attr('data-options');
+ if (item_code == items[i].item_code && instance_code == items[i].instance_code && r_option==d_option) {
+ if (qty > 1) {
+ qty = parseInt($(item_row[j]).children('#item_qty').text()) + qty;
+ }else{
+ qty = parseInt($(item_row[j]).children('#item_qty').text()) + 1;
+ }
+
+ $(item_row[j]).children('#item_qty').text(qty);
+ parseFloat($(item_row[j]).children('#item_price').text(parseFloat(price*qty).toFixed(2)));
+ append =1;
+ }else{
+ if (qty > 1) {
+ qty = qty;
+ }else{
+ qty = 1;
+ }
+ }
+ });
+ if (append===0) {
+ row =""
+ +'| '+rowCount+' | '
+ +'' + items[i].name+ ' ' + instance + ' ' + option_name +' | '
+ +'' + qty + ' | '
+ +''
+ + parseFloat(price).toFixed(2)
+ +' | '
+ +'
';
+ $(".second_display_items tbody").append(row);
+
+ }
+ }
+ }
+ if (status == "set_add") {
+ // var option_arr = [];
+ var attribute_arr = [];
+ var rowCount = $('.second_display_items tbody tr').length+1;
+ for(var i in items) {
+
+
+ code = items[i].code;
+ item_code = items[i].item_code;
+ name = items[i].name;
+ item_name = items[i].item_name;
+ qty = items[i].qty;
+ price = items[i].price;
+ option = items[i].option;
+ sub_item = items[i].sub_item;
+ total = qty * price ;
+ // option_arr.push(option);
+ row =""
+ +'| '+rowCount+' | '
+ +'' + item_name+ ' ' + name + ''+option+' | '
+ +'' + qty + ' | '
+ +''
+ + parseFloat(total).toFixed(2)
+ +' | '
+ +'
';
+ $(".second_display_items tbody").append(row);
+ rowCount = rowCount + 1;
+
}
}
//end apend items