-
-
+
+
+
-
@@ -276,23 +294,16 @@
| Item |
Quantity |
- Price Level |
- Res Price (w/ Tax) |
- Total Price Adj. |
- Final Amount |
- No Trade-in Item? |
- Battery Class |
- Discount Item |
- Percentage |
- Converted Rate (in Decimal) |
- Discount Amount |
Warranty Class |
+ Warranty |
+ Date of Purchase |
+ Warranty Until |
|
- |
+ |
No items to display.
|
@@ -828,7 +839,8 @@ $(function() {
var unitPrice = 1000;
$.each(response.data, function(index, battery) {
- html += '';
+ console.log(battery);
+ html += '';
});
field.html(html).prop('disabled', false);
@@ -856,6 +868,8 @@ $(function() {
var qty = $("#invoice-quantity");
var tbody = $("#invoice-table tbody");
var unitPrice = parseFloat(battery.find('option:selected').data('unit-price'));
+ var warrPrivate = parseInt(battery.find('option:selected').data('warr-private'));
+ var warrCommercial = parseInt(battery.find('option:selected').data('warr-commercial'));
if (!bmfg.val() || !battery.val() || !qty.val()) {
swal({
@@ -889,22 +903,24 @@ $(function() {
'subtotal': subtotal
});
+ var warrantyClasses = {
+ {% for key, class in warranty_classes %}
+ "{{ key }}": "{{ class }}",
+ {% endfor %}
+ };
+
+ var warrantyClass = $("#warranty-class").val();
+ var warrantyLength = warrantyClass == warrantyClasses["private"] ? warrPrivate : warrCommercial;
+
// build row html
// TODO: Fill with actual data for the rest of the columns
var html = '' +
'| ' + battery.find('option:selected').text() + ' | ' +
'' + qty.val() + ' | ' +
- 'Base Price | ' + // TODO: static for now
- '' + (Math.round(unitPrice * 100) / 100).toFixed(2) + ' | ' + // TODO: not sure if this is correct since it says w/ tax
- '0.00 | ' + // TODO: static for now
- '' + (Math.round(subtotal * 100) / 100).toFixed(2) + ' | ' + // TODO: I assumed this is unit price * qty
- 'Yes | ' + // TODO: static for now
- 'Regular | ' +
- ' | ' +
- ' | ' +
- ' | ' +
- ' | ' +
- ' | ' +
+ '' + warrantyClasses[warrantyClass] + ' | ' +
+ '' + warrantyLength + ' month' + (warrantyLength > 1 ? 's' : '') + ' | ' +
+ ' | ' + // TODO: Date of Purchase, blank for now
+ ' | ' + // TODO: Warranty until, blank for now
' | ' +
'
';
@@ -918,10 +934,10 @@ $(function() {
});
function updateInvoiceFigures() {
- var amountField = $("#invoice-amount");
- var taxField = $("#invoice-tax");
+ var amountField = $("#invoice-price");
+ var taxField = $("#invoice-vat");
var discountField = $("#invoice-discount");
- var finalAmountField = $("#invoice-final-amount");
+ var finalAmountField = $("#invoice-total-amount");
var finalAmount = invoiceTotal + invoiceTax - invoiceDiscount;
amountField.val(parseFloat(Math.round(invoiceTotal * 100) / 100).toFixed(2));