23 lines
1.4 KiB
PHP
23 lines
1.4 KiB
PHP
<script>
|
|
$(function(){
|
|
var itemIndex = $('#customs_items_table tbody tr').length;
|
|
$('#add_customs_item').on('click', function(){
|
|
var row = '<tr class="customs-item-row">'+
|
|
'<td><input type="text" name="items['+itemIndex+'][description]" class="form-control"></td>'+
|
|
'<td><input type="text" name="items['+itemIndex+'][hs_code]" class="form-control"></td>'+
|
|
'<td><input type="text" name="items['+itemIndex+'][quantity]" class="form-control input_number item-qty" value="1"></td>'+
|
|
'<td><input type="text" name="items['+itemIndex+'][unit]" class="form-control"></td>'+
|
|
'<td><input type="text" name="items['+itemIndex+'][customs_value]" class="form-control input_number item-value" value="0"></td>'+
|
|
'<td><input type="text" name="items['+itemIndex+'][duty_rate]" class="form-control input_number item-duty" value="0"></td>'+
|
|
'<td><input type="text" name="items['+itemIndex+'][vat_rate]" class="form-control input_number item-vat" value="0"></td>'+
|
|
'<td><button type="button" class="btn btn-xs btn-danger remove-customs-item"><i class="fa fa-trash"></i></button></td>'+
|
|
'</tr>';
|
|
$('#customs_items_table tbody').append(row);
|
|
itemIndex++;
|
|
});
|
|
$(document).on('click', '.remove-customs-item', function(){
|
|
if($('#customs_items_table tbody tr').length > 1) $(this).closest('tr').remove();
|
|
});
|
|
});
|
|
</script>
|