From 2d29ced74cce911e3252ed4b65f822e3a083ee9d Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Mon, 11 Jun 2018 23:24:55 +0800 Subject: [PATCH] Add compatible battery list for vehicle edit screen #140 --- templates/vehicle/form.html.twig | 185 +++++++++++++++++++++---------- 1 file changed, 127 insertions(+), 58 deletions(-) diff --git a/templates/vehicle/form.html.twig b/templates/vehicle/form.html.twig index c182512e..bd6fa482 100644 --- a/templates/vehicle/form.html.twig +++ b/templates/vehicle/form.html.twig @@ -13,7 +13,7 @@
-
+
@@ -94,6 +94,24 @@
+ + {% if mode == 'update' %} +
+ +
+
+

+ Compatible Batteries +

+
+
+
+
+
+
+
+ {% endif %} +
@@ -113,72 +131,123 @@ {% endblock %} {% block scripts %} - + }, + layout: { + scroll: true + }, + columns: [ + { + field: 'id', + title: 'ID', + width: 50 + }, + { + field: 'size', + title: 'Size' + }, + { + field: 'model', + title: 'Model', + width: 150 + }, + { + field: 'sell_price', + title: 'Price' + } + ], + pagination: false + }; + + var battTable = $("#data-batts").mDatatable(battOptions); + + // remove all error classes + function removeErrors() { + $(".form-control-danger").removeClass('form-control-danger'); + $("[data-field]").removeClass('has-danger'); + $(".form-control-feedback[data-field]").addClass('hide'); + } +}); + {% endblock %}