| 35806 |
amit |
1 |
<div class="panel panel-default">
|
|
|
2 |
<div class="panel-heading">
|
|
|
3 |
<h4>Invoice #$invoice.getInvoiceNumber() - GRN Correction</h4>
|
|
|
4 |
</div>
|
|
|
5 |
<div class="panel-body">
|
|
|
6 |
|
|
|
7 |
#if($hasPendingRequest)
|
|
|
8 |
<div class="alert alert-warning">
|
|
|
9 |
A pending correction request already exists for this invoice. Please wait for approval.
|
|
|
10 |
</div>
|
|
|
11 |
#end
|
|
|
12 |
|
|
|
13 |
<h5>Items on Invoice</h5>
|
|
|
14 |
<table class="table table-bordered table-condensed" id="correction-items-table">
|
|
|
15 |
<thead>
|
|
|
16 |
<tr>
|
|
|
17 |
<th>Item Id</th>
|
|
|
18 |
<th>Item</th>
|
|
|
19 |
<th>Invoice Qty</th>
|
|
|
20 |
<th>Current IMEIs / Serial Numbers</th>
|
|
|
21 |
</tr>
|
|
|
22 |
</thead>
|
|
|
23 |
<tbody>
|
|
|
24 |
#foreach($invoiceItem in $invoiceItems)
|
|
|
25 |
<tr>
|
|
|
26 |
<td class="currentItemId">$invoiceItem.getItemId()</td>
|
|
|
27 |
<td>
|
|
|
28 |
#if($itemMap.get($invoiceItem.getItemId()))
|
|
|
29 |
$itemMap.get($invoiceItem.getItemId()).getModelName()
|
|
|
30 |
#if($itemMap.get($invoiceItem.getItemId()).getColor()) - $itemMap.get($invoiceItem.getItemId()).getColor()#end
|
|
|
31 |
#else
|
|
|
32 |
$invoiceItem.getItemId()
|
|
|
33 |
#end
|
|
|
34 |
</td>
|
|
|
35 |
<td>$invoiceItem.getQty()</td>
|
|
|
36 |
<td>
|
|
|
37 |
#if($inventoryByItem.get($invoiceItem.getItemId()))
|
|
|
38 |
#set($hasSerialized = false)
|
|
|
39 |
#foreach($inv in $inventoryByItem.get($invoiceItem.getItemId()))
|
|
|
40 |
#if($inv.getSerialNumber())
|
|
|
41 |
#set($hasSerialized = true)
|
|
|
42 |
<span class="label label-default imei-label"
|
|
|
43 |
data-serial="$inv.getSerialNumber()"
|
|
|
44 |
data-itemid="$invoiceItem.getItemId()"
|
|
|
45 |
data-scantype="$inv.getLastScanType()">$inv.getSerialNumber()</span>
|
|
|
46 |
#end
|
|
|
47 |
#end
|
|
|
48 |
#if(!$hasSerialized)
|
|
|
49 |
(Non-serialized: qty $invoiceItem.getQty())
|
|
|
50 |
#end
|
|
|
51 |
#else
|
|
|
52 |
(Non-serialized: qty $invoiceItem.getQty())
|
|
|
53 |
#end
|
|
|
54 |
</td>
|
|
|
55 |
</tr>
|
|
|
56 |
#end
|
|
|
57 |
</tbody>
|
|
|
58 |
</table>
|
|
|
59 |
|
|
|
60 |
<hr/>
|
|
|
61 |
|
|
|
62 |
<h5>Serial Number Corrections</h5>
|
|
|
63 |
<p class="text-muted">For serialized items: enter the wrong IMEI and the correct IMEI to replace it.</p>
|
|
|
64 |
<table class="table table-bordered table-condensed" id="serial-corrections-table">
|
|
|
65 |
<thead>
|
|
|
66 |
<tr>
|
|
|
67 |
<th>Old Serial Number (wrong)</th>
|
|
|
68 |
<th>New Serial Number (correct)</th>
|
|
|
69 |
<th></th>
|
|
|
70 |
</tr>
|
|
|
71 |
</thead>
|
|
|
72 |
<tbody>
|
|
|
73 |
<tr class="serial-correction-row">
|
|
|
74 |
<td><input type="text" class="form-control old-serial" placeholder="Enter wrong IMEI/serial" /></td>
|
|
|
75 |
<td><input type="text" class="form-control new-serial" placeholder="Enter correct IMEI/serial" /></td>
|
|
|
76 |
<td><button class="btn btn-sm btn-danger removeSerialCorrectionRow">Remove</button></td>
|
|
|
77 |
</tr>
|
|
|
78 |
</tbody>
|
|
|
79 |
</table>
|
|
|
80 |
<button class="btn btn-sm btn-default addSerialCorrectionRow">+ Add Row</button>
|
|
|
81 |
|
|
|
82 |
<hr/>
|
|
|
83 |
|
| 35884 |
amit |
84 |
<h5>Item Corrections (Move IMEI or Quantity)</h5>
|
|
|
85 |
<p class="text-muted">Move an IMEI or quantity from one item to another. For serialized items, enter the IMEI.</p>
|
| 35806 |
amit |
86 |
<table class="table table-bordered table-condensed" id="qty-corrections-table">
|
|
|
87 |
<thead>
|
|
|
88 |
<tr>
|
|
|
89 |
<th>From Item</th>
|
|
|
90 |
<th>To Item</th>
|
| 35884 |
amit |
91 |
<th>IMEI / Serial</th>
|
|
|
92 |
<th>Qty</th>
|
| 35806 |
amit |
93 |
<th></th>
|
|
|
94 |
</tr>
|
|
|
95 |
</thead>
|
|
|
96 |
<tbody>
|
|
|
97 |
<tr class="qty-correction-row">
|
|
|
98 |
<td>
|
| 35884 |
amit |
99 |
<input type="text" class="form-control typeaheaditem qty-old-item" autocomplete="off" placeholder="Search from item..." />
|
| 35806 |
amit |
100 |
<input type="hidden" class="qty-old-itemid" />
|
|
|
101 |
</td>
|
|
|
102 |
<td>
|
| 35884 |
amit |
103 |
<input type="text" class="form-control typeaheaditem qty-new-item" autocomplete="off" placeholder="Search to item..." />
|
| 35806 |
amit |
104 |
<input type="hidden" class="qty-new-itemid" />
|
|
|
105 |
</td>
|
| 35884 |
amit |
106 |
<td><input type="text" class="form-control qty-serial" placeholder="IMEI (for serialized)" /></td>
|
| 35806 |
amit |
107 |
<td><input type="number" class="form-control qty-correction-val" placeholder="Qty" min="1" /></td>
|
|
|
108 |
<td><button class="btn btn-sm btn-danger removeQtyCorrectionRow">Remove</button></td>
|
|
|
109 |
</tr>
|
|
|
110 |
</tbody>
|
|
|
111 |
</table>
|
|
|
112 |
<button class="btn btn-sm btn-default addQtyCorrectionRow">+ Add Row</button>
|
|
|
113 |
|
|
|
114 |
<hr/>
|
|
|
115 |
|
|
|
116 |
<div class="form-group">
|
|
|
117 |
<label>Remarks (reason for correction):</label>
|
|
|
118 |
<textarea class="form-control" id="correctionRemarks" rows="3" placeholder="Describe why this correction is needed..."></textarea>
|
|
|
119 |
</div>
|
|
|
120 |
|
|
|
121 |
#if(!$hasPendingRequest)
|
|
|
122 |
<button class="btn btn-primary submitGrnCorrection" data-invoiceid="$invoice.getId()">Submit Correction Request</button>
|
|
|
123 |
#end
|
|
|
124 |
</div>
|
|
|
125 |
</div>
|
|
|
126 |
|
|
|
127 |
<script>
|
| 36131 |
amit |
128 |
#[[
|
| 35806 |
amit |
129 |
$(function() {
|
|
|
130 |
// Initialize typeahead for qty correction rows
|
|
|
131 |
function initQtyTypeahead($row) {
|
|
|
132 |
getItemAheadOptions($row.find('.qty-old-item'), true, function(selectedItem) {
|
|
|
133 |
$row.find('.qty-old-itemid').val(selectedItem.itemId);
|
|
|
134 |
});
|
|
|
135 |
getItemAheadOptions($row.find('.qty-new-item'), true, function(selectedItem) {
|
|
|
136 |
$row.find('.qty-new-itemid').val(selectedItem.itemId);
|
|
|
137 |
});
|
|
|
138 |
}
|
|
|
139 |
|
|
|
140 |
// Init typeahead on existing rows
|
|
|
141 |
$('#qty-corrections-table tbody tr').each(function() {
|
|
|
142 |
initQtyTypeahead($(this));
|
|
|
143 |
});
|
|
|
144 |
|
|
|
145 |
// Add serial correction row
|
|
|
146 |
$(document).on('click', '.addSerialCorrectionRow', function() {
|
|
|
147 |
var $row = $('<tr class="serial-correction-row">' +
|
|
|
148 |
'<td><input type="text" class="form-control old-serial" placeholder="Enter wrong IMEI/serial" /></td>' +
|
|
|
149 |
'<td><input type="text" class="form-control new-serial" placeholder="Enter correct IMEI/serial" /></td>' +
|
|
|
150 |
'<td><button class="btn btn-sm btn-danger removeSerialCorrectionRow">Remove</button></td>' +
|
|
|
151 |
'</tr>');
|
|
|
152 |
$('#serial-corrections-table tbody').append($row);
|
|
|
153 |
});
|
|
|
154 |
|
|
|
155 |
// Add qty correction row
|
|
|
156 |
$(document).on('click', '.addQtyCorrectionRow', function() {
|
|
|
157 |
var $row = $('<tr class="qty-correction-row">' +
|
| 35884 |
amit |
158 |
'<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>' +
|
|
|
159 |
'<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>' +
|
|
|
160 |
'<td><input type="text" class="form-control qty-serial" placeholder="IMEI (for serialized)" /></td>' +
|
| 35806 |
amit |
161 |
'<td><input type="number" class="form-control qty-correction-val" placeholder="Qty" min="1" /></td>' +
|
|
|
162 |
'<td><button class="btn btn-sm btn-danger removeQtyCorrectionRow">Remove</button></td>' +
|
|
|
163 |
'</tr>');
|
|
|
164 |
$('#qty-corrections-table tbody').append($row);
|
|
|
165 |
initQtyTypeahead($row);
|
|
|
166 |
});
|
|
|
167 |
|
|
|
168 |
// Remove rows
|
|
|
169 |
$(document).on('click', '.removeSerialCorrectionRow', function() {
|
|
|
170 |
$(this).closest('tr').remove();
|
|
|
171 |
});
|
|
|
172 |
$(document).on('click', '.removeQtyCorrectionRow', function() {
|
|
|
173 |
$(this).closest('tr').remove();
|
|
|
174 |
});
|
|
|
175 |
});
|
| 36131 |
amit |
176 |
]]#
|
| 35806 |
amit |
177 |
</script>
|