/*****************/ /* URL Variables */ /*****************/ function query_string(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i'); $.each(data.data, function(key, val){ $customerSelect.append(''); }) $("#sched_customer").chosen(); }); } else if (quote != false) { var $quoteSelect = $("#sched_quote"); $.getJSON('php/select/select-quote.php?quote='+quote, function(data){ $quoteSelect.html(''); $quoteSelect.append(''); $.each(data.data, function(key, val){ $quoteSelect.append(''); }) $("#sched_quote").chosen({"disable_search": true}); }); var $customerSelect = $("#sched_customer"); $.getJSON('php/select/select-quote-customer.php?quote='+query_string('quote'), function(data){ $customerSelect.html(''); $customerSelect.append(''); $.each(data.data, function(key, val){ $customerSelect.append(''); }) $("#sched_customer").chosen(); }); } else if (invoice != null && eventRef != null) { var $invoiceSelect = $("#sched_invoice"); $.getJSON('php/select/select-invoice.php?invoice='+invoice, function(data){ $invoiceSelect.html(''); $invoiceSelect.append(''); $.each(data.data, function(key, val){ $invoiceSelect.append(''); }) $("#sched_invoice").chosen({"disable_search": true}); }); var $customerSelect = $("#sched_customer"); $.getJSON('php/select/select-invoice-customer.php?invoice='+query_string('invoice'), function(data){ $customerSelect.html(''); $customerSelect.append(''); $.each(data.data, function(key, val){ $customerSelect.append(''); }) $("#sched_customer").chosen(); }); $.ajax({ url: 'data/schedule/line-items.php?id=' + invoice, data: "", dataType: 'json', async: false, success: function(data) { li = 0; $('#lineItems').append(''); $.each(data.data, function(key, val) { if (val.line_event == null){ $('#liTable > tbody:last').append(''); li++; } else { $('#liTable > tbody:last').append(''); li++; } }); $('#lineItems').append('
ItemColourQuantityDateNotes
'+val.product_name+''+val.product_colour+''+val.line_quantity+''+val.line_notes+'
'+val.product_name+''+val.product_colour+''+val.line_quantity+''+val.sched_start+''+val.line_notes+'
'); } }); } // Resource Select var $resourceSelect = $('#sched_assigned_to'); var res = eventDate.substring(0, 10); $.getJSON('php/select/select-event-resources-all.php?e='+res, function(data){ $resourceSelect.html(''); var resourceOptions; resourceOptions = ''; $.each(data.data, function(key, val){ if (val.group == 'fitter') { if (val.events == 0) { resourceOptions += ''; } else { resourceOptions += ''; } } }) $resourceSelect.append(resourceOptions); $("#sched_assigned_to").chosen(); }); /***********************/ // Date & Time Pickers */ /***********************/ function query_string(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i' + val.name + ''; } else { if (val.events == 0) { resourceOptions += ''; } else { resourceOptions += ''; } } } }) $resourceSelect.append(resourceOptions); $("#sched_assigned_to").trigger('chosen:updated'); }); });