Skip to content

Instantly share code, notes, and snippets.

@esmeromichael
Created January 14, 2017 06:24
Show Gist options
  • Save esmeromichael/b2ed3c81f612d3e9f8a74ead936fba96 to your computer and use it in GitHub Desktop.
Save esmeromichael/b2ed3c81f612d3e9f8a74ead936fba96 to your computer and use it in GitHub Desktop.
$('.add-header').on('click',function(){
var header = $(this).parent().find('#header-name').val();
$('tbody.content').prepend('<tr> \
<td> <div class="groupborder" style="border-color:#333333;">\
<table style="width:100%;" class="tables_details"> \
<th id="groups" data-id="'+headcount+'" style="background-color: #333333; width: 2000px;" > \
<input type="hidden" name="hid[]" class="hid" value=""> \
<label style="display:inline-block;float:left; margin-left:900px; width:60px; color:#FFFFFF;"><strong>Sub-total:</strong></label> \
<label class="head" style="padding-left:8px;margin-bottom:-4px;width:300px;height:20px;display: block; margin-left: -930px; float: left; font-size: 11px;; color:#FFFFFF;">HEADER '+headcount+'</label> \
<input type="text" name="header_name[]" class="edit-input" style="width:300px;height:20px; display: none; margin-left: -930px; float: left; padding-left:5px;" value="HEADER '+headcount+'"/> \
<input name="header_id[]" type="hidden" value="'+headcount+'"> \
<a href="" class="rm-header fa fa-times-circle fa-lg" style="float:right; margin-right:5px; margin-top:5px"></a> \
<label style="display:inline-block; float:right; margin-right:18px; font-weight:bold; color:#FFFFFF;" class="total" id="total_'+headcount+'" data-sub_id="'+headcount+'">0.00</strong></label> \
<input type="hidden" name="subtotal[]" class="stotal" id="stotal_'+headcount+' stotal" value="0.00"> \
</th> \
<tbody class="subcontent tbody"></tbody> \
</table>\
</div></td> \
</tr>');
// header tweak
var dad = $(this).parent().parent();
edit(dad);
$('.head').on('click', function(){
var dad = $(this).parent().parent();
edit(dad);
})
sort();
headcount+=1;
$('.rm-header').on('click',function(){
l = $(this);
headrm(l);
return false;
})
$( ".content" ).sortable({
disabled: false
});
$( ".subcontent" ).sortable({
disabled: false
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment