Created
August 8, 2019 04:49
-
-
Save nomoney4me/3ffff81a99f49e05a25acfaa1f1fdaa5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function (a) { | |
| var c = p3.module("shared/base"), | |
| e = p3.module("shared/datepicker"), | |
| k = p3.module("shared/timepicker"), | |
| m = p3.module("utilities/validate"), | |
| b = p3.module("admissions/applicationformsedit"), | |
| i = p3.module("shared/mainbulletin"), | |
| j = p3.module("utilities/smodal"), | |
| d = p3.Us.Culture, | |
| f = p3.Us.Enum, | |
| h = p3.Us.InfoMessageLibrary, | |
| g = p3.module("shared/filesreview"), | |
| l = p3.Us.Tools; | |
| a.Ms.FormAuthModel = Bbm.extend({ | |
| initialize: function () { | |
| a.Us.SetFormAuthSync(this) | |
| } | |
| }); | |
| a.Ms.ApplicationForm = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| idAttribute: "ApplicationFormId", | |
| url: function () { | |
| return this.id ? aP + "OnlineApplication/ApplicationForm/" + this.id + "/" : aP + "OnlineApplication/ApplicationForm/" | |
| }, | |
| isMigrationPending: function () { | |
| return (this.get("FormType") == f.FormType.INQUIRY.Value) && (this.get("InquiryMigrateStatus") < f.InquiryImport.MIGRATIONCOMPLETE) | |
| }, | |
| isSchoolForm: function () { | |
| return this.get("FormType") & 248 | |
| }, | |
| isRecommendationForm: function () { | |
| return this.get("FormType") === f.FormType.RECOMMENDATION.Value | |
| } | |
| }); | |
| a.Ms.Section = a.Ms.FormAuthModel.extend({ | |
| sync: c.DataParamSync, | |
| idAttribute: "ApplicationSectionId", | |
| validation: { | |
| Name: [{ | |
| required: true, | |
| msg: h.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "OnlineApplication/ApplicationSection/" + this.id + "/" : aP + "OnlineApplication/ApplicationSection/" | |
| } | |
| }); | |
| a.Ms.SectionItem = a.Ms.FormAuthModel.extend({}); | |
| a.Ms.SectionItemDuplicate = a.Ms.FormAuthModel.extend({ | |
| sync: c.DataParamSync, | |
| url: function () { | |
| return this.id ? aP + "OnlineApplication/FieldData/" + this.id + "/" : aP + "OnlineApplication/FieldData/" | |
| } | |
| }); | |
| a.Ms.SectionValidUpdate = a.Ms.FormAuthModel.extend({ | |
| sync: c.DataParamSync, | |
| url: function () { | |
| return this.id ? aP + "OnlineApplication/FieldData/" + this.id + "/" : aP + "OnlineApplication/FieldData/" | |
| } | |
| }); | |
| a.Ms.ElementField = a.Ms.FormAuthModel.extend({}); | |
| a.Ms.BlockField = a.Ms.FormAuthModel.extend({ | |
| sync: c.DataParamSync, | |
| idAttribute: "FieldElementItemId", | |
| validation: { | |
| "FieldItem.FieldData.Data": [{ | |
| required: false, | |
| fn: function (r, n, o) { | |
| var p, q; | |
| if ((o.FieldItem.DataLength) && r && (r.length > o.FieldItem.DataLength)) { | |
| return h.P3.MaxLengthExceeded | |
| } | |
| if (o.FieldItem.DataType === "I") { | |
| p = /^\d+$/g; | |
| if (!p.test(r)) { | |
| return h.P3.NotNumeric | |
| } | |
| } | |
| if (o.FieldItem.DataType === "EM") { | |
| q = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i; | |
| if (!q.test(r)) { | |
| return h.P3.EmailError | |
| } | |
| } | |
| if (o.FieldItem.DataType === "D") { | |
| if (!m.isEmptier(r)) { | |
| if (!m.isDate(r)) { | |
| return h.P3.DateError.fixDateFormat() | |
| } | |
| } | |
| } | |
| } | |
| }] | |
| }, | |
| url: function () { | |
| return aP + "OnlineApplication/FieldElementItem/" + this.id + "/" | |
| }, | |
| getData: function () { | |
| var o = this.get("FieldItem"), | |
| n; | |
| if (o && o.FieldData) { | |
| n = o.FieldData.Data | |
| } | |
| return n | |
| } | |
| }, { | |
| type: "Application.Ms.BlockField" | |
| }); | |
| a.Ms.BlockFieldNull = a.Ms.FormAuthModel.extend({ | |
| sync: c.DataParamSync, | |
| idAttribute: "FieldElementItemId", | |
| validation: { | |
| "FieldItem.FieldData.Data": [{ | |
| fn: function (w, p, q) { | |
| if ((q.FieldItem.DataLength) && w && (w.length > q.FieldItem.DataLength)) { | |
| return h.P3.MaxLengthExceeded | |
| } | |
| if (q.FieldItem.MutexGroup) { | |
| var u = $('.sectionitems [data-mutexgroupid="' + q.FieldItem.MutexGroup + '"][data-ordinalid="' + q.FieldItem.FieldData.Ordinal + '"]:visible'), | |
| x = [], | |
| t = [], | |
| v = false, | |
| n, o, r, s; | |
| if (u.length > 1) { | |
| _.each(u, function (z) { | |
| var y = $(z), | |
| B = y.parent().siblings("label"), | |
| A = B.html(); | |
| t.push(l.trim(A.replace('<span class="required-indicator" rel="tooltip" data-content="" data-original-title="Required">*</span>', ""))); | |
| if (B.hasClass("required")) { | |
| v = true | |
| } | |
| if (y.is("select")) { | |
| n = y.find("option:selected"); | |
| if (y.data("fieldid") != 143) { | |
| x.push(n.val()) | |
| } else { | |
| if (n.text().toLowerCase() !== "* other" && n.text().toLowerCase() !== "*other" && n.text().toLowerCase() !== "other") { | |
| x.push(n.val()) | |
| } | |
| } | |
| } else { | |
| x.push(y.val()) | |
| } | |
| }); | |
| if ((_.compact(x).length > 1) || (v && _.compact(x).length === 0)) { | |
| r = "Please choose either"; | |
| for (s = 0; s < t.length - 1; s++) { | |
| r += " " + t[s] + " or" | |
| } | |
| r += " " + _.last(t) + "."; | |
| _.each(u, function (y) { | |
| $(y).parents(".field").trigger("fieldinvalid", [r]) | |
| }); | |
| return r | |
| } | |
| _.each(u, function (y) { | |
| $(y).parents(".field").trigger("fieldvalid") | |
| }) | |
| } else { | |
| o = $(u[0]); | |
| if (q.FieldItem.Required) { | |
| if (m.isEmptier(w)) { | |
| if (o.hasClass("input-province-other")) { | |
| o.parents(".field").trigger("fieldinvalidprovinceother", h.P3.RequiredInfoNotEntered) | |
| } else { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }] | |
| }, | |
| url: function () { | |
| return aP + "OnlineApplication/FieldElementItem/" + this.id + "/" | |
| }, | |
| getData: function () { | |
| var o = this.get("FieldItem"), | |
| n; | |
| if (o && o.FieldData) { | |
| n = o.FieldData.Data | |
| } | |
| return n | |
| } | |
| }, { | |
| type: "Application.Ms.BlockFieldNull" | |
| }); | |
| a.Ms.BlockFieldRequired = a.Ms.FormAuthModel.extend({ | |
| sync: c.DataParamSync, | |
| idAttribute: "FieldElementItemId", | |
| validation: { | |
| "FieldItem.FieldData.Data": [{ | |
| required: function () { | |
| var n = this, | |
| o = true; | |
| if (n.isEmergencyContactField()) { | |
| o = n.isBlockEnabled() | |
| } | |
| return o | |
| }, | |
| msg: h.P3.RequiredInfoNotEntered | |
| }, { | |
| fn: function (C, n, o) { | |
| var p, q, w, s, u = false, | |
| r = false, | |
| v, B = this, | |
| y = false, | |
| t = false, | |
| x = "", | |
| A, z; | |
| if (o.FieldItem.DataLength && C && (C.length > o.FieldItem.DataLength)) { | |
| return h.P3.MaxLengthExceeded | |
| } | |
| if (o.FieldItem.DataType === "I") { | |
| p = /^\d+$/g; | |
| if (!p.test(C)) { | |
| return h.P3.NotNumeric | |
| } | |
| } | |
| if (o.FieldItem.DataType === "EM") { | |
| q = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i; | |
| if (!q.test(C)) { | |
| return h.P3.EmailError | |
| } | |
| } | |
| if (o.FieldItem.DataType === "D") { | |
| if (!m.isEmptier(C)) { | |
| if (!m.isDate(C)) { | |
| return h.P3.DateError.fixDateFormat() | |
| } | |
| } | |
| } | |
| y = B.isEmergencyContactField(); | |
| if (y) { | |
| t = B.isBlockEnabled() | |
| } | |
| if (y && t) { | |
| if (o.FieldBlockId === 695) { | |
| w = $('.sectionitems [data-fieldblockid="695"]:visible').map(function () { | |
| return $(this).val() | |
| }).toArray(); | |
| w = _.countBy(w); | |
| _.each(w, function (D, E) { | |
| if (D > 1 && E === C) { | |
| u = true | |
| } | |
| }); | |
| if (u) { | |
| return "You can not have duplicate call orders." | |
| } | |
| if (l.stringToInt(C) === 0) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| if (o.FieldBlockId === 688) { | |
| v = $('.sectionitems [data-fieldblockid="688"]:visible').filter(function () { | |
| return parseInt($(this).val(), 10) === 1 | |
| }).toArray(); | |
| if (v.length > 2 && parseInt(C, 10) === 1) { | |
| return "You may only set 2 automated calls to everytime." | |
| } | |
| } | |
| if (o.FieldBlockId === 694) { | |
| s = $('.sectionitems [data-fieldblockid="694"]:visible').map(function () { | |
| return $(this).val() | |
| }).toArray(); | |
| s = _.countBy(s); | |
| _.each(s, function (D, E) { | |
| if (D > 1 && E === C) { | |
| r = true | |
| } | |
| }); | |
| if (r) { | |
| return "You can not have duplicate email orders." | |
| } | |
| if (l.stringToInt(C) === 0) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| if (o.FieldBlockId === 693) { | |
| v = $('.sectionitems [data-fieldblockid="693"]:visible').filter(function () { | |
| return parseInt($(this).val(), 10) === 1 | |
| }).toArray(); | |
| if (v.length > 2 && parseInt(C, 10) === 1) { | |
| return "You may only set 2 automated emails to everytime." | |
| } | |
| } | |
| } | |
| if (o.FieldBlockId === 749 || o.FieldBlockId === 761) { | |
| if (o.FieldBlockId === 749) { | |
| x = "Medication cannot be added more than once for the same allergy" | |
| } else { | |
| if (o.FieldBlockId === 761) { | |
| x = "Medication cannot be added more than once for the same condition" | |
| } | |
| } | |
| A = $('.sectionitems [data-fieldblockid="' + o.FieldBlockId + '"][data-ordinalid="' + o.FieldItem.FieldData.Ordinal + '"]:visible'); | |
| z = _.chain(A).groupBy(function (D) { | |
| return $(D).val() | |
| }).map(function (D, E) { | |
| if (D.length > 1) { | |
| return E | |
| } | |
| }).compact().value(); | |
| _.each(A, function (E) { | |
| var D = $(E); | |
| if (!m.isEmptier(D.val())) { | |
| D.parents(".field").trigger("fieldvalid") | |
| } | |
| }); | |
| if (z.length) { | |
| _.each(z, function (D) { | |
| _.each($('.sectionitems [data-fieldblockid="' + o.FieldBlockId + '"][data-ordinalid="' + o.FieldItem.FieldData.Ordinal + '"]:visible option[value="' + D + '"]:selected'), function (E) { | |
| $(E).parents(".field").trigger("fieldinvalid", x) | |
| }) | |
| }); | |
| if (_.contains(z, C)) { | |
| return x | |
| } | |
| } | |
| } | |
| } | |
| }], | |
| "FieldItem.FieldData.OtherDescription": { | |
| required: function (s, n, o) { | |
| var q = o.FieldItem, | |
| p = q.FieldData.Data, | |
| r = /,-1$/; | |
| return q.Required && q.OtherInd && (p === "-1" || r.test(p)) | |
| }, | |
| msg: h.P3.RequiredInfoNotEntered | |
| } | |
| }, | |
| url: function () { | |
| return aP + "OnlineApplication/FieldElementItem/" + this.id + "/" | |
| }, | |
| isEmergencyContactField: function () { | |
| var n = j.Us.getPropByString(this.attributes, "FieldItem.BlockId"); | |
| return _.contains([47, 48], n) | |
| }, | |
| isBlockEnabled: function () { | |
| return j.Us.getPropByString(this.attributes, "FieldItem.FieldData.IsBlockEnabled") | |
| }, | |
| getData: function () { | |
| var o = this.get("FieldItem"), | |
| n; | |
| if (o && o.FieldData) { | |
| n = o.FieldData.Data | |
| } | |
| return n | |
| } | |
| }, { | |
| type: "Application.Ms.BlockFieldRequired" | |
| }); | |
| a.Ms.ApplicationSubmit = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| url: function () { | |
| return aP + "OnlineApplication/ApplicationSubmit/" | |
| } | |
| }); | |
| a.Ms.SchoolFormSubmit = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| url: function () { | |
| return aP + "SchoolForm/FormSubmit/" | |
| } | |
| }); | |
| a.Ms.RecommendationFormSubmit = a.Ms.FormAuthModel.extend({ | |
| sync: c.DataParamSync, | |
| url: function () { | |
| return aP + "/RecommendationForm/FormSubmit/" | |
| } | |
| }); | |
| a.Ms.SubmitPayment = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| url: function () { | |
| return aP + "OnlineApplication/SubmitPayment/" | |
| } | |
| }); | |
| a.Ms.PaymentCheck = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| url: function () { | |
| return aP + "DataDirect/ApplicationPaymentRender/" | |
| } | |
| }); | |
| a.Ms.ESignatureRender = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| validation: { | |
| SignedText: [{ | |
| fn: function (p, n, o) { | |
| if (m.isEmptier(p) && (o.UserId == p3.Data.Context.attributes.UserInfo.UserId)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }] | |
| }, | |
| url: function () { | |
| return aP + "SchoolForm/FormSignature/" | |
| } | |
| }); | |
| a.Ms.SignatureLabels = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| url: function () { | |
| return aP + "DataDirect/FormSignatureLabels/" | |
| } | |
| }); | |
| a.Ms.EmergencyContact = Bbm.extend({ | |
| url: function () { | |
| return aP + "SchoolForm/EmergencyContact/" | |
| } | |
| }); | |
| a.Ms.RatingMatrix = a.Ms.FormAuthModel.extend({ | |
| url: function () { | |
| return aP + "Rating/FormSectionItemRating/" | |
| } | |
| }); | |
| a.Ms.RatingMatrixSubmit = a.Ms.FormAuthModel.extend({ | |
| url: function () { | |
| return aP + "Rating/FormRatingScore" | |
| } | |
| }); | |
| a.Cs.FormAuthCollection = Bbc.extend({ | |
| initialize: function () { | |
| a.Us.SetFormAuthSync(this) | |
| } | |
| }); | |
| a.Cs.Sections = a.Cs.FormAuthCollection.extend({ | |
| sync: c.DataParamSync, | |
| model: a.Ms.Section, | |
| url: function () { | |
| return aP + "OnlineApplication/ApplicationSectionList/" | |
| } | |
| }); | |
| a.Cs.SectionItems = a.Cs.FormAuthCollection.extend({ | |
| sync: c.DataParamSync, | |
| model: a.Ms.SectionItem, | |
| url: function () { | |
| return aP + "OnlineApplication/SectionItemList/" | |
| } | |
| }); | |
| a.Cs.BlockFields = Bbc.extend({ | |
| sync: c.DataParamSync, | |
| model: function (n, o) { | |
| if (n.ElementItem.Id) { | |
| return new a.Ms.ElementField(n, o) | |
| } | |
| if (n.FieldItem.Id) { | |
| if (n.FieldItem.MutexGroup) { | |
| return new a.Ms.BlockFieldNull(n, o) | |
| } | |
| if (n.FieldItem.Required) { | |
| return new a.Ms.BlockFieldRequired(n, o) | |
| } | |
| return new a.Ms.BlockField(n, o) | |
| } | |
| }, | |
| url: function () { | |
| return aP + "OnlineApplication/FieldBlockItemList/" | |
| } | |
| }); | |
| a.Cs.FormSubmit = Bbc.extend({ | |
| sync: c.DataParamSync, | |
| url: function () { | |
| return aP + "OnlineApplication/FormSubmit/" | |
| } | |
| }); | |
| a.Cs.ESignaturesRender = Bbc.extend({ | |
| sync: c.DataParamSync, | |
| model: a.Ms.ESignatureRender, | |
| url: function () { | |
| return aP + "SchoolForm/FormSignature/" | |
| } | |
| }); | |
| a.Cs.EmergencyContactPhones = Bbc.extend({ | |
| model: a.Ms.EmergencyContact, | |
| url: function () { | |
| return aP + "SchoolForm/emergencycontactPhone/" | |
| } | |
| }); | |
| a.Cs.EmergencyContactEmails = Bbc.extend({ | |
| model: a.Ms.EmergencyContact, | |
| url: function () { | |
| return aP + "SchoolForm/EmergencyContactEmail/" | |
| } | |
| }); | |
| a.Cs.ContractFiles = Bbc.extend({ | |
| url: "DataDirect/GetMyFileContracts" | |
| }); | |
| a.Cs.FormFiles = Bbc.extend({ | |
| url: "DataDirect/GetMyFileForms" | |
| }); | |
| a.Vs.Layout = Bb.View.extend({ | |
| template: "form/form.layout.template.html", | |
| id: "form-main", | |
| className: function () { | |
| return "collapse" | |
| }, | |
| initialize: function (n) { | |
| if (a.Data.Local) { | |
| a.Us.AutoSizeIframe() | |
| } | |
| }, | |
| dispose: function () { | |
| b.Us.DeleteStyle() | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| p3.setTitle(a.Data.FormType); | |
| $(n).append(o.el); | |
| o.renderData() | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({ | |
| formType: a.Data.FormType | |
| })); | |
| p3.rV(new a.Vs.Header({ | |
| layoutView: n | |
| }), n.$(".application-header"), true); | |
| p3.rV(new a.Vs.Sections({ | |
| layoutView: n | |
| }), n.$(".application-navigation"), true) | |
| }) | |
| } | |
| }); | |
| a.Vs.Header = Bb.View.extend({ | |
| template: "form/form.header.template.html", | |
| initialize: function () { | |
| var n = this; | |
| n.model = new a.Ms.ApplicationForm({ | |
| ApplicationFormId: a.Data.FormId | |
| }); | |
| a.Data.ApplicationForm = n.model | |
| }, | |
| events: { | |
| renderdata: "renderData" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el) | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| n.model.fetch({ | |
| cache: false, | |
| success: function (o, p) { | |
| a.Data.SecurePaymentProcessingType = n.model.get("SecurePaymentProcessingType"); | |
| a.Data.SecurePayment = a.Data.SecurePaymentProcessingType > 0 ? true : false; | |
| a.Data.FormSaveType = n.model.get("FormSaveType"); | |
| p3.fT(n.template, function (q) { | |
| n.$el.html(q({ | |
| DisplayName: n.model.get("DisplayName"), | |
| showTestBanner: n.model.isMigrationPending(), | |
| skyUX: true | |
| })) | |
| }) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading form") | |
| } | |
| }) | |
| } | |
| }); | |
| a.Vs.Sections = Bb.View.extend({ | |
| tagName: "ul", | |
| className: function () { | |
| return "nav nav-tabs" | |
| }, | |
| initialize: function () { | |
| var o = this, | |
| n; | |
| o.sections = new a.Cs.Sections(); | |
| o.sections.bind("add", function (r) { | |
| if (!r.get("EmptySection")) { | |
| var p = false, | |
| q = null; | |
| _.each(o.sections.models, function (s) { | |
| if (!s.attributes.EmptySection && s.attributes.Locked === false) { | |
| q = s.id | |
| } | |
| }); | |
| if (q == r.id) { | |
| p = true | |
| } | |
| n = new a.Vs.Section({ | |
| model: r, | |
| layoutView: o.options.layoutView, | |
| sectionId: r.id, | |
| lastSection: p | |
| }); | |
| p3.rV(n, o.el, false) | |
| } | |
| }, this) | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| o.renderData() | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| n.sections.fetch({ | |
| update: true, | |
| remove: false, | |
| cache: false, | |
| data: { | |
| applicationFormId: a.Data.FormId, | |
| keyId: a.Data.KeyId | |
| }, | |
| complete: function () { | |
| $("#form-main").show(); | |
| $(".application-header div").trigger("renderdata"); | |
| if (a.Data.SPResponse === "0") { | |
| n.$("li.payment").trigger("selectsection") | |
| } else { | |
| if (a.Data.SPResponse === "1") { | |
| n.$("li.confirmation").trigger("selectsection") | |
| } else { | |
| n.$("li:first").trigger("selectsection") | |
| } | |
| } | |
| }, | |
| error: function (o, p) { | |
| if (p.responseText.indexOf("Unauthorized form access") > -1) { | |
| $("#form-main").html('<div class="alert alert-error">You do not have access to this information.</div>').show() | |
| } else { | |
| $("#form-main").html('<div class="alert alert-error">There was an error accessing the form.</div>').show() | |
| } | |
| } | |
| }) | |
| } | |
| }); | |
| a.Vs.Section = Bb.View.extend({ | |
| template: "admissions/application.section.template.html", | |
| tagName: "li", | |
| className: function () { | |
| var o = this, | |
| n = ""; | |
| n += "tab "; | |
| switch (o.model.get("LockedType")) { | |
| case 1: | |
| case 3: | |
| n += "payment"; | |
| break; | |
| case 2: | |
| n += "confirmation"; | |
| break | |
| } | |
| if (!m.isEmptier(n)) { | |
| return n | |
| } | |
| }, | |
| initialize: function () { | |
| var n = this; | |
| n.validSection = null; | |
| n.validTest = null; | |
| a.Data.Id = n.model.get("applicationId") | |
| }, | |
| events: { | |
| "click a.unlocked": "selectSection", | |
| "click a.locked": "lockedSection", | |
| selectsection: "selectSection", | |
| refreshsection: "refreshSection" | |
| }, | |
| render: function (n) { | |
| $(n).append(this.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({ | |
| model: n.model.toJSON(), | |
| userId: a.Data.KeyId, | |
| preview: a.Data.Preview | |
| })); | |
| if (n.model.get("Valid") == true) { | |
| $(n.el).find(".p3icon-ok").show() | |
| } else { | |
| if (n.model.get("Valid") == false) { | |
| $(n.el).find(".p3icon-notification").show() | |
| } | |
| } | |
| }) | |
| }, | |
| lockedSection: function (n) { | |
| n.preventDefault(); | |
| n.stopPropagation() | |
| }, | |
| selectSection: function (p, o) { | |
| p.preventDefault(); | |
| p.stopPropagation(); | |
| var s = this, | |
| r, n = $("#form-main .application-section"), | |
| q = p3.Data.SchoolContext.getLibrariesUrl(); | |
| s.$el.parent().find("li").removeClass("active").find("a").removeClass("unlocked"); | |
| s.$el.addClass("active"); | |
| n.html('<div class="textcenter"><img src="' + q + '/p3-cache/img/spinner.gif"> Loading...</div>'); | |
| r = new a.Cs.SectionItems(); | |
| r.fetch({ | |
| cache: false, | |
| data: { | |
| applicationFormId: a.Data.FormId, | |
| keyId: a.Data.KeyId, | |
| sectionId: s.model.id, | |
| preview: a.Data.Preview | |
| }, | |
| success: function () { | |
| if (a.Data.FormType === "Inquiry") { | |
| a.Data.FormDefaults = $.extend(true, [], r.toJSON()) | |
| } | |
| s.$el.siblings("li").find("a:not(.locked)").addClass("unlocked"); | |
| s.model.set({ | |
| SectionItems: r.toJSON() | |
| }); | |
| $("body,html").scrollTop(0); | |
| var t = new a.Cs.SectionItems(s.model.get("SectionItems")); | |
| p3.rV(new a.Vs.SectionItems({ | |
| sectionId: s.model.id, | |
| collection: t, | |
| layoutView: s.options.layoutView, | |
| sectionName: s.model.get("Name"), | |
| lastSection: s.options.lastSection, | |
| lockedSection: s.model.get("Locked"), | |
| lockedSectionType: s.model.get("LockedType"), | |
| applicationId: s.model.get("applicationId"), | |
| scrollTop: o ? o.scrollTop : null | |
| }), $(".application-section"), true) | |
| }, | |
| error: function (t, u) { | |
| if (u.responseText.indexOf("Cannot edit previously submitted form") > -1) { | |
| n.html('<div class="alert alert-error">Previously submitted forms cannot be edited.</div>').show() | |
| } else { | |
| n.html('<div class="alert alert-error">There was an error accessing the form section.</div>').show() | |
| } | |
| } | |
| }) | |
| }, | |
| refreshSection: function (o, n) { | |
| o.preventDefault(); | |
| o.stopPropagation(); | |
| var r = this, | |
| q = new a.Cs.SectionItems(), | |
| p = p3.Data.SchoolContext.getLibrariesUrl(); | |
| r.$el.parent().find("li").find("a").removeClass("unlocked"); | |
| $("#form-main .application-section").html('<div class="textcenter"><img src="' + p + '/p3-cache/img/spinner.gif"> Loading...</div>'); | |
| q.fetch({ | |
| cache: false, | |
| data: { | |
| applicationFormId: a.Data.FormId, | |
| keyId: a.Data.KeyId, | |
| sectionId: r.model.id, | |
| preview: a.Data.Preview | |
| }, | |
| success: function () { | |
| r.model.set({ | |
| SectionItems: q.toJSON() | |
| }); | |
| r.$el.trigger("selectsection", n) | |
| } | |
| }) | |
| } | |
| }); | |
| a.Vs.SectionItems = g.Vs.ClickButton.extend({ | |
| template: "admissions/application.section.items.template.html", | |
| initialize: function () { | |
| var n = this; | |
| if (a.Data.FormType !== f.FormType.RECOMMENDATION.Name) { | |
| n.contractFiles = new a.Cs.ContractFiles(); | |
| n.formFiles = new a.Cs.FormFiles() | |
| } | |
| }, | |
| className: "sectionitems", | |
| events: { | |
| renderdata: "renderData", | |
| "click .prev": "prevSection", | |
| "click .next": "nextSection", | |
| "click .submitform:not(:disabled)": "submitForm", | |
| "click .submitpayment:not(:disabled)": "submitPayment", | |
| "click .submitconfirmation:not(:disabled)": "submitConfirmation", | |
| "click .proceed": "proceedNext" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| if (o.options.lockedSectionType === 1) { | |
| o.paymentCheck = new a.Ms.PaymentCheck(); | |
| o.paymentCheck.fetch({ | |
| cache: false, | |
| data: { | |
| applicationFormId: a.Data.FormId, | |
| keyId: a.Data.KeyId | |
| }, | |
| success: function () { | |
| o.renderData() | |
| } | |
| }) | |
| } else { | |
| o.renderData() | |
| } | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| if ((a.Data.FormType === "Inquiry") || (a.Data.FormType === "Application") || (a.Data.FormType === f.FormType.RECOMMENDATION.Name)) { | |
| n.renderForms() | |
| } else { | |
| n.fetchAllContractsAndForms() | |
| } | |
| }, | |
| renderForms: function () { | |
| var r = this, | |
| q, n, o, p; | |
| if (r.allForms !== undefined) { | |
| o = $.map(r.allForms, function (t, s) { | |
| if (t.DownloadLink === Bb.history.getFragment()) { | |
| return s | |
| } | |
| })[0]; | |
| if (o !== undefined) { | |
| r.currentElement = r.allForms[o]; | |
| if (r.currentElement.ProcessNextForm === true) { | |
| p = r.allForms.filter(function (s, t) { | |
| return s.ProcessNextForm === true && s.ReviewInd !== 2 && t > o | |
| })[0]; | |
| r.currentElement.NextElement = p | |
| } | |
| } | |
| } | |
| p3.fT(r.template, function (v) { | |
| var s = (a.Data.FormType === "Inquiry") ? null : r.options.sectionName, | |
| t = (r.currentElement !== undefined && r.currentElement.ProcessNextForm && r.currentElement.NextElement !== undefined), | |
| u = (r.options.lockedSectionType === 2 && a.Data.FormType !== "Inquiry" && a.Data.FormType !== "Recommendation"); | |
| r.$el.html(v({ | |
| sectionName: s, | |
| showNextButton: t, | |
| showThankYouButton: u | |
| })); | |
| n = $("#form-formbuttons"); | |
| _.each(r.collection.models, function (w) { | |
| if (w.get("ElementItem").Id) { | |
| q = new a.Vs.SectionItemElement({ | |
| model: w, | |
| layoutView: r.options.layoutView, | |
| sectionId: w.id | |
| }) | |
| } else { | |
| if (w.get("FieldBlockItem").Id) { | |
| switch (w.get("FieldBlockItem").Id) { | |
| case 20: | |
| if (!r.paymentCheck.get("PaymentComplete")) { | |
| q = new a.Vs.SectionItemBlock({ | |
| model: w, | |
| layoutView: r.options.layoutView, | |
| sectionId: w.id, | |
| lockedSectionType: r.options.lockedSectionType, | |
| applicationId: r.options.applicationId, | |
| ordinal: w.attributes.FieldElementItems[w.attributes.FieldElementItems.length - 1].FieldItem.FieldData.Ordinal | |
| }) | |
| } else { | |
| q = new a.Vs.SectionItemBlock_Payment({ | |
| model: w, | |
| paymentCheck: r.paymentCheck, | |
| layoutView: r.options.layoutView, | |
| sectionId: w.id, | |
| lockedSectionType: r.options.lockedSectionType, | |
| applicationId: r.options.applicationId, | |
| ordinal: 1 | |
| }) | |
| } | |
| break; | |
| case 39: | |
| case 40: | |
| q = new a.Vs.SectionItemBlock_ESignatures({ | |
| model: w, | |
| layoutView: r.options.layoutView, | |
| sectionId: w.id, | |
| lockedSectionType: r.options.lockedSectionType, | |
| applicationId: r.options.applicationId, | |
| ordinal: w.attributes.FieldElementItems[w.attributes.FieldElementItems.length - 1].FieldItem.FieldData.Ordinal | |
| }); | |
| break; | |
| case 72: | |
| q = new a.Vs.SectionItemBlock_RatingMatrix({ | |
| applicationId: r.options.applicationId, | |
| sectionItemId: w.get("SectionItemId") | |
| }); | |
| break; | |
| default: | |
| q = new a.Vs.SectionItemBlock({ | |
| model: w, | |
| layoutView: r.options.layoutView, | |
| sectionId: w.id, | |
| applicationId: r.options.applicationId, | |
| ordinal: w.attributes.FieldElementItems[w.attributes.FieldElementItems.length - 1].FieldItem.FieldData.Ordinal, | |
| scrollTop: r.options.scrollTop | |
| }) | |
| } | |
| } | |
| } | |
| p3.rV(q, r.$("#form-items"), false) | |
| }); | |
| if (!r.options.lockedSection) { | |
| if (!$(".application-navigation li.active").is(":first-child")) { | |
| n.append('<button class="btn btn-default btn-sm mr-5 pull-left prev">Previous</button>') | |
| } | |
| if (!r.options.lastSection) { | |
| n.append('<button class="btn btn-approve active btn-sm pull-left next">Next</button>') | |
| } else { | |
| n.append('<button class="btn btn-approve active btn-sm pull-left submitform">Submit</button>') | |
| } | |
| } else { | |
| if (r.options.lockedSectionType === 1) { | |
| if (!r.paymentCheck.get("PaymentComplete")) { | |
| if (a.Data.SecurePayment) { | |
| n.append('<button class="btn btn-approve active btn-sm mr-5 pull-left submitpayment">Pay & Submit</button>') | |
| } | |
| } else { | |
| n.append('<button class="btn btn-approve active btn-sm pull-left next">Next</button>') | |
| } | |
| } else { | |
| if (r.options.lockedSectionType === 2 && a.Data.FormType !== "Inquiry") { | |
| if (!a.Data.Preview) { | |
| $(".application-navigation a").removeClass("unlocked").addClass("disabled") | |
| } | |
| } | |
| } | |
| } | |
| n.append('<div class="clear"></div>') | |
| }) | |
| }, | |
| prevSection: function (n) { | |
| $(".application-navigation .active").prev("li").trigger("selectsection") | |
| }, | |
| nextSection: function (n) { | |
| $(".application-navigation .active").next("li").trigger("selectsection") | |
| }, | |
| submitForm: function (p) { | |
| p.stopPropagation(); | |
| p.preventDefault(); | |
| var s = this, | |
| q, o, r, n = $("#form-error"); | |
| if (a.Data.Preview) { | |
| p3.displayError("Preview mode does not allow submit") | |
| } else { | |
| if (a.Data.ApplicationForm.isMigrationPending()) { | |
| p3.displayError("A problem has occurred. Please contact the school for more information.") | |
| } else { | |
| s.$(".submitform").button("loading"); | |
| s.$(".submitform").prop("disabled", true); | |
| if (a.Data.FormSaveType === 1) { | |
| if (a.Data.ApplicationForm.isSchoolForm()) { | |
| q = new a.Ms.SchoolFormSubmit() | |
| } else { | |
| if (a.Data.ApplicationForm.isRecommendationForm()) { | |
| q = new a.Ms.RecommendationFormSubmit() | |
| } else { | |
| q = new a.Ms.ApplicationSubmit() | |
| } | |
| } | |
| o = { | |
| id: s.options.applicationId, | |
| submit: true, | |
| applicationFormId: a.Data.FormId | |
| }; | |
| q.save({}, { | |
| dataParam: o, | |
| success: function (t, u) { | |
| a.Data.Submitted = true; | |
| _.each($(".application-navigation a:not(.locked)"), function (w) { | |
| var v = $(w); | |
| v.find(".p3icon-ok").show(); | |
| v.find(".p3icon-notification").hide(); | |
| _.each(u, function (x) { | |
| if (x.ApplicationSectionId == v.data("id")) { | |
| v.find(".p3icon-ok").hide(); | |
| v.find(".p3icon-notification").show() | |
| } | |
| }) | |
| }); | |
| _.each($("#form-items .field"), function (v) { | |
| $(v).trigger("fieldvalidate") | |
| }); | |
| n.empty(); | |
| if (u.length === 0) { | |
| i.Us.ShowMainBulletin(); | |
| if (($(".application-navigation li.active").index() + 1) < $(".application-navigation li").length) { | |
| $(".application-navigation .active").next("li").trigger("selectsection") | |
| } else { | |
| p3.router().navigate("#candidateview/" + s.collection.models[0].attributes.userId + "/progress", true) | |
| } | |
| } else { | |
| s.$(".submitform").button("reset"); | |
| s.$(".submitform").prop("disabled", false); | |
| if (u.length === 1) { | |
| if (_.chain(u).pluck("ApplicationSectionId").contains(-999).value()) { | |
| p3.rV(new a.Vs.Error({ | |
| errorMsg: "You have used the same medication for multiple allergies and/or conditions. The last set of medication details (ie frequency, etc) will be saved to all attached allergies and/or conditions.<br /><br />To continue, click OK and then Submit.", | |
| medical: true | |
| }), n, false) | |
| } else { | |
| p3.rV(new a.Vs.Error({ | |
| errorMsg: "Please review the fields marked in red on your form. Updates are necessary in order to submit." | |
| }), n, false) | |
| } | |
| } else { | |
| p3.rV(new a.Vs.Error({ | |
| errorMsg: "Please review the fields marked in red on your form. Updates are necessary in order to submit." | |
| }), n, false); | |
| if (_.chain(u).pluck("ApplicationSectionId").contains(-999).value()) { | |
| p3.rV(new a.Vs.Error({ | |
| errorMsg: "You have used the same medication for multiple allergies and/or conditions. The last set of medication details (ie frequency, etc) will be saved to all attached allergies and/or conditions.<br /><br />To continue, click OK and then Submit.", | |
| medical: true | |
| }), n, false) | |
| } | |
| } | |
| if (_.chain(u).pluck("BlockId").contains(72).value()) { | |
| a.Data.InvalidSectionItemIds = []; | |
| _.each(u, function (v) { | |
| $('.ratings-matrix > .ratings-matrix-validation-error[data-section-item-id="' + v.ApplicationSectionItemId + '"]').show(); | |
| a.Data.InvalidSectionItemIds.push(v.ApplicationSectionItemId) | |
| }) | |
| } | |
| } | |
| $("body,html").scrollTop(0) | |
| }, | |
| error: function (u, t) { | |
| s.$(".submitform").button("reset"); | |
| s.$(".submitform").prop("disabled", false); | |
| p3.displayError("Error form validation") | |
| } | |
| }) | |
| } else { | |
| if (a.Data.FormSaveType === 2) { | |
| n.empty(); | |
| r = true; | |
| _.each($("#form-items .field"), function (t) { | |
| if ($(t).triggerHandler("fieldvalidate") === false) { | |
| r = false | |
| } | |
| }); | |
| if (r) { | |
| q = new a.Cs.FormSubmit(a.Data.FormData); | |
| o = { | |
| formId: a.Data.FormId | |
| }; | |
| if (a.Data.Source) { | |
| o.source = a.Data.Source | |
| } | |
| if (a.Data.Admin) { | |
| o.origin = f.ProspectOrigin.ADMININQUIRY | |
| } else { | |
| if (a.Data.Local) { | |
| o.origin = f.ProspectOrigin.INQUIRY | |
| } | |
| } | |
| q.save({ | |
| dataParam: o, | |
| success: function (t, u) { | |
| if (a.Data.Admin) { | |
| p3.router().navigate("#process/inquiries", true) | |
| } else { | |
| if (($(".application-navigation li.active").index() + 1) < $(".application-navigation li").length) { | |
| $(".application-navigation .active").next("li").trigger("selectsection") | |
| } else { | |
| $("#form-items").html("<h2>Thank you for your submission!</h2>") | |
| } | |
| $("#form-formbuttons").empty() | |
| } | |
| }, | |
| error: function (u, t) { | |
| p3.displayError("Error on form save") | |
| } | |
| }) | |
| } else { | |
| s.$(".submitform").button("reset"); | |
| s.$(".submitform").prop("disabled", false); | |
| p3.rV(new a.Vs.Error({ | |
| errorMsg: "Please review the fields marked in red on your form. Updates are necessary in order to submit." | |
| }), n, false); | |
| $("body,html").scrollTop(0) | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| submitPayment: function (o) { | |
| o.stopPropagation(); | |
| o.preventDefault(); | |
| var q = this, | |
| p, n = $("#form-error"); | |
| if (a.Data.Preview) { | |
| p3.displayError("Preview mode does not allow payment") | |
| } else { | |
| q.$(".submitpayment").button("loading"); | |
| q.$(".submitpayment").prop("disabled", true); | |
| n.empty(); | |
| _.each(q.collection.models, function (r) { | |
| if (r.attributes.FieldBlockItem.Id === 20) { | |
| p = new a.Ms.SubmitPayment(r.toJSON()) | |
| } | |
| }); | |
| p.save({}, { | |
| dataParam: { | |
| encodedUri: encodeURIComponent(window.location.href) | |
| }, | |
| success: function (r, s) { | |
| if (s.url) { | |
| window.location = s.url | |
| } else { | |
| if (($(".application-navigation li.active").index() + 1) < $(".application-navigation li").length) { | |
| $(".application-navigation .active").next("li").trigger("selectsection") | |
| } else { | |
| a.Data.PaymentSubmitted = true; | |
| p3.router().navigate("#candidateview/" + q.collection.models[0].attributes.userId + "/progress", true) | |
| } | |
| } | |
| }, | |
| error: function (t, r) { | |
| var s = ""; | |
| if (r.responseText.indexOf("Invalid Waiver Code.") > -1) { | |
| $(".sectionitems input[data-fieldid=201]").parents(".field").trigger("fieldinvalid", ["Invalid waiver code."]); | |
| s = "Invalid Waiver Code." | |
| } else { | |
| if (r.responseText.indexOf("Your credit card cannot be processed at this time") > -1) { | |
| _.each($("#form-items .field"), function (u) { | |
| $(u).trigger("fieldvalidate") | |
| }); | |
| s = "Your credit card cannot be processed at this time. Please try again or contact the school for further information." | |
| } else { | |
| if (r.responseText.indexOf("Your transaction cannot be processed at this time") > -1) { | |
| _.each($("#form-items .field"), function (u) { | |
| $(u).trigger("fieldvalidate") | |
| }); | |
| s = "Your transaction cannot be processed at this time. Please try again or contact the school for further information." | |
| } else { | |
| if (r.responseText.indexOf("gateway does not support EFT") > -1) { | |
| s = "Your payment cannot be processed at this time. Currently selected payment gateway does not support EFT transactions." | |
| } else { | |
| _.each($("#form-items .field"), function (u) { | |
| $(u).trigger("fieldvalidate") | |
| }); | |
| s = "Your payment cannot be processed at this time. Please try again or contact the school for further information." | |
| } | |
| } | |
| } | |
| } | |
| if (s) { | |
| p3.rV(new a.Vs.Error({ | |
| errorMsg: s | |
| }), n, false) | |
| } | |
| q.$(".submitpayment").button("reset"); | |
| q.$(".submitpayment").prop("disabled", false) | |
| } | |
| }) | |
| } | |
| }, | |
| submitConfirmation: function (n) { | |
| var o = this; | |
| n.stopPropagation(); | |
| n.preventDefault(); | |
| if (a.Data.Preview) { | |
| p3.displayError("Preview mode does not allow confirm") | |
| } else { | |
| o.$(".submitconfirmation").button("loading"); | |
| o.$(".submitconfirmation").prop("disabled", true); | |
| if (a.Data.ApplicationForm.isSchoolForm()) { | |
| p3.router().navigate("#myfiles", true) | |
| } else { | |
| if (a.Data.FormType === f.FormType.RECOMMENDATION.Name) { | |
| o.$(".submitconfirmation").prop("disabled", true) | |
| } else { | |
| p3.router().navigate("#candidateview/" + o.collection.models[0].attributes.userId + "/progress", true) | |
| } | |
| } | |
| } | |
| } | |
| }); | |
| a.Vs.SectionItemElement = Bb.View.extend({ | |
| template: "admissions/application.section.item.element.template.html", | |
| className: "form-section-item", | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| o.renderData() | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({ | |
| model: n.model.toJSON() | |
| })) | |
| }) | |
| } | |
| }); | |
| a.Vs.SectionItemBlock = Bb.View.extend({ | |
| template: "admissions/application.section.item.block.template.html", | |
| className: function () { | |
| return "form-section-item form-fix" | |
| }, | |
| initialize: function () { | |
| var r = this, | |
| p, q, o, n; | |
| r.collection = new a.Cs.BlockFields(); | |
| r.ordinal = 0; | |
| if (!a.Data.Preview) { | |
| if ((r.model.get("FieldBlockItem").Id === 26 || r.model.get("FieldBlockItem").Id === 20) && !a.Data.SecurePayment) { | |
| p3.rV(new a.Vs.Error({ | |
| errorMsg: "Payments can not be submitted at this time. Please contact the school for assistance." | |
| }), $("#form-error"), false) | |
| } | |
| if (r.model.get("FieldBlockItem").Id === 47) { | |
| r.addBlockCollection = new a.Cs.EmergencyContactPhones(); | |
| r.addBlockCollection.fetch({ | |
| data: { | |
| userId: a.Data.KeyId, | |
| appId: r.options.applicationId | |
| }, | |
| success: function (s, u) { | |
| var t = ""; | |
| r.addBlockCollection = _.filter(s.models, function (w, v) { | |
| w.set({ | |
| id: t + w.get("UserContactId") + w.get("PhoneIndexId") + w.get("ContactPhoneId"), | |
| description: w.get("FirstName") + " " + w.get("LastName") + " - " + w.get("PhoneType") + " - " + w.get("PhoneNumber") | |
| }); | |
| return w.get("SortOrder") === 0 && w.get("RelationshipId") !== -2 | |
| }); | |
| r.addBlockCollection = new a.Cs.EmergencyContactPhones(r.addBlockCollection) | |
| }, | |
| error: function (t, s) { | |
| p3.displayError("Error getting emergency phone contacts") | |
| } | |
| }) | |
| } | |
| if (r.model.get("FieldBlockItem").Id === 48) { | |
| r.addBlockCollection = new a.Cs.EmergencyContactEmails(); | |
| r.addBlockCollection.fetch({ | |
| data: { | |
| userId: a.Data.KeyId, | |
| appId: r.options.applicationId | |
| }, | |
| success: function (s, u) { | |
| var t = ""; | |
| r.addBlockCollection = _.filter(s.models, function (w, v) { | |
| w.set({ | |
| id: t + w.get("RelationshipUserId") + w.get("UserContactId") + w.get("ContactEmailId"), | |
| description: w.get("FirstName") + " " + w.get("LastName") + " - " + w.get("Email") | |
| }); | |
| return w.get("SortOrder") === 0 && w.get("RelationshipId") !== -2 | |
| }); | |
| r.addBlockCollection = new a.Cs.EmergencyContactEmails(r.addBlockCollection) | |
| }, | |
| error: function (t, s) { | |
| p3.displayError("Error getting emergency email contacts") | |
| } | |
| }) | |
| } | |
| } | |
| r.collection.bind("add", function (s) { | |
| if (r.model.get("MultipleBlockInd") && s.get("FieldItem").FieldData.CanRemove) { | |
| if (r.ordinal != s.get("FieldItem").FieldData.Ordinal) { | |
| r.ordinal = s.get("FieldItem").FieldData.Ordinal; | |
| n = r.$(".fields"); | |
| n.append('<button class="btn btn-default btn-sm mt-10 mb-10 delete" data-ordinalid="' + r.ordinal + '"><i class="fa fa-times"></i> Remove ' + r.model.get("AppendBlockName") + "</button>") | |
| } | |
| } | |
| s.get("FieldItem").FieldData.lastSubOrdinal = r.lastSubOrdinal[s.get("FieldItem").FieldData.Ordinal]; | |
| s.get("FieldItem").FieldData.firstSubOrdinal = r.firstSubOrdinal[s.get("FieldItem").FieldData.Ordinal]; | |
| if (s.get("ElementItem").Id) { | |
| o = new a.Vs.ElementField({ | |
| model: s, | |
| elementName: r.model.get("ElementItem").Name, | |
| showMultiChild1: r.showMultiChild1, | |
| showMultiChild2: r.showMultiChild2 | |
| }) | |
| } else { | |
| if (s.get("FieldItem").Id) { | |
| p = false; | |
| q = _.chain(r.model.get("FieldElementItems")).filter(function (t) { | |
| return t.FieldBlockId | |
| }).last().value().FieldElementItemId; | |
| if (q == s.get("FieldElementItemId")) { | |
| p = true | |
| } | |
| o = new a.Vs.BlockField({ | |
| model: s, | |
| layoutView: r.options.layoutView, | |
| country: r.country, | |
| country_1: r.country_1, | |
| country_2: r.country_2, | |
| country_3: r.country_3, | |
| lockedSection: Boolean(r.model.get("Locked")), | |
| parents: r.parents, | |
| showChild: r.showChild, | |
| showMultiChild1: r.showMultiChild1, | |
| showMultiChild2: r.showMultiChild2, | |
| emPhone: r.emPhone, | |
| emEmail: r.emEmail, | |
| householdAddress: r.householdAddress, | |
| spouseHouseholdAddress: r.spouseHouseholdAddress, | |
| lastField: p, | |
| showSpouse: r.showSpouse | |
| }) | |
| } | |
| } | |
| p3.rV(o, r.$(".fields"), false) | |
| }, this) | |
| }, | |
| events: { | |
| "click .add": "addBlock", | |
| "click .delete": "deleteBlock", | |
| "click .show-blockselect": "showBlockSelect", | |
| "click .cancel-blockselect": "cancelBlockSelect", | |
| "click .add-blockselect": "addBlockSelect" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| o.renderData() | |
| }, | |
| renderData: function () { | |
| var r = this, | |
| q = 0, | |
| p = 0, | |
| o = 0, | |
| n; | |
| p3.fT(r.template, function (s) { | |
| r.$el.html(s({ | |
| model: r.model.toJSON() | |
| })); | |
| r.country_1 = null; | |
| r.country_2 = null; | |
| r.country_3 = null; | |
| r.parents = null; | |
| r.showChild = []; | |
| r.showMultiChild1 = {}; | |
| r.showMultiChild2 = {}; | |
| r.header = null; | |
| r.emPhone = []; | |
| r.emEmail = []; | |
| r.householdAddress = []; | |
| r.spouseHouseholdAddress = []; | |
| r.lastSubOrdinal = {}; | |
| r.firstSubOrdinal = {}; | |
| r.showSpouse = []; | |
| _.each(r.model.get("FieldElementItems"), function (t) { | |
| if (t.FieldItem.FieldData.Ordinal > o) { | |
| r.firstSubOrdinal[t.FieldItem.FieldData.Ordinal] = 0; | |
| r.lastSubOrdinal[t.FieldItem.FieldData.Ordinal] = 0; | |
| o = t.FieldItem.FieldData.Ordinal | |
| } | |
| if (t.FieldItem.Id == 15) { | |
| if (t.FieldItem.BlockGroup == null) { | |
| r.country = t.FieldItem.FieldData.Data | |
| } | |
| if (t.FieldItem.BlockGroup == 1) { | |
| r.country_1 = t.FieldItem.FieldData.Data | |
| } | |
| if (t.FieldItem.BlockGroup == 2) { | |
| r.country_2 = t.FieldItem.FieldData.Data | |
| } | |
| if (t.FieldItem.BlockGroup == 3) { | |
| r.country_3 = t.FieldItem.FieldData.Data | |
| } | |
| } | |
| if (t.FieldItem.Id === 180 || t.FieldItem.Id === 250) { | |
| var u = _.findWhere(t.FieldItem.LookUpList, { | |
| dd_id: t.FieldItem.FieldData.Interest | |
| }); | |
| if (u) { | |
| if (r.header == u.category) { | |
| t.FieldItem.FieldData._header = null | |
| } else { | |
| t.FieldItem.FieldData._header = u.category; | |
| r.header = u.category | |
| } | |
| } | |
| if (l.stringToBoolean(t.FieldItem.FieldData.Data) === true) { | |
| r.showChild.push(t.FieldItem.FieldData.Interest) | |
| } | |
| } | |
| if (t.FieldBlockId === 682) { | |
| if (l.stringToBoolean(t.FieldItem.FieldData.Data) === true) { | |
| q++; | |
| r.emPhone.push(t.FieldItem.FieldData.Ordinal) | |
| } | |
| } | |
| if (t.FieldBlockId === 696) { | |
| if (l.stringToBoolean(t.FieldItem.FieldData.Data) === true) { | |
| p++; | |
| r.emEmail.push(t.FieldItem.FieldData.Ordinal) | |
| } | |
| } | |
| if (t.FieldItem.Id === 160) { | |
| if (l.stringToBoolean(t.FieldItem.FieldData.Data) === true) { | |
| r.showChild.push(161) | |
| } | |
| } | |
| if (t.FieldItem.Id === 161) { | |
| r.showChild.push(161); | |
| _.each(r.model.get("FieldElementItems"), function (v) { | |
| if (v.FieldItem.Id === 160) { | |
| if (v.FieldItem.Visible === true && v.FieldItem.FieldData.Data != "true") { | |
| r.showChild.splice(r.showChild.indexOf(161), 1) | |
| } | |
| } | |
| }) | |
| } | |
| if (t.FieldItem.Id === 162) { | |
| if (l.stringToBoolean(t.FieldItem.FieldData.Data) === true) { | |
| r.showChild.push(163) | |
| } | |
| } | |
| if (t.FieldItem.Id === 163) { | |
| r.showChild.push(163); | |
| _.each(r.model.get("FieldElementItems"), function (v) { | |
| if (v.FieldItem.Id === 162) { | |
| if (v.FieldItem.Visible === true && v.FieldItem.FieldData.Data != "true") { | |
| r.showChild.splice(r.showChild.indexOf(163), 1) | |
| } | |
| } | |
| }) | |
| } | |
| if (t.FieldItem.Id === 164) { | |
| if (l.stringToBoolean(t.FieldItem.FieldData.Data) === true) { | |
| r.showChild.push(165) | |
| } | |
| } | |
| if (t.FieldItem.Id === 165) { | |
| r.showChild.push(165); | |
| _.each(r.model.get("FieldElementItems"), function (v) { | |
| if (v.FieldItem.Id === 164) { | |
| if (v.FieldItem.Visible === true && v.FieldItem.FieldData.Data != "true") { | |
| r.showChild.splice(r.showChild.indexOf(165), 1) | |
| } | |
| } | |
| }) | |
| } | |
| if (t.FieldItem.Id === 166) { | |
| if (l.stringToBoolean(t.FieldItem.FieldData.Data) === true) { | |
| r.showChild.push(167) | |
| } | |
| } | |
| if (t.FieldItem.Id === 167) { | |
| r.showChild.push(167); | |
| _.each(r.model.get("FieldElementItems"), function (v) { | |
| if (v.FieldItem.Id === 166) { | |
| if (v.FieldItem.Visible === true && v.FieldItem.FieldData.Data != "true") { | |
| r.showChild.splice(r.showChild.indexOf(167), 1) | |
| } | |
| } | |
| }) | |
| } | |
| if (t.FieldItem.Id === 169) { | |
| if (l.stringToBoolean(t.FieldItem.FieldData.Data) === true) { | |
| r.showChild.push(171) | |
| } | |
| } | |
| if (t.FieldItem.Id === 171) { | |
| r.showChild.push(171); | |
| _.each(r.model.get("FieldElementItems"), function (v) { | |
| if (v.FieldItem.Id === 169) { | |
| if (v.FieldItem.Visible === true && v.FieldItem.FieldData.Data != "true") { | |
| r.showChild.splice(r.showChild.indexOf(171), 1) | |
| } | |
| } | |
| }) | |
| } | |
| if (t.FieldBlockId === 700) { | |
| if (l.stringToBoolean(t.FieldItem.FieldData.Data) === true) { | |
| r.showChild.push(700) | |
| } | |
| } | |
| if (t.FieldBlockId === 740) { | |
| if (l.stringToBoolean(t.FieldItem.FieldData.Data) === true) { | |
| j.Us.setPropByString(r.showMultiChild1, t.FieldBlockId + "." + t.FieldItem.FieldData.Ordinal, true) | |
| } | |
| } | |
| if (t.FieldBlockId === 748) { | |
| if (l.stringToBoolean(t.FieldItem.FieldData.Data) === true) { | |
| j.Us.setPropByString(r.showMultiChild1, t.FieldBlockId + "." + t.FieldItem.FieldData.Ordinal, true) | |
| } | |
| } | |
| if (t.FieldBlockId === 780) { | |
| if (r.firstSubOrdinal[t.FieldItem.FieldData.Ordinal] === 0) { | |
| r.firstSubOrdinal[t.FieldItem.FieldData.Ordinal] = t.FieldItem.FieldData.SubBlockOrdinal | |
| } | |
| } | |
| if (t.FieldBlockId === 781) { | |
| if (t.FieldItem.FieldData.SubBlockOrdinal > r.lastSubOrdinal[t.FieldItem.FieldData.Ordinal]) { | |
| r.lastSubOrdinal[t.FieldItem.FieldData.Ordinal] = t.FieldItem.FieldData.SubBlockOrdinal | |
| } | |
| } | |
| if (t.FieldBlockId === 753) { | |
| if (l.stringToInt(t.FieldItem.FieldData.Data) === 2) { | |
| j.Us.setPropByString(r.showMultiChild2, t.FieldBlockId + "." + t.FieldItem.FieldData.Ordinal + "." + t.FieldItem.FieldData.SubBlockOrdinal, true) | |
| } | |
| } | |
| if (t.FieldBlockId === 755) { | |
| if (l.stringToBoolean(t.FieldItem.FieldData.Data) === true) { | |
| j.Us.setPropByString(r.showMultiChild1, t.FieldBlockId + "." + t.FieldItem.FieldData.Ordinal, true) | |
| } | |
| } | |
| if (t.FieldBlockId === 760) { | |
| if (l.stringToBoolean(t.FieldItem.FieldData.Data) === true) { | |
| j.Us.setPropByString(r.showMultiChild1, t.FieldBlockId + "." + t.FieldItem.FieldData.Ordinal, true) | |
| } | |
| } | |
| if (t.FieldBlockId === 782) { | |
| if (r.firstSubOrdinal[t.FieldItem.FieldData.Ordinal] === 0) { | |
| r.firstSubOrdinal[t.FieldItem.FieldData.Ordinal] = t.FieldItem.FieldData.SubBlockOrdinal | |
| } | |
| } | |
| if (t.FieldBlockId === 783) { | |
| if (t.FieldItem.FieldData.SubBlockOrdinal > r.lastSubOrdinal[t.FieldItem.FieldData.Ordinal]) { | |
| r.lastSubOrdinal[t.FieldItem.FieldData.Ordinal] = t.FieldItem.FieldData.SubBlockOrdinal | |
| } | |
| } | |
| if (t.FieldBlockId === 765) { | |
| if (l.stringToInt(t.FieldItem.FieldData.Data) === 2) { | |
| j.Us.setPropByString(r.showMultiChild2, t.FieldBlockId + "." + t.FieldItem.FieldData.Ordinal + "." + t.FieldItem.FieldData.SubBlockOrdinal, true) | |
| } | |
| } | |
| if (t.FieldBlockId === 29 || t.FieldBlockId === 361) { | |
| if (l.stringToBoolean(t.FieldItem.FieldData.Data) !== true) { | |
| r.householdAddress.push(t.FieldItem.FieldData.Ordinal) | |
| } | |
| } | |
| if (t.FieldBlockId === 905) { | |
| if (l.stringToBoolean(t.FieldItem.FieldData.Data) !== true) { | |
| r.spouseHouseholdAddress.push(t.FieldItem.FieldData.Ordinal) | |
| } | |
| } | |
| if (t.FieldBlockId === 939) { | |
| if (l.stringToBoolean(t.FieldItem.FieldData.Data) === true) { | |
| r.showSpouse.push(t.FieldItem.FieldData.Ordinal) | |
| } | |
| } | |
| }); | |
| if (q > 10) { | |
| r.$(".form-block-alert").append('<div class="alert alert-error">There are too many emergency phone numbers. Please enter no more than 10.</div>') | |
| } | |
| if (p > 10) { | |
| r.$(".form-block-alert").append('<div class="alert alert-error">There are too many emergency emails. Please enter no more than 10.</div>') | |
| } | |
| r.parents = _.chain(r.model.get("FieldElementItems")).map(function (t) { | |
| return t.FieldItem.Parent | |
| }).uniq().compact().value(); | |
| _.each(r.model.get("FieldElementItems"), function (t) { | |
| r.collection.add(t) | |
| }); | |
| if (r.model.get("AllowAddAnother") && r.model.get("MultipleBlockInd")) { | |
| n = r.$(".addAnother"); | |
| if (r.model.get("FieldBlockItem").Id === 47 || r.model.get("FieldBlockItem").Id === 48) { | |
| n.append('<button class="btn btn-link btn-sm mt-10 mb-10 show-blockselect"><i class="fa fa-plus-circle"></i> Add Another ' + r.model.get("AppendBlockName") + "</button>") | |
| } else { | |
| n.append('<button class="btn btn-link btn-sm mt-10 mb-10 add"><i class="fa fa-plus-circle"></i> Add Another ' + r.model.get("AppendBlockName") + "</button>") | |
| } | |
| r.$("button.add").hover(function () { | |
| r.$(".fields").css("background-color", "#fdffcf") | |
| }, function () { | |
| r.$(".fields").css("background-color", "") | |
| }); | |
| r.$("button.delete").hover(function (t) { | |
| r.$('[data-ordinalid="' + $(t.currentTarget).data("ordinalid") + '"]').parents(".field").css("background-color", "#fdffcf") | |
| }, function (t) { | |
| r.$('[data-ordinalid="' + $(t.currentTarget).data("ordinalid") + '"]').parents(".field").css("background-color", "") | |
| }) | |
| } | |
| if (r.options.scrollTop > 0) { | |
| $(document).scrollTop(r.options.scrollTop) | |
| } | |
| }) | |
| }, | |
| showBlockSelect: function (n) { | |
| n.stopPropagation(); | |
| n.preventDefault(); | |
| var o = this; | |
| if (a.Data.Preview) { | |
| p3.displayError("This feature is not available in Preview mode") | |
| } else { | |
| if (o.addBlockCollection.length > 0) { | |
| p3.rV(new a.Vs.AddBlockSelect({ | |
| collection: o.addBlockCollection | |
| }), o.$(".addAnother"), true) | |
| } else { | |
| o.addBlock(n) | |
| } | |
| } | |
| }, | |
| cancelBlockSelect: function (o) { | |
| o.stopPropagation(); | |
| o.preventDefault(); | |
| var p = this, | |
| n = p.$(".addAnother"); | |
| n.empty().append('<button class="btn btn-link btn-sm mt-10 show-blockselect"><i class="fa fa-plus-circle"></i> Add Another ' + p.model.get("AppendBlockName") + "</button>") | |
| }, | |
| addBlockSelect: function (n) { | |
| var p = this, | |
| o; | |
| p.$(n.currentTarget).button("loading"); | |
| p.$(n.currentTarget).prop("disabled", true); | |
| o = p.addBlockCollection.get(p.$(".blockselect").val()); | |
| o.set({ | |
| FormDataId: p.options.applicationId, | |
| SectionItemId: p.model.get("SectionItemId"), | |
| Ordinal: p.options.ordinal + 1, | |
| BlockId: p.model.get("FieldBlockItem").Id | |
| }); | |
| o.save({}, { | |
| success: function (q, r) { | |
| $(".application-navigation li.active").trigger("refreshsection") | |
| }, | |
| error: function (r, q) { | |
| p3.displayError("Error adding emergency contact"); | |
| p.$(n.currentTarget).button("reset"); | |
| p.$(n.currentTarget).prop("disabled", false) | |
| } | |
| }) | |
| }, | |
| addBlock: function (o) { | |
| o.stopPropagation(); | |
| o.preventDefault(); | |
| var s = this, | |
| q, p, r, n; | |
| if (a.Data.Preview) { | |
| p3.displayError("This feature is not available in Preview mode") | |
| } else { | |
| s.$(o.currentTarget).button("loading"); | |
| s.$(o.currentTarget).prop("disabled", true); | |
| q = s.options.ordinal + 1; | |
| p = s.collection.last().toJSON().FieldItem.FieldData.Ordinal; | |
| if (a.Data.FormSaveType === 1) { | |
| r = new a.Ms.SectionItemDuplicate({ | |
| ApplicantDataId: s.options.applicationId, | |
| ApplicationFormId: a.Data.FormId, | |
| KeyId: a.Data.KeyId, | |
| Data: null, | |
| Ordinal: q, | |
| SectionItemId: s.model.get("SectionItemId"), | |
| XMLElement: "addAnother" | |
| }); | |
| r.save({}, { | |
| dataParam: { | |
| sectionId: s.model.get("ApplicationSectionId"), | |
| returnModel: true | |
| }, | |
| success: function (t, u) { | |
| $(".application-navigation li.active").trigger("refreshsection") | |
| }, | |
| error: function (u, t) { | |
| p3.displayError("Error adding section item"); | |
| s.$(o.currentTarget).button("reset"); | |
| s.$(o.currentTarget).prop("disabled", false) | |
| } | |
| }) | |
| } else { | |
| if (a.Data.FormSaveType === 2) { | |
| s.$(o.currentTarget).button("reset"); | |
| s.$(o.currentTarget).prop("disabled", false); | |
| if (a.Data.FormDefaults.length) { | |
| n = _.findWhere(a.Data.FormDefaults, { | |
| SectionItemId: s.model.get("SectionItemId") | |
| }) | |
| } | |
| n = _.filter(n.FieldElementItems, function (t) { | |
| return t.FieldItem.FieldData.Ordinal === 1 | |
| }); | |
| n = $.extend(true, [], n); | |
| _.each(n, function (t) { | |
| t.FieldItem.FieldData.CanRemove = 1; | |
| t.FieldItem.FieldData.Ordinal = p + 1 | |
| }); | |
| s.collection.add(n) | |
| } | |
| } | |
| } | |
| }, | |
| deleteBlock: function (n) { | |
| n.stopPropagation(); | |
| n.preventDefault(); | |
| var r = this, | |
| o, p = [], | |
| q; | |
| if (a.Data.Preview) { | |
| p3.displayError("This feature is not available in Preview mode") | |
| } else { | |
| o = $(n.currentTarget).data("ordinalid"); | |
| if (a.Data.FormSaveType === 1) { | |
| q = new a.Ms.SectionItemDuplicate({ | |
| ApplicantDataId: r.options.applicationId, | |
| ApplicationFormId: a.Data.FormId, | |
| KeyId: a.Data.KeyId, | |
| Data: null, | |
| Ordinal: $(n.currentTarget).data("ordinalid"), | |
| SectionItemId: r.model.get("SectionItemId"), | |
| XMLElement: "remove" | |
| }); | |
| q.save({}, { | |
| dataParam: { | |
| sectionId: r.model.get("ApplicationSectionId"), | |
| returnModel: true | |
| }, | |
| success: function (s, t) { | |
| $(".application-navigation li.active").trigger("refreshsection") | |
| }, | |
| error: function (t, s) { | |
| if (a.Data.Preview) { | |
| p3.displayError("This feature is not available in Preview mode") | |
| } else { | |
| p3.displayError("Error adding section item") | |
| } | |
| } | |
| }) | |
| } else { | |
| if (a.Data.FormSaveType === 2) { | |
| r.$(n.currentTarget).button("reset"); | |
| r.$(n.currentTarget).prop("disabled", false); | |
| _.each(r.collection.models, function (s) { | |
| if (s.get("FieldItem").FieldData.Ordinal == o) { | |
| p.push(s) | |
| } | |
| }); | |
| r.collection.remove(p); | |
| $(n.currentTarget).remove() | |
| } | |
| } | |
| } | |
| } | |
| }); | |
| a.Vs.ElementField = Bb.View.extend({ | |
| template: "admissions/application.section.item.element.template.html", | |
| initialize: function () { | |
| var n = this; | |
| n.model.bind("remove", this.deleteElement, this) | |
| }, | |
| events: { | |
| "click button": "clickButton" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| o.renderData() | |
| }, | |
| renderData: function () { | |
| var p = this, | |
| n = false, | |
| o = false; | |
| switch (p.model.get("FieldBlockId")) { | |
| case 781: | |
| case 783: | |
| if (p.model.get("FieldItem").FieldData.lastSubOrdinal !== p.model.get("FieldItem").FieldData.SubBlockOrdinal) { | |
| o = true | |
| } | |
| if (!j.Us.getPropByString(p.options.showMultiChild1, p.model.get("FieldItem").Parent + "." + p.model.get("FieldItem").FieldData.Ordinal)) { | |
| n = true | |
| } | |
| break; | |
| case 780: | |
| case 782: | |
| if (p.model.get("FieldItem").FieldData.firstSubOrdinal === p.model.get("FieldItem").FieldData.SubBlockOrdinal) { | |
| o = true | |
| } | |
| if (!j.Us.getPropByString(p.options.showMultiChild1, p.model.get("FieldItem").Parent + "." + p.model.get("FieldItem").FieldData.Ordinal)) { | |
| n = true | |
| } | |
| break | |
| } | |
| if (!o) { | |
| p3.fT(p.template, function (q) { | |
| p.$el.html(q({ | |
| model: p.model.toJSON(), | |
| hide: n, | |
| remove: o | |
| })); | |
| if (p.model.get("FieldBlockId") === 780 || p.model.get("FieldBlockId") === 782) { | |
| p.$("button.meds").hover(function (r) { | |
| $(r.currentTarget).parents(".fields").find('[data-ordinalid="' + $(r.currentTarget).data("ordinalid") + '"][data-subordinalid="' + $(r.currentTarget).data("subordinalid") + '"]').parents(".field").css("background-color", "#fdffcf") | |
| }, function (r) { | |
| $(r.currentTarget).parents(".fields").find('[data-ordinalid="' + $(r.currentTarget).data("ordinalid") + '"][data-subordinalid="' + $(r.currentTarget).data("subordinalid") + '"]').parents(".field").css("background-color", "") | |
| }) | |
| } | |
| if (p.model.get("FieldBlockId") === 781 || p.model.get("FieldBlockId") === 783) { | |
| p.$("button.meds").hover(function (r) { | |
| $(r.currentTarget).parents(".fields").find('[data-ordinalid="' + $(r.currentTarget).data("ordinalid") + '"]').parents(".field").css("background-color", "#fdffcf") | |
| }, function (r) { | |
| $(r.currentTarget).parents(".fields").find('[data-ordinalid="' + $(r.currentTarget).data("ordinalid") + '"]').parents(".field").css("background-color", "") | |
| }) | |
| } | |
| }) | |
| } | |
| }, | |
| clickButton: function (n) { | |
| var p = this, | |
| o; | |
| if (a.Data.Preview) { | |
| p3.displayError("This feature is not available in Preview mode") | |
| } else { | |
| switch (p.model.get("FieldBlockId")) { | |
| case 780: | |
| case 782: | |
| o = new a.Ms.SectionItemDuplicate({ | |
| ApplicantDataId: a.Data.Id, | |
| ApplicationFormId: a.Data.FormId, | |
| Data: null, | |
| KeyId: a.Data.KeyId, | |
| Ordinal: $(n.currentTarget).data("ordinalid"), | |
| SectionItemId: p.model.get("SectionItemId"), | |
| SubBlock: p.model.get("FieldItem").FieldData.SubBlock, | |
| SubBlockOrdinal: p.model.get("FieldItem").FieldData.SubBlockOrdinal, | |
| XMLElement: "removeSub" | |
| }); | |
| o.save({}, { | |
| dataParam: { | |
| sectionId: p.model.get("ApplicationSectionId"), | |
| returnModel: true | |
| }, | |
| success: function (q, r) { | |
| $(".application-navigation li.active").trigger("refreshsection") | |
| }, | |
| error: function (r, q) { | |
| p3.displayError("Error removing section item") | |
| } | |
| }); | |
| break; | |
| case 781: | |
| case 783: | |
| o = new a.Ms.SectionItemDuplicate({ | |
| ApplicantDataId: a.Data.Id, | |
| ApplicationFormId: a.Data.FormId, | |
| Data: null, | |
| KeyId: a.Data.KeyId, | |
| Ordinal: $(n.currentTarget).data("ordinalid"), | |
| SectionItemId: p.model.get("SectionItemId"), | |
| SubBlock: p.model.get("FieldItem").FieldData.SubBlock, | |
| SubBlockOrdinal: p.model.get("FieldItem").FieldData.SubBlockOrdinal + 1, | |
| XMLElement: "addSub" | |
| }); | |
| o.save({}, { | |
| dataParam: { | |
| sectionId: p.model.get("ApplicationSectionId"), | |
| returnModel: true | |
| }, | |
| success: function (q, r) { | |
| $(".application-navigation li.active").trigger("refreshsection") | |
| }, | |
| error: function (r, q) { | |
| p3.displayError("Error adding section item") | |
| } | |
| }); | |
| break | |
| } | |
| } | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| a.Vs.BlockField = Bb.View.extend({ | |
| className: "field", | |
| initialize: function () { | |
| var n = this; | |
| switch (n.model.get("FieldItem").UIType) { | |
| case "T": | |
| n.template = "form/form.field.text.template.html"; | |
| break; | |
| case "TA": | |
| n.template = "form/form.field.textarea.template.html"; | |
| break; | |
| case "Date": | |
| n.template = "form/form.field.date.template.html"; | |
| break; | |
| case "Time": | |
| n.template = "form/form.field.time.template.html"; | |
| break; | |
| case "RB": | |
| n.template = "form/form.field.yesno.template.html"; | |
| break; | |
| case "DD": | |
| n.template = "form/form.field.dropdown.template.html"; | |
| n.addDDOptGroups(n.model.get("FieldItem").LookUpList); | |
| break; | |
| case "CheckBoxSingleSelect": | |
| n.template = "form/form.field.checkboxsingle.template.html"; | |
| break; | |
| case "CheckBoxMultiSelect": | |
| n.template = "form/form.field.checkboxmulti.template.html"; | |
| break; | |
| case "CB": | |
| n.template = "form/form.field.checkbox.template.html"; | |
| break; | |
| case "Display": | |
| n.template = "form/form.field.display.template.html"; | |
| break; | |
| case "IMG": | |
| n.template = "form/form.field.image.template.html"; | |
| break; | |
| case "DOC": | |
| n.template = "form/form.field.document.template.html"; | |
| break; | |
| case "ExpDate": | |
| n.template = "form/form.field.expirationdate.template.html"; | |
| break; | |
| case "Button": | |
| n.template = "form/form.field.button.template.html"; | |
| break | |
| } | |
| n.model.bind("remove", this.deleteElement, this); | |
| _.bindAll(n, "parent", "renderData", "filterLookupList"); | |
| Bb.Validation.bind(n, { | |
| forceUpdate: true, | |
| selector: "name" | |
| }); | |
| n.model.view = n | |
| }, | |
| events: { | |
| updatemodel: "updateModel", | |
| 'change input[type="text"]': "updateModel", | |
| "change select": "updateModel", | |
| "click .radio-input": "updateModel", | |
| "click .checkbox-input": "updateModel", | |
| "click .checkbox-multi-input": "updateModel", | |
| "blur input.time-input": "updateModel", | |
| "change textarea": "updateModel", | |
| "keyup textarea": "updateCharacterCounter", | |
| "click button.delete-attachment-file": "deleteAttachmentFile", | |
| fieldvalidate: "fieldValidate", | |
| fieldvalid: "fieldValid", | |
| fieldinvalid: "fieldInvalid", | |
| fieldinvalidprovinceother: "fieldInvalidProvinceOther", | |
| "change .parent": "parent", | |
| "click .parent.radio-input": "parent", | |
| "click .parent.checkbox-input": "parent", | |
| filterprovince: "filterProvince" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| o.renderData() | |
| }, | |
| renderData: function (n) { | |
| var v = this, | |
| p = false, | |
| q = false, | |
| s, r, t, u, o; | |
| p3.fT(v.template, function (w) { | |
| if (v.model.get("FieldItem").Id === 229) { | |
| if (v.model.get("FieldItem").BlockGroup == null) { | |
| if (v.options.country === "United States") { | |
| p = true; | |
| q = true | |
| } else { | |
| if (v.options.country === "Canada" || v.options.country === "United Kingdom" || v.options.country === "Australia") { | |
| q = true | |
| } else { | |
| if (v.options.country == null) { | |
| p = true; | |
| q = true | |
| } else { | |
| p = true | |
| } | |
| } | |
| } | |
| } else { | |
| if (v.model.get("FieldItem").BlockGroup === 1) { | |
| if (v.options.country_1 === "United States") { | |
| p = true; | |
| q = true | |
| } else { | |
| if (v.options.country_1 === "Canada" || v.options.country_1 === "United Kingdom" || v.options.country_1 === "Australia") { | |
| q = true | |
| } else { | |
| if (v.options.country_1 == null) { | |
| p = true; | |
| q = true | |
| } else { | |
| p = true | |
| } | |
| } | |
| } | |
| } else { | |
| if (v.model.get("FieldItem").BlockGroup === 2) { | |
| if (v.options.country_2 === "United States") { | |
| p = true; | |
| q = true | |
| } else { | |
| if (v.options.country_2 === "Canada" || v.options.country_2 === "United Kingdom" || v.options.country_2 === "Australia") { | |
| q = true | |
| } else { | |
| if (v.options.country_2 == null) { | |
| p = true; | |
| q = true | |
| } else { | |
| p = true | |
| } | |
| } | |
| } | |
| } else { | |
| if (v.model.get("FieldItem").BlockGroup === 3) { | |
| if (v.options.country_3 === "United States") { | |
| p = true; | |
| q = true | |
| } else { | |
| if (v.options.country_3 === "Canada" || v.options.country_3 === "United Kingdom" || v.options.country_3 === "Australia") { | |
| q = true | |
| } else { | |
| if (v.options.country_3 == null) { | |
| p = true; | |
| q = true | |
| } else { | |
| p = true | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| if (v.model.get("FieldItem").Id === 13) { | |
| if (v.model.get("FieldItem").BlockGroup == null) { | |
| if (v.options.country === "United States") { | |
| p = false | |
| } else { | |
| if (v.options.country === "Canada" || v.options.country === "United Kingdom" || v.options.country === "Australia") { | |
| p = true | |
| } else { | |
| p = true | |
| } | |
| } | |
| } else { | |
| if (v.model.get("FieldItem").BlockGroup === 1) { | |
| if (v.options.country_1 === "United States" || v.options.country_1 == null) { | |
| p = false | |
| } else { | |
| if (v.options.country_1 === "Canada" || v.options.country_1 === "United Kingdom" || v.options.country_1 === "Australia") { | |
| p = true | |
| } else { | |
| p = true | |
| } | |
| } | |
| } else { | |
| if (v.model.get("FieldItem").BlockGroup === 2) { | |
| if (v.options.country_2 === "United States" || v.options.country_2 == null) { | |
| p = false | |
| } else { | |
| if (v.options.country_2 === "Canada" || v.options.country_2 === "United Kingdom" || v.options.country_2 === "Australia") { | |
| p = true | |
| } else { | |
| p = true | |
| } | |
| } | |
| } else { | |
| if (v.model.get("FieldItem").BlockGroup === 3) { | |
| if (v.options.country_3 === "United States" || v.options.country_3 == null) { | |
| p = false | |
| } else { | |
| if (v.options.country_3 === "Canada" || v.options.country_3 === "United Kingdom" || v.options.country_3 === "Australia") { | |
| p = true | |
| } else { | |
| p = true | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| switch (v.model.get("FieldBlockId")) { | |
| case 215: | |
| case 216: | |
| case 217: | |
| case 218: | |
| case 219: | |
| case 220: | |
| case 221: | |
| case 222: | |
| case 224: | |
| if (!_.contains(v.options.householdAddress, v.model.get("FieldItem").FieldData.Ordinal)) { | |
| p = true | |
| } | |
| break; | |
| case 362: | |
| case 363: | |
| case 364: | |
| case 365: | |
| case 366: | |
| case 367: | |
| case 368: | |
| case 369: | |
| case 467: | |
| if (!_.contains(v.options.householdAddress, v.model.get("FieldItem").FieldData.Ordinal)) { | |
| p = true | |
| } | |
| break; | |
| case 161: | |
| case 163: | |
| case 165: | |
| case 167: | |
| case 171: | |
| if (!_.contains(v.options.showChild, v.model.get("FieldBlockId"))) { | |
| p = true | |
| } | |
| break; | |
| case 181: | |
| case 182: | |
| case 183: | |
| case 184: | |
| case 453: | |
| case 454: | |
| case 455: | |
| case 456: | |
| if (!_.contains(v.options.showChild, v.model.get("FieldItem").FieldData.Interest)) { | |
| p = true | |
| } | |
| break; | |
| case 203: | |
| case 204: | |
| case 205: | |
| case 206: | |
| case 207: | |
| case 228: | |
| case 229: | |
| case 230: | |
| case 231: | |
| case 232: | |
| case 233: | |
| case 234: | |
| case 235: | |
| case 236: | |
| case 237: | |
| case 238: | |
| case 239: | |
| p = true; | |
| break; | |
| case 686: | |
| case 687: | |
| case 688: | |
| case 695: | |
| if (!_.contains(v.options.emPhone, v.model.get("FieldItem").FieldData.Ordinal)) { | |
| p = true | |
| } | |
| break; | |
| case 692: | |
| case 693: | |
| case 694: | |
| if (!_.contains(v.options.emEmail, v.model.get("FieldItem").FieldData.Ordinal)) { | |
| p = true | |
| } | |
| break; | |
| case 701: | |
| case 702: | |
| case 703: | |
| if (!_.contains(v.options.showChild, v.model.get("FieldItem").Parent)) { | |
| p = true | |
| } | |
| break; | |
| case 741: | |
| case 742: | |
| case 743: | |
| case 744: | |
| case 745: | |
| case 746: | |
| case 747: | |
| case 748: | |
| case 756: | |
| case 757: | |
| case 758: | |
| case 759: | |
| case 760: | |
| case 749: | |
| case 750: | |
| case 751: | |
| case 752: | |
| case 753: | |
| case 761: | |
| case 762: | |
| case 763: | |
| case 764: | |
| case 765: | |
| if (!j.Us.getPropByString(v.options.showMultiChild1, v.model.get("FieldItem").Parent + "." + v.model.get("FieldItem").FieldData.Ordinal)) { | |
| p = true | |
| } | |
| break; | |
| case 754: | |
| case 766: | |
| if (!j.Us.getPropByString(v.options.showMultiChild2, v.model.get("FieldItem").Parent + "." + v.model.get("FieldItem").FieldData.Ordinal + "." + v.model.get("FieldItem").FieldData.SubBlockOrdinal)) { | |
| p = true | |
| } | |
| break; | |
| case 426: | |
| r = v.model.get("FieldItem").Parent; | |
| if (r) { | |
| t = v.model.collection.find(function (x) { | |
| return x.get("FieldBlockId") === r | |
| }); | |
| if (t) { | |
| v.filterLookupList(426, t.getData()) | |
| } | |
| } | |
| break; | |
| case 905: | |
| case 916: | |
| case 917: | |
| case 918: | |
| case 919: | |
| case 920: | |
| case 921: | |
| case 922: | |
| case 923: | |
| case 924: | |
| case 925: | |
| case 926: | |
| case 927: | |
| case 928: | |
| case 929: | |
| case 930: | |
| case 931: | |
| case 932: | |
| case 933: | |
| case 934: | |
| case 935: | |
| case 936: | |
| case 937: | |
| case 938: | |
| if (!_.contains(v.options.showSpouse, v.model.get("FieldItem").FieldData.Ordinal)) { | |
| p = true | |
| } | |
| break; | |
| case 906: | |
| case 907: | |
| case 908: | |
| case 909: | |
| case 910: | |
| case 911: | |
| case 912: | |
| case 913: | |
| case 914: | |
| if (!_.contains(v.options.showSpouse, v.model.get("FieldItem").FieldData.Ordinal)) { | |
| p = true | |
| } | |
| if (!_.contains(v.options.spouseHouseholdAddress, v.model.get("FieldItem").FieldData.Ordinal)) { | |
| p = true | |
| } | |
| break | |
| } | |
| s = v.model.get("FieldBlockId") === 200 ? "200" : v.options.parents.join(","); | |
| v.$el.html(w({ | |
| model: v.model.toJSON(), | |
| parents: s, | |
| hide: p, | |
| hideOther: q | |
| })); | |
| if (v.model.get("FieldItem").Id == 198) { | |
| u = d.getDateString(); | |
| $('[data-fieldblockid="' + v.model.get("FieldItem").FieldData.FieldBlockId + '"]').val(u); | |
| $('[data-fieldblockid="' + v.model.get("FieldItem").FieldData.FieldBlockId + '"]').trigger("change") | |
| } | |
| if (v.model.get("FieldItem").Id == 338) { | |
| u = d.getDateString(); | |
| $('[data-fieldblockid="338"]').val(u); | |
| $('[data-fieldblockid="338"]').trigger("change") | |
| } | |
| e.Us.initialize(".date-input", { | |
| yearRange: "-30:+20" | |
| }); | |
| k.Us.initialize(".time-input"); | |
| $(".required-indicator").tooltip(); | |
| v.$("textarea").trigger(jQuery.Event("keyup")); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.AutoSize, function () { | |
| v.$("textarea").autosize() | |
| }); | |
| v.$("select.input-country").on("change", v.changeCountry); | |
| v.$("select.input-country").on("changecountry", v.changeCountry); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.jQueryUI, function () { | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.FileUpload, function () { | |
| v.initializeFileUpload_File(v) | |
| }) | |
| }); | |
| if ((a.Data.Submitted) && (v.options.lockedSection == false)) { | |
| v.fieldValidate() | |
| } | |
| if ((a.Data.PaymentSubmitted) && (v.options.lockedSection == true)) { | |
| v.fieldValidate() | |
| } | |
| if (a.Data.FormSaveType === 2) { | |
| o = v.model.get("FieldItem"); | |
| if (o.FieldData.Data) { | |
| v.storeFormData(o.FieldData, o.FieldData.Data) | |
| } | |
| } | |
| if (v.options.lastField) { | |
| _.defer(function () { | |
| $("select.input-country").trigger("changecountry") | |
| }) | |
| } | |
| if (_.isFunction(n)) { | |
| n() | |
| } | |
| }) | |
| }, | |
| fieldValidate: function (n) { | |
| var o = this; | |
| if (o.$(".applicationrender-field").is(":visible")) { | |
| return o.model.isValid(true) | |
| } | |
| }, | |
| fieldValid: function (n) { | |
| var o = this; | |
| Bb.Validation.callbacks.valid(o, "FieldItem.FieldData.Data", "name") | |
| }, | |
| fieldInvalid: function (n, o) { | |
| var p = this; | |
| Bb.Validation.callbacks.invalid(p, "FieldItem.FieldData.Data", o, "name") | |
| }, | |
| fieldInvalidProvinceOther: function (n, o) { | |
| var p = this; | |
| Bb.Validation.callbacks.invalid(p, "input-province-other", o, "class") | |
| }, | |
| changeCountry: function () { | |
| var s = this, | |
| r = $(s).data("sectionitem"), | |
| n = $("select[data-sectionitem=" + r + "].input-country"), | |
| q = $("select[data-sectionitem=" + r + "].input-state"), | |
| o = $("select[data-sectionitem=" + r + "].input-province"), | |
| p = $("input[data-sectionitem=" + r + "].input-province-other"); | |
| if (n.is(":visible")) { | |
| if ((n.length) && (n.val() === "United States")) { | |
| q.parents(".applicationrender-field").show(); | |
| o.parents(".applicationrender-field").hide(); | |
| o.val(""); | |
| p.parents(".applicationrender-field").hide(); | |
| p.val("") | |
| } else { | |
| if ((n.length) && (n.val() === "Canada" || n.val() === "United Kingdom" || n.val() === "Australia")) { | |
| q.parents(".applicationrender-field").hide(); | |
| q.val(""); | |
| o.trigger("filterprovince", [n.val(), o.val()]); | |
| o.parents(".applicationrender-field").show(); | |
| p.parents(".applicationrender-field").hide(); | |
| p.val("") | |
| } else { | |
| q.parents(".applicationrender-field").hide(); | |
| q.val(""); | |
| o.parents(".applicationrender-field").hide(); | |
| o.val(""); | |
| p.parents(".applicationrender-field").show() | |
| } | |
| } | |
| } else { | |
| q.parents(".applicationrender-field").hide(); | |
| o.parents(".applicationrender-field").hide(); | |
| p.parents(".applicationrender-field").hide() | |
| } | |
| }, | |
| filterProvince: function (o, n, q) { | |
| var r = this, | |
| p = []; | |
| r.$el.find("option").remove(); | |
| p.push('<option value="">-- Select an Option --</option>'); | |
| _.each(_.where(r.model.get("FieldItem").LookUpList, { | |
| dd_data: n | |
| }), function (s) { | |
| p.push('<option value="' + s.dd_id + '">' + s.dd_description + "</option>") | |
| }); | |
| r.$el.find("select").html(p.join("")); | |
| r.$el.find("select").val(q) | |
| }, | |
| initializeFileUpload_File: function (p) { | |
| var n = p.model.get("FieldItem").UIType, | |
| o = (n === "IMG") ? p3.Us.Enum.UploadType.IMAGE : p3.Us.Enum.UploadType.DOCIMAGE; | |
| p.$("#fileUpload").fileupload({ | |
| url: p3.Config.RootPath + "utilities/FileTransferHandler.ashx", | |
| autoUpload: true, | |
| acceptFileTypes: o.ValidExtensions, | |
| formData: { | |
| safeName: true | |
| }, | |
| add: function (r, q) { | |
| var s = p3.Us.FileTools.isValidFile(o, q.files[0].name); | |
| if (s) { | |
| q.submit() | |
| } else { | |
| p.$("#attachment-file").empty(); | |
| p.$("#attachment-file").append(p3.Us.FileTools.validateFiles(o, q)) | |
| } | |
| } | |
| }).bind("fileuploaddone", function (r, q) { | |
| p.$("#attachment-file").html(q.result[0].original_name); | |
| p.model.get("FieldItem").FieldData.AttachmentFile.Attachment = q.result[0].original_name; | |
| p.model.get("FieldItem").FieldData.AttachmentFile.AttachmentTemp = q.result[0].name; | |
| p.model.get("FieldItem").FieldData.Data = q.result[0].original_name; | |
| _.each($(".tooltip"), function (s) { | |
| $(s).hide() | |
| }); | |
| p.$("#fileUpload").hide(); | |
| p.$(".delete-attachment-file").show(); | |
| p.$el.trigger("updatemodel") | |
| }) | |
| }, | |
| deleteAttachmentFile: function (n) { | |
| var o = this; | |
| n.stopPropagation(); | |
| n.preventDefault(); | |
| o.model.get("FieldItem").FieldData.AttachmentFile.AttachmentRemove = o.model.get("FieldItem").FieldData.AttachmentFile.Attachment; | |
| o.model.get("FieldItem").FieldData.AttachmentFile.Attachment = null; | |
| o.model.get("FieldItem").FieldData.Data = null; | |
| o.$("#attachment-file").empty(); | |
| o.$("#fileUpload").show(); | |
| o.$(".delete-attachment-file").hide(); | |
| o.$el.trigger("updatemodel") | |
| }, | |
| updateCharacterCounter: function (n) { | |
| var o = this; | |
| n.stopPropagation(); | |
| n.preventDefault(); | |
| o.$(".characterCounter").html($(n.currentTarget).val().length) | |
| }, | |
| parent: function (n) { | |
| var o = this; | |
| a.Vs.ParentEvent(n, o) | |
| }, | |
| updateModel: function (p, n) { | |
| var x = this, | |
| v = $(p.currentTarget), | |
| u = v.attr("name"), | |
| w, o = {}, | |
| t, s, r, q; | |
| n = !m.isEmptier(n) ? n : true; | |
| if (x.model.get("FieldBlockId") === 740 || x.model.get("FieldBlockId") === 755) { | |
| n = false | |
| } | |
| _.defer(function () { | |
| if (x.model.get("FieldItem").OtherInd) { | |
| w = v.prop("value"); | |
| if (x.model.get("FieldItem").UIType === "CheckBoxSingleSelect") { | |
| if (v.hasClass("radio-input")) { | |
| w = v.find("input").prop("value"); | |
| u = v.parent().attr("name"); | |
| if (l.stringToInt(w) === -1) { | |
| if (!m.isEmptier(v.siblings(".other-text").val())) { | |
| j.Us.setPropByString(x.model.toJSON(), "FieldItem.FieldData.OtherDescription", v.siblings(".other-text").val()) | |
| } | |
| } else { | |
| j.Us.setPropByString(x.model.toJSON(), "FieldItem.FieldData.OtherDescription", ""); | |
| v.parent().find(".other-text").val("") | |
| } | |
| } else { | |
| if (v.hasClass("other-text")) { | |
| if (!m.isEmptier(v.val())) { | |
| v.siblings(".radio-input").removeClass("active"); | |
| v.siblings(".other-input").addClass("active"); | |
| j.Us.setPropByString(x.model.toJSON(), "FieldItem.FieldData.Data", "-1") | |
| } else { | |
| v.siblings(".other-input").removeClass("active"); | |
| j.Us.setPropByString(x.model.toJSON(), "FieldItem.FieldData.Data", "") | |
| } | |
| } | |
| } | |
| } else { | |
| if (x.model.get("FieldItem").UIType === "CheckBoxMultiSelect") { | |
| if (v.hasClass("checkbox-multi-input")) { | |
| u = v.parent().attr("name"); | |
| w = v.siblings("label.active").andSelf().map(function () { | |
| var y = $(this); | |
| if (y.hasClass("active")) { | |
| return y.find("input").val() | |
| } | |
| }).get(); | |
| w = w.join(); | |
| if (!_.contains(w.split(","), "-1")) { | |
| j.Us.setPropByString(x.model.toJSON(), "FieldItem.FieldData.OtherDescription", ""); | |
| v.parent().find(".other-text").prop("value", "") | |
| } | |
| } else { | |
| if (v.hasClass("other-text")) { | |
| if (!m.isEmptier(v.val())) { | |
| v.siblings(".other-input").addClass("active"); | |
| t = v.siblings("label.active").andSelf().map(function () { | |
| var y = $(this); | |
| if (y.hasClass("active")) { | |
| return y.find("input").val() | |
| } | |
| }).get(); | |
| t = t.join(); | |
| j.Us.setPropByString(x.model.toJSON(), "FieldItem.FieldData.Data", t) | |
| } else { | |
| v.siblings(".other-input").removeClass("active"); | |
| j.Us.setPropByString(x.model.toJSON(), "FieldItem.FieldData.Data", "") | |
| } | |
| } | |
| } | |
| } else { | |
| if (x.model.get("FieldItem").UIType === "DD") { | |
| if (v.hasClass("other-input")) { | |
| if (l.stringToInt(w) === -1) { | |
| v.siblings(".other-text-holder").show() | |
| } else { | |
| v.siblings(".other-text-holder").hide(); | |
| v.siblings(".other-text-holder").children(".other-text").prop("value", ""); | |
| j.Us.setPropByString(x.model.toJSON(), "FieldItem.FieldData.OtherDescription", "") | |
| } | |
| } else { | |
| if (v.hasClass("other-text")) { | |
| if (m.isEmptier(v.prop("value"))) { | |
| v.parent().hide(); | |
| v.parent().siblings(".other-input").prop("value", ""); | |
| j.Us.setPropByString(x.model.toJSON(), "FieldItem.FieldData.Data", "") | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } else { | |
| if (v.hasClass("radio-input")) { | |
| w = v.children("input").prop("value"); | |
| u = v.parent().attr("name") | |
| } else { | |
| if (v.hasClass("checkbox-input")) { | |
| w = (v.hasClass("btn-approve") && v.hasClass("active")).toString(); | |
| u = v.parent().attr("name") | |
| } else { | |
| if (v.hasClass("checkbox-multi-input")) { | |
| w = v.siblings("label.active").map(function () { | |
| return $(this).find("input").val() | |
| }).get(); | |
| if (v.hasClass("active")) { | |
| w.push(v.find("input").val()) | |
| } | |
| w = w.join(); | |
| u = v.parent().attr("name") | |
| } else { | |
| if (v.hasClass("dateexp-input")) { | |
| if (v.hasClass("month")) { | |
| w = v.prop("value") + "/" + v.siblings(".year").prop("value") | |
| } else { | |
| if (v.hasClass("year")) { | |
| w = v.siblings(".month").prop("value") + "/" + v.prop("value") | |
| } | |
| } | |
| } else { | |
| w = v.prop("value") | |
| } | |
| } | |
| } | |
| } | |
| } | |
| if (a.Data.FormSaveType === 1) { | |
| if (!_.contains(u, ".")) { | |
| o[u] = w; | |
| x.model.set(o) | |
| } else { | |
| j.Us.setPropByString(x.model.toJSON(), u, w) | |
| } | |
| x.saveModel(n); | |
| if (x.model.collection && _.contains([682, 696], x.model.get("FieldBlockId"))) { | |
| s = x.model.get("SectionItemId"); | |
| r = j.Us.getPropByString(x.model.attributes, "FieldItem.FieldData.Ordinal"); | |
| q = _.filter(x.model.collection.models, function (y) { | |
| return (y.get("SectionItemId") === s) && j.Us.getPropByString(y.attributes, "FieldItem.FieldData.FieldId") && (j.Us.getPropByString(y.attributes, "FieldItem.FieldData.Ordinal") === r) | |
| }); | |
| _.each(q, function (y) { | |
| j.Us.setPropByString(y.toJSON(), "FieldItem.FieldData.IsBlockEnabled", l.stringToBoolean(w)) | |
| }) | |
| } | |
| } else { | |
| if (a.Data.FormSaveType === 2) { | |
| j.Us.setPropByString(x.model.toJSON(), u, w); | |
| x.storeFormData(x.model.get("FieldItem").FieldData, w) | |
| } | |
| } | |
| }) | |
| }, | |
| storeFormData: function (o, r) { | |
| var s = this, | |
| n = s.model.get("FieldElementItemId"), | |
| p = m.isEmptier(o.Interest), | |
| q = _.find(a.Data.FormData, function (t) { | |
| return t.FieldElementItemId === n && t.Ordinal === o.Ordinal && (t.Interest === o.Interest || p) | |
| }); | |
| if (q) { | |
| q.data = r | |
| } else { | |
| a.Data.FormData.push({ | |
| data: r, | |
| Ordinal: o.Ordinal, | |
| FieldElementItemId: n, | |
| Interest: o.Interest, | |
| DataType: o.DataType | |
| }) | |
| } | |
| }, | |
| saveModel: function (n) { | |
| var o = this; | |
| o.model.defaults = $.extend(true, {}, o.model.attributes); | |
| if (o.model.isValid(true)) { | |
| o.model.get("FieldItem").FieldData.IsDirty = false | |
| } else { | |
| if ((o.model.get("FieldBlockId") == 143) || (o.model.get("FieldBlockId") == 208)) { | |
| o.model.get("FieldItem").FieldData.IsDirty = false | |
| } else { | |
| o.model.get("FieldItem").FieldData.IsDirty = true | |
| } | |
| } | |
| o.model.set({ | |
| FieldsToNull: [] | |
| }); | |
| _.each(o.model.attributes, function (r, p, q) { | |
| j.Us.setFieldsToNull(o.model, r, p, q, "") | |
| }); | |
| if ((!a.Data.Preview) && (o.options.lockedSection == false)) { | |
| o.model.save({}, { | |
| dataParam: { | |
| returnFieldData: true | |
| }, | |
| async: n, | |
| success: function (p, q) { | |
| if (q.FieldItem.DataTypeId === 2) { | |
| o.model.set(q); | |
| if (o.model.get("FieldItem").Id != 198) { | |
| o.$(".date-input").val(o.model.get("FieldItem").FieldData.Data) | |
| } | |
| } | |
| if (o.model.get("FieldBlockId") == 180 && o.model.get("FieldItem").FieldData.Data == "false") { | |
| var s = o.model.get("FieldItem").FieldData.Interest, | |
| r = o.model.get("FieldBlockId"); | |
| $("[data-parentid=" + r + "][data-interestid=" + s + "]").val(""); | |
| $("[data-fieldblockid=183][data-interestid=" + s + "]").removeClass("active") | |
| } | |
| if (o.model.get("FieldItem").Id === 29 || o.model.get("FieldItem").Id === 279) { | |
| $(".application-navigation li.active").trigger("refreshsection", { | |
| scrollTop: $(document).scrollTop() | |
| }) | |
| } | |
| }, | |
| error: function (q, p) { | |
| if (p.responseText.indexOf("Invalid Date.") > -1) { | |
| $(o.el).trigger("fieldinvalid", ["Invalid Date."]) | |
| } else { | |
| if (p.responseText.indexOf("Invalid Future Birth Date.") > 0) { | |
| $(o.el).trigger("fieldinvalid", [h.Login.MaxDateOfBirth]) | |
| } | |
| } | |
| p3.displayError("Error saving field data") | |
| } | |
| }) | |
| } | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| }, | |
| addDDOptGroups: function (n) { | |
| var o = ""; | |
| if (n && n.length && n[0].hasOwnProperty("opt_group")) { | |
| _.each(n, function (q, p) { | |
| if (q.opt_group !== o) { | |
| o = q.opt_group; | |
| if (p > 0) { | |
| n[p - 1].OptGroupEnd = true | |
| } | |
| q.OptGroup = o | |
| } | |
| }); | |
| _.last(n).OptGroupEnd = true | |
| } | |
| }, | |
| filterLookupList: function (n, p) { | |
| var q = this, | |
| o = q.model.get("FieldItem"); | |
| if (q.model.LookUpListBak) { | |
| o.LookUpList = _.clone(q.model.LookUpListBak) | |
| } else { | |
| q.model.LookUpListBak = _.clone(o.LookUpList) | |
| } | |
| if (p) { | |
| switch (n) { | |
| case 426: | |
| o.LookUpList = _.where(o.LookUpList, { | |
| level_num: l.stringToInt(p) | |
| }); | |
| break | |
| } | |
| } | |
| } | |
| }); | |
| a.Vs.ParentEvent = function (u, D) { | |
| var o = $(u.currentTarget), | |
| B = o.val(), | |
| y = o.data("fieldblockid"), | |
| z = o.data("ordinalid"), | |
| A = o.data("subordinalid"), | |
| p = [205, 206, 207, 311, 313, 314], | |
| t = [236, 237, 238, 239, 312, 315, 316, 317], | |
| v = [203, 204, 228, 229, 230, 231, 232, 233, 234, 235, 300, 301, 302, 303, 304, 305, 306, 307, 308, 320], | |
| w = [228, 231, 232, 233, 234, 235, 302, 305, 306, 307, 308, 320], | |
| q = o.parents(".fields"), | |
| C, r, s, n = $("[data-fieldblockid=913]"), | |
| x = $(".active[data-fieldblockid=905] > input").val(); | |
| if (o.hasClass("radio-input")) { | |
| B = o.children("input").prop("value") | |
| } | |
| switch (y) { | |
| case 200: | |
| if (l.stringToBoolean(B)) { | |
| $(q).find("[data-fieldblockid=201]").parents(".applicationrender-field").show(); | |
| $(q).find("[data-fieldblockid=202]").parents(".applicationrender-field").hide(); | |
| a.Us.FieldBlockVisibility(q, t, false); | |
| a.Us.FieldBlockVisibility(q, p, false); | |
| a.Us.FieldBlockVisibility(q, v, false) | |
| } else { | |
| $(q).find("[data-fieldblockid=201]").parents(".applicationrender-field").hide().find("input").val(""); | |
| $(q).find("[data-fieldblockid=202]").parents(".applicationrender-field").show().find("select").val("") | |
| } | |
| break; | |
| case 310: | |
| case 202: | |
| B = l.stringToInt(B); | |
| if (_.contains([1, 2, 3, 4], B)) { | |
| a.Us.FieldBlockVisibility(q, t, false); | |
| a.Us.FieldBlockVisibility(q, p, true); | |
| a.Us.FieldBlockVisibility(q, v, true); | |
| $(q).find("select.input-country").trigger("changecountry") | |
| } else { | |
| if (B === 5) { | |
| a.Us.FieldBlockVisibility(q, t, true); | |
| a.Us.FieldBlockVisibility(q, p, false); | |
| a.Us.FieldBlockVisibility(q, v, true); | |
| if ($(q).find("[data-fieldblockid=238]").children().length < 2) { | |
| $(q).find("[data-fieldblockid=238]").parents(".applicationrender-field").hide().find("select").val("") | |
| } | |
| $(q).find("select.input-country").trigger("changecountry") | |
| } else { | |
| if (B === -1) { | |
| a.Us.FieldBlockVisibility(q, t, false); | |
| a.Us.FieldBlockVisibility(q, p, false); | |
| a.Us.FieldBlockVisibility(q, v, false); | |
| if (a.Data.SecurePaymentProcessingType === 2) { | |
| a.Us.FieldBlockVisibility(q, w, true); | |
| $(q).find("select.input-country").trigger("changecountry") | |
| } | |
| } else { | |
| if (B === "") { | |
| a.Us.FieldBlockVisibility(q, t, false); | |
| a.Us.FieldBlockVisibility(q, p, false); | |
| a.Us.FieldBlockVisibility(q, v, false) | |
| } | |
| } | |
| } | |
| } | |
| break; | |
| case 180: | |
| case 452: | |
| _.defer(function () { | |
| var E = o.data("interestid"); | |
| if (l.stringToBoolean(B) === true || (o.hasClass("btn-approve") && o.hasClass("active"))) { | |
| $("[data-parentid=" + y + "][data-interestid=" + E + "]").parents(".applicationrender-field").show() | |
| } else { | |
| $("[data-parentid=" + y + "][data-interestid=" + E + "]").parents(".applicationrender-field").hide() | |
| } | |
| }); | |
| break; | |
| case 160: | |
| case 162: | |
| case 164: | |
| case 166: | |
| case 169: | |
| if (l.stringToBoolean(B) === true) { | |
| $("[data-parentid=" + y + "]").parents(".applicationrender-field").show() | |
| } else { | |
| $("[data-parentid=" + y + "]").val(""); | |
| $("[data-parentid=" + y + "]").parents(".applicationrender-field").hide() | |
| } | |
| break; | |
| case 682: | |
| case 696: | |
| case 700: | |
| case 740: | |
| case 748: | |
| case 755: | |
| case 760: | |
| if (l.stringToBoolean(B) === true) { | |
| $("[data-parentid=" + y + "][data-ordinalid=" + z + "]").parents(".applicationrender-field").show() | |
| } else { | |
| $("[data-parentid=" + y + "][data-ordinalid=" + z + "]").parents(".applicationrender-field").hide(); | |
| a.Us.ParentsHide(y, z) | |
| } | |
| break; | |
| case 753: | |
| case 765: | |
| if (l.stringToInt(B) === 2) { | |
| $("[data-parentid=" + y + "][data-ordinalid=" + z + "][data-subordinalid=" + A + "]").parents(".applicationrender-field").show() | |
| } else { | |
| $("[data-parentid=" + y + "][data-ordinalid=" + z + "][data-subordinalid=" + A + "]").parents(".applicationrender-field").hide() | |
| } | |
| break; | |
| case 361: | |
| if (l.stringToBoolean(B) === true) { | |
| $("[data-parentid=" + y + "][data-ordinalid=" + z + "]").val(""); | |
| $("[data-parentid=" + y + "][data-ordinalid=" + z + "]").trigger("change"); | |
| $("[data-parentid=" + y + "][data-ordinalid=" + z + "]").parents(".applicationrender-field").hide() | |
| } else { | |
| $("[data-parentid=" + y + "][data-ordinalid=" + z + "]").parents(".applicationrender-field").show(); | |
| if ($("[data-parentid=" + y + "][data-ordinalid=" + z + "][data-fieldblockid=369]")) { | |
| r = D.model.collection.find(function (E) { | |
| return E.get("FieldBlockId") === 369 | |
| }); | |
| s = r.attributes.FieldItem.LookUpList.filter(function (E) { | |
| return E.dd_default === 1 | |
| })[0]; | |
| $("[data-parentid=" + y + "][data-ordinalid=" + z + "][data-fieldblockid=369]")[0].value = s.dd_description; | |
| $("[data-parentid=" + y + "][data-ordinalid=" + z + "][data-fieldblockid=369]").trigger("change") | |
| } | |
| } | |
| break; | |
| case 866: | |
| if (D && D.model.collection) { | |
| C = D.model.collection.find(function (E) { | |
| return E.get("FieldBlockId") === 426 | |
| }); | |
| if (C) { | |
| j.Us.setPropByString(D.model.toJSON(), "FieldItem.FieldData.Data", B); | |
| j.Us.setPropByString(C.toJSON(), "FieldItem.FieldData.Data", ""); | |
| _.defer(function () { | |
| C.view.renderData(function () { | |
| q.find("[data-fieldblockid=426]").trigger("change") | |
| }) | |
| }) | |
| } | |
| } | |
| break; | |
| case 939: | |
| if (l.stringToBoolean(B) === true) { | |
| $("[data-parentid=" + y + "][data-ordinalid=" + z + "]").parents(".applicationrender-field").show(); | |
| if (x === "false" || x === undefined) { | |
| a.Us.FieldBlockVisibility(q, [906, 907, 908, 909, 912, 913, 914], true); | |
| if (n.val() !== "") { | |
| n.val(n.val()).trigger("change") | |
| } | |
| } | |
| } else { | |
| $("[data-parentid=" + y + "][data-ordinalid=" + z + "]").parents(".applicationrender-field").hide(); | |
| a.Us.FieldBlockVisibility(q, [906, 907, 908, 909, 910, 911, 912, 913, 914], false) | |
| } | |
| break | |
| } | |
| }; | |
| a.Vs.Error = Bb.View.extend({ | |
| template: "form/form.error.template.html", | |
| className: "alert", | |
| initialize: function (n) { | |
| var o = this; | |
| o.errorMsg = n.errorMsg || false; | |
| o.medical = n.medical || false | |
| }, | |
| events: { | |
| "click .allow": "allowMedical" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| if (o.medical) { | |
| $(o.el).addClass("alert-info") | |
| } else { | |
| $(o.el).addClass("alert-danger") | |
| } | |
| o.renderData() | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| if (n.errorMsg) { | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({ | |
| errorMsg: n.errorMsg, | |
| medical: n.medical | |
| })) | |
| }) | |
| } | |
| }, | |
| allowMedical: function (n) { | |
| n.preventDefault(); | |
| var o = this; | |
| $.ajax({ | |
| async: true, | |
| method: "PUT", | |
| url: aP + "SchoolForm/MedicalOverride", | |
| dataType: "json", | |
| data: { | |
| id: a.Data.Id | |
| }, | |
| success: function (p) { | |
| o.$el.remove() | |
| }, | |
| error: function () { | |
| p3.displayError("Setting could not be saved.") | |
| } | |
| }); | |
| o.$el.remove() | |
| } | |
| }); | |
| a.Vs.AddBlockSelect = Bb.View.extend({ | |
| template: "form/form.block.blockselect.template.html", | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| o.renderData() | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({ | |
| collection: n.collection.toJSON() | |
| })) | |
| }) | |
| } | |
| }); | |
| a.Vs.SectionItemBlock_Payment = Bb.View.extend({ | |
| template: "form/form.section.item.block.payment.template.html", | |
| className: "form-section-item form-horizontal", | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| o.renderData() | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({ | |
| lockedSectionType: n.options.lockedSectionType, | |
| payment: n.options.paymentCheck.toJSON() | |
| })) | |
| }) | |
| } | |
| }); | |
| a.Vs.SectionItemBlock_ESignatures = Bb.View.extend({ | |
| template: "form/form.block.esignatures.template.html", | |
| className: "form-section-item form-horizontal", | |
| initialize: function () { | |
| var n = this; | |
| n.collection = new a.Cs.ESignaturesRender() | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| o.renderData() | |
| }, | |
| renderData: function () { | |
| var q = this, | |
| n = q.model.get("FieldBlockItem").Id, | |
| p, o; | |
| p3.fT(q.template, function (r) { | |
| if (a.Data.Preview) { | |
| p = new a.Ms.SignatureLabels(); | |
| p.fetch({ | |
| data: { | |
| applicationFormId: a.Data.FormId, | |
| blockId: n | |
| }, | |
| success: function () { | |
| q.$el.html(r({ | |
| model: p.toJSON() | |
| })); | |
| if (n === 39) { | |
| q.collection.add([{ | |
| FirstName: "Jonathan", | |
| LastName: "Whipple" | |
| }]) | |
| } else { | |
| q.collection.add([{ | |
| FirstName: "Pat", | |
| LastName: "Whipple" | |
| }, { | |
| FirstName: "Sue", | |
| LastName: "Whipple" | |
| }]) | |
| } | |
| q.renderUsers(q.collection.models) | |
| } | |
| }) | |
| } else { | |
| q.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| formId: a.Data.FormId, | |
| keyId: a.Data.KeyId | |
| }, | |
| success: function () { | |
| o = q.collection.filter(function (s) { | |
| return s.get("BlockId") === n | |
| }); | |
| if (o.length) { | |
| q.$el.html(r({ | |
| model: { | |
| DateFieldLabel: o[0].get("DateLabel"), | |
| SignatureFieldLabel: o[0].get("SignatureLabel") | |
| } | |
| })) | |
| } | |
| q.renderUsers(o) | |
| } | |
| }) | |
| } | |
| }) | |
| }, | |
| renderUsers: function (n) { | |
| var o = this; | |
| _(n).each(function (q) { | |
| var p = new a.Vs.SectionItemBlock_ESignature({ | |
| model: q, | |
| layoutView: o.options.layoutView, | |
| lockedSectionType: o.options.lockedSectionType | |
| }); | |
| p3.rV(p, o.$("#esignature"), false) | |
| }) | |
| } | |
| }); | |
| a.Vs.SectionItemBlock_ESignature = Bb.View.extend({ | |
| template: "form/form.block.esignature.template.html", | |
| className: "row-fluid", | |
| initialize: function () { | |
| var n = this; | |
| Bb.Validation.bind(n, { | |
| forceUpdate: true, | |
| selector: "name" | |
| }) | |
| }, | |
| events: { | |
| 'change input[type="text"]': "saveSignature", | |
| fieldvalidate: "fieldValidate" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| o.renderData() | |
| }, | |
| renderData: function () { | |
| var o = this, | |
| n = false; | |
| p3.fT(o.template, function (p) { | |
| if (o.options.lockedSectionType === 4 || o.model.get("IsAccepted") == true || o.model.get("UserId") != p3.Data.Context.attributes.UserInfo.UserId) { | |
| n = true | |
| } | |
| o.$el.html(p({ | |
| model: o.model.toJSON(), | |
| sectionItemLocked: n | |
| })); | |
| if ((a.Data.Submitted) && (m.isEmptier(o.options.lockedSectionType))) { | |
| o.fieldValidate() | |
| } | |
| }) | |
| }, | |
| saveSignature: function (o) { | |
| o.preventDefault(); | |
| var s = this, | |
| q = $(o.currentTarget), | |
| p = q.attr("name"), | |
| r, n = {}; | |
| r = q.prop("value"); | |
| n[p] = r; | |
| s.model.set(n); | |
| if (!a.Data.Preview && !m.isEmptier(r)) { | |
| s.model.save({}, { | |
| success: function (t, u) { | |
| s.model.set({ | |
| ContractSignatureId: parseInt(u.Message, 10) | |
| }) | |
| } | |
| }) | |
| } | |
| }, | |
| fieldValidate: function (n) { | |
| var o = this; | |
| return o.model.isValid(true) | |
| } | |
| }); | |
| a.Vs.SectionItemBlock_RatingMatrix = Bb.View.extend({ | |
| template: "form/form.block.rating.matrix.template.html", | |
| className: "ratings-matrix", | |
| events: { | |
| "click .rating-level-radio": "selectRatingLevel", | |
| "change .rating-level-dropdown": "selectRatingLevel", | |
| "keyup .rating-comment": "copyComment", | |
| "blur .rating-comment": "saveComment" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| o.renderData() | |
| }, | |
| renderData: function () { | |
| var o = this, | |
| n; | |
| if (o.options.sectionItemId) { | |
| n = new a.Ms.RatingMatrix(); | |
| n.fetch({ | |
| data: { | |
| formDataId: a.Data.Preview ? undefined : o.options.applicationId, | |
| sectionItemId: o.options.sectionItemId | |
| }, | |
| success: function (p) { | |
| o.model = p; | |
| p3.fT(o.template, function (q) { | |
| o.$el.html(q({ | |
| model: o.model.toJSON(), | |
| variables: { | |
| SectionItemId: o.options.sectionItemId | |
| } | |
| })); | |
| if (!a.Data.Preview && o.options.applicationId) { | |
| o.preSelectRatingLevels(); | |
| if (_.contains(a.Data.InvalidSectionItemIds, o.options.sectionItemId)) { | |
| $('.ratings-matrix > .ratings-matrix-validation-error[data-section-item-id="' + o.options.sectionItemId + '"]').show() | |
| } | |
| } | |
| }) | |
| } | |
| }) | |
| } | |
| }, | |
| preSelectRatingLevels: function () { | |
| var s = this, | |
| r, p, q, o, n; | |
| _.each(s.model.attributes.Rating.Scores, function (t) { | |
| if (t.RatingLevelId) { | |
| r = s.$('.rating-level-radio[data-rating-attribute-id="' + t.RatingAttributeId + '"][data-rating-level-id="' + t.RatingLevelId + '"]').first(); | |
| r[0].checked = true; | |
| p = s.$('.rating-level-radio[data-rating-attribute-id="' + t.RatingAttributeId + '"]'); | |
| _.each(p, function (u) { | |
| $(u).attr("data-rating-score-id", t.RatingScoreId) | |
| }); | |
| q = s.$('.rating-level-dropdown-option[data-rating-attribute-id="' + t.RatingAttributeId + '"][data-rating-level-id="' + t.RatingLevelId + '"]'); | |
| q[0].selected = true; | |
| o = s.$('.rating-level-dropdown[data-rating-attribute-id="' + t.RatingAttributeId + '"]'); | |
| $(o[0]).attr("data-rating-score-id", t.RatingScoreId); | |
| n = s.$('.rating-comment[data-rating-attribute-id="' + t.RatingAttributeId + '"]'); | |
| _.each(n, function (u) { | |
| $(u).attr("data-rating-score-id", t.RatingScoreId); | |
| u.disabled = false | |
| }) | |
| } | |
| }) | |
| }, | |
| selectRatingLevel: function (o) { | |
| var v = this, | |
| n = $(o.target), | |
| p = n.attr("data-rating-attribute-id"), | |
| s, u = n.attr("data-rating-score-id"), | |
| t = v.$('.rating-level-radio[data-rating-attribute-id="' + p + '"]'), | |
| r, q = v.$('.rating-comment[data-rating-attribute-id="' + p + '"]'); | |
| _.each(t, function (w) { | |
| w.checked = false | |
| }); | |
| if (n.hasClass("rating-level-radio")) { | |
| s = n.attr("data-rating-level-id"); | |
| r = v.$('.rating-level-dropdown-option[data-rating-attribute-id="' + p + '"][data-rating-level-id="' + s + '"]'); | |
| r[0].selected = true; | |
| n.prop("checked", true) | |
| } | |
| if (n.hasClass("rating-level-dropdown")) { | |
| s = n.children(":selected")[0].getAttribute("data-rating-level-id"); | |
| t = v.$('.rating-level-radio[data-rating-attribute-id="' + p + '"][data-rating-level-id="' + s + '"]'); | |
| if (t.length) { | |
| t[0].checked = true | |
| } | |
| } | |
| _.each(q, function (w) { | |
| w.disabled = false | |
| }); | |
| v.saveRatingMatrix(p, s, u) | |
| }, | |
| copyComment: function (o) { | |
| var q = this, | |
| n = $(o.target), | |
| p = n.attr("data-rating-attribute-id"); | |
| q.$('.rating-comment[data-rating-attribute-id="' + p + '"]').val(n.val()) | |
| }, | |
| saveComment: function () { | |
| var u = this, | |
| n = $(event.target), | |
| p = n.attr("data-rating-attribute-id"), | |
| q, t = n.attr("data-rating-score-id"), | |
| o = n.val(), | |
| r, s; | |
| r = u.$('.rating-level-radio[data-rating-attribute-id="' + p + '"]'); | |
| s = _.filter(r, function (v) { | |
| return v.checked === true | |
| }); | |
| q = $(s).attr("data-rating-level-id"); | |
| u.saveRatingMatrix(p, q, t, o) | |
| }, | |
| saveRatingMatrix: function (p, s, x, n) { | |
| if (a.Data.Preview) { | |
| return | |
| } | |
| var y = this, | |
| u = y.model.get("RatingMatrix").RatingMatrixId, | |
| v = new a.Ms.RatingMatrixSubmit(), | |
| w, t, r, q, o; | |
| if (!n) { | |
| o = y.$('.rating-comment[data-rating-attribute-id="' + p + '"][data-rating-score-id="' + x + '"]').first(); | |
| n = o.val() | |
| } | |
| v.set({ | |
| ratingScore: { | |
| FormDataId: y.model.get("FormDataId"), | |
| SectionItemId: y.model.get("SectionItemId"), | |
| RatingAttributeId: p, | |
| RatingMatrixId: u, | |
| RatingLevelId: s, | |
| RatingScoreId: x, | |
| Comment: n | |
| } | |
| }); | |
| v.save({}, { | |
| success: function (z, A) { | |
| w = _.filter(y.model.get("Rating").Scores, function (B) { | |
| return B.RatingMatrixId === l.stringToInt(u) && B.RatingAttributeId === l.stringToInt(p) | |
| }); | |
| w[0].RatingScoreId = A.RatingScoreId; | |
| w[0].RatingLevelId = s; | |
| t = y.$('.rating-level-radio[data-rating-attribute-id="' + p + '"]'); | |
| _.each(t, function (B) { | |
| $(B).attr("data-rating-score-id", A.RatingScoreId) | |
| }); | |
| r = y.$('.rating-level-dropdown-option[data-rating-attribute-id="' + p + '"]'); | |
| _.each(r, function (B) { | |
| $(B).attr("data-rating-score-id", A.RatingScoreId) | |
| }); | |
| q = y.$('.rating-comment[data-rating-attribute-id="' + p + '"]'); | |
| _.each(q, function (B) { | |
| $(B).attr("data-rating-score-id", A.RatingScoreId) | |
| }) | |
| }, | |
| error: function (A, z) { | |
| p3.displayError("An error occurred saving your selection. Please try again.") | |
| } | |
| }) | |
| } | |
| }); | |
| a.Us.FieldBlockVisibility = function (o, p, q) { | |
| var n = $(o).find(".applicationrender-field"); | |
| if (q) { | |
| _.each(n, function (t) { | |
| var s = $(t), | |
| r = s.find("input, select"); | |
| if (_.contains(p, r.data("fieldblockid"))) { | |
| s.show() | |
| } | |
| }) | |
| } else { | |
| _.each(n, function (t) { | |
| var s = $(t), | |
| r = s.find("input, select"); | |
| if (_.contains(p, r.data("fieldblockid"))) { | |
| s.hide() | |
| } | |
| }) | |
| } | |
| }; | |
| a.Us.AutoSizeIframe = function () { | |
| if (parent && a.Data.IFrameSelector) { | |
| $("body").addClass("h-auto-important"); | |
| setInterval(function () { | |
| var n = { | |
| eventName: "OnBoard.InquiryForm.Resize", | |
| selector: a.Data.IFrameSelector, | |
| newHeight: $("body").outerHeight() + "px" | |
| }; | |
| parent.postMessage(n, "*") | |
| }, 2000) | |
| } | |
| }; | |
| a.Us.ParentsHide = function (n, o) { | |
| var p = $(".parent[data-parentid=" + n + "][data-ordinalid=" + o + "]").data("fieldblockid"); | |
| if (p) { | |
| $("[data-parentid=" + p + "][data-ordinalid=" + o + "]").parents(".applicationrender-field").hide(); | |
| if ($("button.parent[data-parentid=" + n + "][data-ordinalid=" + o + "]").length > 0) { | |
| $("button.parent[data-parentid=" + n + "][data-ordinalid=" + o + "][value=false]").trigger("click", [false]) | |
| } else { | |
| if ($("select.parent[data-parentid=" + n + "][data-ordinalid=" + o + "]").length > 0) { | |
| $("select.parent[data-parentid=" + n + "][data-ordinalid=" + o + "]").val(""); | |
| $(".parent[data-parentid=" + n + "][data-ordinalid=" + o + "]").trigger("change", [false]) | |
| } | |
| } | |
| } | |
| }; | |
| a.Us.SetFormRequestHeaders = function (p, o) { | |
| var n = o || a.Data.AuthToken; | |
| if (n && p3.Config.AppMode.Name === "Embed") { | |
| p.setRequestHeader("Form-Auth-Token", n) | |
| } | |
| }; | |
| a.Us.SetFormAuthSync = function (o) { | |
| var n; | |
| if (o && !o._isFormAuthSync) { | |
| o._sync = o.sync; | |
| o.sync = function (p, q, r) { | |
| n = r.beforeSend; | |
| r.beforeSend = function (t, s) { | |
| a.Us.SetFormRequestHeaders(t); | |
| if (n) { | |
| n(t, s) | |
| } | |
| }; | |
| return o._sync(p, q, r) | |
| }; | |
| o._isFormAuthSync = true | |
| } | |
| }; | |
| Hb.registerHelper("formSectionItemId", function (n) { | |
| return new Hb.SafeString(!m.isEmptier(n) ? ' data-sectionitem="' + n + '"' : "") | |
| }); | |
| Hb.registerHelper("formFieldId", function (n) { | |
| return new Hb.SafeString(!m.isEmptier(n) ? ' data-fieldid="' + n + '"' : "") | |
| }); | |
| Hb.registerHelper("formFieldBlockId", function (n) { | |
| return new Hb.SafeString(!m.isEmptier(n) ? ' data-fieldblockid="' + n + '"' : "") | |
| }); | |
| Hb.registerHelper("formOrdinalId", function (n) { | |
| return new Hb.SafeString(!m.isEmptier(n) ? ' data-ordinalid="' + n + '"' : "") | |
| }); | |
| Hb.registerHelper("formSubOrdinalId", function (n) { | |
| return new Hb.SafeString(!m.isEmptier(n) ? ' data-subordinalid="' + n + '"' : "") | |
| }); | |
| Hb.registerHelper("formParentId", function (n) { | |
| return new Hb.SafeString(!m.isEmptier(n) ? ' data-parentid="' + n + '"' : "") | |
| }); | |
| Hb.registerHelper("formMutexGroupId", function (n) { | |
| return new Hb.SafeString(!m.isEmptier(n) ? ' data-mutexgroupid="' + n + '"' : "") | |
| }); | |
| Hb.registerHelper("formInterestId", function (n) { | |
| return new Hb.SafeString(!m.isEmptier(n) ? ' data-interestid="' + n + '"' : "") | |
| }); | |
| Hb.registerHelper("formMaxLength", function (n) { | |
| return new Hb.SafeString(!m.isEmptier(n) ? ' maxlength="' + n + '"' : "") | |
| }); | |
| p3.router().route("application/:formid(/keyid=:keyid)(/r=:r)", "application", function (n, o, t) { | |
| var q = false, | |
| p = false, | |
| s = null, | |
| u; | |
| if (o.match(/(r1|r0)/g)) { | |
| u = o.split("r"); | |
| s = u[0]; | |
| t = u[1]; | |
| p3.router().navigate("#" + Bb.history.getFragment().slice(0, -2), false) | |
| } else { | |
| if (o === "preview") { | |
| q = true | |
| } else { | |
| if (o === "local") { | |
| p = true | |
| } else { | |
| s = o | |
| } | |
| } | |
| } | |
| a.Data.FormId = n; | |
| a.Data.KeyId = s; | |
| a.Data.Preview = q; | |
| a.Data.Local = p; | |
| a.Data.FormType = "Application"; | |
| a.Data.Submitted = false; | |
| a.Data.PaymentSubmitted = false; | |
| a.Data.FormSaveType = null; | |
| a.Data.SecurePayment = false; | |
| a.Data.SPResponse = t; | |
| b.Us.GetStyle(a.Data.FormId, function (r) { | |
| b.Us.SetStyle(r.StyleElements); | |
| p3.renderMainPage(new a.Vs.Layout({})) | |
| }) | |
| }); | |
| p3.router().route("inquiry/:formid(/keyid=:keyid)(/source=:source)(/selector=:selector)", "inquiry", function (o, p, t, s) { | |
| var r = (p === "preview"), | |
| q = (p === "local"), | |
| n = (p === "admin"); | |
| t = t || null; | |
| a.Data.FormId = o; | |
| a.Data.KeyId = null; | |
| a.Data.Preview = r; | |
| a.Data.Local = q; | |
| a.Data.Admin = n; | |
| a.Data.Source = t; | |
| a.Data.IFrameSelector = s + " > iframe"; | |
| a.Data.FormType = "Inquiry"; | |
| a.Data.Submitted = false; | |
| a.Data.PaymentSubmitted = false; | |
| a.Data.FormSaveType = null; | |
| a.Data.FormData = []; | |
| b.Us.GetStyle(a.Data.FormId, function (u) { | |
| b.Us.SetStyle(u.StyleElements); | |
| p3.renderMainPage(new a.Vs.Layout({})) | |
| }) | |
| }); | |
| p3.router().route("schoolform/:formid(/keyid=:keyid)(/r=:r)", "schoolform", function (n, o, q) { | |
| var p = false, | |
| t = null, | |
| s; | |
| if (o.match(/(r1|r0)/g)) { | |
| s = o.split("r"); | |
| t = s[0]; | |
| q = s[1]; | |
| p3.router().navigate("#" + Bb.history.getFragment().slice(0, -2), false) | |
| } else { | |
| if (o === "preview") { | |
| p = true | |
| } else { | |
| t = o | |
| } | |
| } | |
| a.Data.FormId = n; | |
| a.Data.KeyId = t; | |
| a.Data.Preview = p; | |
| a.Data.FormType = "School Form"; | |
| a.Data.Submitted = false; | |
| a.Data.PaymentSubmitted = false; | |
| a.Data.FormSaveType = null; | |
| a.Data.SecurePayment = false; | |
| a.Data.SPResponse = q; | |
| p3.renderMainPage(new a.Vs.Layout({})) | |
| }) | |
| }(p3.module("admissions/formrender/application"))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment