| Line 143... |
Line 143... |
| 143 |
$('#qty-corrections-table tbody tr').each(function() {
|
143 |
$('#qty-corrections-table tbody tr').each(function() {
|
| 144 |
initQtyTypeahead($(this));
|
144 |
initQtyTypeahead($(this));
|
| 145 |
});
|
145 |
});
|
| 146 |
|
146 |
|
| 147 |
// Add serial correction row
|
147 |
// Add serial correction row
|
| - |
|
148 |
// Fragment is re-injected with .html(), which re-runs this script; clear the
|
| - |
|
149 |
// namespace first so handlers replace rather than stack.
|
| - |
|
150 |
$(document).off('.warehousegrncorrectiondetail');
|
| 148 |
$(document).on('click', '.addSerialCorrectionRow', function() {
|
151 |
$(document).on('click.warehousegrncorrectiondetail', '.addSerialCorrectionRow', function() {
|
| 149 |
var $row = $('<tr class="serial-correction-row">' +
|
152 |
var $row = $('<tr class="serial-correction-row">' +
|
| 150 |
'<td><input type="text" class="form-control old-serial" placeholder="Enter wrong IMEI/serial" /></td>' +
|
153 |
'<td><input type="text" class="form-control old-serial" placeholder="Enter wrong IMEI/serial" /></td>' +
|
| 151 |
'<td><input type="text" class="form-control new-serial" placeholder="Enter correct IMEI/serial" /></td>' +
|
154 |
'<td><input type="text" class="form-control new-serial" placeholder="Enter correct IMEI/serial" /></td>' +
|
| 152 |
'<td><button class="btn btn-sm btn-danger removeSerialCorrectionRow">Remove</button></td>' +
|
155 |
'<td><button class="btn btn-sm btn-danger removeSerialCorrectionRow">Remove</button></td>' +
|
| 153 |
'</tr>');
|
156 |
'</tr>');
|
| 154 |
$('#serial-corrections-table tbody').append($row);
|
157 |
$('#serial-corrections-table tbody').append($row);
|
| 155 |
});
|
158 |
});
|
| 156 |
|
159 |
|
| 157 |
// Add qty correction row
|
160 |
// Add qty correction row
|
| 158 |
$(document).on('click', '.addQtyCorrectionRow', function() {
|
161 |
$(document).on('click.warehousegrncorrectiondetail', '.addQtyCorrectionRow', function() {
|
| 159 |
var $row = $('<tr class="qty-correction-row">' +
|
162 |
var $row = $('<tr class="qty-correction-row">' +
|
| 160 |
'<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>' +
|
163 |
'<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>' +
|
| 161 |
'<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>' +
|
164 |
'<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>' +
|
| 162 |
'<td><input type="text" class="form-control qty-serial" placeholder="IMEI(s) space-separated" /></td>' +
|
165 |
'<td><input type="text" class="form-control qty-serial" placeholder="IMEI(s) space-separated" /></td>' +
|
| 163 |
'<td><input type="number" class="form-control qty-correction-val" placeholder="Qty" min="1" /></td>' +
|
166 |
'<td><input type="number" class="form-control qty-correction-val" placeholder="Qty" min="1" /></td>' +
|
| Line 166... |
Line 169... |
| 166 |
$('#qty-corrections-table tbody').append($row);
|
169 |
$('#qty-corrections-table tbody').append($row);
|
| 167 |
initQtyTypeahead($row);
|
170 |
initQtyTypeahead($row);
|
| 168 |
});
|
171 |
});
|
| 169 |
|
172 |
|
| 170 |
// Remove rows
|
173 |
// Remove rows
|
| 171 |
$(document).on('click', '.removeSerialCorrectionRow', function() {
|
174 |
$(document).on('click.warehousegrncorrectiondetail', '.removeSerialCorrectionRow', function() {
|
| 172 |
$(this).closest('tr').remove();
|
175 |
$(this).closest('tr').remove();
|
| 173 |
});
|
176 |
});
|
| 174 |
$(document).on('click', '.removeQtyCorrectionRow', function() {
|
177 |
$(document).on('click.warehousegrncorrectiondetail', '.removeQtyCorrectionRow', function() {
|
| 175 |
$(this).closest('tr').remove();
|
178 |
$(this).closest('tr').remove();
|
| 176 |
});
|
179 |
});
|
| 177 |
});
|
180 |
});
|
| 178 |
]]#
|
181 |
]]#
|
| 179 |
</script>
|
182 |
</script>
|