Added Import for Large CSV
This commit is contained in:
+84
-21
@@ -16,9 +16,9 @@ $(document).ready(function () {
|
||||
placeholder: "MM/DD/YYYY",
|
||||
showMaskOnHover: false});
|
||||
|
||||
// --------------
|
||||
// Select Picker.
|
||||
// --------------
|
||||
// -------------
|
||||
// Select Picker
|
||||
// -------------
|
||||
|
||||
$(".search-dropdown").selectpicker({noneSelectedText: "",
|
||||
style: "",
|
||||
@@ -34,25 +34,31 @@ $(document).ready(function () {
|
||||
// Date Pickers
|
||||
// ------------
|
||||
|
||||
$("#subscription_stop_date").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.subscription_stop_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
$(".subscription-end-date").each(function () {
|
||||
$(this).datepicker({
|
||||
format: "mm/dd/yyyy",
|
||||
container: $(this).closest(".subscription_end_date"),
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
orientation: "bottom left",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// ---------------------
|
||||
// Show Calendar Buttons
|
||||
// ---------------------
|
||||
|
||||
$(".btnSubscriptionStopDateCalendar").on("click", function (e) {
|
||||
|
||||
$(".btnSubscriptionEndDateCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
let end_date = $(this).siblings(".subscription-end-date");
|
||||
|
||||
$("#subscription_stop_date").focus().datepicker("show");
|
||||
|
||||
if (!end_date.prop("disabled")) {
|
||||
end_date.focus().datepicker("show");
|
||||
}
|
||||
});
|
||||
|
||||
// -----------
|
||||
@@ -81,24 +87,81 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
function setSubscriptionDateState(subscription_checkbox) {
|
||||
|
||||
let row = subscription_checkbox.closest("tr");
|
||||
let checked = subscription_checkbox.prop("checked");
|
||||
|
||||
row.find(".subscription-end-date").prop("disabled", !checked);
|
||||
row.find(".btnSubscriptionEndDateCalendar").prop("disabled", !checked);
|
||||
|
||||
}
|
||||
|
||||
function parseSubscriptionDate(date_value) {
|
||||
|
||||
let parts = date_value.split("/");
|
||||
|
||||
return new Date(parts[2], parts[0] - 1, parts[1]);
|
||||
|
||||
}
|
||||
|
||||
$(".subscription-checkbox").each(function () {
|
||||
setSubscriptionDateState($(this));
|
||||
});
|
||||
|
||||
$(".subscription-checkbox").on("change", function () {
|
||||
|
||||
let totalSubscriptions = $(".subscription-checkbox").length;
|
||||
let checkedSubscriptions = $(".subscription-checkbox:checked").length;
|
||||
|
||||
$("#selectAllSubscriptions").prop("checked", totalSubscriptions === checkedSubscriptions);
|
||||
setSubscriptionDateState($(this));
|
||||
|
||||
});
|
||||
|
||||
$("#selectAllSubscriptions").on("change", function () {
|
||||
|
||||
$(".subscription-checkbox").prop("checked", $(this).prop("checked")).each(function () {
|
||||
setSubscriptionDateState($(this));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addSubscriptionToUser").submit(function (e) {
|
||||
|
||||
var subscription_title = $("#subscription_serial"), subscription_stop_date = $("#subscription_stop_date");
|
||||
let checkedSubscriptions = $(".subscription-checkbox:checked");
|
||||
|
||||
clearInputErrors();
|
||||
$("#subscriptions_errors").addClass("d-none");
|
||||
|
||||
if ($("option:selected", subscription_title).val() === "") {
|
||||
createInputError(subscription_title, "Subscription is required");
|
||||
// Validate at least one subscription selected
|
||||
if (checkedSubscriptions.length === 0) {
|
||||
e.preventDefault();
|
||||
$("#subscriptions_errors").removeClass("d-none");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(subscription_stop_date)) {
|
||||
createInputError(subscription_stop_date, "Date is required");
|
||||
return false;
|
||||
for (let i = 0; i < checkedSubscriptions.length; i++) {
|
||||
|
||||
let row = checkedSubscriptions.eq(i).closest("tr");
|
||||
let end_date = row.find(".subscription-end-date");
|
||||
|
||||
if (isBlank(end_date)) {
|
||||
createInputError(end_date, "Date is required");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(end_date)) && (!end_date.inputmask("isComplete"))) {
|
||||
createInputError(end_date, "Date is incomplete");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
Reference in New Issue
Block a user