Limit customer vehicles to 2 per customer. #434

This commit is contained in:
Korina Cordero 2020-07-07 07:34:43 +00:00
parent 9c2c1e5895
commit 3fcb3d31b5

View file

@ -663,9 +663,18 @@
// display create vehicle form
$("#add-vehicle").click(function() {
$("#vehicle-form").data('mode', 'create');
$("#vehicle-form-title").html("Add Vehicle");
$("#vehicle-form-modal").modal('show');
// check if there are already 2 vehicles in list
if (vehicleRows.length == 2)
{
swal({
text: 'Customer is limited to only 2 vehicles..',
type: 'info',
});
} else {
$("#vehicle-form").data('mode', 'create');
$("#vehicle-form-title").html("Add Vehicle");
$("#vehicle-form-modal").modal('show');
}
});
// find vehicle row by index