Rev 36136 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<div class="panel panel-default"><div class="panel-heading"><h4>Invoice #$invoice.getInvoiceNumber() - GRN Correction</h4>#if($invoice.getInvoiceDate())<span class="text-muted">Invoice Date: $invoice.getInvoiceDate().format($dateFormatter)</span>#end</div><div class="panel-body">#if($hasPendingRequest)<div class="alert alert-warning">A pending correction request already exists for this invoice. Please wait for approval.</div>#end<h5>Items on Invoice</h5><table class="table table-bordered table-condensed" id="correction-items-table"><thead><tr><th>Item Id</th><th>Item</th><th>Invoice Qty</th><th>Current IMEIs / Serial Numbers</th></tr></thead><tbody>#foreach($invoiceItem in $invoiceItems)<tr><td class="currentItemId">$invoiceItem.getItemId()</td><td>#if($itemMap.get($invoiceItem.getItemId()))$itemMap.get($invoiceItem.getItemId()).getItemDescription()#else$invoiceItem.getItemId()#end</td><td>$invoiceItem.getQty()</td><td>#if($inventoryByItem.get($invoiceItem.getItemId()))#set($hasSerialized = false)#foreach($inv in $inventoryByItem.get($invoiceItem.getItemId()))#if($inv.getSerialNumber())#set($hasSerialized = true)<span class="label label-default imei-label"data-serial="$inv.getSerialNumber()"data-itemid="$invoiceItem.getItemId()"data-scantype="$inv.getLastScanType()">$inv.getSerialNumber()</span>#end#end#if(!$hasSerialized)(Non-serialized: qty $invoiceItem.getQty())#end#else(Non-serialized: qty $invoiceItem.getQty())#end</td></tr>#end</tbody></table><hr/><h5>Serial Number Corrections</h5><p class="text-muted">For serialized items: enter the wrong IMEI and the correct IMEI to replace it.</p><table class="table table-bordered table-condensed" id="serial-corrections-table"><thead><tr><th>Old Serial Number (wrong)</th><th>New Serial Number (correct)</th><th></th></tr></thead><tbody><tr class="serial-correction-row"><td><input type="text" class="form-control old-serial" placeholder="Enter wrong IMEI/serial" /></td><td><input type="text" class="form-control new-serial" placeholder="Enter correct IMEI/serial" /></td><td><button class="btn btn-sm btn-danger removeSerialCorrectionRow">Remove</button></td></tr></tbody></table><button class="btn btn-sm btn-default addSerialCorrectionRow">+ Add Row</button><hr/><h5>Item Corrections (Move IMEI or Quantity)</h5><p class="text-muted">Move an IMEI or quantity from one item to another. For serialized items, enter the IMEI.</p><table class="table table-bordered table-condensed" id="qty-corrections-table"><thead><tr><th>From Item</th><th>To Item</th><th>IMEI / Serial</th><th>Qty</th><th></th></tr></thead><tbody><tr class="qty-correction-row"><td><input type="text" class="form-control typeaheaditem qty-old-item" autocomplete="off" placeholder="Search from item..." /><input type="hidden" class="qty-old-itemid" /></td><td><input type="text" class="form-control typeaheaditem qty-new-item" autocomplete="off" placeholder="Search to item..." /><input type="hidden" class="qty-new-itemid" /></td><td><input type="text" class="form-control qty-serial" placeholder="IMEI(s) space-separated" /></td><td><input type="number" class="form-control qty-correction-val" placeholder="Qty" min="1" /></td><td><button class="btn btn-sm btn-danger removeQtyCorrectionRow">Remove</button></td></tr></tbody></table><button class="btn btn-sm btn-default addQtyCorrectionRow">+ Add Row</button><hr/><div class="form-group"><label>Remarks (reason for correction):</label><textarea class="form-control" id="correctionRemarks" rows="3" placeholder="Describe why this correction is needed..."></textarea></div>#if(!$hasPendingRequest)<button class="btn btn-primary submitGrnCorrection" data-invoiceid="$invoice.getId()">Submit Correction Request</button>#end</div></div><script>#[[$(function() {// Initialize typeahead for qty correction rowsfunction initQtyTypeahead($row) {getItemAheadOptions($row.find('.qty-old-item'), true, function(selectedItem) {$row.find('.qty-old-itemid').val(selectedItem.itemId);});getItemAheadOptions($row.find('.qty-new-item'), true, function(selectedItem) {$row.find('.qty-new-itemid').val(selectedItem.itemId);});}// Init typeahead on existing rows$('#qty-corrections-table tbody tr').each(function() {initQtyTypeahead($(this));});// Add serial correction row$(document).on('click', '.addSerialCorrectionRow', function() {var $row = $('<tr class="serial-correction-row">' +'<td><input type="text" class="form-control old-serial" placeholder="Enter wrong IMEI/serial" /></td>' +'<td><input type="text" class="form-control new-serial" placeholder="Enter correct IMEI/serial" /></td>' +'<td><button class="btn btn-sm btn-danger removeSerialCorrectionRow">Remove</button></td>' +'</tr>');$('#serial-corrections-table tbody').append($row);});// Add qty correction row$(document).on('click', '.addQtyCorrectionRow', function() {var $row = $('<tr class="qty-correction-row">' +'<td><input type="text" class="form-control typeaheaditem qty-old-item" autocomplete="off" placeholder="Search from item..." /><input type="hidden" class="qty-old-itemid" /></td>' +'<td><input type="text" class="form-control typeaheaditem qty-new-item" autocomplete="off" placeholder="Search to item..." /><input type="hidden" class="qty-new-itemid" /></td>' +'<td><input type="text" class="form-control qty-serial" placeholder="IMEI(s) space-separated" /></td>' +'<td><input type="number" class="form-control qty-correction-val" placeholder="Qty" min="1" /></td>' +'<td><button class="btn btn-sm btn-danger removeQtyCorrectionRow">Remove</button></td>' +'</tr>');$('#qty-corrections-table tbody').append($row);initQtyTypeahead($row);});// Remove rows$(document).on('click', '.removeSerialCorrectionRow', function() {$(this).closest('tr').remove();});$(document).on('click', '.removeQtyCorrectionRow', function() {$(this).closest('tr').remove();});});]]#</script>