Created
August 8, 2019 05:15
-
-
Save nomoney4me/f4b2ec5f085e0b9caf54ba34137f7964 to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
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
| var Bb = Backbone, | |
| Bbc = Backbone.Collection, | |
| Bbm = Backbone.Model, | |
| Hb = Handlebars; | |
| (function (a) { | |
| var c = p3.module("utilities/smodal"), | |
| d = p3.module("utilities/sort"), | |
| b = p3.module("shared/datepicker"); | |
| a.Data.Configs = { | |
| Admissions: { | |
| AuditName: "Admissions", | |
| SearchTemplate: "admaudit/admaudit.search.template.html", | |
| AuditsTemplate: "admaudit/admaudit.audits.template.html", | |
| AuditTemplate: "admaudit/auditlog.audit.template.html", | |
| InfoTemplate: "utilities/utilities.smodal.message.html", | |
| FilterTemplate: "admaudit/admaudit.adm.filter.template.html", | |
| Filters: { | |
| tableName: "Table name is @value", | |
| columnName: "Column name is @value", | |
| modifiedBy: "Modified by @value", | |
| startDate: "Start date is @value or later", | |
| endDate: "End date is @value or earlier" | |
| }, | |
| Columns: [{ | |
| Selected: true, | |
| SortName: "Action", | |
| DisplayName: "Action", | |
| Description: "The type of action taken by the user", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "TableName", | |
| DisplayName: "Location", | |
| Description: "Table and column name of the transaction (Sorted by table)", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "Before", | |
| DisplayName: "Data Before", | |
| Description: "Data before the transaction", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "After", | |
| DisplayName: "Data After", | |
| Description: "Data after the transaction", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "ModifiedDate", | |
| DisplayName: "Modified Date", | |
| Description: "Response Code", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "ModifiedBy", | |
| DisplayName: "Modified By", | |
| Description: "Response Data", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "Addendum", | |
| DisplayName: "Info", | |
| Description: "Additional information button", | |
| Sortable: false | |
| }] | |
| }, | |
| Medical: { | |
| AuditName: "Medical", | |
| SearchTemplate: "admaudit/admaudit.search.template.html", | |
| AuditsTemplate: "admaudit/admaudit.audits.template.html", | |
| AuditTemplate: "admaudit/auditlog.audit.template.html", | |
| InfoTemplate: "utilities/utilities.smodal.message.html", | |
| FilterTemplate: "admaudit/admaudit.medical.filter.template.html", | |
| Filters: { | |
| tableName: "Table name is @value", | |
| columnName: "Column name is @value", | |
| modifiedBy: "Modified by @value", | |
| startDate: "Start date is @value or later", | |
| endDate: "End date is @value or earlier", | |
| dataValue: "Data before or data after is @value" | |
| }, | |
| Columns: [{ | |
| Selected: true, | |
| SortName: "Action", | |
| DisplayName: "Action", | |
| Description: "The type of action taken by the user", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "TableName", | |
| DisplayName: "Location", | |
| Description: "Table and column name of the transaction (Sorted by table)", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "Before", | |
| DisplayName: "Data Before", | |
| Description: "Data before the transaction", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "After", | |
| DisplayName: "Data After", | |
| Description: "Data after the transaction", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "ModifiedDate", | |
| DisplayName: "Modified Date", | |
| Description: "Response Code", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "ModifiedBy", | |
| DisplayName: "Modified By", | |
| Description: "Response Data", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "Info", | |
| DisplayName: "Info", | |
| Description: "Additional information button", | |
| Sortable: false | |
| }] | |
| }, | |
| Smart: { | |
| AuditName: "Smart Tuition Contract", | |
| SearchTemplate: "admaudit/admaudit.search.template.html", | |
| AuditsTemplate: "admaudit/admaudit.audits.template.html", | |
| AuditTemplate: "admaudit/admaudit.audit.template.html", | |
| InfoTemplate: "admaudit/admaudit.smart.info.template.html", | |
| FilterTemplate: "admaudit/admaudit.smart.filter.template.html", | |
| Filters: { | |
| nbrEntries: "Show up to @value records", | |
| contractId: "Contract id is @value", | |
| errorInd: "Has errors @value", | |
| startDate: "Start date is @value or later", | |
| endDate: "End date is @value or earlier", | |
| userId1: "Contains user id @value", | |
| userId2: "Contains user id @value", | |
| userId3: "Contains user id @value", | |
| requestType: "Request type is @value" | |
| }, | |
| Columns: [{ | |
| Selected: true, | |
| SortName: "LogId", | |
| DisplayName: "Log Id", | |
| Description: "Log Id", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "ContractId", | |
| DisplayName: "Contract Id", | |
| Description: "Contract Id", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "RequestBegin", | |
| DisplayName: "Start Trans", | |
| Description: "Transaction start date and time", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "RequestEnd", | |
| DisplayName: "End Trans", | |
| Description: "Transaction end date and time", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "ResponseStatusCode", | |
| DisplayName: "Response", | |
| Description: "Response Code", | |
| Sortable: true | |
| }, { | |
| Selected: false, | |
| SortName: "ResponseData", | |
| DisplayName: "Response Data", | |
| Description: "Response Data", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "ParentLogId", | |
| DisplayName: "Parent Id", | |
| Description: "Parent Id", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "InsertUserId", | |
| DisplayName: "Insert User Id", | |
| Description: "User Id of user or impersonated user", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "MasterUserId", | |
| DisplayName: "Master User Id", | |
| Description: "User Id of user who logged in", | |
| Sortable: true | |
| }, { | |
| Selected: false, | |
| SortName: "IsError", | |
| DisplayName: "Error", | |
| Description: "Contract has an error", | |
| Sortable: true | |
| }, { | |
| Selected: false, | |
| SortName: "IsEnrollment", | |
| DisplayName: "Enrollment", | |
| Description: "Contract was an enrollment", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "Pending", | |
| DisplayName: "Pending", | |
| Description: "Contract in a pending state", | |
| Sortable: true | |
| }, { | |
| Selected: false, | |
| SortName: "IsRetry", | |
| DisplayName: "Retry", | |
| Description: "Contract has been tried more than once", | |
| Sortable: true | |
| }, { | |
| Selected: false, | |
| SortName: "RetryCount", | |
| DisplayName: "Retry Count", | |
| Description: "Number of times a contract has been retried", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "Info", | |
| DisplayName: "Info", | |
| Description: "Additional information button", | |
| Sortable: false | |
| }] | |
| }, | |
| BBTM: { | |
| AuditName: "Blackbaud Tuition Management Contract", | |
| SearchTemplate: "admaudit/admaudit.search.template.html", | |
| AuditsTemplate: "admaudit/admaudit.audits.template.html", | |
| AuditTemplate: "admaudit/admaudit.audit.template.html", | |
| InfoTemplate: "admaudit/admaudit.smart.info.template.html", | |
| FilterTemplate: "admaudit/admaudit.smart.filter.template.html", | |
| Filters: { | |
| nbrEntries: "Show up to @value records", | |
| contractId: "Contract id is @value", | |
| errorInd: "Has errors @value", | |
| startDate: "Start date is @value or later", | |
| endDate: "End date is @value or earlier", | |
| userId1: "Contains user id @value", | |
| userId2: "Contains user id @value", | |
| userId3: "Contains user id @value", | |
| requestType: "Request type is @value" | |
| }, | |
| Columns: [{ | |
| Selected: true, | |
| SortName: "LogId", | |
| DisplayName: "Log Id", | |
| Description: "Log Id", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "ContractId", | |
| DisplayName: "Contract Id", | |
| Description: "Contract Id", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "RequestBegin", | |
| DisplayName: "Start Trans", | |
| Description: "Transaction start date and time", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "RequestEnd", | |
| DisplayName: "End Trans", | |
| Description: "Transaction end date and time", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "ResponseStatusCode", | |
| DisplayName: "Response", | |
| Description: "Response Code", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "ResponseData", | |
| DisplayName: "Response Data", | |
| Description: "Response Data", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "InsertUserId", | |
| DisplayName: "Insert User Id", | |
| Description: "User Id of user or impersonated user", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "MasterUserId", | |
| DisplayName: "Master User Id", | |
| Description: "User Id of user who logged in", | |
| Sortable: true | |
| }, { | |
| Selected: false, | |
| SortName: "IsError", | |
| DisplayName: "Error", | |
| Description: "Contract has an error", | |
| Sortable: true | |
| }, { | |
| Selected: false, | |
| SortName: "IsEnrollment", | |
| DisplayName: "Enrollment", | |
| Description: "Contract was an enrollment", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "Pending", | |
| DisplayName: "Pending", | |
| Description: "Contract in a pending state", | |
| Sortable: true | |
| }, { | |
| Selected: false, | |
| SortName: "IsRetry", | |
| DisplayName: "Retry", | |
| Description: "Contract has been tried more than once", | |
| Sortable: true | |
| }, { | |
| Selected: false, | |
| SortName: "RetryCount", | |
| DisplayName: "Retry Count", | |
| Description: "Number of times a contract has been retried", | |
| Sortable: true | |
| }, { | |
| Selected: true, | |
| SortName: "Info", | |
| DisplayName: "Info", | |
| Description: "Additional information button", | |
| Sortable: false | |
| }] | |
| } | |
| }; | |
| a.Ms.Filter = Bbm.extend({}); | |
| a.Cs.AdmissionsAudit = Bbc.extend({ | |
| initialize: function () { | |
| _.extend(this, $.extend(true, {}, d.Us.CollectionSort)) | |
| }, | |
| url: function () { | |
| return aP + "DataDirect/AdmissionsAuditGet/" | |
| } | |
| }); | |
| a.Cs.MedicalAudit = Bbc.extend({ | |
| initialize: function () { | |
| _.extend(this, $.extend(true, {}, d.Us.CollectionSort)) | |
| }, | |
| url: function () { | |
| return aP + "DataDirect/MedicalAuditGet/" | |
| } | |
| }); | |
| a.Cs.SmartAudit = Bbc.extend({ | |
| initialize: function () { | |
| _.extend(this, $.extend(true, {}, d.Us.CollectionSort)) | |
| }, | |
| url: function () { | |
| return aP + "SmartTuition/ApiLogSearch/" | |
| } | |
| }); | |
| a.Cs.SmartAuditExport = Bbc.extend({ | |
| url: function () { | |
| return aP + "SmartTuition/ApiLogExport/" | |
| } | |
| }); | |
| a.Cs.BBTMAudit = Bbc.extend({ | |
| initialize: function () { | |
| _.extend(this, $.extend(true, {}, d.Us.CollectionSort)) | |
| }, | |
| url: function () { | |
| return aP + "TmsContract/ApiLogSearch/" | |
| } | |
| }); | |
| a.Cs.BBTMAuditExport = Bbc.extend({ | |
| url: function () { | |
| return aP + "TmsContract/ApiLogExport/" | |
| } | |
| }); | |
| a.Cs.Columns = Bbc.extend({}); | |
| a.Vs.Layout = Bb.View.extend({ | |
| template: "admaudit/admaudit.layout.template.html", | |
| render: function (e) { | |
| var f = this; | |
| p3.setTitle(a.Data.AuditConfig.AuditName + " Audit"); | |
| $(e).html(f.el); | |
| f.renderData() | |
| }, | |
| renderData: function () { | |
| var e = this; | |
| p3.fT(e.template, function (h) { | |
| e.$el.html(h({ | |
| auditType: a.Data.AuditConfig.AuditName | |
| })); | |
| var f, g; | |
| switch (a.Data.AuditType) { | |
| case "admissions": | |
| f = new a.Cs.AdmissionsAudit(); | |
| break; | |
| case "medical": | |
| f = new a.Cs.MedicalAudit(); | |
| break; | |
| case "smart": | |
| f = new a.Cs.SmartAudit(); | |
| break; | |
| case "bbtm": | |
| f = new a.Cs.BBTMAudit(); | |
| break | |
| } | |
| g = new a.Vs.Audits({ | |
| collection: f | |
| }); | |
| p3.rV(new a.Vs.Search({ | |
| template: a.Data.AuditConfig.SearchTemplate, | |
| callback: function () { | |
| g.refreshData() | |
| } | |
| }), e.$(".search"), false); | |
| p3.rV(g, e.$(".results"), false) | |
| }) | |
| } | |
| }); | |
| a.Vs.Search = Bb.View.extend({ | |
| className: "mb-15", | |
| events: { | |
| "click .refresh": "refreshRecords", | |
| "click .filter-edit": "editFilter", | |
| "click .columns-edit": "editColumns", | |
| "click .export-create": "createExport" | |
| }, | |
| render: function (e) { | |
| $(e).append(this.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var e = this; | |
| p3.fT(e.options.template, function (g) { | |
| var f = {}; | |
| if (e.collection && e.collection.models) { | |
| f.collection = e.collection.toJSON() | |
| } | |
| f.variables = $.extend(true, {}, e.options.variables); | |
| e.$el.html(g(f)) | |
| }) | |
| }, | |
| refreshRecords: function (e) { | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| var f = this; | |
| if (f.options.callback) { | |
| f.options.callback() | |
| } | |
| }, | |
| editFilter: function (e) { | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| var g = this, | |
| f; | |
| f = c.Vs.Modal2.extend({ | |
| template: a.Data.AuditConfig.FilterTemplate, | |
| model: a.Data.Filter, | |
| size: "md", | |
| modalRendered: function () { | |
| b.Us.initialize(".date-input", { | |
| yearRange: "-1:+1" | |
| }) | |
| }, | |
| modalSave: function () { | |
| p3.Layout.Containers.Modal.modal("hide"); | |
| if (g.options.callback) { | |
| g.options.callback() | |
| } | |
| return false | |
| } | |
| }); | |
| c.Us.renderModal(new f()) | |
| }, | |
| editColumns: function (e) { | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| var g = this, | |
| f; | |
| f = c.Vs.Modal2.extend({ | |
| template: "admaudit/admaudit.columns.template.html", | |
| collection: a.Data.Columns, | |
| size: "md", | |
| modalRendered: function () { | |
| var h = this; | |
| _.each(h.collection.models, function (j) { | |
| var i = new a.Vs.Column({ | |
| model: j | |
| }); | |
| p3.rV(i, h.$("tbody"), false) | |
| }) | |
| }, | |
| modalUpdate: function () { | |
| return false | |
| }, | |
| modalSave: function () { | |
| p3.Layout.Containers.Modal.modal("hide"); | |
| if (g.options.callback) { | |
| g.options.callback() | |
| } | |
| return false | |
| } | |
| }); | |
| c.Us.renderModal(new f()) | |
| }, | |
| createExport: function (e) { | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| var f = new a.Cs.SmartAuditExport(); | |
| f.fetch({ | |
| data: a.Data.Filter.toJSON() || {}, | |
| cache: false, | |
| success: function () { | |
| p3.log(f) | |
| } | |
| }) | |
| } | |
| }); | |
| a.Vs.Column = Bb.View.extend({ | |
| template: "admaudit/admaudit.column.template.html", | |
| tagName: "tr", | |
| events: { | |
| "click .checkbox-sky-input": "updateModel" | |
| }, | |
| render: function (e) { | |
| var f = this; | |
| $(e).append(f.el); | |
| f.renderData() | |
| }, | |
| renderData: function () { | |
| var e = this; | |
| p3.fT(e.template, function (f) { | |
| e.$el.html(f({ | |
| model: e.model.toJSON() | |
| })) | |
| }) | |
| }, | |
| updateModel: function (e) { | |
| var f = this; | |
| c.Us.updateModel(e, f.model, "name") | |
| } | |
| }); | |
| a.Vs.Audits = Bb.View.extend({ | |
| className: "audits-table", | |
| initialize: function () { | |
| var e = this; | |
| e.template = a.Data.AuditConfig.AuditsTemplate; | |
| e.moreResults = false | |
| }, | |
| events: { | |
| "click th.sortable": "sort" | |
| }, | |
| render: function (e) { | |
| var f = this; | |
| $(e).html(f.el); | |
| f.renderData() | |
| }, | |
| renderData: function () { | |
| var g = this, | |
| e, f = g.collection.sortDirection === "asc" ? "p3icon-sortDown" : "p3icon-sortUp"; | |
| p3.fT(g.template, function (i) { | |
| g.$el.html(i({ | |
| columns: a.Data.Columns.toJSON() | |
| })); | |
| e = g.$("th[data-sort=" + g.collection.sortProp + "]"); | |
| e.removeClass("muted"); | |
| e.find("i").removeClass("p3icon-sortOff").addClass(f); | |
| var h = $(".filter-list"); | |
| h.empty(); | |
| _.each(a.Data.Filter.toJSON(), function (k, j) { | |
| if (k && a.Data.AuditConfig.Filters[j]) { | |
| h.append('<span class="label label-success" style="display:inline-block;line-height:1.5;margin:3px 3px;">' + a.Data.AuditConfig.Filters[j].replace("@value", k) + "</span>") | |
| } | |
| }); | |
| g.collection.fetch({ | |
| data: a.Data.Filter.toJSON() || {}, | |
| cache: false, | |
| success: function () { | |
| $(".results-count").html(g.collection.models.length + " Records"); | |
| _.each(g.collection.models, function (k) { | |
| var j = new a.Vs.Audit({ | |
| model: k | |
| }); | |
| p3.rV(j, g.$("tbody"), false) | |
| }) | |
| } | |
| }) | |
| }) | |
| }, | |
| refreshData: function () { | |
| var f = this, | |
| e = $(".filter-list"); | |
| e.empty(); | |
| _.each(a.Data.Filter.toJSON(), function (h, g) { | |
| if (h && a.Data.AuditConfig.Filters[g]) { | |
| e.append('<span class="label label-success" style="display:inline-block;line-height:1.5;margin:3px 3px;">' + a.Data.AuditConfig.Filters[g].replace("@value", h) + "</span>") | |
| } | |
| }); | |
| f.collection.fetch({ | |
| data: a.Data.Filter.toJSON() || {}, | |
| cache: false, | |
| success: function () { | |
| $(".results-count").html(f.collection.models.length + " Records"); | |
| f.refreshTemplate() | |
| } | |
| }) | |
| }, | |
| refreshTemplate: function () { | |
| var g = this, | |
| e, f = g.collection.sortDirection === "asc" ? "p3icon-sortDown" : "p3icon-sortUp"; | |
| p3.fT(g.template, function (h) { | |
| g.$el.html(h({ | |
| columns: a.Data.Columns.toJSON() | |
| })); | |
| e = g.$("th[data-sort=" + g.collection.sortProp + "]"); | |
| e.removeClass("muted"); | |
| e.find("i").removeClass("p3icon-sortOff").addClass(f); | |
| _.each(g.collection.models, function (j) { | |
| var i = new a.Vs.Audit({ | |
| model: j | |
| }); | |
| p3.rV(i, g.$("tbody"), false) | |
| }) | |
| }) | |
| }, | |
| sort: function (e) { | |
| var f = this; | |
| f.collection.setSort($(e.currentTarget).data("sort")); | |
| f.refreshTemplate() | |
| } | |
| }); | |
| a.Vs.Audit = Bb.View.extend({ | |
| tagName: "tr", | |
| initialize: function () { | |
| var e = this; | |
| e.template = a.Data.AuditConfig.AuditTemplate | |
| }, | |
| events: { | |
| "click .info": "showInfo" | |
| }, | |
| render: function (e) { | |
| var f = this; | |
| $(e).append(f.el); | |
| f.renderData() | |
| }, | |
| renderData: function () { | |
| var f = this, | |
| e; | |
| if (f.model.get("Before") && f.model.get("Before").slice(-1) === "=") { | |
| f.model.set({ | |
| Before: "[Encrypted]" | |
| }) | |
| } | |
| if (f.model.get("After") && f.model.get("After").slice(-1) === "=") { | |
| f.model.set({ | |
| After: "[Encrypted]" | |
| }) | |
| } | |
| e = _.object(_.map(_.where(a.Data.Columns.toJSON(), { | |
| Selected: true | |
| }), function (h, g) { | |
| return [h.SortName, f.model.get(h.SortName)] | |
| })); | |
| p3.fT(f.template, function (g) { | |
| f.$el.html(g({ | |
| model: e | |
| })) | |
| }) | |
| }, | |
| showInfo: function () { | |
| var f = this, | |
| e; | |
| p3.log(f.model.toJSON()); | |
| e = c.Vs.Modal2.extend({ | |
| template: a.Data.AuditConfig.InfoTemplate, | |
| model: f.model, | |
| variables: { | |
| title: a.Data.AuditConfig.AuditName + " log info", | |
| infoText: f.model.get("Addendum") | |
| } | |
| }); | |
| c.Us.renderModal(new e()) | |
| } | |
| }); | |
| Hb.registerHelper("admLogAction", function (f) { | |
| var e = ""; | |
| if (f) { | |
| switch (f.toUpperCase()) { | |
| case "D": | |
| e = '<span class="label label-danger" style="background-color:#d9534f;">Delete</span>'; | |
| break; | |
| case "U": | |
| e = '<span class="label label-warning" style="background-color:#f0ad4e;">Update</span>'; | |
| break; | |
| case "I": | |
| e = '<span class="label label-success" style="background-color:#5cb85c;">Create</span>'; | |
| break; | |
| case "W": | |
| e = "Waived"; | |
| break | |
| } | |
| } | |
| return new Hb.SafeString(e) | |
| }); | |
| p3.router().route("admaudit/:type", "admissionsaudit", function (e) { | |
| switch (e.toLowerCase()) { | |
| case "admissions": | |
| a.Data.AuditConfig = a.Data.Configs.Admissions; | |
| break; | |
| case "medical": | |
| a.Data.AuditConfig = a.Data.Configs.Medical; | |
| break; | |
| case "smart": | |
| a.Data.AuditConfig = a.Data.Configs.Smart; | |
| break; | |
| case "bbtm": | |
| a.Data.AuditConfig = a.Data.Configs.BBTM; | |
| break | |
| } | |
| a.Data.AuditType = e.toLowerCase(); | |
| a.Data.Filter = new a.Ms.Filter({ | |
| nbrEntries: 20, | |
| andOperator: true | |
| }); | |
| a.Data.Columns = new a.Cs.Columns(a.Data.AuditConfig.Columns); | |
| p3.renderMainPage(new a.Vs.Layout()) | |
| }) | |
| }(p3.module("admissions/admaudit"))); | |
| (function (a) { | |
| var d = p3.module("shared/datepicker"), | |
| j = p3.module("shared/timepicker"), | |
| f = p3.module("shared/feeds"), | |
| i = p3.module("utilities/smodal"), | |
| h = p3.module("utilities/multifetch"), | |
| l = p3.module("utilities/validate"), | |
| b = p3.module("shared/base"), | |
| e = p3.Us.Enum, | |
| c = p3.Us.Culture, | |
| g = p3.Us.InfoMessageLibrary, | |
| k = p3.Us.Tools; | |
| a.Data = {}; | |
| a.Ms.DictionaryItem = Bbm.extend({}); | |
| a.Cs.Dictionary = Bbc.extend({ | |
| model: a.Ms.DictionaryItem, | |
| url: "datadirect/DictionaryGet/" | |
| }); | |
| a.Ms.ScheduleItem = Bbm.extend({}); | |
| a.Ms.Visit = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "VisitId", | |
| validation: { | |
| VisitDate: [{ | |
| fn: function (o, m, n) { | |
| if ($('[name="VisitDate"]').val() == "" || $('[name="VisitTime"]').val() == "") { | |
| return g.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, { | |
| date: true | |
| }], | |
| "VisitType.VisitTypeId": [{ | |
| required: true, | |
| msg: g.P3.RequiredInfoNotEntered | |
| }], | |
| Candidate: [{ | |
| fn: function (o, m, n) { | |
| if (l.isEmptier(n.ProspectInstanceId)) { | |
| $(".modal-body ul.token-input-list").addClass("box-validate"); | |
| return g.P3.RequiredInfoNotEntered | |
| } | |
| $(".modal-body ul.token-input-list").removeClass("box-validate") | |
| } | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "Admissions/ProspectVisit/" + this.id + "/" : aP + "Admissions/ProspectVisit/" | |
| } | |
| }); | |
| a.Ms.Interview = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "InterviewId", | |
| validation: { | |
| InterviewDate: [{ | |
| fn: function (o, m, n) { | |
| if ($('[name="InterviewDate"]').val() == "" || $('[name="InterviewTime"]').val() == "") { | |
| return g.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, { | |
| date: true | |
| }], | |
| "InterviewType.InterviewTypeId": [{ | |
| required: true, | |
| msg: g.P3.RequiredInfoNotEntered | |
| }], | |
| LengthMinutes: [{ | |
| fn: function (o, m, n) { | |
| if (parseInt(o, 10) < 0 || parseInt(o, 10) > 59) { | |
| return g.Admissions.MinuteRange | |
| } | |
| } | |
| }], | |
| Candidate: [{ | |
| fn: function (o, m, n) { | |
| if (l.isEmptier(n.ProspectInstanceId)) { | |
| $(".modal-body ul.token-input-list").addClass("box-validate"); | |
| return g.P3.RequiredInfoNotEntered | |
| } | |
| $(".modal-body ul.token-input-list").removeClass("box-validate") | |
| } | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "Admissions/ProspectInterview/" + this.id + "/" : aP + "Admissions/ProspectInterview/" | |
| } | |
| }); | |
| a.Cs.ScheduleItem = Bbc.extend({ | |
| model: a.Ms.ScheduleItem, | |
| initialize: function (m, n) { | |
| this.scheduleType = n.scheduleType || 0 | |
| }, | |
| url: function () { | |
| return aP + "datadirect/AdmissionSchedulingGet/" | |
| }, | |
| setScheduleTypeFilter: function (m) { | |
| this.scheduleType = m | |
| } | |
| }); | |
| a.Cs.CalendarItem = Bbc.extend({ | |
| model: a.Ms.ScheduleItem, | |
| initialize: function (m, n) { | |
| this.startDate = n.startDate || null; | |
| this.scheduleDuration = n.scheduleDuration || 0; | |
| this.scheduleType = n.scheduleType || 0 | |
| }, | |
| url: function () { | |
| return aP + "datadirect/AdmissionSchedulingGet/" | |
| }, | |
| setScheduleTypeFilter: function (m) { | |
| this.scheduleType = m | |
| } | |
| }); | |
| a.Cs.ProspectInstanceIds = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/ProspectInstanceIdsGet/" | |
| } | |
| }); | |
| a.Cs.ListItems = Bbc.extend({ | |
| model: a.Ms.ListItem | |
| }); | |
| a.Vs.Layout = Bb.View.extend({ | |
| template: "page/page.12.template.html", | |
| initialize: function () { | |
| this.todayDate = c.localDateTime(); | |
| a.Data.Culture = c.getCulture() | |
| }, | |
| render: function (m) { | |
| var n = this; | |
| p3.setTitle("Admissions Calendar"); | |
| $(m).html(n.el); | |
| h.Us.Fetch({ | |
| ADMVisitTypes: { | |
| data: new h.Cs.Dictionary(), | |
| dataParams: e.DictionaryData.ADMVisitTypes | |
| }, | |
| ADMInterviewTypes: { | |
| data: new h.Cs.Dictionary(), | |
| dataParams: e.DictionaryData.ADMInterviewTypes | |
| }, | |
| ADMStaff: { | |
| data: new h.Cs.Dictionary(), | |
| dataParams: e.DictionaryData.ADMStaff | |
| } | |
| }, function (o, q, p) { | |
| a.Data.Dictionaries = o; | |
| n.renderData() | |
| }) | |
| }, | |
| renderData: function () { | |
| var m = this; | |
| p3.fT(m.template, function (n) { | |
| m.$el.html(n()); | |
| p3.rV(new a.Vs.FullCalendarView({}), m.$(".col-center"), false) | |
| }) | |
| } | |
| }); | |
| a.Vs.FullCalendarView = Bb.View.extend({ | |
| template: "page/page.1col.wide.template.html", | |
| events: { | |
| "click .scheduleTypeFilter": "setScheduleType", | |
| "click #week-view": "weekView", | |
| "click #month-view": "monthView", | |
| "click #button-today": "gotoToday", | |
| "click #button-previous": "movePrevious", | |
| "click #button-next": "moveNext" | |
| }, | |
| initialize: function () { | |
| var p = this, | |
| n, o, m; | |
| n = p3.Data.Context.getSelectedPersona().Id; | |
| if (n === 3 || n === 7) { | |
| this.options.canEdit = true | |
| } else { | |
| this.options.canEdit = false | |
| } | |
| this.options.fullCalendar = true; | |
| p.todayDate = c.localDateTime(); | |
| o = new Date(p.todayDate.toString()); | |
| o.setMonth(o.getMonth() - 3); | |
| m = new Date(p.todayDate.toString()); | |
| m.setMonth(m.getMonth() + 3); | |
| a.Data.startDate = o; | |
| a.Data.endDate = m; | |
| a.Data.fullView = true | |
| }, | |
| render: function (m) { | |
| var p = this, | |
| n = 0, | |
| o = '<div id="loading" class="alert alert-info" style="position: absolute; left: 47%; top: 38%; padding:6px; border:solid 1px #ff000;text-align: center;z-index: 1000; "><span id="load-icon"></span></div>'; | |
| $(m).html(p.el); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.jQueryUI, function () { | |
| p3.fT(p.template, function (q) { | |
| p.$el.html(q()); | |
| $("#col-main").prepend(o); | |
| p3.loadingIcon("#load-icon"); | |
| p.collection = new a.Cs.ScheduleItem({}, { | |
| scheduleType: 0 | |
| }); | |
| p.collection.fetch({ | |
| data: { | |
| date: p3.Us.DateTime.format(p.todayDate, "MM/dd/yyyy"), | |
| duration: n | |
| }, | |
| success: function (r, s) { | |
| a.Data.scheduleItems = r; | |
| a.Us.BuildCalendarEventArray(0, p.options.canEdit); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.AthleticCalendar, p.initializeCalendar, p.options); | |
| $("#loading").remove() | |
| }, | |
| error: function (r, s) { | |
| p3.displayError("Error loading schedule") | |
| } | |
| }) | |
| }) | |
| }) | |
| }, | |
| initializeCalendar: function (m) { | |
| a.Us.initializeCalendar(m) | |
| }, | |
| setScheduleType: function (m) { | |
| a.Us.setScheduleType(m); | |
| a.Us.BuildCalendarEventArray(0, true); | |
| $("#col-main").fullCalendar("removeEvents"); | |
| $("#col-main").fullCalendar("addEventSource", a.Data.CalendarEvents) | |
| }, | |
| weekView: function (m) { | |
| var n = this; | |
| $("#col-main").fullCalendar("changeView", "basicWeek"); | |
| n.ensureData() | |
| }, | |
| monthView: function (m) { | |
| var n = this; | |
| $("#col-main").fullCalendar("changeView", "month"); | |
| n.ensureData() | |
| }, | |
| gotoToday: function (m) { | |
| var n = this; | |
| $("#col-main").fullCalendar("today"); | |
| n.ensureData() | |
| }, | |
| movePrevious: function (m) { | |
| var n = this; | |
| $("#col-main").fullCalendar("prev"); | |
| n.ensureData() | |
| }, | |
| moveNext: function (m) { | |
| var n = this; | |
| $("#col-main").fullCalendar("next"); | |
| n.ensureData() | |
| }, | |
| ensureData: function () { | |
| var q = this, | |
| o = 0, | |
| p, n = $("#col-main").fullCalendar("getView"), | |
| m; | |
| if (n.visStart < a.Data.startDate) { | |
| o = -3; | |
| p = a.Data.startDate | |
| } else { | |
| if (n.visEnd > a.Data.endDate) { | |
| o = 3; | |
| p = a.Data.endDate | |
| } | |
| } | |
| if (o != 0) { | |
| m = new a.Cs.CalendarItem({}, { | |
| startDate: k.shortDateDisplayNoTime(p), | |
| scheduleDuration: o | |
| }); | |
| m.fetch({ | |
| data: { | |
| date: k.shortDateDisplayNoTime(p), | |
| duration: o | |
| }, | |
| error: function (r, s) { | |
| p3.displayError("Error loading additional events") | |
| }, | |
| success: function (r, s) { | |
| m.each(function (t) { | |
| if (o == 3) { | |
| a.Data.scheduleItems.push(t) | |
| } else { | |
| a.Data.scheduleItems.unshift(t) | |
| } | |
| }); | |
| if (o == 3) { | |
| a.Data.endDate.setMonth(a.Data.endDate.getMonth() + 3) | |
| } else { | |
| a.Data.startDate.setMonth(a.Data.startDate.getMonth() - 3) | |
| } | |
| a.Us.BuildCalendarEventArray(0, q.options.canEdit); | |
| $("#col-main").fullCalendar("removeEvents"); | |
| $("#col-main").fullCalendar("addEventSource", a.Data.CalendarEvents) | |
| } | |
| }) | |
| } | |
| } | |
| }); | |
| a.Us.setScheduleType = function (n) { | |
| var m = $(n.currentTarget), | |
| o = 0; | |
| if (n.currentTarget.id != "scheduleFilterAll") { | |
| if (m.hasClass("active")) { | |
| m.removeClass("active cal-filter-on").addClass("cal-filter-off"); | |
| m.find("i").removeClass("p3icon-ok").addClass("p3icon-check") | |
| } else { | |
| m.addClass("active cal-filter-on").removeClass("cal-filter-off"); | |
| m.find("i").removeClass("p3icon-check").addClass("p3icon-ok") | |
| } | |
| $(".scheduleTypeFilter").each(function () { | |
| if ($(this).hasClass("active")) { | |
| o += parseInt($(this).data("val"), 10) | |
| } | |
| }); | |
| if (o === 7) { | |
| o = 0 | |
| } | |
| } | |
| if (o == 0) { | |
| $(".scheduleTypeFilter").removeClass("active cal-filter-on").addClass("cal-filter-off"); | |
| $(".filter-row .btn-group i.p3icon-ok").removeClass("p3icon-ok").addClass("p3icon-check"); | |
| $("#scheduleFilterAll").addClass("active cal-filter-on").removeClass("cal-filter-off"); | |
| $("#scheduleFilterAll").find("i").removeClass("p3icon-check").addClass("p3icon-ok") | |
| } else { | |
| $("#scheduleFilterAll").removeClass("active cal-filter-on").addClass("cal-filter-off"); | |
| $("#scheduleFilterAll").find("i").removeClass("p3icon-ok").addClass("p3icon-check") | |
| } | |
| a.Data.scheduleItems.setScheduleTypeFilter(o) | |
| }; | |
| a.Us.initializeCalendar = function (m) { | |
| var n; | |
| n = a.Data.Culture.App.ShortMonthDayYearPattern.split("Y").join("y").split("D").join("d"); | |
| if (n.indexOf("d") < n.indexOf("M")) { | |
| n = n.split(" yyyy").join(" [yyyy]").split(" MMM").join(" [MMM]") + "{ '-' " + n + "}" | |
| } else { | |
| n = n.split(" yyyy").join(" [yyyy]") + "{ '-' " + n.split(" MMM").join(" [MMM]") + "}" | |
| } | |
| $("#col-main").fullCalendar({ | |
| editable: m.canEdit, | |
| disableResizing: true, | |
| header: { | |
| left: "", | |
| center: "title", | |
| right: "" | |
| }, | |
| defaultView: "month", | |
| titleFormat: { | |
| month: a.Data.Culture.App.YearMonthPattern.replace(",", "").split("Y").join("y"), | |
| week: n, | |
| day: a.Data.Culture.App.ShortMonthDayYearPattern | |
| }, | |
| columnFormat: { | |
| week: a.Data.Culture.App.ShortDayDatePattern.split("D").join("d") | |
| }, | |
| firstDay: a.Data.Culture.App.firstDay, | |
| events: a.Data.CalendarEvents, | |
| eventRender: function (p, o) { | |
| o.find(".fc-event-title").html('<span style="font-size: 12px; font-weight: bold;">' + o.find(".fc-event-time").text() + " </span>" + o.find(".fc-event-title").text()) | |
| }, | |
| dayClick: function (q, o, s, v) { | |
| var u = c.displayDate(q, "shortDate") + " " + c.displayDate(q, "shortTime"), | |
| r = true, | |
| t = new a.Ms.Visit({ | |
| VisitDate: u, | |
| VisitType: { | |
| "$type": "clBLL.nAdmissions.VisitType, clBLL" | |
| }, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }), | |
| p = new a.Vs.CalendarModal({ | |
| model: t, | |
| dictionaries: a.Data.Dictionaries, | |
| variables: { | |
| visit: r | |
| } | |
| }); | |
| i.Us.renderModal(p) | |
| }, | |
| eventClick: function (o, s, u) { | |
| var t, r, q, p; | |
| switch (o.type) { | |
| case "V": | |
| t = new a.Ms.Visit({ | |
| Name: o.name | |
| }); | |
| r = true; | |
| q = 12; | |
| p = "VisitId"; | |
| break; | |
| case "I": | |
| t = new a.Ms.Interview({ | |
| Name: o.name | |
| }); | |
| r = false; | |
| q = 7; | |
| p = "InterviewId"; | |
| break | |
| } | |
| if (t) { | |
| t.fetch({ | |
| cache: false, | |
| data: { | |
| id: o.id, | |
| prospectInstanceId: o.instanceId, | |
| userId: o.userId | |
| }, | |
| success: function (v, w) { | |
| h.Us.Fetch({ | |
| dictionary_127: { | |
| data: new h.Cs.Dictionary(), | |
| dataParams: { | |
| id: 127, | |
| keyName: "checklist_item_id", | |
| valueName: "checklist_item_description", | |
| inputParam: "prospect_instance_id=" + v.get("ProspectInstanceId") + "[i],data_collection_type_id=" + q + "[i],data_collection_pk=" + v.get(p) + "[i]" | |
| } | |
| }, | |
| dictionary_128: { | |
| data: new h.Cs.Dictionary(), | |
| dataParams: { | |
| id: 128, | |
| keyName: "item_status_id", | |
| valueName: "item_status_desc", | |
| inputParam: "data_collection_type_id=" + q + "[i]" | |
| } | |
| } | |
| }, function (y, A, z) { | |
| var B = $.extend(true, {}, a.Data.Dictionaries), | |
| x; | |
| B.dictionary_127 = y.dictionary_127; | |
| B.dictionary_128 = y.dictionary_128; | |
| x = new a.Vs.CalendarModal({ | |
| model: v, | |
| dictionaries: B, | |
| variables: { | |
| visit: r | |
| } | |
| }); | |
| i.Us.renderModal(x) | |
| }) | |
| } | |
| }) | |
| } | |
| return false | |
| }, | |
| eventDragStart: function (o, p, q, r) { | |
| if (!o.canDrag) { | |
| p.preventDefault() | |
| } | |
| }, | |
| eventDrop: function (q, p, s, o, t, r, u, x) { | |
| var w, v; | |
| x.newDate = c.getDateString(q.start) + " " + c.getTimeString(q.start); | |
| switch (q.type) { | |
| case "V": | |
| w = new a.Ms.Visit(); | |
| v = "VisitDate"; | |
| break; | |
| case "I": | |
| w = new a.Ms.Interview(); | |
| v = "InterviewDate"; | |
| break | |
| } | |
| w.fetch({ | |
| cache: false, | |
| data: { | |
| id: q.id, | |
| prospectInstanceId: q.instanceId | |
| }, | |
| success: function (z, A) { | |
| var y = {}; | |
| y[v] = x.newDate; | |
| w.set(y); | |
| w.save({}, { | |
| error: function (C, B) { | |
| p3.displayError("Error moving calendar item") | |
| } | |
| }) | |
| } | |
| }) | |
| }, | |
| loading: function (o) { | |
| var p = '<div id="loading" class="alert alert-info" style="position: absolute; left: 47%; top: 38%; padding:6px; border:solid 1px #ff000;text-align: center;z-index: 1000; "><span id="load-icon"></span>Loading ...</div>'; | |
| if (o) { | |
| $("#col-main").prepend(p); | |
| p3.loadingIcon("#load-icon") | |
| } else { | |
| $("#loading").remove() | |
| } | |
| }, | |
| viewDisplay: function (u) { | |
| var p = 0, | |
| o, q = false, | |
| t = false, | |
| r = false, | |
| s = false; | |
| if (p == 0) { | |
| q = true | |
| } | |
| if (p == 1 || p == 3 || p == 5) { | |
| t = true | |
| } | |
| if (p == 2 || p == 3 || p == 6) { | |
| r = true | |
| } | |
| if (p == 4 || p == 5 || p == 6) { | |
| s = true | |
| } | |
| p3.fT("admissions/scheduling.calendar.header.template.html", function (v) { | |
| if ($("tr.calendar-tile").length === 0) { | |
| $(".fc-header").html(v({ | |
| typeAll: q, | |
| typeVisits: t, | |
| typeInterviews: r, | |
| typeRegistrations: s, | |
| date: u.title | |
| })) | |
| } | |
| p3.rV(new f.Vs.iCalAdmissions({ | |
| personaId: 7, | |
| sdate: a.Data.startDate, | |
| edate: a.Data.endDate | |
| }), $(".rss-schedule"), true); | |
| $(".fc-widget-header").addClass("cal-column-header"); | |
| $(".fc-content").addClass("white-bgc"); | |
| $(".date-row .btn").removeClass("active"); | |
| o = new Date().getTime(); | |
| if (o >= u.visStart.getTime() && o <= u.visEnd.getTime()) { | |
| $("#button-today").prop("disabled", true) | |
| } else { | |
| $("#button-today").prop("disabled", false) | |
| } | |
| switch (u.name) { | |
| case "basicWeek": | |
| $("#week-view").addClass("active"); | |
| break; | |
| case "month": | |
| $("#month-view").addClass("active"); | |
| break | |
| } | |
| $("#col-main").css("margin-bottom", "20px") | |
| }) | |
| } | |
| }) | |
| }; | |
| a.Us.BuildCalendarEventArray = function (s, y) { | |
| var r = [], | |
| w = "", | |
| n = "", | |
| m, q, p, v = false, | |
| t = false, | |
| u = false, | |
| x = a.Data.scheduleItems.scheduleType, | |
| o; | |
| v = (x == 0) || (x == 1) || (x == 3) || (x == 5); | |
| t = (x == 0) || (x == 2) || (x == 3) || (x == 6); | |
| u = (x == 0) || (x == 4) || (x == 5) || (x == 6); | |
| _.each(a.Data.scheduleItems.models, function (z) { | |
| q = false; | |
| p = false; | |
| m = false; | |
| o = ""; | |
| if (s > 0 || x == 0 || (v && z.get("ScheduleType") === "V") || (t && z.get("ScheduleType") === "I") || (u && z.get("ScheduleType") === "R")) { | |
| if (z.get("StartTime") == "00:00:00") { | |
| m = true | |
| } | |
| switch (z.get("ScheduleType")) { | |
| case "V": | |
| w = '<span style="font-size:12px;"><strong>' + z.get("Name") + "</strong><br />Visit: " + z.get("ScheduleDesc") + "</span>"; | |
| n = "#DDEFFC"; | |
| p = true; | |
| q = true; | |
| o = '<br/><span style="color:#595858;">'; | |
| if (z.get("Staff")) { | |
| o += "Staff: " + z.get("Staff") + "<br />" | |
| } | |
| if (z.get("ScheduledWith") !== null) { | |
| o += "Guide: " + z.get("ScheduledWith") + "<br />" | |
| } else { | |
| if (z.get("ScheduledOther") !== null) { | |
| o += "Guide: " + z.get("ScheduledOther") + "<br />" | |
| } | |
| } | |
| o += "</span>"; | |
| break; | |
| case "I": | |
| w = '<span style="font-size:12px;"><strong>' + z.get("Name") + "</strong><br />Interview: " + z.get("ScheduleDesc") + "</span>"; | |
| n = "#C5F6C5"; | |
| p = true; | |
| q = true; | |
| o = '<br/><span style="color:#595858;">'; | |
| if (z.get("Staff")) { | |
| o += "Staff: " + z.get("Staff") + "<br />" | |
| } | |
| if (z.get("ScheduledWith") !== null) { | |
| o += "Interviewer: " + z.get("ScheduledWith") + "<br />" | |
| } else { | |
| if (z.get("ScheduledOther") !== null) { | |
| o += "Interviewer: " + z.get("ScheduledOther") + "<br />" | |
| } | |
| } | |
| o += "</span>"; | |
| break; | |
| case "R": | |
| w = '<span style="font-size:12px;"><strong></strong><br />Registration: ' + z.get("ScheduleDesc") + "</span>"; | |
| n = "#F9E9D2"; | |
| break | |
| } | |
| r.push({ | |
| title: w + o, | |
| start: c.getDate(z.get("ScheduleDate")), | |
| end: c.getDate(z.get("EndDate")), | |
| backgroundColor: n, | |
| borderColor: "#c6c4c4", | |
| allDay: m, | |
| canEdit: q, | |
| editable: q, | |
| id: z.get("ScheduleId"), | |
| instanceId: z.get("ProspectInstanceId"), | |
| userId: z.get("UserId"), | |
| name: z.get("Name"), | |
| type: z.get("ScheduleType"), | |
| canDrag: p | |
| }) | |
| } | |
| }); | |
| a.Data.CalendarEvents = r | |
| }; | |
| a.Us.updateHeaderDisplay = function (r) { | |
| var o = r.visStart, | |
| n = r.visEnd, | |
| m, p = "", | |
| q; | |
| switch (r.name) { | |
| case "basicDay": | |
| p = c.displayDate(c.getDateString(o), "fullDate"); | |
| break; | |
| case "basicWeek": | |
| m = new Date(n.getTime() - (24 * 60 * 60 * 1000)); | |
| p = c.getDateRangeString(o, m); | |
| break; | |
| case "month": | |
| m = new Date(o.getTime() + (8 * 24 * 60 * 60 * 1000)); | |
| p = c.displayDate(c.getDateString(m), "monthYear"); | |
| break | |
| } | |
| $("#date-display-label").html(p); | |
| $("#small-date-display-label").html(p); | |
| q = c.localDateTime(); | |
| if (q > r.visStart && q < r.visEnd) { | |
| $("#button-today").addClass("active") | |
| } else { | |
| $("#button-today").removeClass("active") | |
| } | |
| $("#view-buttons .btn-inverseCal").removeClass("active"); | |
| switch (r.name) { | |
| case "basicWeek": | |
| $("#week-view").addClass("active"); | |
| break; | |
| case "month": | |
| $("#month-view").addClass("active"); | |
| break; | |
| case "basicDay": | |
| $("#day-view").addClass("active"); | |
| break | |
| } | |
| }; | |
| a.Us.InitializeAutoComplete = function (p, n, m, o) { | |
| $.ajax({ | |
| url: aP + "datadirect/UsersByRole?format=json&parentRoleId=" + m + "&resultSize=4000", | |
| cache: false, | |
| success: function (q) { | |
| _.each(q, function (s) { | |
| s.FullName = ""; | |
| s.FullName += (s.FirstName) ? s.FirstName + " " : ""; | |
| s.FullName += s.LastName || ""; | |
| s.id = s.Id | |
| }); | |
| var r = null; | |
| _.each(r, function (s) { | |
| s.FullName = ""; | |
| s.FullName += (s.FirstName) ? s.FirstName + " " : ""; | |
| s.FullName += s.LastName || ""; | |
| s.id = s.UserId | |
| }); | |
| n.tokenInput(q, { | |
| minChars: 2, | |
| searchDelay: 100, | |
| preventDuplicates: true, | |
| animateDropdown: false, | |
| propertyToSearch: "FullName", | |
| hintText: "Type to find a candidate", | |
| classes: { | |
| tokenList: "token-input-list span3 col-md-3", | |
| dropdown: "token-input-dropdown input-xlarge" | |
| }, | |
| resultsFormatter: function (s) { | |
| return "<li>" + s.FullName + "</li>" | |
| }, | |
| prePopulate: r, | |
| tokenLimit: o, | |
| onAdd: function (s) { | |
| p.pidCollection = new a.Cs.ProspectInstanceIds(); | |
| p.pidCollection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| userId: s.id | |
| }, | |
| success: function (t, u) { | |
| p.options.model.set("ProspectInstanceId", t.models[0].get("ProspectInstanceId")); | |
| if (p.options.visit) { | |
| p.dataType = 12; | |
| p.dataPk = null | |
| } else { | |
| p.dataType = 7; | |
| p.dataPk = null | |
| } | |
| h.Us.Fetch({ | |
| dictionary_127: { | |
| data: new h.Cs.Dictionary(), | |
| dataParams: { | |
| id: 127, | |
| keyName: "checklist_item_id", | |
| valueName: "checklist_item_description", | |
| inputParam: "prospect_instance_id=" + p.model.get("ProspectInstanceId") + "[i],data_collection_type_id=" + p.dataType + "[i],data_collection_pk=null" | |
| } | |
| }, | |
| dictionary_128: { | |
| data: new h.Cs.Dictionary(), | |
| dataParams: { | |
| id: 128, | |
| keyName: "item_status_id", | |
| valueName: "item_status_desc", | |
| inputParam: "data_collection_type_id=" + p.dataType + "[i]" | |
| } | |
| } | |
| }, function (v, x, w) { | |
| if (v.dictionary_127.length) { | |
| $(".checklist-item").removeClass("hide"); | |
| _.each(v.dictionary_127, function (y) { | |
| $('select[name="ChecklistItemId"]').append($("<option />").val(y.dd_id).text(y.dd_description)) | |
| }); | |
| _.each(v.dictionary_128, function (y) { | |
| $('select[name="ChecklistItemStatus"]').append($("<option />").val(y.dd_id).text(y.dd_description)) | |
| }) | |
| } | |
| }) | |
| } | |
| }) | |
| }, | |
| onDelete: function () { | |
| p.options.model.set("ProspectInstanceId", null); | |
| $('select[name="ChecklistItemId"]').empty().append($("<option />").val("").text("-- Select an Option --")); | |
| $('select[name="ChecklistItemStatus"]').empty().append($("<option />").val("").text("-- Select an Option --")); | |
| $(".checklist-item").addClass("hide"); | |
| $(".checklist-status").addClass("hide") | |
| } | |
| }) | |
| } | |
| }) | |
| }; | |
| a.Vs.CalendarModal = i.Vs.Modal2.extend({ | |
| template: "admissions/scheduling.calendar.edit.template.html", | |
| size: "md", | |
| events: { | |
| "keyup textarea.counter-input": "updateCharacterCounter", | |
| 'change select[name="ChecklistItemId"]': "toggleChecklistStatus", | |
| "click #switch-add-schedule-link": "switchAddMode" | |
| }, | |
| modalRendered: function (n) { | |
| var m = this; | |
| d.Us.initialize(".date-input", { | |
| yearRange: "-30:+20" | |
| }); | |
| j.Us.initialize(".time-input"); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.TokenInput, function () { | |
| if (m.$('[name="Candidate"]').length > 0) { | |
| a.Us.InitializeAutoComplete(m, $('[name="Candidate"]'), 554, 1) | |
| } | |
| }); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.AutoSize, function () { | |
| m.$("textarea").autosize() | |
| }); | |
| _.each(m.$("textarea.counter-input"), function (o) { | |
| $(o).trigger($.Event("keyup")) | |
| }); | |
| m.initializeFileUpload_File(); | |
| if ($('select[name="ChecklistItemId"] option:selected').val() != "") { | |
| $(".checklist-status").removeClass("hide") | |
| } | |
| }, | |
| switchAddMode: function (n) { | |
| var p = this, | |
| o, q, m; | |
| n.preventDefault(); | |
| n.stopPropagation(); | |
| p3.Layout.Containers.Modal.modal("hide"); | |
| if (p.options.variables.visit == true) { | |
| o = false; | |
| q = new a.Ms.Interview({ | |
| InterviewDate: p.model.get("VisitDate"), | |
| InterviewType: { | |
| "$type": "clBLL.nAdmissions.InterviewType, clBLL" | |
| }, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }) | |
| } else { | |
| o = true; | |
| q = new a.Ms.Visit({ | |
| VisitDate: p.model.get("InterviewDate"), | |
| VisitType: { | |
| "$type": "clBLL.nAdmissions.VisitType, clBLL" | |
| }, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }) | |
| } | |
| m = new a.Vs.CalendarModal({ | |
| model: q, | |
| dictionaries: a.Data.Dictionaries, | |
| variables: { | |
| visit: o | |
| } | |
| }); | |
| i.Us.renderModal(m) | |
| }, | |
| updateCharacterCounter: function (n) { | |
| var o = this, | |
| m = o.$(n.currentTarget); | |
| m.siblings().find(".characterCounter").html(m.val().length); | |
| if (m.val().length > 4000) { | |
| m.siblings().find(".characterCounter").addClass("badge-important") | |
| } else { | |
| m.siblings().find(".characterCounter").removeClass("badge-important") | |
| } | |
| }, | |
| toggleChecklistStatus: function (m) { | |
| var n = this; | |
| if ($(m.target).prop("value") == "") { | |
| n.$('select[name="ChecklistItemStatus"]').val(""); | |
| n.$(".checklist-status").addClass("hide") | |
| } else { | |
| n.$(".checklist-status").removeClass("hide") | |
| } | |
| }, | |
| modalSavedSuccess: function (m) { | |
| a.Us.UpdateCalendar(0, true) | |
| } | |
| }); | |
| a.Us.UpdateCalendar = function (o) { | |
| var m = $("#col-main").fullCalendar("getView"), | |
| p = new Date(m.visStart), | |
| n = new Date(m.visStart); | |
| p.setMonth(m.visStart.getMonth() - 3); | |
| n.setMonth(m.visStart.getMonth() + 3); | |
| a.Data.startDate = p; | |
| a.Data.endDate = n; | |
| a.Data.scheduleItems.reset(); | |
| a.Data.scheduleItems.startDate = k.shortDateDisplayNoTime(m.visStart); | |
| a.Data.scheduleItems.fetch({ | |
| data: { | |
| date: p3.Us.DateTime.format(new Date(m.visStart), "MM/dd/yyyy"), | |
| duration: 0 | |
| }, | |
| error: function (q, r) { | |
| p3.displayError("Error loading schedule") | |
| }, | |
| success: function (q, r) { | |
| var s = 0; | |
| a.Us.BuildCalendarEventArray(s, true); | |
| $("#col-main").fullCalendar("removeEvents"); | |
| $("#col-main").fullCalendar("addEventSource", a.Data.CalendarEvents) | |
| } | |
| }) | |
| } | |
| }(p3.module("admissions/admissionscalendar"))); | |
| (function (a) { | |
| var b = p3.module("shared/base"), | |
| d = p3.module("utilities/smodal"), | |
| c = p3.Us.InfoMessageLibrary; | |
| a.Ms.CommentBox = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "SchoolId", | |
| validation: { | |
| CandidateProgressText: [{ | |
| maxLength: 4000, | |
| msg: c.P3.MaxLengthExceeded | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "admissions/AdmissionOptions/" + this.id + "/" : aP + "admissions/AdmissionOptions/" | |
| } | |
| }); | |
| a.Vs.Layout = Bb.View.extend({ | |
| template: "admissions/admissionoptions.progresstext.template.html", | |
| events: { | |
| "click button.save": "saveProgressText" | |
| }, | |
| initialize: function () { | |
| var e = this; | |
| e.model = new a.Ms.CommentBox({ | |
| SchoolId: p3.Data.SchoolContext.attributes.SchoolInfo.SchoolId | |
| }); | |
| e.model.defaults = $.extend(true, {}, e.model.attributes); | |
| e.Containers = {}; | |
| Bb.Validation.bind(e, { | |
| forceUpdate: true, | |
| selector: e.selector | |
| }) | |
| }, | |
| render: function (e) { | |
| var f = this; | |
| $(e).append(f.el); | |
| f.renderData() | |
| }, | |
| renderData: function () { | |
| var e = this; | |
| e.model.off("sync"); | |
| p3.fT(e.template, function (f) { | |
| e.model.fetch({ | |
| cache: false, | |
| success: function (h, i) { | |
| var g; | |
| e.$el.html(f({ | |
| model: e.model.toJSON() | |
| })); | |
| g = e.$(".tinyeditor"); | |
| d.Us.showHtmlEditor(e, "tinyeditor", function () { | |
| $.each(g, function () { | |
| var j = tinyMCE.get(this.id); | |
| e.$(".characterCounter").html(j.save().length); | |
| if (j.save().length > 4000) { | |
| e.$(".characterCounter").addClass("bb-badge-danger") | |
| } else { | |
| e.$(".characterCounter").removeClass("bb-badge-danger") | |
| } | |
| j.onChange.add(function (l, k) { | |
| e.$(".characterCounter").html(l.save().length); | |
| if (l.save().length > 4000) { | |
| e.$(".characterCounter").addClass("bb-badge-danger") | |
| } else { | |
| e.$(".characterCounter").removeClass("bb-badge-danger") | |
| } | |
| $.each(g, function () { | |
| var m = {}; | |
| m[this.name] = tinyMCE.get(this.id).save(); | |
| e.model.set(m) | |
| }) | |
| }); | |
| j.onKeyUp.add(function (l, k) { | |
| e.$(".characterCounter").html(l.save().length); | |
| if (l.save().length > 4000) { | |
| e.$(".characterCounter").addClass("bb-badge-danger") | |
| } else { | |
| e.$(".characterCounter").removeClass("bb-badge-danger") | |
| } | |
| $.each(g, function () { | |
| var m = {}; | |
| m[this.name] = tinyMCE.get(this.id).save(); | |
| e.model.set(m) | |
| }) | |
| }) | |
| }) | |
| }) | |
| } | |
| }) | |
| }) | |
| }, | |
| saveProgressText: function () { | |
| var f = this, | |
| e = f.$(".save"); | |
| e.button("loading").prop("disabled", true); | |
| $.each(f.$(".tinyeditor"), function () { | |
| var g = {}; | |
| g[this.id] = tinyMCE.get(this.id).save(); | |
| f.model.set(g) | |
| }); | |
| if (f.model.isValid(true)) { | |
| f.model.set({ | |
| FieldsToNull: [] | |
| }); | |
| _.each(f.model.attributes, function (i, g, h) { | |
| d.Us.setFieldsToNull(f.model, i, g, h, "") | |
| }); | |
| f.model.save({}, { | |
| dataParam: f.options.dataParam, | |
| complete: function () { | |
| e.button("reset") | |
| } | |
| }) | |
| } else { | |
| e.button("reset") | |
| } | |
| } | |
| }); | |
| p3.router().route("admissionOptions", "admissionOptions", function (e) { | |
| p3.renderMainPage(new a.Vs.Layout({})) | |
| }) | |
| }(p3.module("admissions/admissionOptions"))); | |
| (function (a) { | |
| var j = p3.module("system/mycalendar"), | |
| l = p3.module("utilities/smodal"), | |
| d = p3.module("shared/datepicker"), | |
| n = p3.module("shared/timepicker"), | |
| f = p3.module("cms/shared/event"), | |
| i = p3.module("utilities/multifetch"), | |
| p = p3.module("utilities/validate"), | |
| b = p3.module("shared/base"), | |
| g = p3.module("admissions/form/forms"), | |
| m = p3.module("utilities/sort"), | |
| k = p3.module("officialNote"), | |
| h = p3.Us.InfoMessageLibrary, | |
| c = p3.Us.Culture, | |
| e = p3.Us.Enum, | |
| o = p3.Us.Tools; | |
| a.Ms.Settings = Bbm.extend({ | |
| idAttribute: "SchoolId", | |
| validation: { | |
| "VisitNotification.CandidateConfirm.SendTo": [{ | |
| fn: "VisitCandidateConfirm" | |
| }], | |
| "VisitNotification.CandidateConfirm.ReplyAddress": [{ | |
| fn: function (s, q, r) { | |
| if (r.VisitNotification.CandidateConfirm.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!Bb.Validation.patterns.email.test(s)) { | |
| return h.P3.EmailError | |
| } | |
| } | |
| } | |
| }], | |
| "VisitNotification.CandidateConfirm.FromName": [{ | |
| fn: "VisitCandidateConfirm" | |
| }], | |
| "VisitNotification.CandidateConfirm.Subject": [{ | |
| fn: "VisitCandidateConfirm" | |
| }], | |
| "VisitNotification.CandidateConfirm.Body": [{ | |
| fn: "VisitCandidateConfirm" | |
| }], | |
| "VisitNotification.CandidateReminder.SendTo": [{ | |
| fn: "VisitCandidateReminder" | |
| }], | |
| "VisitNotification.CandidateReminder.ReplyAddress": [{ | |
| fn: function (s, q, r) { | |
| if (r.VisitNotification.CandidateReminder.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!Bb.Validation.patterns.email.test(s)) { | |
| return h.P3.EmailError | |
| } | |
| } | |
| } | |
| }], | |
| "VisitNotification.CandidateReminder.FromName": [{ | |
| fn: "VisitCandidateReminder" | |
| }], | |
| "VisitNotification.CandidateReminder.ReminderOption": [{ | |
| fn: "VisitCandidateReminder" | |
| }], | |
| "VisitNotification.CandidateReminder.Subject": [{ | |
| fn: "VisitCandidateReminder" | |
| }], | |
| "VisitNotification.CandidateReminder.Body": [{ | |
| fn: "VisitCandidateReminder" | |
| }], | |
| "VisitNotification.ParticipantConfirm.ReplyAddress": [{ | |
| fn: function (s, q, r) { | |
| if (r.VisitNotification.ParticipantConfirm.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!Bb.Validation.patterns.email.test(s)) { | |
| return h.P3.EmailError | |
| } | |
| } | |
| } | |
| }], | |
| "VisitNotification.ParticipantConfirm.FromName": [{ | |
| fn: "VisitParticipantConfirm" | |
| }], | |
| "VisitNotification.ParticipantConfirm.Subject": [{ | |
| fn: "VisitParticipantConfirm" | |
| }], | |
| "VisitNotification.ParticipantConfirm.Body": [{ | |
| fn: "VisitParticipantConfirm" | |
| }], | |
| "VisitNotification.ParticipantReminder.ReplyAddress": [{ | |
| fn: function (s, q, r) { | |
| if (r.VisitNotification.ParticipantReminder.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!Bb.Validation.patterns.email.test(s)) { | |
| return h.P3.EmailError | |
| } | |
| } | |
| } | |
| }], | |
| "VisitNotification.ParticipantReminder.FromName": [{ | |
| fn: "VisitParticipantReminder" | |
| }], | |
| "VisitNotification.ParticipantReminder.Subject": [{ | |
| fn: "VisitParticipantReminder" | |
| }], | |
| "VisitNotification.ParticipantReminder.ReminderOption": [{ | |
| fn: "VisitParticipantReminder" | |
| }], | |
| "VisitNotification.ParticipantReminder.Body": [{ | |
| fn: "VisitParticipantReminder" | |
| }], | |
| "InterviewNotification.CandidateConfirm.SendTo": [{ | |
| fn: "InterviewCandidateConfirm" | |
| }], | |
| "InterviewNotification.CandidateConfirm.ReplyAddress": [{ | |
| fn: function (s, q, r) { | |
| if (r.InterviewNotification.CandidateConfirm.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!Bb.Validation.patterns.email.test(s)) { | |
| return h.P3.EmailError | |
| } | |
| } | |
| } | |
| }], | |
| "InterviewNotification.CandidateConfirm.FromName": [{ | |
| fn: "InterviewCandidateConfirm" | |
| }], | |
| "InterviewNotification.CandidateConfirm.Subject": [{ | |
| fn: "InterviewCandidateConfirm" | |
| }], | |
| "InterviewNotification.CandidateConfirm.Body": [{ | |
| fn: "InterviewCandidateConfirm" | |
| }], | |
| "InterviewNotification.CandidateReminder.SendTo": [{ | |
| fn: "InterviewCandidateReminder" | |
| }], | |
| "InterviewNotification.CandidateReminder.ReplyAddress": [{ | |
| fn: function (s, q, r) { | |
| if (r.InterviewNotification.CandidateReminder.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!Bb.Validation.patterns.email.test(s)) { | |
| return h.P3.EmailError | |
| } | |
| } | |
| } | |
| }], | |
| "InterviewNotification.CandidateReminder.FromName": [{ | |
| fn: "InterviewCandidateReminder" | |
| }], | |
| "InterviewNotification.CandidateReminder.ReminderOption": [{ | |
| fn: "InterviewCandidateReminder" | |
| }], | |
| "InterviewNotification.CandidateReminder.Subject": [{ | |
| fn: "InterviewCandidateReminder" | |
| }], | |
| "InterviewNotification.CandidateReminder.Body": [{ | |
| fn: "InterviewCandidateReminder" | |
| }], | |
| "InterviewNotification.ParticipantConfirm.ReplyAddress": [{ | |
| fn: function (s, q, r) { | |
| if (r.InterviewNotification.ParticipantConfirm.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!Bb.Validation.patterns.email.test(s)) { | |
| return h.P3.EmailError | |
| } | |
| } | |
| } | |
| }], | |
| "InterviewNotification.ParticipantConfirm.FromName": [{ | |
| fn: "InterviewParticipantConfirm" | |
| }], | |
| "InterviewNotification.ParticipantConfirm.Subject": [{ | |
| fn: "InterviewParticipantConfirm" | |
| }], | |
| "InterviewNotification.ParticipantConfirm.Body": [{ | |
| fn: "InterviewParticipantConfirm" | |
| }], | |
| "InterviewNotification.ParticipantReminder.ReplyAddress": [{ | |
| fn: function (s, q, r) { | |
| if (r.InterviewNotification.ParticipantReminder.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!Bb.Validation.patterns.email.test(s)) { | |
| return h.P3.EmailError | |
| } | |
| } | |
| } | |
| }], | |
| "InterviewNotification.ParticipantReminder.FromName": [{ | |
| fn: "InterviewParticipantReminder" | |
| }], | |
| "InterviewNotification.ParticipantReminder.ReminderOption": [{ | |
| fn: "InterviewParticipantReminder" | |
| }], | |
| "InterviewNotification.ParticipantReminder.Subject": [{ | |
| fn: "InterviewParticipantReminder" | |
| }], | |
| "InterviewNotification.ParticipantReminder.Body": [{ | |
| fn: "InterviewParticipantReminder" | |
| }], | |
| "SelfSchedulingVisit.SelfScheduleNum": [{ | |
| fn: function (t, q, r) { | |
| var s = this; | |
| if (r.SelfSchedulingVisit.AllowSelfSchedule && r.SelfSchedulingVisit.ControlSelfSchedule) { | |
| if (p.isEmptier(t)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (Bb.Validation.validators.pattern(t, q, "digits", s)) { | |
| return h.P3.DigitError | |
| } | |
| if (Bb.Validation.validators.max(t, q, 365, s)) { | |
| return "Maximum value is 365" | |
| } | |
| } | |
| } | |
| }], | |
| "SelfSchedulingVisit.SelfScheduleOpeningsNum": [{ | |
| fn: function (t, q, r) { | |
| var s = this; | |
| if (r.SelfSchedulingVisit.AllowSelfSchedule && r.SelfSchedulingVisit.ControlSelfScheduleOpenings) { | |
| if (p.isEmptier(t)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (Bb.Validation.validators.pattern(t, q, "digits", s)) { | |
| return h.P3.DigitError | |
| } | |
| if (Bb.Validation.validators.max(t, q, 365, s)) { | |
| return "Maximum value is 365" | |
| } | |
| } | |
| } | |
| }], | |
| "SelfSchedulingInterview.SelfScheduleNum": [{ | |
| fn: function (t, q, r) { | |
| var s = this; | |
| if (r.SelfSchedulingInterview.AllowSelfSchedule && r.SelfSchedulingInterview.ControlSelfSchedule) { | |
| if (p.isEmptier(t)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (Bb.Validation.validators.pattern(t, q, "digits", s)) { | |
| return h.P3.DigitError | |
| } | |
| if (Bb.Validation.validators.max(t, q, 365, s)) { | |
| return "Maximum value is 365" | |
| } | |
| } | |
| } | |
| }], | |
| "SelfSchedulingInterview.SelfScheduleOpeningsNum": [{ | |
| fn: function (t, q, r) { | |
| var s = this; | |
| if (r.SelfSchedulingInterview.AllowSelfSchedule && r.SelfSchedulingInterview.ControlSelfScheduleOpenings) { | |
| if (p.isEmptier(t)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (Bb.Validation.validators.pattern(t, q, "digits", s)) { | |
| return h.P3.DigitError | |
| } | |
| if (Bb.Validation.validators.max(t, q, 365, s)) { | |
| return "Maximum value is 365" | |
| } | |
| } | |
| } | |
| }], | |
| "SelfSchedulingNotification.ReplyAddress": [{ | |
| fn: function (s, q, r) { | |
| if (r.SelfSchedulingNotification.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!Bb.Validation.patterns.email.test(s)) { | |
| return h.P3.EmailError | |
| } | |
| } | |
| } | |
| }], | |
| "SelfSchedulingNotification.FromName": [{ | |
| fn: "SelfSchedulingNotification" | |
| }], | |
| "SelfSchedulingNotification.Subject": [{ | |
| fn: "SelfSchedulingNotification" | |
| }], | |
| "SelfSchedulingNotification.Body": [{ | |
| fn: "SelfSchedulingNotification" | |
| }], | |
| "SelfReSchedulingNotification.ReplyAddress": [{ | |
| fn: function (s, q, r) { | |
| if (r.SelfReSchedulingNotification.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!Bb.Validation.patterns.email.test(s)) { | |
| return h.P3.EmailError | |
| } | |
| } | |
| } | |
| }], | |
| "SelfReSchedulingNotification.FromName": [{ | |
| fn: "SelfReSchedulingNotification" | |
| }], | |
| "SelfReSchedulingNotification.Subject": [{ | |
| fn: "SelfReSchedulingNotification" | |
| }], | |
| "SelfReSchedulingNotification.Body": [{ | |
| fn: "SelfReSchedulingNotification" | |
| }], | |
| "SelfSchedulingCancellationNotification.ReplyAddress": [{ | |
| fn: function (s, q, r) { | |
| if (r.SelfSchedulingCancellationNotification.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!Bb.Validation.patterns.email.test(s)) { | |
| return h.P3.EmailError | |
| } | |
| } | |
| } | |
| }], | |
| "SelfSchedulingCancellationNotification.FromName": [{ | |
| fn: "SelfSchedulingCancellationNotification" | |
| }], | |
| "SelfSchedulingCancellationNotification.Subject": [{ | |
| fn: "SelfSchedulingCancellationNotification" | |
| }], | |
| "SelfSchedulingCancellationNotification.Body": [{ | |
| fn: "SelfSchedulingCancellationNotification" | |
| }] | |
| }, | |
| VisitCandidateConfirm: function (s, q, r) { | |
| if (r.VisitNotification.CandidateConfirm.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, | |
| VisitCandidateReminder: function (s, q, r) { | |
| if (r.VisitNotification.CandidateReminder.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, | |
| VisitParticipantConfirm: function (s, q, r) { | |
| if (r.VisitNotification.ParticipantConfirm.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, | |
| VisitParticipantReminder: function (s, q, r) { | |
| if (r.VisitNotification.ParticipantReminder.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, | |
| InterviewCandidateConfirm: function (s, q, r) { | |
| if (r.InterviewNotification.CandidateConfirm.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, | |
| InterviewCandidateReminder: function (s, q, r) { | |
| if (r.InterviewNotification.CandidateReminder.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, | |
| InterviewParticipantConfirm: function (s, q, r) { | |
| if (r.InterviewNotification.ParticipantConfirm.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, | |
| InterviewParticipantReminder: function (s, q, r) { | |
| if (r.InterviewNotification.ParticipantReminder.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, | |
| SelfSchedulingNotification: function (s, q, r) { | |
| if (r.SelfSchedulingNotification.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, | |
| SelfReSchedulingNotification: function (s, q, r) { | |
| if (r.SelfReSchedulingNotification.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, | |
| SelfSchedulingCancellationNotification: function (s, q, r) { | |
| if (r.SelfSchedulingCancellationNotification.Active) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, | |
| url: function () { | |
| return aP + "AdmScheduling/Settings" | |
| } | |
| }); | |
| a.Ms.Opening = Bbm.extend({ | |
| idAttribute: "OpeningDetailId", | |
| validation: { | |
| Date: [{ | |
| fn: function (s, q, r) { | |
| if (r.Occurrence === "single" && p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }], | |
| StartTime: [{ | |
| fn: function (s, q, r) { | |
| if (r.Occurrence === "single") { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!this.isStartEndTimeValid(s, r.EndTime)) { | |
| return "Please enter valid start and end times" | |
| } | |
| } | |
| } | |
| }], | |
| EndTime: [{ | |
| fn: function (s, q, r) { | |
| if (r.Occurrence === "single") { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!this.isStartEndTimeValid(r.StartTime, s)) { | |
| return "Please enter valid start and end times" | |
| } | |
| } | |
| } | |
| }], | |
| "Recurrence.StartTimeDisplay": [{ | |
| fn: function (s, q, r) { | |
| if (r.Occurrence === "multiple") { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!this.isStartEndTimeValid(s, r.Recurrence.EndTimeDisplay)) { | |
| return "Please enter valid start and end times" | |
| } | |
| } | |
| } | |
| }], | |
| "Recurrence.EndTimeDisplay": [{ | |
| fn: function (s, q, r) { | |
| if (r.Occurrence === "multiple") { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!this.isStartEndTimeValid(r.Recurrence.StartTimeDisplay, s)) { | |
| return "Please enter valid start and end times" | |
| } | |
| } | |
| } | |
| }], | |
| VisitTypeId: [{ | |
| fn: function (s, q, r) { | |
| if (p.isEmptier(r.InterviewTypeId) && p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }], | |
| InterviewTypeId: [{ | |
| fn: function (s, q, r) { | |
| if (p.isEmptier(r.VisitTypeId) && p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }], | |
| Grades: [{ | |
| fn: function (t, q, r) { | |
| var s = _.some(t, function (u) { | |
| return u.Selected | |
| }); | |
| if (!s) { | |
| p3.Us.InfoMessage.ErrorBox("Please select a School/grade level.", ".modal-body", false); | |
| $(".modal-body").animate({ | |
| scrollTop: 0 | |
| }, "fast"); | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }], | |
| SlotsAvailable: [{ | |
| required: true, | |
| msg: h.P3.RequiredInfoNotEntered | |
| }, { | |
| range: [1, 100], | |
| msg: "Number of openings must be between 1 and 100" | |
| }] | |
| }, | |
| isStartEndTimeValid: function (v, r) { | |
| var s = true, | |
| u = c.getDateString(new Date()), | |
| t, q; | |
| if (v && r) { | |
| t = c.getDate(u + " " + v); | |
| q = c.getDate(u + " " + r); | |
| s = t.getTime() < q.getTime() | |
| } | |
| return s | |
| }, | |
| url: function () { | |
| if (this.attributes.Occurrence === "single") { | |
| return this.id ? aP + "AdmScheduling/Opening/" + this.id : aP + "AdmScheduling/Opening" | |
| } | |
| if (this.attributes.Occurrence === "multiple") { | |
| return this.attributes.OpeningId ? aP + "AdmScheduling/OpeningSeries/" + this.attributes.OpeningId : aP + "AdmScheduling/Opening" | |
| } | |
| } | |
| }); | |
| a.Ms.Visit = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "VisitId", | |
| validation: { | |
| Date: [{ | |
| fn: function (s, q, r) { | |
| if ($(".custom-opening-holder:visible").length > 0) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!p3.Us.Culture.isDate(s)) { | |
| return h.P3.DateError.fixDateFormat() | |
| } | |
| } | |
| } | |
| }], | |
| StartTime: [{ | |
| fn: function (s, q, r) { | |
| if ($(".custom-opening-holder:visible").length > 0 && p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }], | |
| VisitDate: [{ | |
| date: true | |
| }, { | |
| fn: function (u, q, r) { | |
| if (r.OpeningDetailId && r.OpeningDetail) { | |
| var t = c.getDate(r.OpeningDetail.StartDate), | |
| s = c.getDate(r.OpeningDetail.EndDate), | |
| v = c.getDate(u); | |
| if (v < t || v >= s) { | |
| return "Please select a visit start time within the opening period.x" | |
| } | |
| } | |
| } | |
| }], | |
| OpeningDetailId: [{ | |
| fn: function (s, q, r) { | |
| if (r.SelfScheduleInd) { | |
| if (p.isEmptier(r.VisitDate)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } else { | |
| if ($(".available-opening-holder:visible").length > 0 && p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| } | |
| }], | |
| "VisitType.VisitTypeId": [{ | |
| required: true, | |
| msg: h.P3.RequiredInfoNotEntered | |
| }], | |
| ProspectInstanceId: [{ | |
| required: true, | |
| msg: h.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| getTypeObject: function () { | |
| return this.get("VisitType") || {} | |
| }, | |
| getScheduledDate: function () { | |
| return this.get("VisitDate") | |
| }, | |
| setScheduledDate: function (q) { | |
| this.set("VisitDate", q) | |
| }, | |
| url: function () { | |
| return this.id ? aP + "Admissions/ProspectVisit/" + this.id + "/" : aP + "Admissions/ProspectVisit/" | |
| } | |
| }); | |
| a.Ms.Interview = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "InterviewId", | |
| validation: { | |
| Date: [{ | |
| fn: function (s, q, r) { | |
| if ($(".custom-opening-holder:visible").length > 0) { | |
| if (p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| if (!p3.Us.Culture.isDate(s)) { | |
| return h.P3.DateError.fixDateFormat() | |
| } | |
| } | |
| } | |
| }], | |
| StartTime: [{ | |
| fn: function (s, q, r) { | |
| if ($(".custom-opening-holder:visible").length > 0 && p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }], | |
| InterviewDate: [{ | |
| date: true | |
| }, { | |
| fn: function (v, q, r) { | |
| if (r.OpeningDetailId && r.OpeningDetail) { | |
| var u = c.getDate(r.OpeningDetail.StartDate), | |
| s = c.getDate(r.OpeningDetail.EndDate), | |
| t = c.getDate(v); | |
| if (t < u || t >= s) { | |
| return "Please select an interview start time within the opening period." | |
| } | |
| } | |
| } | |
| }], | |
| OpeningDetailId: [{ | |
| fn: function (s, q, r) { | |
| if (r.SelfScheduleInd) { | |
| if (p.isEmptier(r.InterviewDate)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } else { | |
| if ($(".available-opening-holder:visible").length > 0 && p.isEmptier(s)) { | |
| return h.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| } | |
| }], | |
| "InterviewType.InterviewTypeId": [{ | |
| required: true, | |
| msg: h.P3.RequiredInfoNotEntered | |
| }], | |
| ProspectInstanceId: [{ | |
| required: true, | |
| msg: h.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| getTypeObject: function () { | |
| return this.get("InterviewType") || {} | |
| }, | |
| getScheduledDate: function () { | |
| return this.get("InterviewDate") | |
| }, | |
| setScheduledDate: function (q) { | |
| this.set("InterviewDate", q) | |
| }, | |
| url: function () { | |
| return this.id ? aP + "Admissions/ProspectInterview/" + this.id + "/" : aP + "Admissions/ProspectInterview/" | |
| } | |
| }); | |
| a.Ms.CandidateSnapshot = Bbm.extend({ | |
| url: function () { | |
| return this.id ? aP + "AdmScheduling/CandidateSnapshot/" + this.id + "/" : aP + "AdmScheduling/CandidateSnapshot/" | |
| } | |
| }); | |
| a.Ms.Activity = Bbm.extend({ | |
| validation: { | |
| StartTime: [{ | |
| required: true, | |
| msg: h.P3.RequiredInfoNotEntered | |
| }], | |
| EndTime: [{ | |
| required: true, | |
| msg: h.P3.RequiredInfoNotEntered | |
| }], | |
| Activity: [{ | |
| required: true, | |
| msg: h.P3.RequiredInfoNotEntered | |
| }] | |
| } | |
| }); | |
| a.Ms.Participant = Bbm.extend({ | |
| validation: { | |
| ParticipantUserId: [{ | |
| required: true, | |
| msg: h.P3.RequiredInfoNotEntered | |
| }], | |
| ParticipantTypeId: [{ | |
| required: true, | |
| msg: h.P3.RequiredInfoNotEntered | |
| }] | |
| } | |
| }); | |
| a.Ms.ChecklistVisit = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "VisitId", | |
| url: function () { | |
| if (this.get("MyDay")) { | |
| return this.id ? aP + "AdmScheduling/AgendaParticipantVisit/" + this.id + "/" : aP + "AdmScheduling/AgendaParticipantVisit/" | |
| } | |
| return this.id ? aP + "Admissions/ParentProspectVisit/" + this.id + "/" : aP + "Admissions/ParentProspectVisit/" | |
| } | |
| }); | |
| a.Ms.ChecklistInterview = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "InterviewId", | |
| url: function () { | |
| if (this.get("MyDay")) { | |
| return this.id ? aP + "AdmScheduling/AgendaParticipantInterview/" + this.id + "/" : aP + "AdmScheduling/AgendaParticipantInterview/" | |
| } | |
| return this.id ? aP + "Admissions/ParentProspectInterview/" + this.id + "/" : aP + "Admissions/ParentProspectInterview/" | |
| } | |
| }); | |
| a.Cs.GradeLevels = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/OnlineFormGradeLevels" | |
| } | |
| }); | |
| a.Cs.ProspectInstanceIds = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/ProspectInstanceIdsGet/" | |
| } | |
| }); | |
| a.Cs.OpeningAvailable = Bbc.extend({ | |
| sync: b.DataParamSync, | |
| model: a.Ms.Opening, | |
| url: function () { | |
| return aP + "AdmScheduling/OpeningAvailable/" | |
| } | |
| }); | |
| a.Cs.Candidates = Bbc.extend({ | |
| url: function () { | |
| return aP + "AdmScheduling/ProspectSearch" | |
| } | |
| }); | |
| a.Cs.CandidateParents = Bbc.extend({ | |
| url: function () { | |
| return aP + "AdmScheduling/ProspectParents" | |
| } | |
| }); | |
| a.Cs.Locations = Bbc.extend({ | |
| url: function () { | |
| return aP + "dorm/allrooms" | |
| } | |
| }); | |
| a.Cs.Participants = Bbc.extend({ | |
| url: function () { | |
| return aP + "AdmScheduling/ParticipantSearch" | |
| } | |
| }); | |
| a.Cs.MyDaySchedules = Bbc.extend({ | |
| sync: b.DataParamSync, | |
| url: function () { | |
| return aP + "schedule/MyDayCalendarStudentList/" | |
| } | |
| }); | |
| a.Data.ReminderOptions = [{ | |
| dd_id: 1, | |
| dd_description: "1 Day before" | |
| }, { | |
| dd_id: 2, | |
| dd_description: "2 Days before" | |
| }, { | |
| dd_id: 3, | |
| dd_description: "3 Days before" | |
| }, { | |
| dd_id: 4, | |
| dd_description: "4 Days before" | |
| }, { | |
| dd_id: 5, | |
| dd_description: "5 Days before" | |
| }, { | |
| dd_id: 6, | |
| dd_description: "6 Days before" | |
| }, { | |
| dd_id: 7, | |
| dd_description: "7 Days before" | |
| }]; | |
| a.Data.ViewConfigs = { | |
| Visit: { | |
| AppointmentType: "Visit", | |
| AppointmentTypeLower: "visit", | |
| Template: "admscheduling/admscheduling.visit.edit.template.html", | |
| AccompanyTemplate: "admscheduling/admscheduling.visit.edit.basics.accompany.template.html", | |
| HasAgenda: true, | |
| DateName: "VisitDate", | |
| ApptTypePath: "VisitType.VisitTypeId", | |
| ApptTypeIdName: "VisitTypeId", | |
| ApptTypeIdLowerName: "visitTypeId", | |
| DataCollectionTypeId: "12", | |
| BasicsView: { | |
| template: "admscheduling/admscheduling.visit.edit.basics.template.html" | |
| }, | |
| NotesView: { | |
| template: "admscheduling/admscheduling.visit.edit.notes.template.html" | |
| } | |
| }, | |
| VisitSelfSchedule: { | |
| AppointmentType: "Visit", | |
| AppointmentTypeLower: "visit", | |
| Template: "admscheduling/admscheduling.visit.selfschedule.edit.template.html", | |
| AccompanyTemplate: "admscheduling/admscheduling.visit.edit.basics.accompany.template.html", | |
| HasAgenda: false, | |
| DateName: "VisitDate", | |
| ApptTypePath: "VisitType.VisitTypeId", | |
| ApptTypeIdName: "VisitTypeId", | |
| ApptTypeIdLowerName: "visitTypeId", | |
| DataCollectionTypeId: "12", | |
| BasicsView: { | |
| template: "admscheduling/admscheduling.visit.edit.basics.template.html" | |
| } | |
| }, | |
| Interview: { | |
| AppointmentType: "Interview", | |
| AppointmentTypeLower: "interview", | |
| Template: "admscheduling/admscheduling.interview.edit.template.html", | |
| AccompanyTemplate: "admscheduling/admscheduling.interview.edit.basics.accompany.template.html", | |
| HasAgenda: true, | |
| DateName: "InterviewDate", | |
| ApptTypePath: "InterviewType.InterviewTypeId", | |
| ApptTypeIdName: "InterviewTypeId", | |
| ApptTypeIdLowerName: "interviewTypeId", | |
| DataCollectionTypeId: "7", | |
| BasicsView: { | |
| template: "admscheduling/admscheduling.interview.edit.basics.template.html" | |
| }, | |
| NotesView: { | |
| template: "admscheduling/admscheduling.interview.edit.notes.template.html" | |
| } | |
| }, | |
| InterviewSelfSchedule: { | |
| AppointmentType: "Interview", | |
| AppointmentTypeLower: "interview", | |
| Template: "admscheduling/admscheduling.interview.selfschedule.edit.template.html", | |
| AccompanyTemplate: "admscheduling/admscheduling.interview.edit.basics.accompany.template.html", | |
| HasAgenda: false, | |
| DateName: "InterviewDate", | |
| ApptTypePath: "InterviewType.InterviewTypeId", | |
| ApptTypeIdName: "InterviewTypeId", | |
| ApptTypeIdLowerName: "interviewTypeId", | |
| DataCollectionTypeId: "7", | |
| BasicsView: { | |
| template: "admscheduling/admscheduling.interview.edit.basics.template.html" | |
| } | |
| } | |
| }; | |
| a.Vs.Settings = l.Vs.Modal2.extend({ | |
| template: "admscheduling/admscheduling.settings.template.html", | |
| size: "lg", | |
| modalRendered: function () { | |
| var q = this; | |
| q.candidateSnapshotView = new a.Vs.CandidateSnapshot({ | |
| model: q.model | |
| }); | |
| p3.rV(q.candidateSnapshotView, q.$("#tab1"), true); | |
| q.selfSchedulingView = new a.Vs.SelfScheduling({ | |
| model: q.model | |
| }); | |
| p3.rV(q.selfSchedulingView, q.$("#tab2"), true); | |
| q.activityTemplatesView = new a.Vs.ActivityTemplates({ | |
| model: q.model | |
| }); | |
| p3.rV(q.activityTemplatesView, q.$("#tab3"), true); | |
| q.visitNotificationsView = new a.Vs.NotificationGroup({ | |
| data: q.model.get("VisitNotification"), | |
| notifSetup: { | |
| title: "Visit", | |
| participantName: "Participant", | |
| path: "VisitNotification" | |
| } | |
| }); | |
| p3.rV(q.visitNotificationsView, q.$("#tab4"), true); | |
| q.interviewNotificationsView = new a.Vs.NotificationGroup({ | |
| data: q.model.get("InterviewNotification"), | |
| notifSetup: { | |
| title: "Interview", | |
| participantName: "Participant", | |
| path: "InterviewNotification" | |
| } | |
| }); | |
| p3.rV(q.interviewNotificationsView, q.$("#tab5"), true) | |
| }, | |
| modalUpdated: function (r) { | |
| var q = this; | |
| q.updateNotificationLabel(q.$("#visit-candidate-confirm"), q.model.get("VisitNotification").CandidateConfirm.Active); | |
| q.updateNotificationLabel(q.$("#visit-candidate-reminder"), q.model.get("VisitNotification").CandidateReminder.Active); | |
| q.updateNotificationLabel(q.$("#visit-participant-confirm"), q.model.get("VisitNotification").ParticipantConfirm.Active); | |
| q.updateNotificationLabel(q.$("#visit-participant-reminder"), q.model.get("VisitNotification").ParticipantReminder.Active); | |
| q.updateNotificationLabel(q.$("#interview-candidate-confirm"), q.model.get("InterviewNotification").CandidateConfirm.Active); | |
| q.updateNotificationLabel(q.$("#interview-candidate-reminder"), q.model.get("InterviewNotification").CandidateReminder.Active); | |
| q.updateNotificationLabel(q.$("#interview-participant-confirm"), q.model.get("InterviewNotification").ParticipantConfirm.Active); | |
| q.updateNotificationLabel(q.$("#interview-participant-reminder"), q.model.get("InterviewNotification").ParticipantReminder.Active) | |
| }, | |
| updateNotificationLabel: function (q, r) { | |
| if (r) { | |
| q.siblings(".active-label").find(".label").removeClass("label-warning").addClass("label-success").html("Active") | |
| } else { | |
| q.siblings(".active-label").find(".label").removeClass("label-success").addClass("label-warning").html("Inactive") | |
| } | |
| }, | |
| modalSave: function () { | |
| var r = this, | |
| q; | |
| q = r.model.isValid(true); | |
| r.tabToggleError("#tab1", q); | |
| r.tabToggleError("#tab2", q); | |
| r.tabToggleError("#tab3", q); | |
| r.tabToggleError("#tab4", q); | |
| r.tabToggleError("#tab5", q) | |
| }, | |
| tabToggleError: function (u, s) { | |
| var t = this, | |
| v = !s, | |
| q = t.$('[data-target="' + u + '"]'), | |
| r = t.$(u); | |
| if (!s) { | |
| v = r.find(".box-validate").length > 0 | |
| } | |
| q.closest("li").toggleClass("box-validate", v) | |
| } | |
| }); | |
| a.Vs.CandidateSnapshot = Bb.View.extend({ | |
| template: "admscheduling/admscheduling.settings.candidatesnapshot.template.html", | |
| render: function (q) { | |
| var r = this; | |
| $(q).html(r.el); | |
| r.renderData() | |
| }, | |
| renderData: function () { | |
| var q = this; | |
| p3.fT(q.template, function (r) { | |
| q.$el.html(r({ | |
| model: q.model.toJSON() | |
| })); | |
| a.Us.SetModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| } | |
| }); | |
| a.Vs.SelfScheduling = Bb.View.extend({ | |
| render: function (q) { | |
| this.$el.appendTo(q); | |
| p3.rV(new a.Vs.SelfSchedulingSettings({ | |
| label: "Visit", | |
| data: this.model.get("SelfSchedulingVisit") | |
| }), this.$el, false); | |
| p3.rV(new a.Vs.SelfSchedulingSettings({ | |
| label: "Interview", | |
| data: this.model.get("SelfSchedulingInterview") | |
| }), this.$el, false); | |
| p3.rV(new a.Vs.SelfSchedulingNotification({ | |
| data: this.model.get("SelfSchedulingNotification"), | |
| notifSetup: { | |
| title: "Admin notification - Self-schedule confirmation", | |
| path: "SelfSchedulingNotification" | |
| } | |
| }), this.$el, false); | |
| p3.rV(new a.Vs.SelfSchedulingNotification({ | |
| data: this.model.get("SelfReSchedulingNotification"), | |
| notifSetup: { | |
| title: "Admin notification - Self-reschedule confirmation", | |
| path: "SelfReSchedulingNotification" | |
| } | |
| }), this.$el, false); | |
| p3.rV(new a.Vs.SelfSchedulingNotification({ | |
| data: this.model.get("SelfSchedulingCancellationNotification"), | |
| notifSetup: { | |
| title: "Admin notification - Self-schedule cancellations", | |
| path: "SelfSchedulingCancellationNotification" | |
| } | |
| }), this.$el, false) | |
| } | |
| }); | |
| a.Vs.SelfSchedulingSettings = Bb.View.extend({ | |
| template: "admscheduling/admscheduling.settings.selfschedulingsettings.template.html", | |
| tagName: "section", | |
| className: "bb-tile", | |
| events: { | |
| 'click [data-action="collapse"]': "clickCollapseSettings", | |
| 'click [name="SelfSchedulingVisit.ControlSelfSchedule"]': "updateSelfScheduleStartDate", | |
| 'click [name="SelfSchedulingInterview.ControlSelfSchedule"]': "updateSelfScheduleStartDate", | |
| 'click [name="SelfSchedulingVisit.ControlSelfScheduleOpenings"]': "updateSelfScheduleDateRange", | |
| 'click [name="SelfSchedulingInterview.ControlSelfScheduleOpenings"]': "updateSelfScheduleDateRange" | |
| }, | |
| render: function (q) { | |
| var r = this; | |
| p3.fT(r.template, function (s) { | |
| if (!r.options.data.ControlSelfSchedule) { | |
| r.options.data.SelfScheduleNum = 0 | |
| } | |
| if (!r.options.data.ControlSelfScheduleOpenings) { | |
| r.options.data.SelfScheduleOpeningsNum = 180 | |
| } | |
| r.$el.html(s({ | |
| label: r.options.label, | |
| data: r.options.data | |
| })); | |
| r.clickCollapseSettings(); | |
| a.Us.SetModalHeight(p3.Layout.Containers.Modal) | |
| }); | |
| r.$el.appendTo(q) | |
| }, | |
| updateSelfScheduleStartDate: function (s) { | |
| var t = this, | |
| r = $(s.currentTarget), | |
| q = t.$('[name="SelfScheduling' + t.options.label + '.SelfScheduleNum"]'); | |
| if (r.is(":checked")) { | |
| q.val("").prop("disabled", false) | |
| } else { | |
| q.val(0).prop("disabled", true) | |
| } | |
| l.Us.setPropByString(t.options.data, "SelfScheduleNum", q.val()) | |
| }, | |
| updateSelfScheduleDateRange: function (s) { | |
| var t = this, | |
| r = $(s.currentTarget), | |
| q = t.$('[name="SelfScheduling' + t.options.label + '.SelfScheduleOpeningsNum"]'); | |
| if (r.is(":checked")) { | |
| q.val("").prop("disabled", false) | |
| } else { | |
| q.val(180).prop("disabled", true) | |
| } | |
| l.Us.setPropByString(t.options.data, "SelfScheduleOpeningsNum", q.val()) | |
| }, | |
| clickCollapseSettings: function () { | |
| var q = this; | |
| q.$(".collapse").collapse(q.$('[data-value="show-detail"]').is(":checked") ? "show" : "hide") | |
| } | |
| }); | |
| a.Vs.SelfSchedulingNotification = Bb.View.extend({ | |
| template: "admscheduling/admscheduling.settings.selfschedulingnotification.template.html", | |
| tagName: "section", | |
| className: "bb-tile", | |
| render: function (q) { | |
| var r = this; | |
| p3.fT(r.template, function (s) { | |
| r.$el.html(s({ | |
| title: r.options.notifSetup.title, | |
| path: r.options.notifSetup.path | |
| })); | |
| p3.rV(new a.Vs.Notification({ | |
| data: r.options.data, | |
| notifSetup: r.options.notifSetup | |
| }), r.$("#notification-settings"), true); | |
| r.recipientView = new g.Vs.NotifyRecipients({ | |
| model: new Bbm({ | |
| AdminRecipients: r.options.data.AdminRecipients | |
| }) | |
| }); | |
| r.recipientView.on("recipientsUpdated", function (t) { | |
| r.options.data.AdminRecipients = this.model.get("AdminRecipients") | |
| }); | |
| p3.rV(r.recipientView, r.$("#notification-recipients"), true); | |
| if (!r.options.data.Active) { | |
| r.$(".bb-tile-content").collapse("hide") | |
| } | |
| a.Us.SetModalHeight(p3.Layout.Containers.Modal) | |
| }); | |
| r.$el.appendTo(q) | |
| } | |
| }); | |
| a.Vs.ActivityTemplates = Bb.View.extend({ | |
| template: "admscheduling/admscheduling.settings.activitytemplates.template.html", | |
| render: function (q) { | |
| var r = this; | |
| $(q).html(r.el); | |
| r.renderData() | |
| }, | |
| renderData: function () { | |
| var q = this; | |
| p3.fT(q.template, function (r) { | |
| q.$el.html(r({})); | |
| a.Us.SetModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| } | |
| }); | |
| a.Vs.NotificationGroup = Bb.View.extend({ | |
| template: "admscheduling/admscheduling.settings.notification.group.template.html", | |
| initialize: function (q) { | |
| var r = this; | |
| r.notifSetup = r.options.notifSetup || {}; | |
| r.data = r.options.data || {} | |
| }, | |
| render: function (q) { | |
| var r = this; | |
| $(q).html(r.el); | |
| r.renderData() | |
| }, | |
| renderData: function () { | |
| var q = this; | |
| p3.fT(q.template, function (r) { | |
| q.$el.html(r({ | |
| notifSetup: q.notifSetup, | |
| candidateConfirmActive: q.data.CandidateConfirm.Active, | |
| candidateReminderActive: q.data.CandidateReminder.Active, | |
| participantConfirmActive: q.data.ParticipantConfirm.Active, | |
| participantReminderActive: q.data.ParticipantReminder.Active | |
| })); | |
| q.renderNotificationGroup() | |
| }) | |
| }, | |
| renderNotificationGroup: function () { | |
| var u = this, | |
| q = "#" + u.notifSetup.title.toLowerCase() + "-candidate-confirm", | |
| r = "#" + u.notifSetup.title.toLowerCase() + "-candidate-reminder", | |
| s = "#" + u.notifSetup.title.toLowerCase() + "-participant-confirm", | |
| t = "#" + u.notifSetup.title.toLowerCase() + "-participant-reminder"; | |
| u.candidateConfirmView = new a.Vs.Notification({ | |
| data: u.data.CandidateConfirm, | |
| notifSetup: $.extend({}, u.notifSetup, { | |
| path: u.notifSetup.path + ".CandidateConfirm" | |
| }) | |
| }); | |
| p3.rV(u.candidateConfirmView, u.$(q), true); | |
| u.candidateReminderView = new a.Vs.Notification({ | |
| data: u.data.CandidateReminder, | |
| notifSetup: $.extend({}, u.notifSetup, { | |
| path: u.notifSetup.path + ".CandidateReminder" | |
| }) | |
| }); | |
| p3.rV(u.candidateReminderView, u.$(r), true); | |
| u.participantConfirmView = new a.Vs.Notification({ | |
| data: u.data.ParticipantConfirm, | |
| notifSetup: $.extend({}, u.notifSetup, { | |
| path: u.notifSetup.path + ".ParticipantConfirm" | |
| }) | |
| }); | |
| p3.rV(u.participantConfirmView, u.$(s), true); | |
| u.participantReminderView = new a.Vs.Notification({ | |
| data: u.data.ParticipantReminder, | |
| notifSetup: $.extend({}, u.notifSetup, { | |
| path: u.notifSetup.path + ".ParticipantReminder" | |
| }) | |
| }); | |
| p3.rV(u.participantReminderView, u.$(t), true) | |
| } | |
| }); | |
| a.Vs.Notification = Bb.View.extend({ | |
| template: "admscheduling/admscheduling.settings.notification.template.html", | |
| events: { | |
| "click button.placeholder": "addPlaceholder" | |
| }, | |
| render: function (q) { | |
| var r = this; | |
| $(q).html(r.el); | |
| r.renderData() | |
| }, | |
| renderData: function () { | |
| var q = this; | |
| p3.fT(q.template, function (r) { | |
| q.$el.html(r({ | |
| Notification: q.options.data, | |
| SettingsProperty: q.options.notifSetup.path, | |
| placeholders: g.Us.toPlaceholderArray(q.options.data.Placeholders), | |
| reminderOptions: a.Data.ReminderOptions | |
| })); | |
| a.Us.SetModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| addPlaceholder: function (s) { | |
| s.preventDefault(); | |
| var y = this, | |
| v = "[" + $(s.currentTarget).data("value") + "]", | |
| q = y.$(".notify-body"), | |
| u = q.val(), | |
| t = q[0], | |
| x = "", | |
| w = 0, | |
| r = 0; | |
| if (t.selectionStart || t.selectionStart === 0) { | |
| w = t.selectionStart; | |
| r = t.selectionEnd; | |
| x = u.substring(0, w) + v + u.substring(r, u.length) | |
| } else { | |
| x = v | |
| } | |
| q.val(x).focus().trigger($.Event("change")); | |
| t.selectionStart = w + v.length; | |
| t.selectionEnd = w + v.length | |
| } | |
| }); | |
| a.Vs.VisitNotifications = Bb.View.extend({ | |
| template: "admscheduling/admscheduling.settings.visitnotifications.template.html", | |
| render: function (q) { | |
| var r = this; | |
| $(q).html(r.el); | |
| r.renderData() | |
| }, | |
| renderData: function () { | |
| var q = this; | |
| p3.fT(q.template, function (r) { | |
| q.$el.html(r({})); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| } | |
| }); | |
| a.Vs.InterviewNotifications = Bb.View.extend({ | |
| template: "admscheduling/admscheduling.settings.interviewnotifications.template.html", | |
| render: function (q) { | |
| var r = this; | |
| $(q).html(r.el); | |
| r.renderData() | |
| }, | |
| renderData: function () { | |
| var q = this; | |
| p3.fT(q.template, function (r) { | |
| q.$el.html(r({})); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| } | |
| }); | |
| a.Vs.AddOpening = l.Vs.Modal2.extend({ | |
| template: "admscheduling/admscheduling.opening.template.html", | |
| size: "md", | |
| modalRendered: function () { | |
| d.Us.initialize(".date-input", { | |
| maxDate: "+1y", | |
| minDate: 0 | |
| }); | |
| n.Us.initialize(".time-input") | |
| }, | |
| modalUpdate: function (y) { | |
| var x = this, | |
| v = y.eventCurrentTarget.data("gradeid"), | |
| w = x.model.get("Grades"), | |
| z = y.eventCurrentTarget.prop("name"), | |
| s = y.eventCurrentTarget.children("input"), | |
| r = x.$(".occurrence-single-holder"), | |
| q = x.$(".occurrence-multiple-holder"), | |
| t, u; | |
| if (v && w) { | |
| t = _.findWhere(w, { | |
| GradeId: v | |
| }); | |
| if (t) { | |
| _.defer(function () { | |
| t.Selected = y.eventCurrentTarget.hasClass("active") | |
| }); | |
| return false | |
| } | |
| } | |
| if (z === "Date" || z === "StartTime" || z === "EndTime") { | |
| u = x.$('[name="Date"]').val(); | |
| x.model.set({ | |
| StartDate: u + " " + x.$('[name="StartTime"]').val(), | |
| EndDate: u + " " + x.$('[name="EndTime"]').val() | |
| }) | |
| } | |
| if (z === "Recurrence.StartDateDisplay" || z === "Recurrence.StartTimeDisplay" || z === "Recurrence.EndTimeDisplay") { | |
| u = x.$('[name="Recurrence.StartDateDisplay"]').val(); | |
| l.Us.setPropsByString(x.model.attributes, { | |
| "Recurrence.StartDate": u + " " + x.$('[name="Recurrence.StartTimeDisplay"]').val(), | |
| "Recurrence.EndDate": u + " " + x.$('[name="Recurrence.EndTimeDisplay"]').val() | |
| }) | |
| } | |
| if (s.prop("name") === "Recurrence.frequency") { | |
| a.Us.ToggleRecurHolder(x, s.val()); | |
| return false | |
| } | |
| if (s.prop("name") === "Occurrence") { | |
| if (s.val() === "single") { | |
| r.show(); | |
| q.hide() | |
| } else { | |
| if (s.val() === "multiple") { | |
| r.hide(); | |
| q.show() | |
| } | |
| } | |
| } | |
| }, | |
| modalSave: function () { | |
| var r = this, | |
| s = true, | |
| q; | |
| r.$(".modal-body #infomessage-error").remove(); | |
| if (r.model.get("Occurrence") === "multiple") { | |
| s = f.Us.BuildRecurrencePattern(r.model, r); | |
| if (!s) { | |
| q = r.errorMessage; | |
| r.errorMessage = null; | |
| p3.Us.InfoMessage.ErrorBox(q, ".modal-body", false); | |
| r.scrollTo(); | |
| return false | |
| } | |
| } | |
| }, | |
| modalSavedSuccess: function () { | |
| if (this.options.refresh) { | |
| this.options.refresh.call() | |
| } else { | |
| $("#fullCalView").fullCalendar("refetchEvents") | |
| } | |
| }, | |
| modalSavedError: function () { | |
| p3.Us.InfoMessage.ErrorBox("Error saving opening", ".modal-body", false) | |
| } | |
| }); | |
| a.Vs.EditOpening = l.Vs.Modal2.extend({ | |
| template: "admscheduling/admscheduling.opening.edit.template.html", | |
| size: "md", | |
| events: { | |
| "click .occurrence": "toggleOccurrence", | |
| "click .delete": "deleteOpening" | |
| }, | |
| modalRendered: function () { | |
| var q = this, | |
| r = q.model.get("Recurrence"); | |
| d.Us.initialize(".date-input", { | |
| maxDate: "+1y", | |
| minDate: 0 | |
| }); | |
| n.Us.initialize(".time-input"); | |
| if (r) { | |
| a.Us.ToggleRecurHolder(q, r.frequency) | |
| } | |
| }, | |
| modalUpdate: function (w) { | |
| var v = this, | |
| t = w.eventCurrentTarget.data("gradeid"), | |
| u = v.model.get("Grades"), | |
| x = w.eventCurrentTarget.prop("name"), | |
| q = w.eventCurrentTarget.children("input"), | |
| r, s; | |
| if (t && u) { | |
| r = _.findWhere(u, { | |
| GradeId: t | |
| }); | |
| if (r) { | |
| _.defer(function () { | |
| r.Selected = w.eventCurrentTarget.hasClass("active") | |
| }); | |
| return false | |
| } | |
| } | |
| if (x === "Date" || x === "StartTime" || x === "EndTime") { | |
| s = v.$('[name="Date"]').val(); | |
| v.model.set({ | |
| StartDate: s + " " + v.$('[name="StartTime"]').val(), | |
| EndDate: s + " " + v.$('[name="EndTime"]').val() | |
| }) | |
| } | |
| if (x === "Recurrence.StartDateDisplay" || x === "Recurrence.StartTimeDisplay" || x === "Recurrence.EndTimeDisplay") { | |
| s = v.$('[name="Recurrence.StartDateDisplay"]').val(); | |
| l.Us.setPropsByString(v.model.attributes, { | |
| "Recurrence.StartDate": s + " " + v.$('[name="Recurrence.StartTimeDisplay"]').val(), | |
| "Recurrence.EndDate": s + " " + v.$('[name="Recurrence.EndTimeDisplay"]').val() | |
| }) | |
| } | |
| if (q.prop("name") === "Recurrence.frequency") { | |
| a.Us.ToggleRecurHolder(v, q.val()); | |
| return false | |
| } | |
| }, | |
| modalSave: function () { | |
| var r = this, | |
| s = true, | |
| q; | |
| r.$(".modal-body #infomessage-error").remove(); | |
| if (r.model.get("Occurrence") === "multiple") { | |
| s = f.Us.BuildRecurrencePattern(r.model, r); | |
| if (!s) { | |
| q = r.errorMessage; | |
| r.errorMessage = null; | |
| p3.Us.InfoMessage.ErrorBox(q, ".modal-body", false); | |
| r.scrollTo(); | |
| return false | |
| } | |
| } | |
| }, | |
| modalSavedSuccess: function () { | |
| if (this.options.refresh) { | |
| this.options.refresh.call() | |
| } else { | |
| $("#fullCalView").fullCalendar("refetchEvents") | |
| } | |
| }, | |
| modalSavedError: function () { | |
| p3.Us.InfoMessage.ErrorBox("Error saving opening", ".modal-body", false) | |
| }, | |
| toggleOccurrence: function (x) { | |
| var z = this, | |
| q = z.$(".bb-dialog-header"), | |
| s = z.$(".occurrence"), | |
| u = z.$(".occurrence-single-holder"), | |
| t = z.$(".occurrence-multiple-holder"), | |
| v = z.$(".occurrence-toggle"), | |
| r = z.$(".delete"), | |
| A = z.model.get("StartDate"), | |
| w = z.model.get("EndDate"), | |
| y = !!z.model.get("RecurrencePattern"); | |
| if (z.model.get("Occurrence") === "single") { | |
| z.model.set({ | |
| Occurrence: "multiple" | |
| }); | |
| q.text(z.options.variables.seriesTitle); | |
| s.text("Edit occurrence"); | |
| u.hide(); | |
| t.show(); | |
| v.attr("disabled", false); | |
| r.text("Delete series").toggle(y); | |
| if (!y) { | |
| if (A) { | |
| z.$("#rdoDaily").prop("checked", true).change(); | |
| z.$('input[name="Recurrence.StartDateDisplay"]').val(c.getDateString(new Date(A))).change(); | |
| z.$('input[name="Recurrence.StartTimeDisplay"]').val(c.getTimeString(new Date(A))).change(); | |
| if (w) { | |
| z.$('input[name="Recurrence.EndTimeDisplay"]').val(c.getTimeString(new Date(w))).change() | |
| } | |
| } | |
| } | |
| } else { | |
| if (z.model.get("Occurrence") === "multiple") { | |
| z.model.set({ | |
| Occurrence: "single" | |
| }); | |
| q.text(z.options.variables.title); | |
| s.text((y ? "Edit" : "Add") + " series"); | |
| u.show(); | |
| t.hide(); | |
| v.attr("disabled", y); | |
| r.text("Delete occurrence").show() | |
| } | |
| } | |
| }, | |
| deleteOpening: function () { | |
| var q = this; | |
| a.Us.DeleteOpening(q.model, function () { | |
| if (q.options.refresh) { | |
| q.options.refresh.call() | |
| } else { | |
| $("#fullCalView").fullCalendar("refetchEvents") | |
| } | |
| }) | |
| } | |
| }); | |
| a.Vs.EditAppointment = l.Vs.Modal2.extend({ | |
| size: "lg", | |
| events: { | |
| "keyup textarea.counter-input": "updateCharacterCounter", | |
| "click form .bb-select-field-single": "showSelector", | |
| 'change select[name="ChecklistItemId"]': "toggleChecklistStatus", | |
| "click .delete-appt": "deleteAppointment" | |
| }, | |
| modalInitialized: function (r) { | |
| var q = this; | |
| q.viewConfig = r.modalView.options.viewConfig || {}; | |
| q.proto.template = q.viewConfig.Template; | |
| q.filterByGrade = []; | |
| q.appLocation = window.location.hash.toLowerCase().indexOf("candidateview") > -1 ? "candidateview" : window.location.hash.toLowerCase().indexOf("candidate") > -1 ? "candidate" : window.location.hash.toLowerCase().indexOf("visitinterview") > -1 ? "visitinterview" : window.location.hash.toLowerCase().indexOf("dashboard") > -1 ? "dashboard" : "calendar"; | |
| q.OpeningAvailable = new a.Cs.OpeningAvailable(); | |
| _.bindAll(q, "renderProspect") | |
| }, | |
| modalRendered: function () { | |
| var q = this; | |
| q.basicsView = new a.Vs.Basics({ | |
| model: q.model, | |
| viewConfig: q.viewConfig.BasicsView, | |
| dictionaries: q.options.dictionaries, | |
| parent: q | |
| }); | |
| p3.rV(q.basicsView, q.$("#tab1"), true); | |
| if (q.viewConfig.HasAgenda) { | |
| q.agendaView = new a.Vs.Agenda({ | |
| model: q.model, | |
| dictionaries: q.options.dictionaries, | |
| parent: q | |
| }); | |
| p3.rV(q.agendaView, q.$("#tab2"), true) | |
| } | |
| if (q.viewConfig.NotesView) { | |
| q.notesView = new a.Vs.Notes({ | |
| model: q.model, | |
| viewConfig: q.viewConfig.NotesView, | |
| dictionaries: q.options.dictionaries, | |
| parent: q | |
| }); | |
| p3.rV(q.notesView, q.$("#tab3"), true) | |
| } | |
| }, | |
| modalUpdate: function (v) { | |
| var u = this, | |
| r = v.eventCurrentTarget, | |
| w = r.prop("name"), | |
| x = r.val(), | |
| t, q, s = { | |
| prospectInstanceId: u.model.get("ProspectInstanceId"), | |
| selfScheduleInd: u.model.get("SelfScheduleInd"), | |
| checklistItemId: u.model.get("ChecklistItemId") | |
| }; | |
| s[u.viewConfig.ApptTypeIdLowerName] = x; | |
| if (r.hasClass("sub-collection")) { | |
| return false | |
| } | |
| if (w === "Date" || w === "StartTime") { | |
| t = u.$('[name="Date"]').val(); | |
| u.model.attributes[u.viewConfig.DateName] = t + " " + u.$('[name="StartTime"]').val() | |
| } | |
| if (w === "ScheduledTime") { | |
| u.fieldValid("ScheduledTime"); | |
| u.model.attributes[u.viewConfig.DateName] = u.model.get("ScheduledDate") + " " + r.val(); | |
| if (!u.model.isValid(u.viewConfig.DateName)) { | |
| u.fieldInvalid("ScheduledTime", "Please select a start time within the opening period.") | |
| } | |
| } | |
| if (w === u.viewConfig.ApptTypePath) { | |
| u.clearOpeningSelection(); | |
| if (!p.isEmptier(x) && !p.isEmptier(u.model.get("ProspectInstanceId"))) { | |
| u.$(".scheduled-opening-select").show(); | |
| u.$(".scheduled-opening-empty").hide(); | |
| u.OpeningAvailable.fetch({ | |
| cache: false, | |
| data: s, | |
| success: function () { | |
| if (u.OpeningAvailable.length > 0) { | |
| u.$(".available-opening-holder").show(); | |
| u.$(".available-opening-holder-empty").hide() | |
| } else { | |
| u.$(".available-opening-holder").hide(); | |
| u.$(".available-opening-holder-empty").show() | |
| } | |
| } | |
| }) | |
| } else { | |
| u.$(".scheduled-opening-select").hide(); | |
| u.$(".scheduled-opening-empty").show() | |
| } | |
| } | |
| if (w === "FirstName") { | |
| _.findWhere(u.model.get("AccompanyingAdults"), { | |
| _tempid: r.data("tempid") | |
| }).FirstName = x; | |
| return false | |
| } | |
| if (w === "LastName") { | |
| _.findWhere(u.model.get("AccompanyingAdults"), { | |
| _tempid: r.data("tempid") | |
| }).LastName = x; | |
| return false | |
| } | |
| if (w === "Email") { | |
| _.findWhere(u.model.get("AccompanyingAdults"), { | |
| _tempid: r.data("tempid") | |
| }).Email = x; | |
| return false | |
| } | |
| if (w === "AccompanyingAdultId") { | |
| u.updateAccompany(); | |
| return false | |
| } | |
| if (r.hasClass("accompany-remove")) { | |
| r.parents(".accompanying-adult").find('[name="AccompanyingAdultId"]').val(""); | |
| u.updateAccompany(); | |
| return false | |
| } | |
| if (r.hasClass("accompany-add")) { | |
| u.$(".accompany-new-holder").show(); | |
| u.$(".accompany-add").hide() | |
| } | |
| if (w === "ProspectInstanceId") { | |
| return false | |
| } | |
| if (r.hasClass("toggle-opening-holder")) { | |
| u.$(".scheduled-opening-holder").toggle(); | |
| q = u.$(".custom-opening-holder"); | |
| q.toggle(); | |
| if (q.is(":visible")) { | |
| u.clearOpeningSelection() | |
| } | |
| } | |
| }, | |
| modalSave: function () { | |
| var r = this, | |
| q = r.model.isValid(true); | |
| _.each(r.$(".accompany-selected-holder"), function (t) { | |
| var s = $(t); | |
| if (s.find('[name="AccompanyingAdultId"]').val() === "-1") { | |
| if (p.isEmptier(s.find('[name="FirstName"]').val())) { | |
| s.find('[name="FirstName"]').addClass("box-validate"); | |
| q = true | |
| } else { | |
| s.find('[name="FirstName"]').removeClass("box-validate") | |
| } | |
| if (p.isEmptier(s.find('[name="LastName"]').val())) { | |
| s.find('[name="LastName"]').addClass("box-validate"); | |
| q = true | |
| } else { | |
| s.find('[name="LastName"]').removeClass("box-validate") | |
| } | |
| if (p.isEmptier(s.find('[name="Email"]').val()) || !Bb.Validation.patterns.email.test(s.find('[name="Email"]').val())) { | |
| s.find('[name="Email"]').addClass("box-validate"); | |
| q = true | |
| } else { | |
| s.find('[name="Email"]').removeClass("box-validate") | |
| } | |
| } | |
| }); | |
| r.tabToggleError("#tab1", q); | |
| r.tabToggleError("#tab2", q); | |
| r.tabToggleError("#tab3", q); | |
| if (!q) { | |
| return false | |
| } | |
| }, | |
| tabToggleError: function (u, s) { | |
| var t = this, | |
| v = !s, | |
| q = t.$('[data-target="' + u + '"]'), | |
| r = t.$(u); | |
| if (!s) { | |
| v = r.find(".box-validate").length > 0 | |
| } | |
| q.closest("li").toggleClass("box-validate", v) | |
| }, | |
| modalSavedSuccess: function () { | |
| var q = this; | |
| if (q.appLocation === "calendar") { | |
| $("#fullCalView").fullCalendar("refetchEvents") | |
| } else { | |
| if (q.appLocation === "dashboard") { | |
| $("#sort-table").trigger("refreshData") | |
| } else { | |
| if (q.appLocation === "candidateview") { | |
| $("#checklistHeader").trigger("refreshData") | |
| } else { | |
| if (q.appLocation === "visitinterview") { | |
| $(".visitinterview-worklist-refresh").trigger("refreshData") | |
| } else { | |
| $(".candidate-header").parent().parent().trigger("renderdata") | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| deleteAppointment: function () { | |
| var q = this; | |
| a.Us.DeleteAppointment(q.model, true) | |
| }, | |
| updateCharacterCounter: function (r) { | |
| var s = this, | |
| q = s.$(r.currentTarget); | |
| q.siblings().find(".characterCounter").html(q.val().length); | |
| if (q.val().length > 4000) { | |
| q.siblings().find(".characterCounter").addClass("badge-important") | |
| } else { | |
| q.siblings().find(".characterCounter").removeClass("badge-important") | |
| } | |
| }, | |
| showSelector: function () { | |
| var r = this, | |
| q; | |
| q = l.Vs.Modal2.extend({ | |
| template: "admscheduling/admscheduling.appointment.edit.basics.opening.template.html", | |
| model: r.model, | |
| dictionaries: { | |
| OpeningAvailable: r.OpeningAvailable.toJSON() | |
| }, | |
| events: { | |
| "click .clear": "clearSelection" | |
| }, | |
| subModal: true, | |
| modalUpdate: function (s) { | |
| var t = s.eventCurrentTarget.data("id"); | |
| if (s.eventCurrentTarget.hasClass("bb-checklist-list-row")) { | |
| if (t) { | |
| r.model.set({ | |
| OpeningDetailId: t | |
| }) | |
| } else { | |
| r.model.unset("OpeningDetailId") | |
| } | |
| r.model.setScheduledDate(); | |
| r.renderOpeningSelection(); | |
| l.Us.showMainModal(); | |
| p3.setModalHeight(p3.Layout.Containers.Modal); | |
| return false | |
| } | |
| }, | |
| modalCancel: function (s) { | |
| l.Us.showMainModal(); | |
| p3.setModalHeight(p3.Layout.Containers.Modal); | |
| return false | |
| }, | |
| clearSelection: function () { | |
| r.clearOpeningSelection(); | |
| l.Us.showMainModal(); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| } | |
| }); | |
| l.Us.showSubModal(); | |
| p3.rV(new q(), $(".modal .modal-sub"), true) | |
| }, | |
| clearOpeningSelection: function () { | |
| var q = this; | |
| q.model.unset("OpeningDetailId"); | |
| q.model.unset("OpeningDetail"); | |
| q.model.unset("ScheduledDate"); | |
| q.$('[name="OpeningDetailId"] .bb-select-field-single-title').html('<span class="bb-select-field-single-title-placeholder">Select a value</span>') | |
| }, | |
| renderOpeningSelection: function () { | |
| var s = this, | |
| t = s.model.get("OpeningDetailId"), | |
| u = t ? s.OpeningAvailable.get(t) : s.OpeningAvailable.find(function (w) { | |
| return w.get("OpeningDetailId") === t | |
| }), | |
| v = s.model.getScheduledDate() || u.get("StartDate"), | |
| r = u.get("EndDate"), | |
| q = s.$(".scheduled-opening-holder"); | |
| s.model.set({ | |
| ScheduledDate: c.getDateString(v) | |
| }); | |
| s.model.attributes[s.viewConfig.DateName] = v; | |
| s.model.set({ | |
| OpeningDetail: u.toJSON() | |
| }); | |
| q.find('input[name="ScheduledTime"]').val(c.getTimeString(c.getDate(v))); | |
| s.$('[name="OpeningDetailId"] .bb-select-field-single-title').text(c.displayDate(v, "abbrDay") + " " + c.displayDate(v) + " " + c.displayTime(v) + " - " + c.displayTime(r)); | |
| if (t) { | |
| s.filterByGrade = _.chain(s.model.attributes.OpeningDetail.Grades).where({ | |
| Selected: true | |
| }).pluck("GradeId").value() | |
| } | |
| }, | |
| initializeAutoComplete: function () { | |
| var t = this, | |
| q = t.$('[name="ProspectInstanceId"]'), | |
| r, s, v, u; | |
| q.autocomplete({ | |
| userAll: null, | |
| minLength: 2, | |
| previousSearch: "", | |
| source: function (w, x) { | |
| r = this; | |
| if (r.options.userAll === null) { | |
| r.options.userAll = new a.Cs.Candidates() | |
| } | |
| r.fetchComplete = function (y) { | |
| r.previous = q.prop("value"); | |
| s = new RegExp($.ui.autocomplete.escapeRegex(this.term), "i"); | |
| x($.map(y.models, function (z) { | |
| v = ""; | |
| u = true; | |
| if (t.model.get("OpeningDetailId")) { | |
| if (!_.contains(t.filterByGrade, z.attributes.EnteringGradeId)) { | |
| u = false | |
| } | |
| } | |
| if (u) { | |
| if (z.attributes.FirstName !== "") { | |
| v += z.attributes.FirstName | |
| } | |
| if (z.attributes.LastName !== "") { | |
| v += " " + z.attributes.LastName | |
| } | |
| if (z.attributes.EnteringYear !== "") { | |
| v += " (" + z.attributes.EnteringYear + ")" | |
| } | |
| z.attributes.SearchString = v; | |
| if (z.attributes.SearchString.match(s)) { | |
| return { | |
| value: v, | |
| obj: z | |
| } | |
| } | |
| } | |
| })) | |
| }; | |
| if ((r.options.userAll.length === 0) || (q.prop("value").slice(0, 2) !== r.previous.slice(0, 2))) { | |
| r.options.userAll.fetch({ | |
| data: { | |
| searchText: q.prop("value").slice(0, 2) | |
| }, | |
| success: function (y) { | |
| r.fetchComplete(y) | |
| } | |
| }) | |
| } else { | |
| r.fetchComplete(r.options.userAll) | |
| } | |
| }, | |
| select: function (w, x) { | |
| t.model.set({ | |
| ProspectInstanceId: x.item.obj.get("ProspectInstanceId") | |
| }); | |
| t.renderProspect() | |
| } | |
| }); | |
| q.focus(function () { | |
| var w = $(this); | |
| if (w.val().length > 1) { | |
| w.autocomplete("search") | |
| } | |
| }) | |
| }, | |
| updateAccompany: function () { | |
| var r = this, | |
| s = true, | |
| t, q = _.clone(r.model.get("AccompanyingAdults")); | |
| r.model.set({ | |
| AccompanyingAdults: [] | |
| }); | |
| _.each(r.$('[name="AccompanyingAdultId"]'), function (w) { | |
| var u = $(w), | |
| x = o.stringToInt(u.val()), | |
| v = o.stringToInt(u.data("id")); | |
| if (p.isEmptier(u.val())) { | |
| s = false | |
| } else { | |
| if (u.val() === "-1") { | |
| t = u.data("tempid"); | |
| if (t) { | |
| r.model.get("AccompanyingAdults").push({ | |
| _tempid: t, | |
| UserId: -1, | |
| FirstName: r.$('[name="FirstName"][data-tempid="' + t + '"]').val(), | |
| LastName: r.$('[name="LastName"][data-tempid="' + t + '"]').val(), | |
| Email: r.$('[name="Email"][data-tempid="' + t + '"]').val() | |
| }) | |
| } else { | |
| r.model.get("AccompanyingAdults").push({ | |
| _tempid: _.uniqueId("_tempid_"), | |
| UserId: -1, | |
| FirstName: "", | |
| LastName: "", | |
| Email: "" | |
| }) | |
| } | |
| } else { | |
| if (v) { | |
| r.model.get("AccompanyingAdults").push(_.findWhere(q, { | |
| AccompanyingAdultId: v | |
| })) | |
| } else { | |
| r.model.get("AccompanyingAdults").push(_.findWhere(r.CandidateParents.toJSON(), { | |
| UserId: x | |
| })) | |
| } | |
| } | |
| } | |
| }); | |
| if (s) { | |
| r.$(".accompany-add-holder").show() | |
| } else { | |
| r.$(".accompany-add-holder").hide() | |
| } | |
| r.refreshAccompany() | |
| }, | |
| refreshAccompany: function () { | |
| var q = this, | |
| r = _.chain(q.model.get("AccompanyingAdults")).filter(function (s) { | |
| return s.UserId > 0 | |
| }).pluck("UserId").value(); | |
| p3.fT(q.viewConfig.AccompanyTemplate, function (s) { | |
| q.$(".accompanying-holder").html(s({ | |
| accompanyingAdults: q.model.get("AccompanyingAdults"), | |
| candidateParents: q.CandidateParents.toJSON(), | |
| usedCandidateParents: r | |
| })) | |
| }) | |
| }, | |
| renderProspect: function () { | |
| var s = this, | |
| t = { | |
| ADMCandidateDataCollectionStatuses: { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| id: 128, | |
| keyName: "item_status_id", | |
| valueName: "item_status_desc", | |
| inputParam: "data_collection_type_id=" + s.viewConfig.DataCollectionTypeId + "[i]" | |
| } | |
| } | |
| }, | |
| q = s.model.get("ChecklistItemId"), | |
| r = s.model.get("ChecklistItemStatus"); | |
| if (s.model.get("ProspectInstanceId")) { | |
| t.ADMChecklistStep = { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| id: 127, | |
| keyName: "checklist_item_id", | |
| valueName: "checklist_item_description", | |
| inputParam: "prospect_instance_id=" + s.model.get("ProspectInstanceId") + "[i],data_collection_type_id=" + s.viewConfig.DataCollectionTypeId + "[i]" + (s.model.id ? ",data_collection_pk=" + s.model.id + "[i]" : "") | |
| } | |
| }; | |
| if (s.appLocation === "calendar" || s.appLocation === "visitinterview") { | |
| t.CandidateSnapshot = { | |
| data: new a.Ms.CandidateSnapshot({ | |
| HomeAddress: {}, | |
| CandidateUser: {} | |
| }), | |
| dataParams: { | |
| id: s.model.get("ProspectInstanceId") | |
| } | |
| } | |
| } | |
| t.CandidateParents = { | |
| data: new a.Cs.CandidateParents(), | |
| dataParams: { | |
| id: s.model.get("ProspectInstanceId") | |
| } | |
| } | |
| } | |
| i.Us.Fetch(t, function (w, y, x) { | |
| var u = s.$('select[name="ChecklistItemId"]'), | |
| v = s.$('select[name="ChecklistItemStatus"]'), | |
| z, A = s.model.getTypeObject(); | |
| if (w.CandidateSnapshot) { | |
| z = w.CandidateSnapshot.get("HomeAddress"); | |
| if (z) { | |
| z.State = z.State || z.StateShort; | |
| z.Zip = z.Zip || z.ZipCode; | |
| z.AddressFull = o.addressFormat(z, false) | |
| } | |
| w.CandidateSnapshot.get("CandidateUser").NameFull = o.userNameFormat(w.CandidateSnapshot.get("CandidateUser"), 'F "N" L'); | |
| w.CandidateSnapshot.get("CandidateUser").Age = c.getAgeString(w.CandidateSnapshot.get("CandidateUser").BirthDate); | |
| p3.fT("admscheduling/admscheduling.visit.edit.basics.snapshot.template.html", function (B) { | |
| s.$(".snapshot-holder").html(B({ | |
| model: w.CandidateSnapshot.toJSON() | |
| })); | |
| a.Us.SetModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| } | |
| if (!p.isEmptier(A.VisitTypeId || A.InterviewTypeId)) { | |
| s.$(".scheduled-opening-select").show(); | |
| s.$(".scheduled-opening-empty").hide(); | |
| s.OpeningAvailable.fetch({ | |
| cache: false, | |
| data: { | |
| visitTypeId: A.VisitTypeId, | |
| interviewTypeId: A.InterviewTypeId, | |
| prospectInstanceId: s.model.get("ProspectInstanceId"), | |
| openingDetailId: s.model.get("OpeningDetailId"), | |
| selfScheduleInd: s.model.get("SelfScheduleInd"), | |
| checklistItemId: s.model.get("ChecklistItemId") | |
| }, | |
| success: function (B) { | |
| if (B.length > 0) { | |
| s.$(".available-opening-holder").show(); | |
| s.$(".available-opening-holder-empty").hide(); | |
| if (s.model.get("OpeningDetailId") || s.model.get("SelfScheduleInd")) { | |
| s.renderOpeningSelection() | |
| } | |
| } else { | |
| s.$(".available-opening-holder").hide(); | |
| s.$(".available-opening-holder-empty").show() | |
| } | |
| s.toggleScheduleHolder(); | |
| a.Us.SetModalHeight(p3.Layout.Containers.Modal) | |
| } | |
| }) | |
| } else { | |
| s.$(".scheduled-opening-select").hide(); | |
| s.$(".scheduled-opening-empty").show() | |
| } | |
| s.CandidateParents = w.CandidateParents || new a.Cs.CandidateParents(); | |
| s.$(".accompanying-holder").show(); | |
| s.$(".accompanying-holder-empty").hide(); | |
| s.refreshAccompany(); | |
| if (w.ADMChecklistStep && w.ADMChecklistStep.length) { | |
| s.$(".checklist-item").show(); | |
| u.empty().append($("<option />").val("").text("-- Select an Option --")); | |
| _.each(w.ADMChecklistStep, function (B) { | |
| u.append($("<option />").val(B.dd_id).text(B.dd_description).prop("selected", (B.dd_id === q))) | |
| }); | |
| v.empty().append($("<option />").val("").text("-- Select an Option --")); | |
| _.each(w.ADMCandidateDataCollectionStatuses, function (B) { | |
| v.append($("<option />").val(B.dd_id).text(B.dd_description).prop("selected", (B.dd_id === r))) | |
| }); | |
| u.change(); | |
| if (s.model.get("SelfScheduleInd")) { | |
| s.$("#checklist-name").html(_.findWhere(w.ADMChecklistStep, { | |
| dd_id: q | |
| }).dd_description) | |
| } | |
| } | |
| a.Us.SetModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| toggleChecklistStatus: function (q) { | |
| var r = this; | |
| if ($(q.target).prop("value") == "") { | |
| r.$('select[name="ChecklistItemStatus"]').val(""); | |
| r.$(".checklist-status").hide() | |
| } else { | |
| r.$(".checklist-status").show() | |
| } | |
| }, | |
| toggleScheduleHolder: function () { | |
| var s = this, | |
| q = !!s.model.get("OpeningDetailId"), | |
| r = !!s.model.getScheduledDate(), | |
| t = s.model.get("SelfScheduleInd"); | |
| if (q || !r || t) { | |
| s.$(".scheduled-opening-holder").toggle(true); | |
| s.$(".custom-opening-holder").toggle(false) | |
| } else { | |
| s.$(".scheduled-opening-holder").toggle(false); | |
| s.$(".custom-opening-holder").toggle(true) | |
| } | |
| } | |
| }); | |
| a.Vs.DeleteAppointment = l.Vs.Modal2.extend({ | |
| template: "admscheduling/admscheduling.appointment.delete.template.html", | |
| events: { | |
| "shown.bs.collapse #send-official-note": "showCollapse", | |
| "hidden.bs.collapse #send-official-note": "hideCollapse" | |
| }, | |
| modalInitialized: function () { | |
| this.options.variables = { | |
| labelDelete: (!this.model.get("SelfScheduleInd") && this.model.get("ChecklistItemStatus") === 2) ? "Decline" : "Delete", | |
| labelType: (this.model.has("VisitId")) ? "Visit" : "Interview", | |
| hasComposeAccess: p3.Data.Context.findByTaskId(53186) | |
| }; | |
| this.appLocation = window.location.hash.toLowerCase().indexOf("candidateview") > -1 ? "candidateview" : window.location.hash.toLowerCase().indexOf("candidate") > -1 ? "candidate" : window.location.hash.toLowerCase().indexOf("visitinterview") > -1 ? "visitinterview" : window.location.hash.toLowerCase().indexOf("dashboard") > -1 ? "dashboard" : "calendar" | |
| }, | |
| modalUpdate: function (q) { | |
| return false | |
| }, | |
| modalRendered: function () { | |
| var q = this; | |
| if (q.options.variables.hasComposeAccess) { | |
| k.PrepopulateData = q.model.get("ProspectUserId"); | |
| q.officialNote = new k.Vs.AdmissionsCompose({ | |
| hideModal: true, | |
| detailId: 0 | |
| }); | |
| p3.rV(q.officialNote, q.$("#send-official-note"), true) | |
| } | |
| }, | |
| modalSave: function () { | |
| var q = this; | |
| if (q.$('[name="send-official-note"]').is(":checked")) { | |
| q.officialNote.once("saveSuccess", q.deleteAppointment, this); | |
| q.officialNote.save({ | |
| target: { | |
| id: "send" | |
| } | |
| }) | |
| } else { | |
| q.deleteAppointment() | |
| } | |
| return false | |
| }, | |
| deleteAppointment: function () { | |
| var q = this; | |
| q.model.destroy({ | |
| dataParam: { | |
| prospectInstanceId: q.model.get("ProspectInstanceId"), | |
| selfScheduleInd: q.model.get("SelfScheduleInd") | |
| }, | |
| wait: true, | |
| success: function () { | |
| if (!_.has(q.model._events, "destroy")) { | |
| if (q.appLocation === "calendar") { | |
| $("#fullCalView").fullCalendar("refetchEvents") | |
| } else { | |
| if (q.appLocation === "dashboard") { | |
| $("#sort-table").trigger("refreshData") | |
| } else { | |
| if (q.appLocation === "candidateview") { | |
| $("#checklistHeader").trigger("refreshData") | |
| } else { | |
| if (q.appLocation === "visitinterview") { | |
| $(".visitinterview-worklist-refresh").trigger("refreshData") | |
| } else { | |
| $(".candidate-header").parent().parent().trigger("renderdata") | |
| } | |
| } | |
| } | |
| } | |
| } | |
| p3.Layout.Containers.Modal.modal("hide") | |
| }, | |
| error: function () { | |
| p3.displayError("Error deleting appointment") | |
| } | |
| }) | |
| }, | |
| modalCancel: function (q) { | |
| if (this.options.subModal) { | |
| l.Us.showMainModal(); | |
| p3.setModalHeight(p3.Layout.Containers.Modal); | |
| return false | |
| } | |
| }, | |
| showCollapse: function () { | |
| this.$(".save").html(this.options.variables.labelDelete + " & send official note") | |
| }, | |
| hideCollapse: function () { | |
| this.$(".save").html(this.options.variables.labelDelete) | |
| } | |
| }); | |
| a.Vs.Basics = Bb.View.extend({ | |
| initialize: function (q) { | |
| var r = this; | |
| r.viewConfig = q.viewConfig || {}; | |
| r.template = r.viewConfig.template | |
| }, | |
| render: function (q) { | |
| var r = this; | |
| $(q).html(r.el); | |
| r.renderData() | |
| }, | |
| renderData: function () { | |
| var s = this, | |
| q = s.model.getScheduledDate(), | |
| r = (s.options.parent.appLocation === "calendar" || (s.options.parent.appLocation === "visitinterview" && _.isNull(s.model.get("ProspectInstanceId")))); | |
| if (q) { | |
| q = new Date(q); | |
| s.model.set({ | |
| Date: c.getDateString(q), | |
| StartTime: c.getTimeString(q) | |
| }) | |
| } | |
| p3.fT(s.template, function (t) { | |
| s.$el.html(t({ | |
| model: s.model.toJSON(), | |
| dictionaries: s.options.dictionaries, | |
| id: s.model.id, | |
| showCandidate: r, | |
| viewConfig: s.viewConfig | |
| })); | |
| d.Us.initialize(".date-input", { | |
| yearRange: "-1:+1" | |
| }); | |
| n.Us.initialize(".time-input"); | |
| if (r) { | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.jQueryUI, function () { | |
| s.options.parent.initializeAutoComplete() | |
| }) | |
| } | |
| if (s.model.get("ProspectInstanceId") || s.model.get("OpeningDetailId")) { | |
| s.options.parent.renderProspect() | |
| } | |
| a.Us.SetModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| } | |
| }); | |
| a.Vs.Agenda = Bb.View.extend({ | |
| template: "admscheduling/admscheduling.appointment.edit.agenda.template.html", | |
| id: "agenda-main", | |
| events: { | |
| "click .add-activity": "addActivity", | |
| refreshactivities: "refreshActivities" | |
| }, | |
| render: function (q) { | |
| var r = this; | |
| $(q).html(r.el); | |
| r.renderData() | |
| }, | |
| renderData: function () { | |
| var q = this; | |
| p3.fT(q.template, function (r) { | |
| q.$el.html(r({ | |
| model: q.model.toJSON() | |
| })); | |
| q.refreshActivities() | |
| }) | |
| }, | |
| refreshActivities: function () { | |
| var r = this, | |
| q = r.$(".activity-list-holder"); | |
| q.empty(); | |
| if (!r.model.get("Agenda").Activities) { | |
| r.model.get("Agenda").Activities = [] | |
| } | |
| _.each(r.model.get("Agenda").Activities, function (s) { | |
| if (c.isDate(s.StartTime)) { | |
| s.StartTime = c.getTimeString(c.getDate(s.StartTime)) | |
| } | |
| s.Sort = c.displayTime(s.StartTime, null, "timeSpan") | |
| }); | |
| r.model.get("Agenda").Activities.sort(function (s, t) { | |
| return m.Us.naturalSort(s.Sort, t.Sort, "asc") | |
| }); | |
| if (r.model.get("Agenda").Activities.length) { | |
| _.each(r.model.get("Agenda").Activities, function (u, t) { | |
| if (!u.DeleteInd) { | |
| u._tempindex = t; | |
| if (!u.Participants) { | |
| u.Participants = [] | |
| } | |
| var s = new a.Vs.Activity({ | |
| model: new a.Ms.Activity(u), | |
| dictionaries: r.options.dictionaries, | |
| parent: r.options.parent | |
| }); | |
| p3.rV(s, q, false) | |
| } | |
| }) | |
| } else { | |
| q.html('<div class="bb-deemphasized mt-20">No activities scheduled</div>') | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }, | |
| addActivity: function () { | |
| var r = this, | |
| q = new a.Ms.Activity({ | |
| Participants: [] | |
| }); | |
| a.Us.EditActivity(r, q, r.model) | |
| } | |
| }); | |
| a.Vs.Activity = Bb.View.extend({ | |
| template: "admscheduling/admscheduling.appointment.edit.agenda.activity.template.html", | |
| className: "col-xs-12", | |
| events: { | |
| "click .edit-activity": "editActivity", | |
| "click .delete-activity": "deleteActivity" | |
| }, | |
| render: function (q) { | |
| var r = this; | |
| $(q).append(r.el); | |
| r.renderData() | |
| }, | |
| renderData: function () { | |
| var q = this; | |
| p3.fT(q.template, function (r) { | |
| q.$el.html(r({ | |
| model: q.model.toJSON(), | |
| dictionaries: q.options.dictionaries | |
| })); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| editActivity: function (q) { | |
| q.preventDefault(); | |
| q.stopPropagation(); | |
| var r = this; | |
| r.$(".dropdown").removeClass("open"); | |
| a.Us.EditActivity(r, r.model, r.options.parent.model) | |
| }, | |
| deleteActivity: function (r) { | |
| r.preventDefault(); | |
| r.stopPropagation(); | |
| var s = this, | |
| q; | |
| q = _.reject(s.options.parent.model.get("Agenda").Activities, function (u, t) { | |
| if (t === s.model.get("_tempindex")) { | |
| if (p.isEmptier(u.ActivityId)) { | |
| return true | |
| } | |
| u.DeleteInd = true | |
| } | |
| }); | |
| s.options.parent.model.get("Agenda").Activities = q; | |
| $("#agenda-main").trigger("refreshactivities") | |
| } | |
| }); | |
| a.Us.EditActivity = function (t, s, q) { | |
| var r; | |
| i.Us.Fetch({ | |
| ADMParticipantType: { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| id: 148, | |
| inputParam: "@" + t.options.parent.viewConfig.AppointmentTypeLower + "_ind=1[i]" | |
| } | |
| }, | |
| Locations: new a.Cs.Locations() | |
| }, function (u, w, v) { | |
| r = l.Vs.Modal2.extend({ | |
| template: "admscheduling/admscheduling.appointment.edit.agenda.editactivity.template.html", | |
| model: s, | |
| dictionaries: u, | |
| events: { | |
| "click .show-participant-add": "showParticipant", | |
| "click .cancel-participant": "hideParticipant", | |
| "click .save-participant": "saveParticipant", | |
| "click .remove-participant": "removeParticipant", | |
| "click .show-schedule": "showMyDaySchedule" | |
| }, | |
| subModal: true, | |
| modalInitialized: function () { | |
| var x = this; | |
| p3.fT("admscheduling/admscheduling.myday.schedule.template.html", function (y) { | |
| x.scheduleTemplateFunction = y | |
| }) | |
| }, | |
| modalDispose: function () { | |
| var x = this; | |
| x.disposePopover() | |
| }, | |
| modalRendered: function () { | |
| var x = this; | |
| x.refreshParticipants(); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.jQueryUI, function () { | |
| a.Us.AutoComplete(x.$('[name="ParticipantUserId"]'), new a.Cs.Participants(), "ParticipantName", function (y, z) { | |
| x.NewParticipant.set({ | |
| ParticipantUserId: z.item.obj.get("ParticipantUserId") | |
| }); | |
| x.NewParticipant.set({ | |
| ParticipantName: z.item.obj.get("ParticipantName") | |
| }); | |
| a.Us.GetMyDaySchedule(z.item.obj.get("ParticipantUserId"), q.get("Date"), function (A) { | |
| if (A && A.length) { | |
| x.NewParticipant.set({ | |
| HasSchedule: true, | |
| MyDaySchedule: A | |
| }); | |
| x.$(".participant-add-holder .student-schedule-holder").show() | |
| } | |
| }) | |
| }); | |
| a.Us.AutoComplete(x.$('[name="BuildingRoomId"]'), new a.Cs.Locations(), "FullName", function (y, z) { | |
| x.model.set({ | |
| BuildingRoomId: z.item.obj.get("BuildingRoomId") | |
| }) | |
| }) | |
| }); | |
| n.Us.initialize(".time-input"); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.AutoSize, function () { | |
| x.$("textarea").autosize() | |
| }); | |
| _.each(x.$("textarea.counter-input"), function (y) { | |
| $(y).trigger($.Event("keyup")) | |
| }); | |
| $(document).on("click.AdmSchedule", function (y) { | |
| if ($(y.target).closest(".popover").length === 0) { | |
| x.closePopover() | |
| } | |
| }); | |
| $("#site-modal").one("hidden.bs.modal", function (y) { | |
| x.disposePopover() | |
| }) | |
| }, | |
| modalUpdate: function (y) { | |
| var z = this, | |
| x = y.eventCurrentTarget, | |
| A = x.prop("name"), | |
| B = x.val(); | |
| if (A === "ParticipantUserId") { | |
| return false | |
| } | |
| if (A === "BuildingRoomId") { | |
| return false | |
| } | |
| if (A === "ParticipantTypeId") { | |
| z.NewParticipant.set({ | |
| ParticipantTypeId: o.stringToInt(B) | |
| }); | |
| return false | |
| } | |
| }, | |
| modalCancel: function (x) { | |
| var y = this; | |
| y.disposePopover(); | |
| l.Us.showMainModal(); | |
| p3.setModalHeight(p3.Layout.Containers.Modal); | |
| return false | |
| }, | |
| modalSave: function (x) { | |
| var y = this; | |
| if (y.model.isValid(true)) { | |
| if (!p.isEmptier(y.model.get("_tempindex"))) { | |
| t.options.parent.model.get("Agenda").Activities[y.model.get("_tempindex")] = y.model.toJSON() | |
| } else { | |
| t.options.parent.model.get("Agenda").Activities.push(y.model.toJSON()) | |
| } | |
| y.disposePopover(); | |
| l.Us.showMainModal(); | |
| $("#agenda-main").trigger("refreshactivities") | |
| } | |
| return false | |
| }, | |
| showParticipant: function () { | |
| var x = this; | |
| x.NewParticipant = new a.Ms.Participant({ | |
| ParticipantId: null | |
| }); | |
| x.$(".show-participant-add").hide(); | |
| x.$(".participant-add-holder").show() | |
| }, | |
| hideParticipant: function () { | |
| var z = this, | |
| y = z.$('[name="ParticipantUserId"]'), | |
| x = z.$('[name="ParticipantTypeId"]'); | |
| y.val(""); | |
| x.val(""); | |
| y.removeClass("box-validate"); | |
| x.removeClass("box-validate"); | |
| z.$(".show-participant-add").show(); | |
| z.$(".participant-add-holder").hide(); | |
| z.$(".participant-add-holder .student-schedule-holder").hide() | |
| }, | |
| saveParticipant: function () { | |
| var A = this, | |
| z = A.$('[name="ParticipantUserId"]'), | |
| y = A.$('[name="ParticipantTypeId"]'), | |
| x = true; | |
| if (p.isEmptier(A.NewParticipant.get("ParticipantUserId"))) { | |
| z.val("") | |
| } else { | |
| z.val(A.NewParticipant.get("ParticipantName")) | |
| } | |
| if (p.isEmptier(z.val())) { | |
| z.addClass("box-validate"); | |
| x = false | |
| } else { | |
| z.removeClass("box-validate") | |
| } | |
| if (p.isEmptier(y.val())) { | |
| y.addClass("box-validate"); | |
| x = false | |
| } else { | |
| y.removeClass("box-validate") | |
| } | |
| if (x) { | |
| A.model.get("Participants").push(A.NewParticipant.toJSON()); | |
| A.hideParticipant(); | |
| A.refreshParticipants() | |
| } | |
| }, | |
| removeParticipant: function (x) { | |
| var z = this, | |
| y; | |
| y = _.reject(z.model.get("Participants"), function (A) { | |
| if (A.ParticipantUserId === z.$(x.currentTarget).data("userid")) { | |
| if (p.isEmptier(A.ParticipantId)) { | |
| return true | |
| } | |
| A.DeleteInd = true | |
| } | |
| }); | |
| z.model.set({ | |
| Participants: y | |
| }); | |
| z.refreshParticipants() | |
| }, | |
| refreshParticipants: function () { | |
| var A = this, | |
| x = A.$(".participant-holder"), | |
| z = A.model.get("Participants"), | |
| y = q.get("Date"); | |
| p3.fT("admscheduling/admscheduling.appointment.edit.agenda.editactivity.participants.template.html", function (B) { | |
| x.html(B({ | |
| model: A.model.toJSON(), | |
| dictionaries: u | |
| })); | |
| if (q.isNew() && y && z && z.length) { | |
| _.each(z, function (C) { | |
| if (!C.hasOwnProperty("HasSchedule")) { | |
| a.Us.GetMyDaySchedule(C.ParticipantUserId, y, function (D) { | |
| if (D && D.length) { | |
| C.HasSchedule = true; | |
| C.MyDaySchedule = D; | |
| A.$(".show-schedule[data-userid=" + C.ParticipantUserId + "]").closest(".student-schedule-holder").show() | |
| } else { | |
| C.HasSchedule = false | |
| } | |
| }) | |
| } | |
| }) | |
| } | |
| A.initPopover() | |
| }); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }, | |
| showMyDaySchedule: function (y) { | |
| y.preventDefault(); | |
| var A = this, | |
| x = $(y.currentTarget), | |
| z, B; | |
| A.closePopover(); | |
| if (x.parents(".participant-add-holder").length) { | |
| z = A.NewParticipant.toJSON() | |
| } else { | |
| B = x.data("userid"); | |
| z = _.findWhere(A.model.get("Participants"), { | |
| ParticipantUserId: B | |
| }) | |
| } | |
| if (z && z.HasSchedule) { | |
| A.scheduleParticipant = z; | |
| if (z.MyDaySchedule && z.MyDaySchedule.length) { | |
| _.defer(function () { | |
| x.popover("show") | |
| }) | |
| } else { | |
| a.Us.GetMyDaySchedule(z.ParticipantUserId, q.get("Date"), function (C) { | |
| if (C && C.length) { | |
| z.MyDaySchedule = C; | |
| x.popover("show") | |
| } | |
| }) | |
| } | |
| } | |
| }, | |
| getScheduleContent: function (y) { | |
| var x = this; | |
| return x.scheduleTemplateFunction({ | |
| items: x.scheduleParticipant.MyDaySchedule.toJSON() | |
| }) | |
| }, | |
| initPopover: function () { | |
| var y = this, | |
| x = y.$(".show-schedule"); | |
| x.popover({ | |
| html: true, | |
| title: function () { | |
| return y.popoverTitle(this) | |
| }, | |
| placement: "bottom", | |
| container: "body", | |
| content: function () { | |
| return y.getScheduleContent(this) | |
| }, | |
| template: '<div class="popover schedule-popover" role="tooltip" style="z-index:1110; max-width:600px"><div class="arrow"></div><a class="close pull-right iconColor popover-close mr-5">×</a><h3 class="popover-title"></h3><div class="popover-content"></div></div>', | |
| trigger: "manual" | |
| }).on("shown.bs.popover", function () { | |
| $(".schedule-popover .popover-close").click(function () { | |
| y.closePopover() | |
| }) | |
| }) | |
| }, | |
| popoverTitle: function (y) { | |
| var x = this; | |
| return x.scheduleParticipant.ParticipantName + "'s schedule for " + c.displayDate(q.get("Date")) | |
| }, | |
| closePopover: function () { | |
| $(".popover.schedule-popover").hide().remove() | |
| }, | |
| disposePopover: function () { | |
| var x = this; | |
| x.closePopover(); | |
| $(document).off(".AdmSchedule") | |
| } | |
| }); | |
| l.Us.showSubModal(); | |
| p3.rV(new r(), $(".modal .modal-sub"), true) | |
| }) | |
| }; | |
| a.Vs.Notes = Bb.View.extend({ | |
| initialize: function (q) { | |
| var r = this; | |
| r.viewConfig = q.viewConfig || {}; | |
| r.template = r.viewConfig.template | |
| }, | |
| render: function (q) { | |
| var r = this; | |
| $(q).html(r.el); | |
| r.renderData() | |
| }, | |
| renderData: function () { | |
| var q = this; | |
| p3.fT(q.template, function (r) { | |
| q.$el.html(r({ | |
| model: q.model.toJSON() | |
| })); | |
| l.Us.initializeUpload_File(q, "name"); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.AutoSize, function () { | |
| q.$("textarea").autosize() | |
| }); | |
| _.each(q.$("textarea.counter-input"), function (s) { | |
| $(s).trigger($.Event("keyup")) | |
| }); | |
| a.Us.SetModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| } | |
| }); | |
| a.Us.ToggleRecurHolder = function (r, q) { | |
| q = o.stringToInt(q); | |
| r.$(".recur-holder").hide(); | |
| if (q === 4) { | |
| r.$(".daily-holder").show() | |
| } else { | |
| if (q === 5) { | |
| r.$(".weekly-holder").show() | |
| } else { | |
| if (q === 6) { | |
| r.$(".monthly-holder").show() | |
| } else { | |
| if (q === 7) { | |
| r.$(".yearly-holder").show() | |
| } | |
| } | |
| } | |
| } | |
| }; | |
| a.Us.AddOpening = function (t, u) { | |
| var q = {}, | |
| v, r, s = new a.Ms.Opening({ | |
| Occurrence: "single", | |
| SlotsAvailable: 1, | |
| Recurrence: { | |
| frequency: 4 | |
| } | |
| }); | |
| q.Months = p3.Us.DataLibrary.Months; | |
| q.Days = p3.Us.DataLibrary.Days; | |
| r = { | |
| GradeLevels: new a.Cs.GradeLevels() | |
| }; | |
| if (t === "visit") { | |
| r.ADMVisitTypes = { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| name: "ADM Visit Types", | |
| id: 103, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| dataName: "dd_data" | |
| } | |
| }; | |
| v = "Add a visit opening" | |
| } else { | |
| if (t === "interview") { | |
| r.ADMInterviewTypes = { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| name: "ADM Interview Types", | |
| id: 101, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| dataName: "dd_data" | |
| } | |
| }; | |
| v = "Add an interview opening" | |
| } | |
| } | |
| i.Us.Fetch(r, function (w, y, x) { | |
| var z = 0; | |
| if (t === "visit") { | |
| q.ADMVisitTypes = w.ADMVisitTypes; | |
| if (q.ADMVisitTypes.length) { | |
| q.ADMVisitTypes = _.filter(q.ADMVisitTypes, function (A) { | |
| if (A.dd_active) { | |
| return A | |
| } | |
| }) | |
| } | |
| } else { | |
| if (t === "interview") { | |
| q.ADMInterviewTypes = w.ADMInterviewTypes; | |
| if (q.ADMInterviewTypes.length) { | |
| q.ADMInterviewTypes = _.filter(q.ADMInterviewTypes, function (A) { | |
| if (A.dd_active) { | |
| return A | |
| } | |
| }) | |
| } | |
| } | |
| } | |
| q.GradeLevels = _.chain(w.GradeLevels.toJSON()).groupBy("SchoolLevelDesc").each(function (A) { | |
| A.LevelDesc = A[0].SchoolLevelDesc; | |
| A.LevelNum = A[0].SchoolLevelNum; | |
| _.each(A, function (B) { | |
| B.index = z; | |
| z++ | |
| }) | |
| }).value(); | |
| s.set({ | |
| Grades: w.GradeLevels.toJSON() | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new a.Vs.AddOpening({ | |
| model: s, | |
| dictionaries: q, | |
| variables: { | |
| title: v, | |
| openingType: t | |
| }, | |
| refresh: u | |
| }), p3.Layout.Containers.Modal, true) | |
| }) | |
| }; | |
| a.Us.EditOpening = function (u, r, v, y) { | |
| var q = {}, | |
| x, w, s, t = new a.Ms.Opening({ | |
| Occurrence: "single", | |
| OpeningDetailId: r, | |
| Recurrence: { | |
| frequency: 4 | |
| } | |
| }); | |
| q.Months = p3.Us.DataLibrary.Months; | |
| q.Days = p3.Us.DataLibrary.Days; | |
| s = { | |
| Opening: t | |
| }; | |
| if (u === "visit") { | |
| s.ADMVisitTypes = { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| name: "ADM Visit Types", | |
| id: 103, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| dataName: "dd_data" | |
| } | |
| }; | |
| x = "Edit a visit opening occurrence"; | |
| w = "Edit a visit opening series" | |
| } else { | |
| if (u === "interview") { | |
| s.ADMInterviewTypes = { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| name: "ADM Interview Types", | |
| id: 101, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| dataName: "dd_data" | |
| } | |
| }; | |
| x = "Edit an interview opening occurrence"; | |
| w = "Edit an interview opening series" | |
| } | |
| } | |
| i.Us.Fetch(s, function (z, B, A) { | |
| var C = 0, | |
| D; | |
| if (u === "visit") { | |
| q.ADMVisitTypes = z.ADMVisitTypes; | |
| if (q.ADMVisitTypes.length) { | |
| q.ADMVisitTypes = _.filter(q.ADMVisitTypes, function (E) { | |
| if (E.dd_active) { | |
| return E | |
| } | |
| }) | |
| } | |
| } else { | |
| if (u === "interview") { | |
| q.ADMInterviewTypes = z.ADMInterviewTypes; | |
| if (q.ADMInterviewTypes.length) { | |
| q.ADMInterviewTypes = _.filter(q.ADMInterviewTypes, function (E) { | |
| if (E.dd_active) { | |
| return E | |
| } | |
| }) | |
| } | |
| } | |
| } | |
| q.GradeLevels = _.chain(t.toJSON().Grades).groupBy("SchoolLevelDesc").each(function (E) { | |
| E.LevelDesc = E[0].SchoolLevelDesc; | |
| E.LevelNum = E[0].SchoolLevelNum; | |
| _.each(E, function (F) { | |
| F.index = C; | |
| C++ | |
| }) | |
| }).value(); | |
| t.set({ | |
| Date: c.getDateString(c.getDate(t.get("StartDate"))), | |
| StartTime: c.getTimeString(c.getDate(t.get("StartDate"))), | |
| EndTime: c.getTimeString(c.getDate(t.get("EndDate"))) | |
| }); | |
| D = new a.Vs.EditOpening({ | |
| model: t, | |
| dictionaries: q, | |
| variables: { | |
| title: x, | |
| seriesTitle: w, | |
| openingType: u | |
| }, | |
| refresh: v | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(D, p3.Layout.Containers.Modal, true); | |
| if (y) { | |
| D.toggleOccurrence() | |
| } | |
| }) | |
| }; | |
| a.Us.DeleteOpening = function (q, s) { | |
| var r = q.get("Occurrence") === "single" ? "occurrence" : "series"; | |
| p3.showConfirm("Delete opening " + r, "Wait a minute. Are you really sure you want to delete this opening " + r + "?", null, function () { | |
| q.destroy({ | |
| success: function () { | |
| s.call(); | |
| p3.Layout.Containers.Modal.modal("hide") | |
| }, | |
| error: function () { | |
| p3.displayError("Error deleting opening") | |
| } | |
| }) | |
| }) | |
| }; | |
| a.Us.AddVisit = function (r, s) { | |
| var q, t = new a.Ms.Visit({ | |
| VisitType: {}, | |
| OpeningDetailId: r, | |
| ProspectInstanceId: s, | |
| AccompanyingAdults: [], | |
| Agenda: { | |
| Activities: [] | |
| } | |
| }); | |
| q = { | |
| ADMVisitTypes: { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| name: "ADM Visit Types", | |
| id: 103, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| dataName: "dd_data" | |
| } | |
| }, | |
| ADMStaff: { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| id: e.DictionaryData.ADMStaff.id, | |
| keyName: e.DictionaryData.ADMStaff.keyName, | |
| valueName: e.DictionaryData.ADMStaff.valueName, | |
| inputParam: e.DictionaryData.ADMStaff.inputParam | |
| } | |
| } | |
| }; | |
| if (r) { | |
| q.Opening = new a.Ms.Opening({ | |
| OpeningDetailId: r, | |
| Occurrence: "single" | |
| }) | |
| } | |
| i.Us.Fetch(q, function (u, w, v) { | |
| if (r) { | |
| t.set({ | |
| VisitType: { | |
| VisitTypeId: u.Opening.get("VisitTypeId") | |
| }, | |
| VisitDate: u.Opening.get("StartDate"), | |
| OpeningDetail: u.Opening.toJSON() | |
| }) | |
| } | |
| if (u.ADMVisitTypes.length) { | |
| u.ADMVisitTypes = _.filter(u.ADMVisitTypes, function (x) { | |
| if (x.dd_active) { | |
| return x | |
| } | |
| }) | |
| } | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new a.Vs.EditAppointment({ | |
| model: t, | |
| dictionaries: u, | |
| viewConfig: a.Data.ViewConfigs.Visit | |
| }), p3.Layout.Containers.Modal, true) | |
| }) | |
| }; | |
| a.Us.EditVisit = function (t, r) { | |
| var q, s = new a.Ms.Visit({ | |
| VisitId: t | |
| }); | |
| s.fetch({ | |
| cache: false, | |
| data: { | |
| prospectInstanceId: r | |
| }, | |
| success: function () { | |
| q = { | |
| ADMVisitTypes: { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| name: "ADM Visit Types", | |
| id: 103, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| dataName: "dd_data" | |
| } | |
| }, | |
| ADMStaff: { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| id: e.DictionaryData.ADMStaff.id, | |
| keyName: e.DictionaryData.ADMStaff.keyName, | |
| valueName: e.DictionaryData.ADMStaff.valueName, | |
| inputParam: e.DictionaryData.ADMStaff.inputParam | |
| } | |
| } | |
| }; | |
| i.Us.Fetch(q, function (u, w, v) { | |
| if (u.ADMVisitTypes.length) { | |
| u.ADMVisitTypes = _.filter(u.ADMVisitTypes, function (x) { | |
| if (x.dd_active || (x.dd_id === s.get("VisitType").VisitTypeId)) { | |
| return x | |
| } | |
| }) | |
| } | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new a.Vs.EditAppointment({ | |
| model: s, | |
| dictionaries: u, | |
| viewConfig: a.Data.ViewConfigs.Visit | |
| }), p3.Layout.Containers.Modal, true) | |
| }) | |
| }, | |
| error: function () { | |
| p3.displayError("Error opening visit") | |
| } | |
| }) | |
| }; | |
| a.Us.AddSelfScheduleVisit = function (s, q) { | |
| var r, t = new a.Ms.Visit({ | |
| VisitType: {}, | |
| ProspectInstanceId: s, | |
| ChecklistItemId: q, | |
| SelfScheduleInd: true, | |
| AccompanyingAdults: [], | |
| Agenda: { | |
| Activities: [] | |
| } | |
| }); | |
| r = { | |
| ADMVisitTypes: { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| name: "ADM Visit Types", | |
| id: 103, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| dataName: "dd_data", | |
| inputParam: "checklist_item_id =" + q + "[i]" | |
| } | |
| } | |
| }; | |
| if (!_.has(a.Data.ViewConfigs.VisitSelfSchedule.BasicsView, "SelfScheduleText")) { | |
| r.Settings = new a.Ms.Settings() | |
| } | |
| i.Us.Fetch(r, function (u, w, v) { | |
| if (u.Settings) { | |
| a.Data.ViewConfigs.VisitSelfSchedule.BasicsView.SelfScheduleText = u.Settings.get("SelfSchedulingVisit").SelfScheduleText | |
| } | |
| if (u.ADMVisitTypes.length) { | |
| u.ADMVisitTypes = _.filter(u.ADMVisitTypes, function (x) { | |
| if (x.dd_data) { | |
| return x | |
| } | |
| }) | |
| } | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new a.Vs.EditAppointment({ | |
| model: t, | |
| dictionaries: u, | |
| viewConfig: a.Data.ViewConfigs.VisitSelfSchedule | |
| }), p3.Layout.Containers.Modal, true) | |
| }) | |
| }; | |
| a.Us.EditSelfScheduleVisit = function (s, q, u) { | |
| var r, t = new a.Ms.Visit({ | |
| VisitId: u, | |
| SelfScheduleInd: true | |
| }); | |
| t.fetch({ | |
| cache: false, | |
| data: { | |
| prospectInstanceId: s | |
| }, | |
| success: function () { | |
| r = { | |
| ADMVisitTypes: { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| name: "ADM Visit Types", | |
| id: 103, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| dataName: "dd_data", | |
| inputParam: "checklist_item_id =" + q + "[i]" | |
| } | |
| } | |
| }; | |
| if (!_.has(a.Data.ViewConfigs.VisitSelfSchedule.BasicsView, "SelfScheduleText")) { | |
| r.Settings = new a.Ms.Settings() | |
| } | |
| i.Us.Fetch(r, function (v, x, w) { | |
| if (v.Settings) { | |
| a.Data.ViewConfigs.VisitSelfSchedule.BasicsView.SelfScheduleText = v.Settings.get("SelfSchedulingVisit").SelfScheduleText | |
| } | |
| if (v.ADMVisitTypes.length) { | |
| v.ADMVisitTypes = _.filter(v.ADMVisitTypes, function (y) { | |
| if (y.dd_data || (y.dd_id === t.get("VisitType").VisitTypeId)) { | |
| return y | |
| } | |
| }) | |
| } | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new a.Vs.EditAppointment({ | |
| model: t, | |
| dictionaries: v, | |
| viewConfig: a.Data.ViewConfigs.VisitSelfSchedule | |
| }), p3.Layout.Containers.Modal, true) | |
| }) | |
| }, | |
| error: function () { | |
| p3.displayError("Error opening visit") | |
| } | |
| }) | |
| }; | |
| a.Us.AddInterview = function (s, t) { | |
| var r, q = new a.Ms.Interview({ | |
| InterviewType: {}, | |
| OpeningDetailId: s, | |
| ProspectInstanceId: t, | |
| AccompanyingAdults: [], | |
| Agenda: { | |
| Activities: [] | |
| } | |
| }); | |
| r = { | |
| ADMInterviewTypes: { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| name: "ADM Interview Types", | |
| id: 101, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| dataName: "dd_data" | |
| } | |
| }, | |
| ADMStaff: { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| id: 102, | |
| keyName: "user_id", | |
| valueName: "user_name", | |
| inputParam: "@admissions_staff_id=null,@onBoard_ind=1[i]" | |
| } | |
| } | |
| }; | |
| if (s) { | |
| r.Opening = new a.Ms.Opening({ | |
| OpeningDetailId: s, | |
| Occurrence: "single" | |
| }) | |
| } | |
| i.Us.Fetch(r, function (u, w, v) { | |
| if (s) { | |
| q.set({ | |
| InterviewType: { | |
| InterviewTypeId: u.Opening.get("InterviewTypeId") | |
| }, | |
| InterviewDate: u.Opening.get("StartDate"), | |
| OpeningDetail: u.Opening.toJSON() | |
| }) | |
| } | |
| if (u.ADMInterviewTypes.length) { | |
| u.ADMInterviewTypes = _.filter(u.ADMInterviewTypes, function (x) { | |
| if (x.dd_active) { | |
| return x | |
| } | |
| }) | |
| } | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new a.Vs.EditAppointment({ | |
| model: q, | |
| dictionaries: u, | |
| viewConfig: a.Data.ViewConfigs.Interview | |
| }), p3.Layout.Containers.Modal, true) | |
| }) | |
| }; | |
| a.Us.EditInterview = function (r, t) { | |
| var s, q = new a.Ms.Interview({ | |
| InterviewId: r | |
| }); | |
| q.fetch({ | |
| cache: false, | |
| data: { | |
| prospectInstanceId: t | |
| }, | |
| success: function () { | |
| s = { | |
| ADMInterviewTypes: { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| name: "ADM Interview Types", | |
| id: 101, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| dataName: "dd_data" | |
| } | |
| }, | |
| ADMStaff: { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| id: 102, | |
| keyName: "user_id", | |
| valueName: "user_name", | |
| inputParam: "@admissions_staff_id=null,@onBoard_ind=1[i]" | |
| } | |
| } | |
| }; | |
| i.Us.Fetch(s, function (u, w, v) { | |
| if (u.ADMInterviewTypes.length) { | |
| u.ADMInterviewTypes = _.filter(u.ADMInterviewTypes, function (x) { | |
| if (x.dd_active || (x.dd_id === q.get("InterviewType").InterviewTypeId)) { | |
| return x | |
| } | |
| }) | |
| } | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new a.Vs.EditAppointment({ | |
| model: q, | |
| dictionaries: u, | |
| viewConfig: a.Data.ViewConfigs.Interview | |
| }), p3.Layout.Containers.Modal, true) | |
| }) | |
| }, | |
| error: function () { | |
| p3.displayError("Error opening interview") | |
| } | |
| }) | |
| }; | |
| a.Us.AddSelfScheduleInterview = function (t, q) { | |
| var s, r = new a.Ms.Interview({ | |
| InterviewType: {}, | |
| ProspectInstanceId: t, | |
| ChecklistItemId: q, | |
| SelfScheduleInd: true, | |
| AccompanyingAdults: [] | |
| }); | |
| s = { | |
| ADMInterviewTypes: { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| name: "ADM Interview Types", | |
| id: 101, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| dataName: "dd_data", | |
| inputParam: "checklist_item_id =" + q + "[i]" | |
| } | |
| } | |
| }; | |
| if (!_.has(a.Data.ViewConfigs.InterviewSelfSchedule.BasicsView, "SelfScheduleText")) { | |
| s.Settings = new a.Ms.Settings() | |
| } | |
| i.Us.Fetch(s, function (u, w, v) { | |
| if (u.Settings) { | |
| a.Data.ViewConfigs.InterviewSelfSchedule.BasicsView.SelfScheduleText = u.Settings.get("SelfSchedulingInterview").SelfScheduleText | |
| } | |
| if (u.ADMInterviewTypes.length) { | |
| u.ADMInterviewTypes = _.filter(u.ADMInterviewTypes, function (x) { | |
| if (x.dd_data) { | |
| return x | |
| } | |
| }) | |
| } | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new a.Vs.EditAppointment({ | |
| model: r, | |
| dictionaries: u, | |
| viewConfig: a.Data.ViewConfigs.InterviewSelfSchedule | |
| }), p3.Layout.Containers.Modal, true) | |
| }) | |
| }; | |
| a.Us.EditSelfScheduleInterview = function (u, q, s) { | |
| var t, r = new a.Ms.Interview({ | |
| InterviewId: s, | |
| SelfScheduleInd: true | |
| }); | |
| r.fetch({ | |
| cache: false, | |
| data: { | |
| prospectInstanceId: u | |
| }, | |
| success: function (v) { | |
| t = { | |
| ADMInterviewTypes: { | |
| data: new i.Cs.Dictionary(), | |
| dataParams: { | |
| name: "ADM Interview Types", | |
| id: 101, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| dataName: "dd_data", | |
| inputParam: "checklist_item_id =" + q + "[i]" | |
| } | |
| } | |
| }; | |
| if (!_.has(a.Data.ViewConfigs.InterviewSelfSchedule.BasicsView, "SelfScheduleText")) { | |
| t.Settings = new a.Ms.Settings() | |
| } | |
| i.Us.Fetch(t, function (w, y, x) { | |
| if (w.Settings) { | |
| a.Data.ViewConfigs.InterviewSelfSchedule.BasicsView.SelfScheduleText = w.Settings.get("SelfSchedulingInterview").SelfScheduleText | |
| } | |
| if (w.ADMInterviewTypes.length) { | |
| w.ADMInterviewTypes = _.filter(w.ADMInterviewTypes, function (z) { | |
| if (z.dd_data || (z.dd_id === r.get("InterviewType").InterviewTypeId)) { | |
| return z | |
| } | |
| }) | |
| } | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new a.Vs.EditAppointment({ | |
| model: r, | |
| dictionaries: w, | |
| viewConfig: a.Data.ViewConfigs.InterviewSelfSchedule | |
| }), p3.Layout.Containers.Modal, true) | |
| }) | |
| }, | |
| error: function () { | |
| p3.displayError("Error opening interview") | |
| } | |
| }) | |
| }; | |
| a.Us.AutoComplete = function (q, u, s, t) { | |
| var r, v; | |
| q.autocomplete({ | |
| userAll: null, | |
| minLength: 2, | |
| previousSearch: "", | |
| source: function (w, x) { | |
| r = this; | |
| if (r.options.userAll === null) { | |
| r.options.userAll = u | |
| } | |
| r.fetchComplete = function (y) { | |
| r.previous = q.prop("value"); | |
| v = new RegExp($.ui.autocomplete.escapeRegex(this.term), "i"); | |
| x($.map(y.models, function (z) { | |
| if (z.get(s).match(v)) { | |
| return { | |
| value: z.get(s), | |
| obj: z | |
| } | |
| } | |
| })) | |
| }; | |
| if ((r.options.userAll.length === 0) || (q.prop("value").slice(0, 2) !== r.previous.slice(0, 2))) { | |
| r.options.userAll.fetch({ | |
| data: { | |
| searchText: q.prop("value").slice(0, 2) | |
| }, | |
| success: function (y) { | |
| r.fetchComplete(y) | |
| } | |
| }) | |
| } else { | |
| r.fetchComplete(r.options.userAll) | |
| } | |
| }, | |
| select: function (w, x) { | |
| t(w, x) | |
| } | |
| }); | |
| q.focus(function () { | |
| var w = $(this); | |
| if (w.val().length > 1) { | |
| w.autocomplete("search") | |
| } | |
| }) | |
| }; | |
| a.Us.DeleteAppointment = function (r, s) { | |
| var q = new a.Vs.DeleteAppointment({ | |
| model: r, | |
| dictionaries: { | |
| Appointment: r.toJSON() | |
| }, | |
| subModal: s | |
| }); | |
| if (s) { | |
| l.Us.showSubModal(); | |
| p3.rV(q, $(".modal .modal-sub"), true) | |
| } else { | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(q, p3.Layout.Containers.Modal, true) | |
| } | |
| }; | |
| a.Us.AgendaModal = function (s, r, v, w, u) { | |
| var t, q; | |
| u = u || false; | |
| switch (s) { | |
| case 7: | |
| q = new a.Ms.ChecklistInterview({ | |
| InterviewId: r, | |
| MyDay: u | |
| }); | |
| break; | |
| case 12: | |
| q = new a.Ms.ChecklistVisit({ | |
| VisitId: r, | |
| MyDay: u | |
| }); | |
| break | |
| } | |
| q.fetch({ | |
| cache: false, | |
| data: { | |
| prospectInstanceId: v | |
| }, | |
| success: function () { | |
| t = l.Vs.Modal2.extend({ | |
| template: "admscheduling/admscheduling.agenda.template.html", | |
| model: q, | |
| size: "md", | |
| variables: { | |
| userName: w | |
| } | |
| }); | |
| l.Us.renderModal(new t({})) | |
| }, | |
| error: function (x, z, y) { | |
| p3.displayError("Error loading agenda.") | |
| } | |
| }) | |
| }; | |
| a.Us.GetMyDaySchedule = function (t, s, q) { | |
| if (t && s) { | |
| var r = new a.Cs.MyDaySchedules(); | |
| r.fetch({ | |
| data: { | |
| userId: t, | |
| scheduleDate: s, | |
| personaId: e.AppPersona.ONBOARD.Value | |
| }, | |
| error: function () { | |
| p3.displayError("Error getting student schedule") | |
| }, | |
| complete: function () { | |
| if (_.isFunction(q)) { | |
| q(r) | |
| } | |
| } | |
| }) | |
| } else { | |
| if (_.isFunction(q)) { | |
| q() | |
| } | |
| } | |
| }; | |
| a.Us.SetModalHeight = _.debounce(p3.setModalHeight, 300); | |
| p3.router().route("admissions/scheduling", "admissions/scheduling", function () { | |
| p3.renderMainPage(new j.Vs.Layout({ | |
| CalendarSet: e.CalendarSet.AdmScheduling | |
| })) | |
| }) | |
| }(p3.module("admissions/admissionsscheduling"))); | |
| (function (a) { | |
| var b = p3.module("shared/base"), | |
| f = p3.module("utilities/smodal"), | |
| g = p3.Us.Tools, | |
| d = p3.Us.InfoMessageLibrary, | |
| c = p3.Us.Enum, | |
| e = p3.module("utilities/multifetch"); | |
| a.Ms.Test = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "AdmissionsTestId", | |
| validation: { | |
| Description: [{ | |
| required: true, | |
| msg: d.P3.RequiredInfoNotEntered | |
| }], | |
| SortOrder: [{ | |
| required: true, | |
| msg: d.P3.RequiredInfoNotEntered | |
| }, { | |
| pattern: "number", | |
| msg: d.P3.NotNumeric | |
| }], | |
| AdmTestTypeId: [{ | |
| fn: function (j, h, i) { | |
| if ((g.stringToInt(this.attributes.AdmTestTypeId) !== g.stringToInt(this.attributes.InitialTestTypeInUse)) && this.attributes.IsSelectedTestTypeInUse) { | |
| return "This Test Type is in use by another test. Test Type can only be used by one test at a time." | |
| } | |
| } | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "admissionstest/AdmissionsTest/" + this.id + "/" : aP + "admissionstest/AdmissionsTest/" | |
| } | |
| }); | |
| a.Ms.SubTest = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| validation: { | |
| "SubTest.Description": [{ | |
| required: true, | |
| msg: d.P3.RequiredInfoNotEntered | |
| }], | |
| "SubTest.SortOrder": [{ | |
| required: true, | |
| msg: d.P3.RequiredInfoNotEntered | |
| }, { | |
| pattern: "number", | |
| msg: d.P3.NotNumeric | |
| }], | |
| "SubTest.AdmSubTestTypeId": [{ | |
| fn: function (m, h, j) { | |
| var k = _.chain(this.collection.toJSON()).pluck("SubTest").pluck("AdmSubTestTypeId").value(), | |
| i = [], | |
| l; | |
| _.each(k, function (n) { | |
| i.push(g.stringToInt(n)) | |
| }); | |
| l = _.chain(i).compact().countBy().value(); | |
| if (l[m] > 1) { | |
| return "Each Sub Test type can only be used once." | |
| } | |
| } | |
| }] | |
| } | |
| }); | |
| a.Ms.InUse = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "AdmissionsTestId", | |
| url: function () { | |
| return this.id ? aP + "admissionstest/AdmissionsTestInUse/" + this.id + "/" : aP + "admissionstest/AdmissionsTestInUse/" | |
| } | |
| }); | |
| a.Ms.SubTestInUse = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "SubTestId", | |
| url: function () { | |
| return aP + "admissionstest/AdmissionsSubTestInUse/" | |
| } | |
| }); | |
| a.Cs.Tests = Bbc.extend({ | |
| model: a.Ms.Test, | |
| url: function () { | |
| return aP + "admissionstest/AdmissionsTestList/" | |
| } | |
| }); | |
| a.Cs.SubTests = Bbc.extend({ | |
| model: a.Ms.SubTest, | |
| isValid: f.Us.isValidCollection | |
| }); | |
| a.Vs.Layout = Bb.View.extend({ | |
| template: "admissions/candidate.detail.profile.template.html", | |
| initialize: function () { | |
| this.Containers = {} | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| $(h).html(i.el); | |
| p3.fT(i.template, function (j) { | |
| p3.setTitle("Tests"); | |
| i.$el.html(j()); | |
| p3.rV(new a.Vs.Tests({}), $("#content"), false) | |
| }) | |
| } | |
| }); | |
| a.Vs.Tests = Bb.View.extend({ | |
| template: "tests/tests.layout.template.html", | |
| initialize: function () { | |
| var h = this; | |
| h.collection = new a.Cs.Tests(); | |
| h.collection.bind("add", function (i) { | |
| var j = new a.Vs.Test({ | |
| model: i, | |
| layoutView: h | |
| }); | |
| i.bind("sync", h.renderData, h); | |
| p3.rV(j, h.$("#testTable"), false) | |
| }, h) | |
| }, | |
| events: { | |
| "click a.toggleLink": "toggleSection", | |
| "click button.create": "createTest" | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| $(h).append(i.el); | |
| i.renderData() | |
| }, | |
| renderData: function () { | |
| var h = this; | |
| h.collection.reset(); | |
| p3.fT(h.template, function (i) { | |
| h.$el.html(i({})); | |
| h.collection.fetch({ | |
| update: true, | |
| cache: false | |
| }) | |
| }) | |
| }, | |
| toggleSection: function (i) { | |
| var h = $(i.currentTarget); | |
| h.siblings(".toggledetail").slideToggle("fast"); | |
| if (h.hasClass("active")) { | |
| h.removeClass("active") | |
| } else { | |
| h.addClass("active") | |
| } | |
| return false | |
| }, | |
| createTest: function () { | |
| var j = this, | |
| i, h; | |
| i = new a.Ms.Test({ | |
| Description: "", | |
| SortOrder: 0, | |
| ProspectTestId: 0, | |
| SubTests: [] | |
| }); | |
| i.bind("sync", j.renderData, j); | |
| e.Us.Fetch({ | |
| TestTypes: { | |
| data: new e.Cs.Dictionary(), | |
| dataParams: c.DictionaryData.ADMTestType | |
| } | |
| }, function (k, m, l) { | |
| if (l) { | |
| p3.displayError("There was an error loading data.") | |
| } | |
| if (m) { | |
| h = new a.Vs.TestModal({ | |
| model: i, | |
| dictionaries: k | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(h, p3.Layout.Containers.Modal, true) | |
| } | |
| }) | |
| } | |
| }); | |
| a.Vs.Test = Bb.View.extend({ | |
| template: "tests/tests.test.template.html", | |
| tagName: "tr", | |
| initialize: function () { | |
| this.model.bind("destroy", this.deleteElement, this); | |
| this.model.bind("remove", this.deleteElement, this) | |
| }, | |
| events: { | |
| "click .edit": "editTest", | |
| "click .delete": "deleteTest", | |
| "click a.togglebutton": "toggleInfo" | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| $(h).append(i.el); | |
| i.inUse = new a.Ms.InUse(); | |
| i.inUse.fetch({ | |
| data: { | |
| testId: i.model.attributes.AdmissionsTestId | |
| }, | |
| success: function (j) { | |
| i.renderData() | |
| } | |
| }) | |
| }, | |
| renderData: function () { | |
| var h = this; | |
| p3.fT(h.template, function (j) { | |
| h.$el.html(j({ | |
| model: h.model.toJSON(), | |
| inUse: h.inUse.attributes.Message | |
| })); | |
| var i = ""; | |
| if (g.stringToInt(h.inUse.attributes.Message) === 1) { | |
| i = "Test scores have been recorded for the test type '" + h.model.attributes.Description + "'. It may not be deleted." | |
| } else { | |
| if (g.stringToInt(h.inUse.attributes.Message) === 2) { | |
| i = "The test type '" + h.model.attributes.Description + "' is used on one or more transcripts. It may not be deleted." | |
| } else { | |
| if (g.stringToInt(h.inUse.attributes.Message) === 3) { | |
| i = "Test scores have been recorded for the test type '" + h.model.attributes.Description + "' and it is also used on one or more transcripts. It may not be deleted." | |
| } | |
| } | |
| } | |
| $(".tooltip-inuse").tooltip({ | |
| title: i, | |
| placement: "left" | |
| }) | |
| }) | |
| }, | |
| toggleInfo: function (i) { | |
| var j = this, | |
| h = $(i.currentTarget); | |
| j.$(".toggleinfo").slideToggle("fast"); | |
| if (h.hasClass("active")) { | |
| h.removeClass("active") | |
| } else { | |
| h.addClass("active") | |
| } | |
| return false | |
| }, | |
| editTest: function () { | |
| var h = this; | |
| e.Us.Fetch({ | |
| TestTypes: { | |
| data: new e.Cs.Dictionary(), | |
| dataParams: c.DictionaryData.ADMTestType | |
| }, | |
| SubTests: { | |
| data: new a.Ms.Test(), | |
| dataParams: { | |
| testId: h.model.attributes.AdmissionsTestId | |
| } | |
| }, | |
| SubTestTypes: { | |
| data: new e.Cs.Dictionary(), | |
| dataParams: { | |
| id: 150, | |
| adm_test_type_id: this.model.attributes.AdmissionsTestId | |
| } | |
| } | |
| }, function (i, k, j) { | |
| if (j) { | |
| p3.displayError("There was an error loading data.") | |
| } | |
| if (k) { | |
| h.model.set({ | |
| SubTests: i.SubTests.attributes[0].AdmissionsSubTests | |
| }); | |
| var l = new a.Vs.TestModal({ | |
| model: h.model, | |
| dictionaries: i, | |
| variables: { | |
| Test: i.SubTests.attributes[0].AdmTestTypeId | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(l, p3.Layout.Containers.Modal, true) | |
| } | |
| }) | |
| }, | |
| deleteTest: function (h) { | |
| var i = this; | |
| if (g.stringToInt(i.inUse.attributes.Message) === 0) { | |
| p3.showConfirm("Delete Test", "Wait a minute. Are you really sure you want to delete this test?", null, function () { | |
| i.model.destroy({ | |
| dataParam: { | |
| testId: i.model.attributes.AdmissionsTestId | |
| } | |
| }) | |
| }) | |
| } | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| a.Vs.TestModal = f.Vs.Modal2.extend({ | |
| template: "tests/tests.test.edit.template.html", | |
| modalInitialized: function () { | |
| var h = this; | |
| h.subTestCollection = new a.Cs.SubTests(h.model.get("SubTests")) | |
| }, | |
| events: { | |
| "click .test-add": "optionAdd", | |
| "click .test-delete": "optionDelete", | |
| "change .test-type": "optionSelectTestType" | |
| }, | |
| modalRendered: function () { | |
| var h = this, | |
| i = $(".test-type"); | |
| a.Us.ShowSubTestTypes(); | |
| _.each(h.subTestCollection.models, function (j) { | |
| p3.rV(new a.Vs.SubTest({ | |
| model: j, | |
| dictionaries: h.options.dictionaries | |
| }), h.$("table.subtests tbody"), false) | |
| }); | |
| h.model.attributes.IsSelectedTestTypeInUse = i.find(":selected").data("is-test-type-in-use"); | |
| h.model.attributes.InitialTestTypeInUse = i.find(":selected").val() | |
| }, | |
| modalUpdate: function (i) { | |
| var h = i.eventCurrentTarget; | |
| if (h.hasClass("description")) { | |
| return false | |
| } | |
| if (h.hasClass("sortorder")) { | |
| return false | |
| } | |
| if (h.hasClass("ignore")) { | |
| return false | |
| } | |
| }, | |
| updateSubTestTypes: function (i) { | |
| var h = this, | |
| j = h.$(".sub-test-type"); | |
| j.html(""); | |
| j.append('<option value="">-- Select an Option --</option>'); | |
| _.each(h.options.dictionaries.SubTestTypes, function (k) { | |
| j.append('<option value="' + k.dd_id + '">' + k.dd_description + "</option>") | |
| }); | |
| a.Us.ShowSubTestTypes() | |
| }, | |
| optionSelectTestType: function (h) { | |
| var j = this, | |
| l = $(".test-type"), | |
| k = parseInt(l.val(), 10), | |
| i = l.find(":selected").data("is-test-type-in-use"); | |
| j.model.attributes.IsSelectedTestTypeInUse = i; | |
| j.model.attributes.TestTypeChanged = 1; | |
| if (!isNaN(k)) { | |
| e.Us.Fetch({ | |
| SubTestTypes: { | |
| data: new e.Cs.Dictionary(), | |
| dataParams: { | |
| id: 150, | |
| adm_test_type_id: k | |
| } | |
| } | |
| }, function (m, o, n) { | |
| if (n) { | |
| p3.displayError("There was an error loading data.") | |
| } | |
| if (o) { | |
| j.options.dictionaries.SubTestTypes = m.SubTestTypes; | |
| j.updateSubTestTypes() | |
| } | |
| }) | |
| } else { | |
| j.options.dictionaries.SubTestTypes = []; | |
| _.each(j.subTestCollection.models, function (m) { | |
| m.attributes.SubTest.SubTestId = ""; | |
| m.attributes.SubTest.AdmSubTestTypeId = "" | |
| }); | |
| j.updateSubTestTypes() | |
| } | |
| }, | |
| optionAdd: function (h) { | |
| var i = this, | |
| j = new a.Ms.SubTest(); | |
| i.subTestCollection.add(j); | |
| p3.rV(new a.Vs.SubTest({ | |
| model: j, | |
| dictionaries: i.options.dictionaries | |
| }), i.$("table.subtests tbody"), false) | |
| }, | |
| optionDelete: function (i) { | |
| var j = this, | |
| h = $(i.currentTarget), | |
| k = j.subTestCollection.find(function (l) { | |
| return l.get("SubTest").SubTestId === h.parent().parent().find(".description").data("subtestid") | |
| }); | |
| j.subTestCollection.remove(k); | |
| h.parent().parent().remove(); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }, | |
| modalSave: function (i) { | |
| var h = this, | |
| k = "<subtest>", | |
| j = 0; | |
| _.each(h.subTestCollection.models, function (l) { | |
| if (l.isValid(true)) { | |
| j++ | |
| } | |
| }); | |
| if (h.model.isValid(true) && j === h.subTestCollection.length) { | |
| _.each(h.$("table.subtests tr:not(:first)"), function (m) { | |
| var o = $(m).find(".description").data("subtestid"), | |
| l = $(m).find(".description").val(), | |
| n = $(m).find(".sortorder").val() || 0, | |
| p = $(m).find(".sub-test-type").val(); | |
| if (p) { | |
| k += '<i stid="' + o + '" sd="' + l + '" subtest_type_id="' + p + '" so="' + n + '" />' | |
| } else { | |
| k += '<i stid="' + o + '" sd="' + l + '" so="' + n + '" />' | |
| } | |
| }); | |
| k += "</subtest>"; | |
| h.model.set({ | |
| XMLList: k | |
| }) | |
| } else { | |
| return false | |
| } | |
| } | |
| }); | |
| a.Vs.SubTest = Bb.View.extend({ | |
| template: "tests/tests.subtest.template.html", | |
| tagName: "tr", | |
| events: { | |
| "change input[type=text]": "updateModel", | |
| "change select": "updateModel" | |
| }, | |
| initialize: function () { | |
| var h = this; | |
| Bb.Validation.bind(h, { | |
| forceUpdate: true, | |
| selector: "name" | |
| }) | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| $(h).append(i.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var h = this; | |
| p3.fT(h.template, function (i) { | |
| h.$el.html(i({ | |
| model: h.model.toJSON(), | |
| dictionaries: h.options.dictionaries | |
| })); | |
| a.Us.ShowSubTestTypes() | |
| }) | |
| }, | |
| updateModel: function (h) { | |
| var i = this; | |
| f.Us.updateModel(h, i.model, "name", null) | |
| } | |
| }); | |
| a.Us.ShowSubTestTypes = function () { | |
| var h = $(".sub-test-type-column"), | |
| i = $(".sub-test-type-row"); | |
| if ($(".test-type").val() !== "") { | |
| h.show(); | |
| i.show(); | |
| return true | |
| } | |
| h.hide(); | |
| i.hide(); | |
| return false | |
| }; | |
| p3.router().route("tests", "tests", function () { | |
| p3.renderMainPage(new a.Vs.Layout({})) | |
| }) | |
| }(p3.module("admissions/admissionstests"))); | |
| (function (a) { | |
| var b = p3.module("shared/base"), | |
| c = p3.module("shared/datepicker"), | |
| h = p3.module("utilities/validate"), | |
| f = p3.module("utilities/smodal"), | |
| e = p3.module("officialNote"), | |
| g = p3.module("utilities/sort"), | |
| d = p3.module("utilities/multifetch"); | |
| a.Ms.Criteria = Bbm.extend({}); | |
| a.Ms.Worklist = Bbm.extend({ | |
| idAttribute: "Id", | |
| urlRoot: "IntermediateLM/crud" | |
| }); | |
| a.Ms.RoleGroupTask = Bbm.extend({ | |
| idAttribute: "RoleGroupId" | |
| }); | |
| a.Cs.WorklistDDLB = Bbm.extend({ | |
| url: function () { | |
| return aP + "DataDirect/ILMDDLBget/" | |
| } | |
| }); | |
| a.Cs.Worklists = Bbc.extend({ | |
| model: a.Ms.Worklist, | |
| url: function () { | |
| return aP + "IntermediateLM/List/" | |
| } | |
| }); | |
| a.Cs.Criterias = Bbc.extend({ | |
| sync: b.DataParamSync, | |
| url: function () { | |
| return aP + "IntermediateLM/CriteriaList/" | |
| } | |
| }); | |
| a.Cs.Blocks = Bbc.extend({}); | |
| a.Cs.Fields = Bbc.extend({}); | |
| a.Cs.Criteria = Bbc.extend({ | |
| sync: b.DataParamSync, | |
| url: function () { | |
| return aP + "IntermediateLM/ResultsList/" | |
| } | |
| }); | |
| a.Cs.Results = Bbc.extend({ | |
| sync: b.DataParamSync, | |
| sortProp: "Name", | |
| sortDirection: "asc", | |
| setSort: function (j, i) { | |
| this.sortProp = j; | |
| if (i) { | |
| if (i === "toggle") { | |
| this.sortDirection = (this.sortDirection === "asc") ? "desc" : "asc" | |
| } else { | |
| this.sortDirection = i | |
| } | |
| } | |
| this.sort() | |
| }, | |
| comparator: function (i, j) { | |
| if (this.sortProp) { | |
| return g.Us.naturalSort(i.get(this.sortProp), j.get(this.sortProp), this.sortDirection) | |
| } | |
| return 0 | |
| }, | |
| url: function () { | |
| return aP + "IntermediateLM/ResultsList/" | |
| } | |
| }); | |
| a.Cs.ExportCriterias = Bbc.extend({ | |
| sync: b.DataParamSync, | |
| url: function () { | |
| return aP + "IntermediateLM/ExportCriteria/" | |
| } | |
| }); | |
| a.Ms.UpdateStatus = Bbm.extend({ | |
| urlRoot: "IntermediateLM/updatestatus" | |
| }); | |
| a.Cs.RoleGroupTasks = Bbc.extend({ | |
| model: a.Ms.RoleGroupTask, | |
| url: "PeopleFinder/RoleGroupTaskList" | |
| }); | |
| a.Cs.OutputColumns = Bbc.extend({ | |
| sync: b.DataParamSync, | |
| url: function () { | |
| return aP + "IntermediateLM/SavedSearchFields/" | |
| } | |
| }); | |
| a.Vs.Layout = Bb.View.extend({ | |
| template: "worklist/worklist.admissions.layout.template.html", | |
| initialize: function () { | |
| $(document).click(function (j) { | |
| var i = $(j.target); | |
| if (!i.hasClass("range-input") && !i.hasClass("ui-icon") && !i.hasClass("ui-datepicker-current") && !i.hasClass("ui-datepicker-close") && !i.hasClass("worklist-dropdown") && !i.hasClass("worklist-field") && !i.hasClass("worklist-bit")) { | |
| $(".popover-markup").popover("hide").removeClass("on") | |
| } | |
| }) | |
| }, | |
| dispose: function () { | |
| $("BODY").removeClass("background-gray-texture"); | |
| p3.closeFixedFooter(); | |
| $(".popover").remove(); | |
| $(document).off("click") | |
| }, | |
| render: function (i) { | |
| var j = this; | |
| p3.setTitle("Worklist"); | |
| $(i).append(j.el); | |
| d.Us.Fetch({ | |
| OutputColumns: { | |
| data: new a.Cs.OutputColumns(), | |
| dataParams: { | |
| id: a.Data.worklistId | |
| } | |
| } | |
| }, function (k, m, l) { | |
| if (l) { | |
| p3.displayError("There was an error loading data.") | |
| } | |
| a.Data.OutputColumns = k.OutputColumns; | |
| j.renderData() | |
| }); | |
| j.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this; | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({})); | |
| p3.rV(new a.Vs.Main({ | |
| layoutView: i | |
| }), i.$("#workspace-main"), true); | |
| p3.renderFixedFooter(new a.Vs.Footer({ | |
| layoutView: i | |
| })) | |
| }) | |
| } | |
| }); | |
| a.Vs.Main = Bb.View.extend({ | |
| template: "worklist/worklist.admissions.main.template.html", | |
| id: "listmanager-main", | |
| className: "workspace shadowborder white-bgc", | |
| initialize: function () { | |
| var i = this; | |
| i.collection = new a.Cs.Criterias(); | |
| a.Data.Criterias = i.collection | |
| }, | |
| events: { | |
| saveworklist: "saveWorklist" | |
| }, | |
| render: function (i) { | |
| var j = this; | |
| $(i).append(j.el); | |
| j.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this; | |
| a.Us.setCriteriaDirty(false); | |
| a.Us.setResultsDirty(false); | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({})); | |
| i.Containers = { | |
| Header: i.$("#worklist-header"), | |
| Results: i.$("#worklist-results") | |
| }; | |
| p3.rV(new a.Vs.Header({ | |
| layoutView: i.options.layoutView, | |
| parentView: i | |
| }), i.Containers.Header, false); | |
| p3.rV(new a.Vs.Criterias({ | |
| layoutView: i.options.layoutView, | |
| parentView: i | |
| }), i.Containers.Results, false); | |
| p3.rV(new a.Vs.Results({ | |
| layoutView: i.options.layoutView, | |
| parentView: i | |
| }), i.Containers.Results, false) | |
| }) | |
| }, | |
| saveWorklist: function () { | |
| var i = this; | |
| i.collection.save({ | |
| dataParam: { | |
| id: i.options.layoutView.options.worklistId | |
| }, | |
| success: function (j, k) { | |
| a.Us.setCriteriaDirty(false); | |
| a.Us.setResultsDirty(false); | |
| a.Us.displayDirtyMessage() | |
| }, | |
| error: function (k, j) { | |
| p3.displayError("Error Saving Worklist") | |
| } | |
| }) | |
| } | |
| }); | |
| a.Vs.Header = Bb.View.extend({ | |
| template: "worklist/worklist.admissions.header.template.html", | |
| id: "listmanager-header", | |
| initialize: function () { | |
| var i = this; | |
| i.collection = new a.Cs.Worklists() | |
| }, | |
| events: { | |
| "click #add-criteria": "addCriteria", | |
| "click #edit-output": "editOutput" | |
| }, | |
| render: function (i) { | |
| var j = this; | |
| $(i).append(j.el); | |
| j.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this; | |
| p3.fT(i.template, function (j) { | |
| i.collection.fetch({ | |
| data: { | |
| directoryId: 1 | |
| }, | |
| update: true, | |
| cache: false, | |
| complete: function () { | |
| var l = "Untitled", | |
| k = _.findWhere(i.collection.toJSON(), { | |
| Id: parseInt(i.options.layoutView.options.worklistId, 10) | |
| }); | |
| if (k) { | |
| l = k.Name | |
| } | |
| i.options.layoutView.worklistName = l; | |
| i.$el.html(j({ | |
| collection: i.collection.toJSON(), | |
| worklistName: l | |
| })) | |
| } | |
| }) | |
| }) | |
| }, | |
| addCriteria: function (i) { | |
| i.preventDefault(); | |
| $("#listmanager-criterias").trigger("addcriteria") | |
| }, | |
| editOutput: function (i) { | |
| i.stopPropagation(); | |
| i.preventDefault(); | |
| var k = this, | |
| j; | |
| j = f.Vs.Modal2.extend({ | |
| template: "worklist/worklist.admissions.outputcolumns.template.html", | |
| collection: a.Data.OutputColumns, | |
| dataParam: { | |
| id: k.options.layoutView.options.worklistId | |
| }, | |
| modalRendered: function (m) { | |
| var l = this; | |
| l.collection.each(function (n) { | |
| var o = new a.Vs.OutputColumn({ | |
| model: n, | |
| selector: l.selector | |
| }); | |
| p3.rV(o, l.$(".ui-sortable"), false) | |
| }) | |
| }, | |
| modalUpdate: function (l) { | |
| if (l.eventCurrentTarget.attr("name") === "Selected") { | |
| return false | |
| } | |
| }, | |
| modalSave: function (n) { | |
| var m = this, | |
| l = m.$("#output-error"); | |
| if (_.where(m.collection.toJSON(), { | |
| Selected: true | |
| }).length > 8) { | |
| l.html("Please select no more than 8 output columns."); | |
| l.show(); | |
| return false | |
| } | |
| if (_.where(m.collection.toJSON(), { | |
| Selected: true | |
| }).length === 0) { | |
| l.html("Please select at least 1 output column."); | |
| l.show(); | |
| return false | |
| } | |
| l.hide() | |
| }, | |
| modalSavedSuccess: function (l) { | |
| a.Data.OutputColumns.reset(l.response); | |
| $("#listmanager-results").trigger("runresults") | |
| } | |
| }); | |
| f.Us.renderModal(new j({})) | |
| } | |
| }); | |
| a.Vs.Criterias = Bb.View.extend({ | |
| template: "worklist/worklist.admissions.criterias.template.html", | |
| id: "listmanager-criterias", | |
| className: function () { | |
| var i = ""; | |
| return i | |
| }, | |
| events: { | |
| addcriteria: "addCriteria", | |
| "click .runresults": "runResults" | |
| }, | |
| render: function (i) { | |
| var j = this; | |
| $(i).append(j.el); | |
| j.options.parentView.collection.fetch({ | |
| cache: false, | |
| data: { | |
| id: j.options.layoutView.options.worklistId, | |
| directoryId: 1 | |
| }, | |
| success: function () { | |
| j.renderData() | |
| } | |
| }) | |
| }, | |
| renderData: function () { | |
| var j = this, | |
| i = a.Us.getResultsDirty(); | |
| p3.fT(j.template, function (l) { | |
| j.$el.html(l({ | |
| collection: j.options.parentView.collection, | |
| resultsDirty: i | |
| })); | |
| var k = _.chain(j.options.parentView.collection.toJSON()).where({ | |
| Selected: true | |
| }).pluck("Id").value(); | |
| k = k.join(","); | |
| j.WorklistDDLB = new a.Cs.WorklistDDLB(); | |
| j.WorklistDDLB.fetch({ | |
| cache: false, | |
| data: { | |
| list: k | |
| }, | |
| success: function (m, n) { | |
| _.each(j.options.parentView.collection.models, function (o) { | |
| if (o.get("Selected")) { | |
| var p = new a.Vs.Criteria({ | |
| model: o, | |
| parentView: j | |
| }); | |
| p3.rV(p, j.$("#criterias"), false) | |
| } | |
| }) | |
| } | |
| }) | |
| }) | |
| }, | |
| addCriteria: function (i) { | |
| i.stopPropagation(); | |
| i.preventDefault(); | |
| var j = this; | |
| j.modal2Extend = f.Vs.Modal2.extend({ | |
| template: "worklist/worklist.admissions.criterias.edit.template.html", | |
| collection: j.options.parentView.collection, | |
| events: { | |
| "click .toggle-category": "toggleCategory", | |
| "submit .search-form": "searchCategories" | |
| }, | |
| modalUpdate: function (m) { | |
| var l = this, | |
| p = m.eventCurrentTarget.attr(l.selector), | |
| q, k = {}, | |
| o, n; | |
| if (m.eventCurrentTarget.hasClass("criteria")) { | |
| m.eventCurrentTarget.toggleClass("active"); | |
| q = (m.eventCurrentTarget.hasClass("active")) ? true : false; | |
| if (!_.contains(p, ".")) { | |
| k[p] = q; | |
| j.model.set(k) | |
| } else { | |
| l.setPropByString(l.collection.models, p, q) | |
| } | |
| return false | |
| } | |
| if (m.eventCurrentTarget.hasClass("search")) { | |
| o = $.trim(m.eventCurrentTarget.siblings("input").val()); | |
| m.eventCurrentTarget.siblings(".search-input").val(o); | |
| n = _.chain(l.collection.toJSON()).flatten(true).filter(function (r) { | |
| return r.Name.toLowerCase().indexOf(o.toLowerCase()) >= 0 | |
| }).pluck("Id").value(); | |
| l.$el.find("tr").hide(); | |
| _.each(n, function (r) { | |
| l.$el.find("tr[data-criteriaid=" + r + "]").show() | |
| }); | |
| l.$el.find("table").show(); | |
| return false | |
| } | |
| if (m.eventCurrentTarget.hasClass("search-input")) { | |
| return false | |
| } | |
| }, | |
| modalSave: function (k) { | |
| a.Us.setCriteriaDirty(true); | |
| p3.Layout.Containers.Modal.modal("hide"); | |
| j.renderData(); | |
| return false | |
| }, | |
| searchCategories: function (k) { | |
| var l = this; | |
| l.$el.find(".search").click() | |
| }, | |
| toggleCategory: function (k) { | |
| var l = this; | |
| l.$(k.currentTarget).siblings("table").toggle() | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new j.modal2Extend(), p3.Layout.Containers.Modal, true) | |
| }, | |
| runResults: function (i) { | |
| i.stopPropagation(); | |
| i.preventDefault(); | |
| $("#listmanager-results").trigger("runresults") | |
| } | |
| }); | |
| a.Vs.OutputColumn = Bb.View.extend({ | |
| template: "worklist/worklist.admissions.outputcolumn.template.html", | |
| tagName: "tr", | |
| initialize: function (i) { | |
| var j = this; | |
| Bb.Validation.bind(j, { | |
| forceUpdate: true, | |
| selector: i.selector | |
| }) | |
| }, | |
| events: { | |
| 'click [name="Selected"]': "selected" | |
| }, | |
| render: function (i) { | |
| var j = this; | |
| $(i).append(j.el); | |
| j.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this; | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({ | |
| model: i.model.toJSON() | |
| })); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| selected: function (i) { | |
| var j = this; | |
| _.defer(function () { | |
| j.model.set({ | |
| Selected: $(i.currentTarget).hasClass("active") | |
| }) | |
| }) | |
| } | |
| }); | |
| a.Vs.Criteria = Bb.View.extend({ | |
| template: "worklist/worklist.admissions.criteria.template.html", | |
| className: "label label-info", | |
| events: { | |
| "change select": "updateCriteria", | |
| "click .delete": "deleteCriteria" | |
| }, | |
| render: function (i) { | |
| var j = this; | |
| $(i).append(j.el); | |
| j.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this; | |
| p3.fT(i.template, function (k) { | |
| var j = _.where(i.options.parentView.WorklistDDLB.toJSON(), { | |
| BlockId: i.model.get("Id") | |
| }); | |
| i.$el.html(k({ | |
| model: i.model.toJSON(), | |
| ddlb: j | |
| })); | |
| if (i.model.toJSON().Field != null && i.model.toJSON().Field.length == 1 && i.model.toJSON().Field[0].FieldTypeId == 1) { | |
| if (h.isEmptier(i.model.toJSON().Field[0].Value)) { | |
| i.model.toJSON().Field[0].Value = j[0].dd_id | |
| } | |
| } | |
| i.$(".popover-markup").popover({ | |
| html: true, | |
| title: function () { | |
| return $(this).parent().find(".head").html() | |
| }, | |
| placement: "bottom", | |
| content: function () { | |
| return i.getOptionContent(j) | |
| }, | |
| trigger: "manual" | |
| }).click(function (l) { | |
| var m = (!i.$(".popover-markup").hasClass("on")); | |
| $(".popover-markup.on").popover("hide"); | |
| $(".popover-markup.on").removeClass("on"); | |
| if (m) { | |
| $(this).popover("show"); | |
| i.$(".popover-markup").addClass("on"); | |
| $(".popover").css("z-index", "2000").css("max-width", "none"); | |
| $(".popover-inner").css("width", "auto").css("padding", "0px"); | |
| $(".arrow").css("top", "-5px").css("left", "50%").css("margin-left", "-10px").css("border-bottom-color", "#ffffff").css("border-width", "0px 10px 10px 0px"); | |
| $(".worklist-multi").bind("click", function (n) { | |
| i.updateMultiSelect(n) | |
| }); | |
| $(".range-input").bind("change", function (n) { | |
| i.updateRange(n) | |
| }); | |
| $(".range-input").bind("blur", function (n) { | |
| i.updateRange(n) | |
| }); | |
| $(".worklist-dropdown").bind("change", function (n) { | |
| i.updateDropdown(n) | |
| }); | |
| $(".worklist-field").bind("change", function (n) { | |
| i.updateText(n) | |
| }); | |
| $(".worklist-bit").bind("click", function (n) { | |
| i.updateBit(n) | |
| }); | |
| c.Us.initialize(".date-input") | |
| } | |
| l.preventDefault(); | |
| l.stopPropagation() | |
| }) | |
| }) | |
| }, | |
| getOptionContent: function (k) { | |
| var n = this, | |
| m = [], | |
| j = "", | |
| l; | |
| if (n.model.get("BlockTypeId") == 3) { | |
| return n.getComplexContent(k) | |
| } | |
| if (h.isEmptier(n.model.toJSON().Field[0].Value)) { | |
| m = "" | |
| } else { | |
| m = n.model.toJSON().Field[0].Value.split(",") | |
| } | |
| j = "<form><fieldset><h6>" + n.model.get("Name") + "</h6>"; | |
| switch (n.model.get("Id")) { | |
| case 3: | |
| j += "<table><tr>"; | |
| for (l = 0; l < k.length; l++) { | |
| if (l % 4 === 0) { | |
| j += "</tr><tr>" | |
| } | |
| j += '<td><div style="margin-bottom:5px;margin-right:5px;" class="btn btn-default btn-mini btn-approve worklist-multi'; | |
| if ($.inArray(k[l].dd_id, m) > -1) { | |
| j += " active" | |
| } | |
| j += '" data-toggle="button" data-id="' + k[l].dd_id + '" data-field="2"><i class="p3icon-check"></i> ' + k[l].dd_description + "</div></td>" | |
| } | |
| j += "</tr></table>"; | |
| break; | |
| default: | |
| j += n.getMultiSelectButtons(k, m, n.model.toJSON().Field[0].Id); | |
| break | |
| } | |
| j += "</fieldset></form>"; | |
| return j | |
| }, | |
| getComplexContent: function (l) { | |
| var r = this, | |
| k = "", | |
| p = [], | |
| m = r.model.toJSON().Field, | |
| n, o, q; | |
| for (n = 0; n < m.length; n++) { | |
| q = ""; | |
| if (n > 0) { | |
| k += '<hr style="margin:5px -5px 5px -10px">' | |
| } | |
| k += "<h6>" + m[n].Label + "</h6>"; | |
| switch (m[n].FieldTypeId) { | |
| case p3.Us.Enum.WorklistFieldType.MULTISELECT: | |
| if (m[n].Value != null && m[n].Value.length > 0) { | |
| p = m[n].Value.split(",") | |
| } else { | |
| p = [] | |
| } | |
| k += r.getMultiSelectButtons(l, p, m[n].Id); | |
| break; | |
| case p3.Us.Enum.WorklistFieldType.DATERANGE: | |
| if (h.isEmptier(m[n].Value)) { | |
| p = [] | |
| } else { | |
| p = m[n].Value.split("|") | |
| } | |
| k += '<input type="text" data-field="' + m[n].Id + '" class="range-input date-input start" style="width:90px;color:#29202b;"'; | |
| if (p.length > 0) { | |
| k += ' value="' + p[0] + '"' | |
| } | |
| k += '/> to <input type="text" data-field="' + m[n].Id + '" class="range-input date-input end" style="width:90px;color:#29202b;"'; | |
| if (p.length > 0) { | |
| k += ' value="' + p[1] + '"' | |
| } | |
| k += "/>"; | |
| break; | |
| case p3.Us.Enum.WorklistFieldType.NUMERICRANGE: | |
| if (h.isEmptier(m[n].Value)) { | |
| p = [] | |
| } else { | |
| p = m[n].Value.split("|") | |
| } | |
| k += '<input type="text" data-field="' + m[n].Id + '" class="range-input start" style="width:90px;color:#29202b;"'; | |
| if (p.length > 0) { | |
| k += ' value="' + p[0] + '"' | |
| } | |
| k += '/> to <input type="text" data-field="' + m[n].Id + '" class="range-input end" style="width:90px;color:#29202b;"'; | |
| if (p.length > 0) { | |
| k += ' value="' + p[1] + '"' | |
| } | |
| k += "/>"; | |
| break; | |
| case p3.Us.Enum.WorklistFieldType.TEXTBOX: | |
| if (!h.isEmptier(m[n].Value)) { | |
| q = m[n].Value | |
| } | |
| k += '<input type="text" data-field="' + m[n].Id + '"class="worklist-field" value="' + q + '" style="color:#29202b;"/>'; | |
| break; | |
| case p3.Us.Enum.WorklistFieldType.DROPDOWN: | |
| k += '<select data-field="' + m[n].Id + '"class="worklist-dropdown" style="color:#29202b;"><option value="0">All</option>'; | |
| for (o = 0; o < l.length; o++) { | |
| if (l[o].FieldId == m[n].Id) { | |
| k += '<option value="' + l[o].dd_id + '"'; | |
| if (m[n].Value == l[o].dd_id) { | |
| k += ' selected="selected"' | |
| } | |
| k += ">" + l[o].dd_description + "</option>" | |
| } | |
| } | |
| k += "</select>"; | |
| break; | |
| case p3.Us.Enum.WorklistFieldType.BITFIELD: | |
| k += '<div class="btn-group" data-toggle="buttons"><label data-field="' + m[n].Id + '" class="btn btn-default btn-approve worklist-bit'; | |
| if (m[n].Value == "1") { | |
| k += " active" | |
| } | |
| k += '"><input type="radio">Yes</label><label data-field="' + m[n].Id + '" class="btn btn-default btn-denied worklist-bit'; | |
| if (m[n].Value == "0") { | |
| k += " active" | |
| } | |
| k += '"><input type="radio">No</label></div>'; | |
| break; | |
| case p3.Us.Enum.WorklistFieldType.NOTEXISTSBITFIELD: | |
| k += '<div class="btn-group" data-toggle="buttons"><label data-field="' + m[n].Id + '" class="btn btn-default btn-approve worklist-bit'; | |
| if (m[n].Value == "1") { | |
| k += " active" | |
| } | |
| k += '"><input type="radio">Yes</label><label data-field="' + m[n].Id + '" class="btn btn-default btn-denied worklist-bit'; | |
| if (m[n].Value == "0") { | |
| k += " active" | |
| } | |
| k += '"><input type="radio">No</button></div>'; | |
| break | |
| } | |
| } | |
| return k | |
| }, | |
| getMultiSelectButtons: function (j, n, k) { | |
| var m = "", | |
| l; | |
| for (l = 0; l < j.length; l++) { | |
| if (j[l].FieldId == k) { | |
| m += '<div style="margin-bottom:5px" class="btn btn-default btn-mini btn-approve worklist-multi'; | |
| if ($.inArray(j[l].dd_id, n) > -1) { | |
| m += " active" | |
| } | |
| m += '" data-toggle="button" data-id="' + j[l].dd_id + '" data-field="' + k + '"><i class="p3icon-check"></i> ' + j[l].dd_description + "</div><br />" | |
| } | |
| } | |
| return m | |
| }, | |
| deleteCriteria: function (i) { | |
| var j = this; | |
| j.model.set({ | |
| Selected: false | |
| }); | |
| _.each(j.model.toJSON().Field, function (k) { | |
| k.Value = null | |
| }); | |
| j.$el.remove(); | |
| a.Us.setCriteriaDirty(true); | |
| j.options.parentView.renderData(); | |
| $(".popover").remove() | |
| }, | |
| updateCriteria: function (i) { | |
| a.Us.setCriteriaDirty(true); | |
| var j = this; | |
| j.model.toJSON().Field[0].Value = $(i.currentTarget).val() | |
| }, | |
| updateMultiSelect: function (k) { | |
| a.Us.setCriteriaDirty(true); | |
| var r = this, | |
| j = $(k.currentTarget), | |
| o = j.data("id"), | |
| l = j.data("field"), | |
| p = !j.hasClass("active"), | |
| q = "", | |
| m = r.model.toJSON().Field, | |
| n; | |
| if (p) { | |
| q = o.toString(); | |
| j.addClass("active") | |
| } else { | |
| j.removeClass("active") | |
| } | |
| $(".worklist-multi.active").each(function (i, s) { | |
| if ($(s).data("id") != o && $(s).data("field") == l) { | |
| if (q.length > 0) { | |
| q += "," | |
| } | |
| q += $(s).data("id").toString() | |
| } | |
| }); | |
| for (n = 0; n < m.length; n++) { | |
| if (m[n].Id == l) { | |
| m[n].Value = q; | |
| break | |
| } | |
| } | |
| k.stopPropagation() | |
| }, | |
| updateRange: function (l) { | |
| a.Us.setCriteriaDirty(true); | |
| var r = this, | |
| j = $(l.currentTarget), | |
| m = j.data("field"), | |
| n = r.model.toJSON().Field, | |
| q = "", | |
| k = "", | |
| p = "", | |
| o; | |
| if (j.hasClass("start")) { | |
| q = j.val(); | |
| k = $(".end[data-field=" + m + "]").val() | |
| } else { | |
| if (j.hasClass("end")) { | |
| k = j.val(); | |
| q = $(".start[data-field=" + m + "]").val() | |
| } | |
| } | |
| if (q.length > 0 || k.length > 0) { | |
| p = q + "|" + k | |
| } | |
| for (o = 0; o < n.length; o++) { | |
| if (n[o].Id == m) { | |
| n[o].Value = p; | |
| break | |
| } | |
| } | |
| }, | |
| updateBit: function (k) { | |
| a.Us.setCriteriaDirty(true); | |
| var p = this, | |
| j = $(k.currentTarget), | |
| l = j.data("field"), | |
| m = p.model.toJSON().Field, | |
| o = 0, | |
| n; | |
| if (j.hasClass("btn-approve")) { | |
| o = 1 | |
| } | |
| for (n = 0; n < m.length; n++) { | |
| if (m[n].Id == l) { | |
| m[n].Value = o; | |
| break | |
| } | |
| } | |
| }, | |
| updateText: function (k) { | |
| a.Us.setCriteriaDirty(true); | |
| var o = this, | |
| j = $(k.currentTarget), | |
| l = j.data("field"), | |
| m = o.model.toJSON().Field, | |
| n; | |
| for (n = 0; n < m.length; n++) { | |
| if (m[n].Id == l) { | |
| m[n].Value = j.val(); | |
| break | |
| } | |
| } | |
| }, | |
| updateDropdown: function (k) { | |
| a.Us.setCriteriaDirty(true); | |
| var p = this, | |
| j = $(k.currentTarget), | |
| l = j.data("field"), | |
| m = p.model.toJSON().Field, | |
| o = j.val(), | |
| n; | |
| if (o === "0") { | |
| o = "" | |
| } | |
| for (n = 0; n < m.length; n++) { | |
| if (m[n].Id == l) { | |
| m[n].Value = o; | |
| break | |
| } | |
| } | |
| } | |
| }); | |
| a.Vs.CriteriaEdit = Bb.View.extend({ | |
| template: "worklist/worklist.admissions.criteria.edit.template.html", | |
| tagName: "tr", | |
| events: { | |
| "click button.criteria": "setCriteria" | |
| }, | |
| render: function (i) { | |
| var j = this; | |
| $(i).append(j.el); | |
| j.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this; | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({ | |
| model: i.model.toJSON() | |
| })) | |
| }) | |
| }, | |
| setCriteria: function (i) { | |
| var l = this, | |
| j = $(i.currentTarget), | |
| k; | |
| j.toggleClass("active"); | |
| k = (j.hasClass("active")) ? true : false; | |
| l.model.set({ | |
| Selected: k | |
| }) | |
| } | |
| }); | |
| a.Vs.Results = Bb.View.extend({ | |
| template: "worklist/worklist.admissions.results.template.html", | |
| id: "listmanager-results", | |
| initialize: function () { | |
| var i = this; | |
| i.criteria = new a.Cs.Criteria(); | |
| i.results = new a.Cs.Results(); | |
| a.Data.Results = i.results | |
| }, | |
| events: { | |
| runresults: "renderData", | |
| "click th": "resultSort", | |
| "click .start-worklist-session": "startWorklistSession" | |
| }, | |
| render: function (i) { | |
| var j = this; | |
| $(i).append(j.el); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.jQueryUI, function () { | |
| a.Data.roleGroupTasks = new a.Cs.RoleGroupTasks(); | |
| a.Data.roleGroupTasks.fetch({ | |
| data: { | |
| id: 1 | |
| }, | |
| success: function (k, l) { | |
| j.dictionaries = {}; | |
| j.dictionaries.RoleGroupTasks = l[0].RoleGroupTasks; | |
| j.renderData() | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading landing pages") | |
| } | |
| }) | |
| }) | |
| }, | |
| renderData: function () { | |
| var j = this, | |
| i = j.options.parentView.collection.toJSON(); | |
| j.criteria.reset(i); | |
| p3.fT(j.template, function (k) { | |
| j.criteria.save({ | |
| dataParam: { | |
| id: j.options.layoutView.options.worklistId, | |
| changed: true | |
| }, | |
| success: function (l, m) { | |
| j.columns = []; | |
| _.each(a.Data.OutputColumns.toJSON(), function (n) { | |
| if (n.Selected === true) { | |
| j.columns.push({ | |
| SortName: n.FieldName, | |
| DisplayName: n.Header, | |
| Sortable: true | |
| }) | |
| } | |
| }); | |
| j.results.sortProp = j.columns[0].SortName; | |
| _.each(l, function (n) { | |
| _.each(_.difference(_.pluck(j.columns, "SortName"), _.keys(n)), function (o) { | |
| n[o] = "" | |
| }) | |
| }); | |
| j.results.reset(l); | |
| j.$el.html(k({ | |
| dictionaries: j.dictionaries, | |
| columns: j.columns | |
| })); | |
| j.$("th").first().click(); | |
| a.Us.setResultsDirty(a.Us.getCriteriaDirty()); | |
| a.Us.displayDirtyMessage() | |
| }, | |
| error: function (l, m) { | |
| p3.displayError("Error Running Results") | |
| } | |
| }) | |
| }) | |
| }, | |
| startWorklistSession: function (i) { | |
| i.preventDefault(); | |
| var l = this, | |
| j = $(i.currentTarget).data("id"), | |
| k = l.results.pluck("UserId").map(function (m) { | |
| return m.toString() | |
| }); | |
| k.unshift(l.options.layoutView.worklistName); | |
| k.unshift(l.options.layoutView.options.worklistId); | |
| k.unshift(0); | |
| if (k) { | |
| p3.setSessionState("AdmWorkList", k, function () { | |
| p3.router().navigate("#candidate/" + j + "/" + l.$("#worklist-task").val().toLowerCase(), true) | |
| }) | |
| } | |
| }, | |
| resultSort: function (i) { | |
| i.preventDefault(); | |
| var n = this, | |
| l = $(i.currentTarget), | |
| m = l.data("sort"), | |
| j = (l.hasClass("muted")) ? "asc" : "toggle", | |
| k = (l.find("i").hasClass("p3icon-sortUp")) ? "p3icon-sortDown" : "p3icon-sortUp"; | |
| p3.fT(n.template, function (o) { | |
| n.results.setSort(m, j); | |
| n.$el.html(o({ | |
| dictionaries: n.dictionaries, | |
| collection: n.results.toJSON(), | |
| columns: n.columns, | |
| count: n.results.length | |
| })); | |
| l = n.$("th[data-sort=" + m + "]"); | |
| l.removeClass("muted"); | |
| l.find("i").removeClass("p3icon-sortOff").addClass(k); | |
| _.each($("#listmanager-results th:not(:last-child)"), function (p) { | |
| $(p).width($(p).width()) | |
| }); | |
| n.columnResize() | |
| }) | |
| }, | |
| columnResize: function () { | |
| $(".resize").draggable({ | |
| axis: "x", | |
| containment: $("#listmanager-results table"), | |
| stop: function () { | |
| $(this).css("left", "0px") | |
| } | |
| }) | |
| } | |
| }); | |
| a.Vs.Footer = Bb.View.extend({ | |
| template: "worklist/worklist.admissions.footer.template.html", | |
| id: "listmanager-footer", | |
| className: "workspace-footer", | |
| events: { | |
| "click .save": "saveChanges", | |
| "click .export": "exportResults", | |
| "click .sendmessage": "sendMessage", | |
| "click .maillabels": "mailLabels" | |
| }, | |
| render: function (i) { | |
| var j = this; | |
| $(i).append(j.el); | |
| j.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this; | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({ | |
| id: i.options.layoutView.options.worklistId, | |
| columnListId: 1 | |
| })) | |
| }) | |
| }, | |
| saveChanges: function (i) { | |
| i.preventDefault(); | |
| $("#listmanager-main").trigger("saveworklist") | |
| }, | |
| exportResults: function (l) { | |
| var n = this, | |
| i = $(l.currentTarget), | |
| m = n.options.layoutView.options.worklistId, | |
| j = aP + "IntermediateLM/ExportFile/" + m + "?columnListid=1", | |
| k = new a.Cs.ExportCriterias(a.Data.Criterias.toJSON()); | |
| i.prop("disabled", true).button("loading"); | |
| k.save({ | |
| dataParam: { | |
| id: m, | |
| changed: true | |
| }, | |
| success: function (o, p) { | |
| window.location.replace(j) | |
| }, | |
| error: function () { | |
| p3.displayError("Error storing current criteria") | |
| }, | |
| complete: function () { | |
| i.prop("disabled", false).button("reset") | |
| } | |
| }) | |
| }, | |
| sendMessage: function (j) { | |
| j.preventDefault(); | |
| var i; | |
| if (a.Data.Results && a.Data.Results.length) { | |
| i = _.chain(a.Data.Results.toJSON()).pluck("UserId").uniq().value(); | |
| if (i.length) { | |
| e.PrepopulateData = i.join() | |
| } | |
| } | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new e.Vs.AdmissionsCompose({ | |
| detailId: 0 | |
| }), p3.Layout.Containers.Modal, false) | |
| }, | |
| mailLabels: function (i) { | |
| i.preventDefault(); | |
| window.open("/podium/default.aspx?t=38466&wapp=1&ilm=1", "_blank") | |
| } | |
| }); | |
| a.Vs.Worklists = Bb.View.extend({ | |
| template: "worklist/worklist.worklists.template.html", | |
| initialize: function () { | |
| var i = this; | |
| i.collection = new a.Cs.Worklists(); | |
| i.searchTerm = ""; | |
| i.filterBy = 0 | |
| }, | |
| events: { | |
| "click .filter-link": "filterChange", | |
| "click #search-button": "doSearch", | |
| "keydown #search-box": "doSearchEnter", | |
| "click .copy-list-button": "openCopyDialog", | |
| "click .delete-list-button": "openDeleteDialog", | |
| "click .edit-list-button": "editList", | |
| "click #add-worklist-button": "openAddDialog" | |
| }, | |
| render: function (i) { | |
| var j = this; | |
| $(i).append(j.el); | |
| j.renderTemplate() | |
| }, | |
| renderTemplate: function () { | |
| var i = this; | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({})); | |
| i.renderLists(i.getListArray(true)) | |
| }) | |
| }, | |
| getListArray: function (i) { | |
| var l = this, | |
| j = [], | |
| k; | |
| if (i) { | |
| l.collection.fetch({ | |
| async: false, | |
| data: { | |
| directoryId: 1 | |
| }, | |
| error: function () { | |
| p3.displayError("Error Loading Worklists") | |
| } | |
| }) | |
| } | |
| if (l.searchTerm.length > 0 || l.filterBy > 0) { | |
| k = l.collection.filter(function (m) { | |
| var n = false; | |
| if (l.searchTerm.length > 0) { | |
| n = (m.get("Name").toLowerCase().indexOf(l.searchTerm) > -1) | |
| } | |
| if (l.filterBy > 0 && (l.searchTerm.length == 0 || n)) { | |
| if (l.filterBy == 1) { | |
| n = (m.get("Active")) | |
| } else { | |
| n = (!m.get("Active")) | |
| } | |
| } | |
| return n | |
| }); | |
| _.each(k, function (m) { | |
| j.push(m.toJSON()) | |
| }) | |
| } else { | |
| j = l.collection.toJSON() | |
| } | |
| return j | |
| }, | |
| renderLists: function (i) { | |
| var k = this, | |
| j = new a.Vs.ListItems({ | |
| lists: i | |
| }); | |
| p3.rV(j, "#worklist-items-container", true); | |
| j.on("statusChange", function (m, l) { | |
| var n = k.collection.get(m); | |
| n.set("Active", l); | |
| if (k.filterBy > 0) { | |
| k.renderLists(k.getListArray(false)) | |
| } | |
| }); | |
| j.on("nameChange", function (l, n) { | |
| var m = k.collection.get(l); | |
| m.set("Name", n) | |
| }) | |
| }, | |
| filterChange: function (j) { | |
| var k = this, | |
| i = $(j.currentTarget); | |
| $(".filter-icon").removeClass("p3icon-ok").addClass("p3icon-check"); | |
| $(".filter-color").css("color", "#999"); | |
| i.find(".filter-icon").removeClass("p3icon-check").addClass("p3icon-ok"); | |
| i.find(".filter-color").css("color", "#424242"); | |
| switch (j.currentTarget.id) { | |
| case "filter-all-link": | |
| k.filterBy = 0; | |
| break; | |
| case "filter-active-link": | |
| k.filterBy = 1; | |
| break; | |
| case "filter-inactive-link": | |
| k.filterBy = 2; | |
| break | |
| } | |
| k.renderLists(k.getListArray(false)); | |
| return false | |
| }, | |
| doSearchEnter: function (i) { | |
| if (i.keyCode === 13) { | |
| this.doSearch(i) | |
| } | |
| }, | |
| doSearch: function (i) { | |
| var j = this; | |
| j.searchTerm = $("#search-box").val().toLowerCase(); | |
| j.renderLists(j.getListArray(false)); | |
| return false | |
| }, | |
| openDeleteDialog: function (j) { | |
| var k = this, | |
| i = $(j.currentTarget); | |
| p3.showConfirm("Delete Work List", "Are you sure you want to delete this Work List?", null, function () { | |
| var l = new a.Ms.Worklist({ | |
| Id: i.data("id") | |
| }); | |
| l.destroy({ | |
| error: function () { | |
| p3.displayError("Error deleting work list") | |
| }, | |
| success: function () { | |
| i.parents("tr").remove(); | |
| k.collection.remove(k.collection.get(i.data("id"))) | |
| } | |
| }) | |
| }); | |
| return false | |
| }, | |
| openAddDialog: function (j) { | |
| var i = new a.Vs.AddWorklist(); | |
| p3.rV(i, p3.Layout.Containers.Modal, true); | |
| p3.showModal(p3.Layout.Containers.Modal); | |
| return false | |
| }, | |
| editList: function (i) { | |
| var j = $(i.currentTarget).data("id"); | |
| p3.router().navigate("#admissionsworklist/" + j, true); | |
| return false | |
| } | |
| }); | |
| a.Vs.ListItems = Bb.View.extend({ | |
| template: "worklist/worklist.listitems.template.html", | |
| initialize: function () { | |
| var i = this; | |
| i.lists = i.options.lists | |
| }, | |
| events: { | |
| "mouseover td.inline-edit": "handleHover", | |
| "mouseout td.inline-edit": "handleHoverOff", | |
| "click td.inline-edit": "inlineEdit", | |
| "focusout .edit-cell": "inlineClose", | |
| "change .status-select": "saveStatus" | |
| }, | |
| render: function (i) { | |
| var j = this; | |
| $(i).append(j.el); | |
| j.renderTemplate() | |
| }, | |
| renderTemplate: function () { | |
| var i = this; | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({ | |
| worklist: i.lists | |
| })) | |
| }) | |
| }, | |
| handleHover: function (j) { | |
| var i = $(j.target).closest("td"), | |
| k = "fa fa-pencil"; | |
| if (!$(".edit-cell-icon").length) { | |
| if (!i.hasClass("edit-cell")) { | |
| i.prepend($("<i>", { | |
| "class": k + " edit-cell-icon pull-right" | |
| })) | |
| } | |
| i.addClass("on"); | |
| i.mouseleave(function () { | |
| if (i.hasClass("on")) { | |
| i.removeClass("on") | |
| } | |
| }) | |
| } | |
| }, | |
| handleHoverOff: function (i) { | |
| if (!$(i.target).hasClass("on")) { | |
| this.$("i.edit-cell-icon").remove() | |
| } | |
| }, | |
| inlineEdit: function (k) { | |
| var i = $(k.target).closest("td"), | |
| j = false, | |
| l = ""; | |
| if (!i.hasClass("edit-cell")) { | |
| if (i.hasClass("list-status")) { | |
| if (i.html().indexOf("Inactive") == -1) { | |
| j = true | |
| } | |
| l = '<select class="status-select input-small form-control" style="width:auto;"><option value="Active"'; | |
| if (j) { | |
| l += ' selected="selected"' | |
| } | |
| l += '>Active</option><option value="Inactive"'; | |
| if (!j) { | |
| l += ' selected="selected"' | |
| } | |
| l += ">Inactive</option></select>"; | |
| i.html(l); | |
| i.addClass("edit-cell"); | |
| i.find("select").focus() | |
| } else { | |
| i.html('<input type="text" class="list-name-box input-medium form-control" max-length="50" value="' + i.find("P").html() + '"/>'); | |
| i.addClass("edit-cell"); | |
| i.find(".list-name-box").focus() | |
| } | |
| } | |
| }, | |
| inlineClose: function (l, k) { | |
| var r = this, | |
| j, m, q, o, n, p = ""; | |
| if (!_.isEqual(l.target, l.currentTarget)) { | |
| j = $(l.target); | |
| if (j.hasClass("list-name-box")) { | |
| n = j.closest("td").data("id"); | |
| for (m = 0; m < r.lists.length; m++) { | |
| if (r.lists[m].Id == n) { | |
| o = r.lists[m]; | |
| if (j.val().length > 0 && j.val() != o.Name) { | |
| p = j.val() | |
| } else { | |
| p = o.Name | |
| } | |
| break | |
| } | |
| } | |
| q = new a.Ms.UpdateStatus(); | |
| q.save({ | |
| id: n, | |
| activeInd: o.Active, | |
| searchName: p | |
| }, { | |
| success: function () { | |
| r.trigger("nameChange", n, p) | |
| }, | |
| error: function () { | |
| p3.displayError("Error saving list name") | |
| } | |
| }); | |
| j.closest("td").removeClass("edit-cell").html('<p style="margin:5px 0px 0px 0px">' + p + "</p>") | |
| } else { | |
| j.closest("td").removeClass("edit-cell").html(j.val()) | |
| } | |
| } | |
| }, | |
| saveStatus: function (j) { | |
| var m = this, | |
| i = $(j.target), | |
| k = i.closest("td").data("id"), | |
| l = new a.Ms.UpdateStatus(); | |
| l.save({ | |
| id: k, | |
| activeInd: i.val() === "Active", | |
| searchName: "" | |
| }, { | |
| error: function () { | |
| p3.displayError("Error saving list status") | |
| }, | |
| success: function () { | |
| m.trigger("statusChange", k, i.val() === "Active") | |
| } | |
| }) | |
| } | |
| }); | |
| a.Vs.AddWorklist = Bb.View.extend({ | |
| template: "worklist/worklist.add.template.html", | |
| events: { | |
| "click #btnSave": "saveWorkList" | |
| }, | |
| render: function (i) { | |
| var j = this; | |
| $(i).append(j.el); | |
| j.renderTemplate() | |
| }, | |
| renderTemplate: function () { | |
| var i = this; | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({})) | |
| }) | |
| }, | |
| saveWorkList: function (k) { | |
| var j = $("#name-box"), | |
| i = $(".control-group"), | |
| l; | |
| i.removeClass("error"); | |
| if (j.val().trim().length > 0) { | |
| l = new a.Ms.Worklist({ | |
| Name: j.val(), | |
| DirectoryId: 1 | |
| }); | |
| l.save({}, { | |
| success: function (m, n) { | |
| $("#site-modal").modal("hide"); | |
| p3.router().navigate("#admissionsworklist/" + n, true) | |
| }, | |
| error: function (m, n) { | |
| p3.displayError("Error creating worklist") | |
| } | |
| }) | |
| } else { | |
| i.addClass("error") | |
| } | |
| } | |
| }); | |
| a.Vs.popup = Bb.View.extend({ | |
| template: "worklist/worklist.add.template.html", | |
| render: function (i) { | |
| var j = this; | |
| $(i).append(j.el); | |
| j.renderTemplate() | |
| }, | |
| renderTemplate: function () { | |
| var i = this; | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({})) | |
| }) | |
| } | |
| }); | |
| Hb.registerHelper("eachWorklistResultWithName", function (l, j, k) { | |
| var m = _.pick(l, _.pluck(j, "SortName")), | |
| i = ""; | |
| _.each(m, function (o, n) { | |
| if (n === "Name") { | |
| i += k.fn('<a class="start-worklist-session" href="#" data-id="' + l.UserId + '">' + o + "</a>") | |
| } else { | |
| i += k.fn(o) | |
| } | |
| }); | |
| return i | |
| }); | |
| Hb.registerHelper("eachWorklistResult", function (p, l, o) { | |
| var q = _.chain(p).pick(l).values().value(), | |
| k = "", | |
| m, n; | |
| for (m = 0, n = q.length; m < n; m++) { | |
| k += o.fn(q[m]) | |
| } | |
| return k | |
| }); | |
| a.Us.getCriteriaDirty = function () { | |
| return a.Data.criteriaDirty | |
| }; | |
| a.Us.setCriteriaDirty = function (i) { | |
| a.Data.criteriaDirty = i | |
| }; | |
| a.Us.getResultsDirty = function () { | |
| return a.Data.resultsDirty | |
| }; | |
| a.Us.setResultsDirty = function (i) { | |
| a.Data.resultsDirty = i | |
| }; | |
| a.Us.displayDirtyMessage = function () { | |
| if (a.Data.resultsDirty) { | |
| $(".dirtymessage").show() | |
| } else { | |
| $(".dirtymessage").hide() | |
| } | |
| }; | |
| p3.router().route("admissionsworklist/:worklistid", "admissionsworklist", function (i) { | |
| a.Data.worklistId = i; | |
| a.Data.criteriaDirty = false; | |
| a.Data.resultsDirty = false; | |
| p3.renderMainPage(new a.Vs.Layout({ | |
| worklistId: i | |
| })) | |
| }); | |
| p3.router().route("admissionsworklists", "admissionsworklists", function () { | |
| p3.renderMainPage(new a.Vs.Worklists({})) | |
| }) | |
| }(p3.module("admissions/admissionsworklist"))); | |
| (function (a) { | |
| a.Ms.MigrationStatus = Bbm.extend({ | |
| url: function () { | |
| return aP + "Inquiry/MigrationStatus" | |
| } | |
| }); | |
| a.Cs.ProcessGet = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/DashboardProcessGet/" | |
| } | |
| }); | |
| a.Vs.Layout = Bb.View.extend({ | |
| template: "page/page.12.template.html", | |
| render: function (b) { | |
| var c = this; | |
| p3.setTitle("Admissions Overview"); | |
| $(b).html(c.el); | |
| c.renderData() | |
| }, | |
| renderData: function () { | |
| var b = this; | |
| p3.fT(b.template, function (c) { | |
| b.$el.html(c({})); | |
| p3.rV(new a.Vs.Candidates(), b.$(".col-center"), false) | |
| }) | |
| } | |
| }); | |
| a.Vs.Candidates = Bb.View.extend({ | |
| template: "admissions/overview.template.html", | |
| className: "mt-20", | |
| render: function (b) { | |
| var d = this, | |
| c = new a.Ms.MigrationStatus(); | |
| c.fetch({ | |
| cache: false, | |
| success: function (e, f) { | |
| d.MigrateStatusId = c.get("MigrateStatusId"); | |
| $(b).html(d.el); | |
| d.renderData() | |
| } | |
| }) | |
| }, | |
| renderData: function () { | |
| var b = this; | |
| p3.fT(b.template, function (c) { | |
| b.$el.html(c({ | |
| migrateStatusId: b.MigrateStatusId | |
| })); | |
| p3.rV(new a.Vs.ProcessCounts(), b.$(".process-counts"), false) | |
| }) | |
| } | |
| }); | |
| a.Vs.ProcessCounts = Bb.View.extend({ | |
| template: "admissions/overview.process.template.html", | |
| initialize: function () { | |
| var b = this; | |
| b.collection = new a.Cs.ProcessGet() | |
| }, | |
| render: function (b) { | |
| var c = this; | |
| $(b).html(c.el); | |
| c.renderData() | |
| }, | |
| renderData: function () { | |
| var b = this; | |
| b.collection.fetch({ | |
| success: function () { | |
| p3.fT(b.template, function (c) { | |
| b.$el.html(c({ | |
| collection: b.collection.toJSON() | |
| })) | |
| }) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading overview") | |
| } | |
| }) | |
| } | |
| }); | |
| p3.router().route("admissions/overview", "admissionsoverview", function () { | |
| p3.renderMainPage(new a.Vs.Layout({})) | |
| }) | |
| }(p3.module("admissions/admoverview"))); | |
| (function (a) { | |
| var c = p3.module("report"), | |
| b = p3.module("lists"); | |
| a.Ms.Assignment = Bbm.extend({}); | |
| a.Ms.AdmissionStatus = Bbm.extend({}); | |
| a.Cs.Assignments = Bbc.extend({ | |
| model: a.Ms.Assignment, | |
| url: function () { | |
| return aP + "datadirect/ParentStudentUserAssignments/" | |
| } | |
| }); | |
| a.Cs.AdmissionStatuses = Bbc.extend({ | |
| model: a.Ms.AdmissionStatus, | |
| url: function () { | |
| return aP + "datadirect/AdmissionStatusCountChartGet/" | |
| } | |
| }); | |
| a.Vs.Layout = Bb.View.extend({ | |
| template: "admissions/analytics.layout.template.html", | |
| initialize: function () { | |
| b.loadLists() | |
| }, | |
| render: function (d) { | |
| var e = this; | |
| e.$el.appendTo(d); | |
| p3.fT(e.template, function (j) { | |
| p3.setTitle("Analytics"); | |
| e.$el.html(j()); | |
| var f = e.$el.find("#page-2col-wideleft"), | |
| g = e.$el.find("#page-2col-slimright"), | |
| h = new a.Cs.AdmissionStatuses(), | |
| i = new a.Vs.AdmissionStatusChart({ | |
| collection: h | |
| }); | |
| p3.rV(i, f, false); | |
| c.reportList(g); | |
| p3.rV(new b.Vs.ListsView(), g, false) | |
| }) | |
| } | |
| }); | |
| a.Vs.AdmissionStatusChart = Bb.View.extend({ | |
| template: "admissions/chart.template.html", | |
| events: {}, | |
| initialize: function (d) { | |
| var e = this; | |
| d.chart = function (f) { | |
| e.options.collection.fetch({ | |
| data: { | |
| numberOfItems: 6 | |
| }, | |
| success: function (g, h) { | |
| d3.select("#chart-container svg").datum(e.newChartData(g)).transition().duration(500).call(f) | |
| } | |
| }) | |
| } | |
| }, | |
| dispose: function () { | |
| $(window).off("resize") | |
| }, | |
| render: function (d) { | |
| var e = this; | |
| e.$el.appendTo(d); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.Chart, function () { | |
| nv.addGraph(function () { | |
| var f = nv.models.multiBarChart().x(function (g, h) { | |
| return g.label | |
| }).y(function (g) { | |
| return g.value | |
| }).showControls(true); | |
| f.xAxis.tickFormat(function (g) { | |
| return g | |
| }); | |
| f.yAxis.tickFormat(function (g) { | |
| return g | |
| }); | |
| e.options.chart(f); | |
| return f | |
| }); | |
| e.renderTemplate() | |
| }) | |
| }, | |
| renderTemplate: function () { | |
| var d = this; | |
| p3.fT(d.template, function (e) { | |
| d.$el.html(e({ | |
| title: "Status Counts by Entering Year", | |
| height: 400 | |
| })) | |
| }) | |
| }, | |
| newChartData: function (d) { | |
| var f = this, | |
| e = _.groupBy(d.models, function (g) { | |
| return g.get("DataLabel1") | |
| }); | |
| f.newChartData = []; | |
| f.newTicks = []; | |
| _.each(e, function (h) { | |
| var g = []; | |
| _.each(h, function (j, i) { | |
| g.push({ | |
| label: j.get("AxisLabel"), | |
| value: j.get("DataValue1") | |
| }) | |
| }); | |
| f.newChartData.push({ | |
| key: h[0].get("DataLabel1"), | |
| values: g | |
| }) | |
| }); | |
| return f.newChartData | |
| } | |
| }) | |
| }(p3.module("admissions/analytics"))); | |
| (function (a) { | |
| var d = p3.module("admissions/managecandidates"), | |
| m = p3.module("system/logosandseals"), | |
| l = p3.module("admissions/form/inquiries"), | |
| b = p3.module("admissions/form/applications"), | |
| q = p3.module("utilities/smodal"), | |
| c = p3.module("shared/base"), | |
| i = p3.module("admissions/form/forms"), | |
| g = p3.module("shared/datepicker"), | |
| n = p3.module("utilities/multifetch"), | |
| p = p3.module("shared/schoolforms"), | |
| e = p3.module("admissions/form/contracts"), | |
| o = p3.module("admissions/form/recommendations"), | |
| t = p3.module("utilities/validate"), | |
| h = p3.Us.Enum, | |
| s = p3.Us.Tools, | |
| k = p3.Us.InfoMessageLibrary, | |
| j = p3.Us.InfoMessage, | |
| f = p3.Us.Culture, | |
| r = p3.module("shared/task"); | |
| a.Ms.BaseForm = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| idAttribute: "ApplicationFormId", | |
| url: function () { | |
| return this.id ? aP + "OnlineApplication/ApplicationForm/" + this.id + "/" : aP + "OnlineApplication/ApplicationForm/" | |
| } | |
| }); | |
| a.Ms.ApplicationForm = a.Ms.BaseForm.extend({ | |
| defaults: { | |
| FormType: h.FormType.APPLICATION.Value | |
| }, | |
| initialize: function () { | |
| _.extend(this, $.extend(true, {}, a.Us.NotificationValidation)); | |
| _.extend(this.validation, { | |
| Name: [{ | |
| required: true, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| EffectiveDate: [{ | |
| date: true | |
| }], | |
| EndDate: [{ | |
| date: true | |
| }], | |
| Fee: [{ | |
| required: false, | |
| pattern: "number", | |
| msg: k.P3.NotNumeric | |
| }] | |
| }) | |
| } | |
| }); | |
| a.Ms.ContractForm = a.Ms.BaseForm.extend({ | |
| defaults: { | |
| FormType: h.FormType.CONTRACT.Value, | |
| OkToEdit: true | |
| }, | |
| initialize: function () { | |
| _.extend(this, $.extend(true, {}, a.Us.NotificationValidation)); | |
| _.extend(this.validation, { | |
| SchoolYear: [{ | |
| required: true, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| ContractTypeId: [{ | |
| required: true, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| EffectiveDate: [{ | |
| date: true, | |
| required: false | |
| }], | |
| EndDate: [{ | |
| date: true, | |
| required: false | |
| }], | |
| DueDate: [{ | |
| fn: function (w, u, v) { | |
| if (!v.ignoreDueDate) { | |
| if (t.isEmptier(w)) { | |
| return k.P3.RequiredInfoNotEntered | |
| } | |
| if (!t.isDate(w)) { | |
| return k.P3.DateError.fixDateFormat() | |
| } | |
| } | |
| } | |
| }], | |
| InSchoolPmtText: [{ | |
| fn: function (x, v, w) { | |
| var u = $("#" + v); | |
| if (w.InSchoolPmt && t.isEmptier(x)) { | |
| u.parent().addClass("box-validate"); | |
| return k.P3.RequiredInfoNotEntered | |
| } | |
| u.parent().removeClass("box-validate") | |
| } | |
| }] | |
| }) | |
| }, | |
| IsMigrationLocked: function () { | |
| var v = this, | |
| u; | |
| if (v.get("FormType") === h.FormType.SMART_TUITION_CONTRACT.Value || v.get("FormType") === h.FormType.TMS_CONTRACT.Value) { | |
| u = v.get("HasGeneratedContracts") || !v.get("TemplateFormId") || v.get("TemplateFormId") <= 0 | |
| } | |
| return u | |
| } | |
| }); | |
| a.Ms.InquiryForm = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| idAttribute: "ApplicationFormId", | |
| defaults: { | |
| FormType: h.FormType.INQUIRY.Value, | |
| ActiveInd: false, | |
| InquiryAdmissionsInd: true | |
| }, | |
| initialize: function () { | |
| _.extend(this, $.extend(true, {}, a.Us.NotificationValidation)); | |
| _.extend(this.validation, { | |
| Name: [{ | |
| required: true, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| EffectiveDate: [{ | |
| date: true | |
| }], | |
| EndDate: [{ | |
| date: true | |
| }] | |
| }) | |
| }, | |
| urlRoot: "OnlineApplication/ApplicationForm/" | |
| }); | |
| a.Ms.SchoolForm = a.Ms.BaseForm.extend({ | |
| defaults: { | |
| ActiveInd: false, | |
| ESigNbr: 99, | |
| ESigFrom: 2, | |
| OkToEdit: true | |
| }, | |
| initialize: function () { | |
| _.extend(this, $.extend(true, {}, a.Us.NotificationValidation)); | |
| _.extend(this.validation, { | |
| FormType: [{ | |
| required: true, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| Name: [{ | |
| required: true, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| EffectiveDate: [{ | |
| date: true | |
| }], | |
| EndDate: [{ | |
| date: true | |
| }], | |
| DueDate: [{ | |
| date: true, | |
| required: true, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| ESigNbr: [{ | |
| required: true, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }] | |
| }) | |
| }, | |
| getRecipientCollection: function () { | |
| var u = new p.Cs.UsersRegarding(this.get("UsersRegarding")); | |
| u.parentModel = this; | |
| return u | |
| }, | |
| url: function () { | |
| return this.id ? aP + "SchoolForm/Edit/" + this.id + "/" : aP + "SchoolForm/Edit/" | |
| }, | |
| parse: function (v, u) { | |
| _(v.UsersRegarding).each(function (w) { | |
| w.Name = w.LastName + ", " + w.FirstName; | |
| _(w.Recipients).each(function (x) { | |
| x.Name = x.LastName + ", " + x.FirstName | |
| }) | |
| }); | |
| return v | |
| }, | |
| sync: function (u, v, w) { | |
| if (u.toLowerCase() !== "read") { | |
| w.url = v.url(); | |
| if (!_.isEmpty(w.dataParam)) { | |
| var x = (w.url.indexOf("?") > -1) ? "&" : "?"; | |
| w.url += x + $.param(w.dataParam) | |
| } | |
| if (u.toLowerCase() === "update") { | |
| v.attributes.UsersRegarding = _(v.attributes.UsersRegarding).map(function (z) { | |
| var y = _(z.Recipients).map(function (A) { | |
| return { | |
| UserId: A.UserId, | |
| Selected: A.Selected | |
| } | |
| }); | |
| return { | |
| UserId: z.UserId, | |
| Recipients: y | |
| } | |
| }) | |
| } | |
| } | |
| return Bb.sync.apply(this, arguments) | |
| } | |
| }); | |
| a.Ms.RecommendationForm = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| idAttribute: "ApplicationFormId", | |
| defaults: { | |
| FormType: h.FormType.RECOMMENDATION.Value, | |
| ActiveInd: false | |
| }, | |
| initialize: function () { | |
| var u = this, | |
| v = o.Us.FormValidation(u); | |
| _.extend(u, v) | |
| }, | |
| urlRoot: "RecommendationForm/FormDetail/", | |
| isNotifFieldRequired: function (v, u) { | |
| var w = q.Us.getPropByString(u, v); | |
| return u.ActiveInd && w && w.Active | |
| } | |
| }); | |
| a.Ms.Section = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| idAttribute: "ApplicationSectionId", | |
| validation: { | |
| Name: [{ | |
| required: true, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "OnlineApplication/ApplicationSection/" + this.id + "/" : aP + "OnlineApplication/ApplicationSection/" | |
| } | |
| }); | |
| a.Ms.Element = Bbm.extend({ | |
| idAttribute: "Id" | |
| }); | |
| a.Ms.Block = Bbm.extend({ | |
| idAttribute: "Id" | |
| }); | |
| a.Ms.SectionItem = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| idAttribute: "SectionItemId", | |
| url: function () { | |
| return this.id ? aP + "OnlineApplication/SectionItem/" + this.id + "/" : aP + "OnlineApplication/SectionItem/" | |
| }, | |
| validation: { | |
| "FieldBlockItem.RatingWeight": [{ | |
| required: false, | |
| pattern: "digits", | |
| min: 1, | |
| max: 10000, | |
| msg: k.P3.DigitError | |
| }] | |
| }, | |
| isElement: function () { | |
| return (this.get("ElementItem").Id) ? true : false | |
| }, | |
| isBlock: function () { | |
| return (this.get("FieldBlockItem").Id) ? true : false | |
| }, | |
| isFormField: function () { | |
| return (this.get("FieldBlockItem").Id === 41) ? true : false | |
| }, | |
| hasFields: function () { | |
| var v = false, | |
| u; | |
| if (this.isBlock()) { | |
| u = this.get("FieldElementItems"); | |
| if (u && u.length) { | |
| v = _.some(u, function (w) { | |
| return w.FieldItem.Id ? true : false | |
| }) | |
| } | |
| } | |
| return v | |
| }, | |
| displayOnlyFields: function () { | |
| var v = false, | |
| u; | |
| if (this.isBlock()) { | |
| u = this.get("FieldElementItems"); | |
| if (u && u.length) { | |
| v = _.every(u, function (w) { | |
| return w.FieldItem.DisplayOnly | |
| }) | |
| } | |
| } | |
| return v | |
| }, | |
| isBasicElement: function () { | |
| var v = false, | |
| u; | |
| if (this.isElement()) { | |
| u = a.Us.findElementById(this.get("ElementItem").Id); | |
| v = u ? u.BasicElement : true | |
| } | |
| return v | |
| } | |
| }); | |
| a.Ms.ElementField = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| idAttribute: "FieldElementItemId", | |
| validation: { | |
| "ElementItem.DisplayAs": function (v) { | |
| var u = this.get("ElementItem").Id == h.Element.HTML.Value ? 50000 : 2000; | |
| if (v != null && v.trim().length > u) { | |
| return k.P3.MaxLengthExceeded | |
| } | |
| } | |
| }, | |
| url: function () { | |
| return this.id ? aP + "OnlineApplication/FieldBlockItem/" + this.id + "/" : aP + "OnlineApplication/FieldBlockItem/" | |
| }, | |
| isBasicElement: function () { | |
| var u = a.Us.findElementById(this.get("ElementItem").Id); | |
| return u ? u.BasicElement : true | |
| } | |
| }); | |
| a.Ms.BlockField = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| idAttribute: "FieldElementItemId", | |
| url: function () { | |
| return aP + "OnlineApplication/FieldBlockItem/" + this.id + "/" | |
| } | |
| }); | |
| a.Ms.FormField = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| idAttribute: "FieldElementItemId", | |
| validation: { | |
| "FieldItem.LookUpList": [{ | |
| fn: function (x, u, v) { | |
| if (v.FieldItem.UIType === "DD" || v.FieldItem.UIType === "CheckBoxSingleSelect" || v.FieldItem.UIType === "CheckBoxMultiSelect") { | |
| var w = _.filter(v.FieldItem.LookUpList, function (y) { | |
| return !t.isEmptier(y.dd_description) | |
| }); | |
| if (!w.length) { | |
| return "Please enter a label." | |
| } | |
| } | |
| } | |
| }] | |
| }, | |
| url: function () { | |
| return aP + "OnlineApplication/FieldBlockItem/" + this.id + "/" | |
| } | |
| }); | |
| a.Ms.PaymentGateway = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| url: function () { | |
| return aP + "OnlineApplication/PaymentGatewayAccount/" | |
| } | |
| }); | |
| a.Ms.ContractPaymentPlan = Bbm.extend({ | |
| idAttribute: "PaymentPlanId", | |
| validation: { | |
| "PaymentPlan.NumberOfPayments": [{ | |
| required: true, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }, { | |
| pattern: "number", | |
| msg: k.P3.NotNumeric | |
| }, { | |
| fn: function (x, u, v) { | |
| if (v.Selected) { | |
| var w = parseInt(x, 10); | |
| if (!isNaN(w) && w < 1) { | |
| return "Please enter Number of Payments greater than zero" | |
| } | |
| } | |
| } | |
| }] | |
| } | |
| }); | |
| a.Ms.SmartPaymentPlan = Bbm.extend({ | |
| idAttribute: "PaymentPlanId", | |
| validation: { | |
| ExpireDate: [{ | |
| required: false, | |
| fn: function (z, u, v) { | |
| if (z && v.SmartExpireDate) { | |
| var x = new Date(z), | |
| y = new Date(v.SmartExpireDate), | |
| w = f.getDateString(y); | |
| if (x > y) { | |
| return "The expiration date cannot be later then the expiration date in Smart Tuition (" + w + ")" | |
| } | |
| } | |
| } | |
| }] | |
| } | |
| }); | |
| a.Ms.TmsPaymentPlan = Bbm.extend({ | |
| idAttribute: "BbtmId" | |
| }); | |
| a.Ms.FeeType = Bbm.extend({ | |
| idAttribute: "FeeTypeId" | |
| }); | |
| a.Ms.Fee = Bbm.extend({ | |
| idAttribute: "FeeId", | |
| urlRoot: "OnlineApplication/Fee", | |
| validation: { | |
| Name: [{ | |
| required: true, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| Amount: [{ | |
| required: true, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| EffectiveDate: [{ | |
| required: false, | |
| fn: function (y, u, v) { | |
| if (y && v.EndDate) { | |
| var w = new Date(y), | |
| x = new Date(v.EndDate); | |
| if (w > x) { | |
| return "Please enter an effective date prior to the end date." | |
| } | |
| } | |
| } | |
| }], | |
| EndDate: [{ | |
| required: false, | |
| fn: function (y, u, v) { | |
| if (y && v.EffectiveDate) { | |
| var w = new Date(v.EffectiveDate), | |
| x = new Date(y); | |
| if (x < w) { | |
| return "Please enter an end date after the effective date." | |
| } | |
| } | |
| } | |
| }] | |
| }, | |
| findGrade: function (u) { | |
| return a.Us.findGrade(this.get("Grades"), u) | |
| }, | |
| validateGrades: function () { | |
| var u = this.get("Grades") || []; | |
| if (!_.some(u, function (v) { | |
| return v.SelectedInd | |
| })) { | |
| return "Please select one or more grades." | |
| } | |
| } | |
| }); | |
| a.Ms.RatingMatrix = Bbm.extend({ | |
| idAttribute: "ratingMatrixId", | |
| urlRoot: "Rating/RatingMatrix/", | |
| getAttributeList: function () { | |
| return this.getCsvList(this.get("RatingAttributes"), "Name") | |
| }, | |
| getLevelList: function () { | |
| return this.getCsvList(this.get("RatingScale"), "Name") | |
| }, | |
| getCsvList: function (u, v) { | |
| if (!u || !u.length) { | |
| return "" | |
| } | |
| return _.pluck(u, v).join(", ") | |
| } | |
| }); | |
| a.Ms.SmartFeeSelect = Bbm.extend({ | |
| idAttribute: "SmartFeeId" | |
| }); | |
| a.Ms.TmsFeeSelect = Bbm.extend({ | |
| idAttribute: "idAttrib", | |
| parse: function (v, u) { | |
| v.idAttrib = v.BbtmId + "," + v.Amount; | |
| return v | |
| } | |
| }); | |
| a.Ms.GenerateContracts = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| url: function () { | |
| return "EnrollmentContract/GenerateContracts/" | |
| }, | |
| userIds: null, | |
| applicationFormId: null | |
| }); | |
| a.Ms.StyleElement = Bbm.extend({}); | |
| a.Ms.StyleProperty = Bbm.extend({ | |
| idAttribute: "StyleFormId", | |
| sync: c.DataParamSync, | |
| url: function () { | |
| return this.id ? aP + "FormStyle/Property/" + this.id + "/" : aP + "FormStyle/Property/" | |
| } | |
| }); | |
| a.Ms.SmartTuitionFee = Bbm.extend({ | |
| idAttribute: "SchoolYearLabel", | |
| urlRoot: "SmartTuition/HasTuitionFees/" | |
| }); | |
| a.Cs.Elements = Bbc.extend({ | |
| sync: c.DataParamSync, | |
| model: a.Ms.Element, | |
| url: function () { | |
| return aP + "OnlineApplication/ElementList/" | |
| } | |
| }); | |
| a.Cs.Blocks = Bbc.extend({ | |
| sync: c.DataParamSync, | |
| model: a.Ms.Block, | |
| url: function () { | |
| return aP + "OnlineApplication/FieldBlockList/" | |
| } | |
| }); | |
| a.Cs.Sections = Bbc.extend({ | |
| sync: c.DataParamSync, | |
| model: a.Ms.Section, | |
| url: function () { | |
| return aP + "OnlineApplication/ApplicationSectionList/" | |
| } | |
| }); | |
| a.Cs.SectionItems = Bbc.extend({ | |
| sync: c.DataParamSync, | |
| model: a.Ms.SectionItem, | |
| url: function () { | |
| return aP + "OnlineApplication/SectionItemList/" | |
| } | |
| }); | |
| a.Cs.BlockFields = Bbc.extend({ | |
| sync: c.DataParamSync, | |
| model: function (u, v) { | |
| if (u.ElementItem.Id) { | |
| return new a.Ms.ElementField(u, v) | |
| } | |
| if (u.FieldItem.Id) { | |
| if (u.FieldItem.Id === 253) { | |
| return new a.Ms.FormField(u, v) | |
| } | |
| return new a.Ms.BlockField(u, v) | |
| } | |
| }, | |
| url: function () { | |
| return aP + "OnlineApplication/FieldBlockItemList/" | |
| } | |
| }); | |
| a.Cs.ContractPaymentPlans = Bbc.extend({ | |
| sync: c.DataParamSync, | |
| model: a.Ms.ContractPaymentPlan, | |
| url: function () { | |
| return aP + "EnrollmentContract/FormPaymentPlanList" | |
| } | |
| }); | |
| a.Cs.ContractPaymentPlansSelect = Bbc.extend({ | |
| sync: c.DataParamSync, | |
| model: a.Ms.ContractPaymentPlan, | |
| url: function () { | |
| return aP + "EnrollmentContract/FormPaymentPlanSelect/" | |
| } | |
| }); | |
| a.Cs.SmartPaymentPlansSelect = Bbc.extend({ | |
| sync: c.DataParamSync, | |
| model: a.Ms.SmartPaymentPlan, | |
| url: function () { | |
| return aP + "SmartTuition/PaymentPlanSelect/" | |
| } | |
| }); | |
| a.Cs.TmsPaymentPlansSelect = Bbc.extend({ | |
| sync: c.DataParamSync, | |
| model: a.Ms.TmsPaymentPlan, | |
| url: function () { | |
| return aP + "TmsContract/PaymentPlanSelect/" | |
| } | |
| }); | |
| a.Cs.FeeTypes = Bbc.extend({ | |
| sync: c.DataParamSync, | |
| model: a.Ms.FeeType, | |
| url: "DataDirect/ContractFeeTypes" | |
| }); | |
| a.Cs.FeeSchedule = Bbc.extend({ | |
| model: a.Ms.Fee, | |
| url: "OnlineApplication/FeeSchedule/", | |
| initialize: function (u, v) { | |
| this.applicationFormId = v.applicationFormId; | |
| this.feeTypeId = v.feeTypeId | |
| }, | |
| hasTuitionFees: function () { | |
| var u = this, | |
| v = false; | |
| if (a.Data.FormType !== h.FormType.CONTRACT && u.feeTypeId === h.ContractFeeType.TUITION.Value && u.length > 0) { | |
| v = u.any(function (w) { | |
| return w.get("SmartFeeId") || w.get("BbtmFeeId") | |
| }) | |
| } | |
| return v | |
| }, | |
| hasOnboardTuition: function () { | |
| var u = this, | |
| v = false; | |
| if (a.Data.FormType !== h.FormType.TMS_CONTRACT && u.feeTypeId === h.ContractFeeType.TUITION.Value && u.length > 0) { | |
| v = u.any(function (w) { | |
| return !w.get("SmartFeeId") | |
| }) | |
| } | |
| return v | |
| } | |
| }); | |
| a.Cs.SmartFeeSelect = Bbc.extend({ | |
| sync: c.DataParamSync, | |
| model: a.Ms.SmartFeeSelect, | |
| duplicateTuitionFees: function (y) { | |
| var w = {}, | |
| v, x, u = []; | |
| _.each(y.models, function (z) { | |
| z.set({ | |
| preSelectedFee: true | |
| }) | |
| }); | |
| u = this.models.concat(y.models); | |
| _.each(u, function (z) { | |
| if (z.get("Selected") || z.get("preSelectedFee")) { | |
| _.each(z.get("Grades"), function (A) { | |
| x = A.GradeId.toString(); | |
| if (w[x]) { | |
| w[x].push(z) | |
| } else { | |
| w[x] = [z] | |
| } | |
| }) | |
| } | |
| }); | |
| v = _.pick(w, function (z) { | |
| return z.length > 1 | |
| }); | |
| return v | |
| }, | |
| url: function () { | |
| return aP + "SmartTuition/FeeSelect/" | |
| } | |
| }); | |
| a.Cs.TmsFeeSelect = Bbc.extend({ | |
| model: a.Ms.TmsFeeSelect, | |
| sync: c.DataParamSync, | |
| url: function () { | |
| return aP + "TmsContract/FeeSelect/" | |
| } | |
| }); | |
| a.Cs.ContractGenerateStudentList = Bbc.extend({ | |
| url: "EnrollmentContract/GeneratePreview/" | |
| }); | |
| a.Cs.Style = Bbm.extend({ | |
| sync: c.DataParamSync, | |
| url: function () { | |
| return this.id ? aP + "FormStyle/Style/" + this.id + "/" : aP + "FormStyle/Style/" | |
| } | |
| }); | |
| a.Cs.StyleProperties = Bbm.extend({}); | |
| a.Cs.FormFieldType = Bbc.extend({ | |
| sync: c.DataParamSync, | |
| url: "DataDirect/FormFieldTypeGet/" | |
| }); | |
| a.Vs.Layout = Bb.View.extend({ | |
| template: "formedit/formedit.main.template.html", | |
| id: "application-main", | |
| initialize: function (u) { | |
| var v = this; | |
| v.ApplicationFormId = a.Data.ApplicationFormId | |
| }, | |
| dispose: function () { | |
| p3.closeFixedSidebar(); | |
| p3.closeFixedFooter(); | |
| a.Us.DeleteStyle() | |
| }, | |
| render: function (v) { | |
| var w = this, | |
| u; | |
| $(v).append(w.el); | |
| u = new a.Ms.BaseForm({ | |
| ApplicationFormId: a.Data.ApplicationFormId | |
| }); | |
| u.fetch({ | |
| cache: false, | |
| success: function (x, y) { | |
| a.Data.FormModel = u; | |
| a.Data.FormType = _.findWhere(h.FormType, { | |
| Value: y.FormType | |
| }); | |
| a.Data.SecurePayment = x.get("UseSecurePayment"); | |
| a.Data.PaymentSectionVisible = x.get("PaymentSectionVisible"); | |
| w.options.formType = a.Data.FormType; | |
| w.FormType = a.Data.FormType; | |
| w.ArchivedInd = x.get("ArchivedInd"); | |
| a.Data.FormModel = new a.Ms[a.Data.FormType.Model](y); | |
| p3.setTitle(w.title()); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.jQueryUI, function () { | |
| w.renderData() | |
| }) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading form") | |
| } | |
| }) | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({})); | |
| p3.rV(new a.Vs.Content({ | |
| layoutView: u, | |
| selectedTab: "content" | |
| }), u.$(".col-md-12"), true); | |
| p3.renderFixedSidebar(new a.Vs.Sidebar({ | |
| layoutView: u | |
| })); | |
| p3.renderFixedFooter(new a.Vs.Footer({ | |
| layoutView: u | |
| })) | |
| }) | |
| }, | |
| title: function () { | |
| return a.Data.FormType.Name + " Forms Edit" | |
| } | |
| }); | |
| a.Vs.Sidebar = Bb.View.extend({ | |
| className: "workspace-sidebar", | |
| render: function (u) { | |
| $(u).append(this.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.rV(new a.Vs.SidebarOptions({ | |
| layoutView: u.options.layoutView | |
| }), u.el, false); | |
| if (a.Data.FormType.Value == h.FormType.INQUIRY.Value || a.Data.FormType.Value == h.FormType.APPLICATION.Value) { | |
| p3.rV(new a.Vs.SidebarTabs({ | |
| layoutView: u.options.layoutView | |
| }), u.el, false) | |
| } | |
| p3.rV(new a.Vs.SidebarMenu({ | |
| layoutView: u.options.layoutView | |
| }), u.el, false) | |
| } | |
| }); | |
| a.Vs.SidebarOptions = Bb.View.extend({ | |
| template: "admissions/applicationformsedit.sidebaroptions.template.html", | |
| className: "workspace-sidebar-header", | |
| initialize: function (u) { | |
| var v = this; | |
| v.model = new a.Ms[a.Data.FormType.Model](); | |
| v.model.set(v.model.idAttribute, a.Data.ApplicationFormId) | |
| }, | |
| events: { | |
| editsettings: "editSettings", | |
| editpayment: "editPayment", | |
| editsignatures: "editSignatures" | |
| }, | |
| render: function (u) { | |
| $(u).append(this.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| u.model.unbind("sync", u.renderData); | |
| p3.fT(u.template, function (v) { | |
| u.model.fetch({ | |
| cache: false, | |
| success: function (w, y) { | |
| var z = false, | |
| x = u.model.get("Name"); | |
| if (a.Data.FormType.IsContractForm) { | |
| if (x) { | |
| z = x.indexOf(w.get("SchoolYear")) < 0 | |
| } else { | |
| z = true | |
| } | |
| } | |
| u.$el.html(v({ | |
| model: w.toJSON(), | |
| showYear: z, | |
| formType: a.Data.FormType | |
| })); | |
| a.Data.FormModel = u.model.clone() | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading options") | |
| }, | |
| complete: function () { | |
| u.model.bind("sync", u.renderData, u) | |
| } | |
| }) | |
| }) | |
| }, | |
| editSettings: function (v) { | |
| var x = this, | |
| w, u = false; | |
| v.stopPropagation(); | |
| v.preventDefault(); | |
| x.model.unbind("sync", x.renderData); | |
| x.model.fetch({ | |
| success: function (y, z) { | |
| if (a.Data.FormType.Value == h.FormType.INQUIRY.Value) { | |
| w = new l.Vs.InquiryForm({ | |
| model: x.model, | |
| variables: { | |
| hideEdit: true | |
| } | |
| }) | |
| } else { | |
| if (a.Data.FormType.Value == h.FormType.APPLICATION.Value) { | |
| w = new b.Vs.ApplicationForm({ | |
| model: x.model, | |
| variables: { | |
| hideEdit: true | |
| } | |
| }) | |
| } else { | |
| if (a.Data.FormType.IsSchoolForm) { | |
| w = new p.Vs.Settings({ | |
| model: x.model, | |
| variables: { | |
| hideEdit: true | |
| } | |
| }) | |
| } else { | |
| if (a.Data.FormType.IsContractForm) { | |
| e.Us.ShowContractSettings(x.model, { | |
| hideEdit: true | |
| }); | |
| u = true | |
| } else { | |
| if (a.Data.FormType.Value == h.FormType.RECOMMENDATION.Value) { | |
| o.Us.ShowRecommendationSettings(x.model.get("ApplicationFormId")); | |
| u = true | |
| } | |
| } | |
| } | |
| } | |
| } | |
| if (u) { | |
| return | |
| } | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(w, p3.Layout.Containers.Modal, true) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading options") | |
| }, | |
| complete: function () { | |
| x.model.bind("sync", x.renderData, x) | |
| } | |
| }) | |
| }, | |
| editPayment: function (w, u) { | |
| w.stopPropagation(); | |
| w.preventDefault(); | |
| var E = this, | |
| y = new a.Ms.PaymentGateway(), | |
| z, A, B, C, D, x, v = { | |
| DepositPercentageType: { | |
| data: new n.Cs.Dictionary(), | |
| dataParams: { | |
| name: "Deposit Percentage Type", | |
| id: 131, | |
| inputParam: "@oa_form_type_id=" + a.Data.FormType.Value + "[i]" | |
| } | |
| } | |
| }; | |
| if (parseInt(u.FieldBlockId, 10) === 65) { | |
| E.model.set("hidePaymentGateway", true) | |
| } else { | |
| v.PaymentGateway = y; | |
| E.model.set("hidePaymentGateway", false) | |
| } | |
| if (a.Data.FormType === h.FormType.TMS_CONTRACT) { | |
| E.model.set("hideExceptions", true) | |
| } | |
| n.Us.Fetch(v, function (F, H, G) { | |
| E.dictionaries = F; | |
| E.dictionaries.PaymentGateway = (F.PaymentGateway) ? _.toArray(F.PaymentGateway.toJSON()) : {}; | |
| if (a.Data.FormType === h.FormType.TMS_CONTRACT) { | |
| E.dictionaries.PaymentGateway = _.filter(E.dictionaries.PaymentGateway, function (I) { | |
| return I.GatewayId === 6 | |
| }) | |
| } | |
| E.model.set({ | |
| ignoreDueDate: true | |
| }); | |
| z = new i.Cs.FeeRules(E.model.get("FeeRules")); | |
| A = z.ruleTypeExists(1); | |
| B = z.ruleTypeExists(2); | |
| C = z.ruleTypeExists(3); | |
| D = z.ruleTypeExists(4); | |
| if (A) { | |
| x = 1 | |
| } else { | |
| if (B) { | |
| x = 2 | |
| } else { | |
| if (C) { | |
| x = 3 | |
| } else { | |
| if (D) { | |
| x = 4 | |
| } | |
| } | |
| } | |
| } | |
| E.modal2Extend = q.Vs.Modal2.extend({ | |
| template: "formedit/formedit.block.settings.payment.template.html", | |
| model: E.model, | |
| selector: "id", | |
| dictionaries: E.dictionaries, | |
| variables: { | |
| formType: a.Data.FormType, | |
| ruleType1: A, | |
| ruleType2: B, | |
| ruleType3: C, | |
| ruleType4: D, | |
| firstRuleType: x, | |
| BBTMLink: a.Us.GetBBTMLinkForAuthorizedUsers | |
| }, | |
| events: { | |
| "change select.GatewayAccount_AccountId": "changeGateway", | |
| "click button.select-all": "selectAll", | |
| "click button.btn-select-toggle": "toggleSelection", | |
| "click .toggleFee": "toggleFee", | |
| "click .toggleGrade": "toggleGrade", | |
| "click .togglePercentage": "togglePercentage", | |
| "click .paymentoptions-input": "togglePaymentOption" | |
| }, | |
| modalRendered: function () { | |
| var I = this; | |
| I.showGateway(); | |
| q.Us.showHtmlEditor(I, "tinyeditor") | |
| }, | |
| showGateway: function () { | |
| var I = this; | |
| E.hasEFT = false; | |
| if (_.contains(E.model.get("PaymentOptions"), 5)) { | |
| E.hasEFT = true | |
| } | |
| I.changeGateway() | |
| }, | |
| changeGateway: function (J) { | |
| var L = this, | |
| K, I = L.$(".paymentoptions-holder"); | |
| I.empty(); | |
| p3.fT("formedit/formedit.block.settings.paymentoptions.template.html", function (M) { | |
| K = _.chain(L.dictionaries.PaymentGateway).filter(function (N) { | |
| return N.AccountId === s.stringToInt($(".GatewayAccount_AccountId").val()) | |
| }).first().value(); | |
| if (K) { | |
| E.model.set({ | |
| PaymentOptions: _.chain(K.OnlineFormSelectedCards.split(",").join("").split("")).map(function (N) { | |
| return parseInt(N, 10) | |
| }).filter(function (N) { | |
| return N !== 5 | |
| }).value() | |
| }); | |
| if (E.hasEFT) { | |
| E.model.get("PaymentOptions").push(5); | |
| E.hasEFT = false | |
| } | |
| _.each(K.OnlineFormSelectedCards.split(",").join("").split(""), function (P, N) { | |
| P = s.stringToInt(P); | |
| var Q = _.findWhere(_.values(h.OnlineFormPaymentType), { | |
| Value: P | |
| }), | |
| O = (N === 0) ? true : false; | |
| I.append(M({ | |
| isFirst: O, | |
| paymentOption: Q, | |
| securePayment: a.Data.SecurePayment, | |
| paymentOptionsList: E.model.get("PaymentOptions").join() | |
| })) | |
| }) | |
| } else { | |
| E.model.set({ | |
| PaymentOptions: [] | |
| }) | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| selectAll: function (K) { | |
| K.preventDefault(); | |
| var L = this, | |
| J = $(K.currentTarget), | |
| M = J.data("selector"), | |
| I = L.$("." + M + ":not(.active)"); | |
| I.click() | |
| }, | |
| toggleSelection: function (J) { | |
| J.preventDefault(); | |
| var M = this, | |
| I = $(J.currentTarget), | |
| P = I.closest("tr"), | |
| N = P.data("prop"), | |
| K = P.data("id"), | |
| L = $.extend(true, [], M.model.get(N)), | |
| O; | |
| if (N === "FeeRules" && L) { | |
| O = _.find(L, function (Q) { | |
| return Q.FeeRuleId == K | |
| }); | |
| if (O) { | |
| O.InUseOnForm = !O.InUseOnForm; | |
| M.model.set("FeeRules", L) | |
| } | |
| } | |
| }, | |
| toggleFee: function (I) { | |
| var J = this; | |
| _.defer(function () { | |
| J.$(".feeHolder").show(); | |
| J.$(".gradeHolder").hide(); | |
| J.$(".percentageHolder").hide() | |
| }) | |
| }, | |
| toggleGrade: function (I) { | |
| var J = this; | |
| _.defer(function () { | |
| J.$(".feeHolder").hide(); | |
| J.$(".gradeHolder").show(); | |
| J.$(".percentageHolder").hide() | |
| }) | |
| }, | |
| togglePercentage: function (I) { | |
| var J = this; | |
| _.defer(function () { | |
| J.$(".feeHolder").hide(); | |
| J.$(".gradeHolder").hide(); | |
| J.$(".percentageHolder").show() | |
| }) | |
| }, | |
| togglePaymentOption: function (J) { | |
| var I = $(J.currentTarget), | |
| L = s.stringToInt(I.prop("value")), | |
| K = E.model.get("PaymentOptions") || []; | |
| L = s.stringToInt(I.children("input").prop("value")); | |
| if (I.data("action") === "add") { | |
| if (K.indexOf(L) === -1) { | |
| K.push(L) | |
| } | |
| } else { | |
| if (I.data("action") === "remove") { | |
| if (K.indexOf(L) > -1) { | |
| K.splice(K.indexOf(L), 1) | |
| } | |
| } | |
| } | |
| E.model.set({ | |
| PaymentOptions: K | |
| }) | |
| }, | |
| modalSave: function () { | |
| var I = this, | |
| J = true; | |
| $.each(I.$(".tinyeditor"), function () { | |
| var K = {}; | |
| K[this.id] = tinyMCE.get(this.id).save(); | |
| I.model.set(K) | |
| }); | |
| if (!E.model.isValid(true)) { | |
| if (!I.$el.find(".control-group.error").length) { | |
| J = false; | |
| I.$el.find(".error-holder .alert").html("Please check form settings for missing or invalid fields."); | |
| I.$el.find(".error-holder").show(); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| } | |
| } | |
| return J | |
| }, | |
| modalSavedSuccess: function (I) { | |
| E.model.set({ | |
| ignoreDueDate: false | |
| }) | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new E.modal2Extend(), p3.Layout.Containers.Modal, true) | |
| }) | |
| }, | |
| editSignatures: function (u, v) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| var w = this; | |
| if (v && _.isFunction(v.callback)) { | |
| w.model.once("sync", v.callback, v.context) | |
| } | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new d.Vs.Modal({ | |
| template: "formedit/formedit.block.settings.esignature.template.html", | |
| model: w.model | |
| }), p3.Layout.Containers.Modal, true) | |
| } | |
| }); | |
| a.Vs.SidebarTabs = Bb.View.extend({ | |
| template: "admissions/applicationformsedit.sidebartabs.template.html", | |
| className: "workspace-sidebar-tabs", | |
| events: { | |
| "click .edit": "editSettings", | |
| "click .content": "showContent", | |
| "click .style": "showStyle" | |
| }, | |
| render: function (u) { | |
| $(u).append(this.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({})) | |
| }) | |
| }, | |
| editSettings: function (u) { | |
| u.stopPropagation(); | |
| $(".workspace-sidebar-header").trigger("editsettings") | |
| }, | |
| showContent: function (u) { | |
| var v = this; | |
| u.stopPropagation(); | |
| a.Data.EditMode = "content"; | |
| v.$(".active").removeClass("active"); | |
| v.$(u.currentTarget).addClass("active"); | |
| a.trigger("rendermain"); | |
| a.trigger("rendersidebar") | |
| }, | |
| showStyle: function (u) { | |
| var v = this; | |
| u.stopPropagation(); | |
| a.Us.GetStyle(a.Data.ApplicationFormId, function (w) { | |
| a.Data.Style = w; | |
| a.Us.SetStyle(a.Data.Style.StyleElements); | |
| a.Data.EditMode = "style"; | |
| v.$(".active").removeClass("active"); | |
| v.$(u.currentTarget).addClass("active"); | |
| a.trigger("rendermain"); | |
| a.trigger("rendersidebar") | |
| }) | |
| } | |
| }); | |
| a.Vs.SidebarMenu = Bb.View.extend({ | |
| className: function () { | |
| return "workspace-sidebar-content m-10" | |
| }, | |
| initialize: function () { | |
| var u = this; | |
| a.on("rendersidebar", function () { | |
| u.renderData() | |
| }, u); | |
| a.on("editstyle", function () { | |
| u.editStyle() | |
| }, u) | |
| }, | |
| dispose: function () { | |
| a.off("rendersidebar") | |
| }, | |
| events: { | |
| "click .edit": "editSettings" | |
| }, | |
| render: function (u) { | |
| $(u).append(this.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var v = this, | |
| u; | |
| if (a.Data.EditMode === "content") { | |
| v.template = "formedit/formedit.sidebarmenu.template.html" | |
| } else { | |
| if (a.Data.EditMode === "style") { | |
| v.template = "formedit/formedit.sidebar.style.template.html"; | |
| if (a.Data.FormType.Value == h.FormType.INQUIRY.Value) { | |
| u = s.createEmbed("#inquiry/" + a.Data.ApplicationFormId) | |
| } | |
| } | |
| } | |
| p3.fT(v.template, function (w) { | |
| v.$el.html(w({ | |
| formType: a.Data.FormType, | |
| formEmbed: u | |
| })); | |
| if (a.Data.EditMode === "content") { | |
| p3.rV(new a.Vs.Elements({ | |
| layoutView: v.options.layoutView | |
| }), v.$("#elements"), true); | |
| p3.rV(new a.Vs.Blocks({ | |
| layoutView: v.options.layoutView | |
| }), v.$("#blocks"), true) | |
| } | |
| }) | |
| }, | |
| editSettings: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| $(".workspace-sidebar-header").trigger("editsettings") | |
| }, | |
| editStyle: function () { | |
| var w = this, | |
| u = $("#application-workspace .style-element.selected"), | |
| v = _.findWhere(a.Data.Style.StyleElements, { | |
| StyleElementId: u.data("id") | |
| }); | |
| p3.rV(new a.Vs.StyleProperties({ | |
| model: new a.Ms.StyleElement(v) | |
| }), w.$(".style-holder"), true) | |
| } | |
| }); | |
| a.Vs.StyleProperties = Bb.View.extend({ | |
| template: "formedit/formedit.sidebar.style.properties.template.html", | |
| events: { | |
| "click .reset": "resetStyle" | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.JSColor, function () { | |
| v.renderData() | |
| }) | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| model: u.model.toJSON() | |
| })); | |
| _.each(u.model.get("StyleProperties"), function (x, w) { | |
| p3.rV(new a.Vs.StyleProperty({ | |
| model: new a.Ms.StyleProperty(x), | |
| parent: u.model.toJSON(), | |
| path: "StyleProperties." + w | |
| }), u.$(".style-properties"), false) | |
| }) | |
| }) | |
| }, | |
| resetStyle: function (u) { | |
| var v = this; | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| _.each(v.$(".form-group"), function (w) { | |
| $(w).trigger("deleteproperty") | |
| }) | |
| } | |
| }); | |
| a.Vs.StyleProperty = Bb.View.extend({ | |
| template: "formedit/formedit.sidebar.style.property.template.html", | |
| events: { | |
| "change .style-input": "updateProperty", | |
| deleteproperty: "deleteProperty" | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| model: u.model.toJSON() | |
| })); | |
| if (u.$(".color").length > 0) { | |
| jscolor.color(u.$(".color")[0], { | |
| required: false, | |
| hash: true, | |
| pickerPosition: "bottom" | |
| }) | |
| } | |
| }) | |
| }, | |
| updateProperty: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| var v = this; | |
| q.Us.updateModel(u, v.model, "name"); | |
| if (s.stringToInt($(u.currentTarget).data("id")) === 2) { | |
| v.model.set({ | |
| PropertyValue: v.model.get("PropertyValue") + "px" | |
| }) | |
| } | |
| v.model.save({}, { | |
| success: function (w, x) { | |
| q.Us.setPropByString(v.options.parent, v.options.path, x); | |
| a.Us.SetStyle(a.Data.Style.StyleElements) | |
| }, | |
| error: function (x, w) { | |
| p3.displayError("Error updating style") | |
| } | |
| }) | |
| }, | |
| deleteProperty: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| var v = this; | |
| if (v.model.id) { | |
| v.model.set({ | |
| ResetInd: true | |
| }); | |
| v.model.save({}, { | |
| success: function (w, x) { | |
| q.Us.setPropByString(v.options.parent, v.options.path, x); | |
| v.renderData(); | |
| a.Us.SetStyle(a.Data.Style.StyleElements) | |
| }, | |
| error: function (x, w) { | |
| p3.displayError("Error deleting style") | |
| } | |
| }) | |
| } | |
| } | |
| }); | |
| a.Vs.Elements = Bb.View.extend({ | |
| template: "formedit/formedit.sidebar.elements.template.html", | |
| initialize: function (u) { | |
| var v = this; | |
| this.collection = new a.Cs.Elements(); | |
| this.collection.bind("add", function (z) { | |
| var y, w, x; | |
| if (z.get("Id") === 12) { | |
| x = i.Us.findElementById(z.get("Id")); | |
| z.set({ | |
| IconClass: x.IconClass | |
| }); | |
| y = new a.Vs.FormField({ | |
| model: z, | |
| attributes: { | |
| "data-id": 41, | |
| "data-type": "formfield" | |
| }, | |
| layoutView: v.options.layoutView | |
| }); | |
| p3.rV(y, this.el, false) | |
| } else { | |
| w = new a.Vs.Element({ | |
| model: z, | |
| attributes: { | |
| "data-id": z.get("Id"), | |
| "data-type": "element" | |
| }, | |
| layoutView: v.options.layoutView | |
| }); | |
| x = i.Us.findElementById(z.get("Id")); | |
| z.set({ | |
| IconClass: x.IconClass | |
| }); | |
| p3.rV(w, v.el, false) | |
| } | |
| }, this) | |
| }, | |
| render: function (u) { | |
| $(u).append(this.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| u.collection.reset(); | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({})); | |
| u.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| FormType: a.Data.FormType.Value | |
| }, | |
| complete: function () { | |
| u.initializeDrag() | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading element list") | |
| } | |
| }) | |
| }) | |
| }, | |
| initializeDrag: function () { | |
| $(".workspace-sidebar-content .drag-element").draggable({ | |
| connectToSortable: ".drop-element", | |
| distance: 5, | |
| tolerance: "pointer", | |
| helper: "clone", | |
| appendTo: "body", | |
| start: function (u, v) { | |
| $("textarea.as-html").each(function (x, y) { | |
| var w = $(y).attr("id"); | |
| tinyMCE.execCommand("mceRemoveControl", false, w) | |
| }) | |
| }, | |
| stop: function () { | |
| $("textarea.as-html").each(function (v, w) { | |
| var u = $(w).attr("id"); | |
| tinyMCE.execCommand("mceAddControl", false, u) | |
| }) | |
| } | |
| }).mousedown(function () { | |
| $("input,textarea").blur() | |
| }).disableSelection(); | |
| $(".workspace-sidebar-content .drag-block").draggable({ | |
| connectToSortable: ".drop-block", | |
| distance: 5, | |
| tolerance: "pointer", | |
| helper: "clone", | |
| appendTo: "body", | |
| start: function (u, v) { | |
| $("textarea.as-html").each(function (x, y) { | |
| var w = $(y).attr("id"); | |
| tinyMCE.execCommand("mceRemoveControl", false, w) | |
| }) | |
| }, | |
| stop: function () { | |
| $("textarea.as-html").each(function (v, w) { | |
| var u = $(w).attr("id"); | |
| tinyMCE.execCommand("mceAddControl", false, u) | |
| }) | |
| } | |
| }).mousedown(function () { | |
| $("input,textarea").blur() | |
| }).disableSelection() | |
| } | |
| }); | |
| a.Vs.Element = Bb.View.extend({ | |
| template: "formedit/formedit.sidebar.element.template.html", | |
| className: function () { | |
| return "btn btn-default btn-sm draggable-item drag-element" | |
| }, | |
| render: function (u) { | |
| $(u).append(this.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| model: u.model.toJSON() | |
| })) | |
| }) | |
| } | |
| }); | |
| a.Vs.FormField = Bb.View.extend({ | |
| template: "formedit/formedit.sidebar.content.formfield.template.html", | |
| className: function () { | |
| return "btn btn-default btn-sm draggable-item" | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.$el.addClass("drag-block"); | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| model: u.model.toJSON() | |
| })) | |
| }) | |
| } | |
| }); | |
| a.Vs.Blocks = Bb.View.extend({ | |
| template: "formedit/formedit.sidebar.blocks.template.html", | |
| className: "blocks-holder", | |
| initialize: function (u) { | |
| var v = this; | |
| this.collection = new a.Cs.Blocks(); | |
| this.collection.bind("add", function (x) { | |
| var w = new a.Vs.Block({ | |
| model: x, | |
| attributes: { | |
| "data-id": x.id, | |
| "data-type": "block" | |
| }, | |
| layoutView: v.options.layoutView | |
| }); | |
| p3.rV(w, this.el, false) | |
| }, this) | |
| }, | |
| events: { | |
| refreshlibrary: "refreshLibrary" | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| u.collection.reset(); | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({})); | |
| u.collection.fetch({ | |
| update: true, | |
| remove: false, | |
| cache: false, | |
| data: { | |
| applicationFormId: a.Data.ApplicationFormId, | |
| formType: a.Data.FormType.Value | |
| }, | |
| complete: function () { | |
| u.initializeDrag() | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading block list") | |
| } | |
| }) | |
| }) | |
| }, | |
| initializeDrag: function () { | |
| $(".workspace-sidebar-content .drag-block").draggable({ | |
| connectToSortable: ".drop-block", | |
| distance: 5, | |
| tolerance: "pointer", | |
| helper: "clone", | |
| appendTo: "body", | |
| start: function (u, v) { | |
| $("textarea.as-html").each(function (x, y) { | |
| var w = $(y).attr("id"); | |
| tinyMCE.execCommand("mceRemoveControl", false, w) | |
| }) | |
| }, | |
| stop: function () { | |
| $("textarea.as-html").each(function (v, w) { | |
| var u = $(w).attr("id"); | |
| tinyMCE.execCommand("mceAddControl", false, u) | |
| }) | |
| } | |
| }).mousedown(function () { | |
| $("input,textarea").blur() | |
| }).disableSelection() | |
| }, | |
| refreshLibrary: function (u) { | |
| var v = this; | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| v.renderData() | |
| } | |
| }); | |
| a.Vs.Block = Bb.View.extend({ | |
| template: "formedit/formedit.sidebar.block.template.html", | |
| className: function () { | |
| return "btn btn-default btn-sm draggable-item a" | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.$el.css("white-space", "normal"); | |
| if (!v.model.get("BlockInUseInd")) { | |
| v.$el.addClass("drag-block") | |
| } else { | |
| v.$el.attr("disabled", true); | |
| v.$el.attr("rel", "tooltip"); | |
| v.$el.attr("data-original-title", "Used in " + v.model.get("BlockUsedInSection")); | |
| v.$el.tooltip() | |
| } | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| model: u.model.toJSON() | |
| })) | |
| }) | |
| } | |
| }); | |
| a.Vs.Content = Bb.View.extend({ | |
| initialize: function () { | |
| var u = this; | |
| a.on("rendermain", function () { | |
| u.renderData() | |
| }, u) | |
| }, | |
| dispose: function () { | |
| a.off("rendermain") | |
| }, | |
| events: { | |
| renderdata: "renderData", | |
| "click .style-element": "editStyle" | |
| }, | |
| render: function (u) { | |
| $(u).append(this.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| if (a.Data.EditMode === "content") { | |
| u.template = "applications/applications.edit.content.template.html" | |
| } else { | |
| if (a.Data.EditMode === "style") { | |
| u.template = "formedit/formedit.main.style.template.html" | |
| } | |
| } | |
| p3.fT(u.template, function (v) { | |
| if (a.Data.EditMode === "style") { | |
| u.$el.html(v({ | |
| style: a.Data.Style | |
| })) | |
| } else { | |
| u.$el.html(v({})) | |
| } | |
| p3.rV(new a.Vs.Sections({ | |
| layoutView: u.options.layoutView | |
| }), u.$("#application-sections"), true) | |
| }) | |
| }, | |
| editStyle: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| $("#application-workspace .style-element.selected").removeClass("selected"); | |
| $(u.currentTarget).addClass("selected"); | |
| a.trigger("editstyle") | |
| } | |
| }); | |
| a.Vs.Sections = Bb.View.extend({ | |
| template: "admissions/applicationformsedit.sections.template.html", | |
| initialize: function (u) { | |
| var v = this; | |
| this.collection = new a.Cs.Sections(); | |
| v.Containers = {}; | |
| this.collection.bind("add", function (w) { | |
| if (w.get("LockedType") !== 1 || a.Data.PaymentSectionVisible) { | |
| var x = new a.Vs.Section({ | |
| model: w, | |
| layoutView: v.options.layoutView | |
| }); | |
| w.View = x; | |
| x.on("sectionDeleted", function () { | |
| if (v.collection.length) { | |
| x = v.collection.at(0); | |
| x.View.selectSection() | |
| } else { | |
| v.renderData() | |
| } | |
| }); | |
| v.Containers.NavTabs = v.$(".nav-tabs"); | |
| p3.rV(x, v.Containers.NavTabs, false) | |
| } | |
| }, this) | |
| }, | |
| events: { | |
| "click .create": "createSection" | |
| }, | |
| render: function (u) { | |
| $(u).append(this.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| u.collection.reset(); | |
| p3.fT(u.template, function (w) { | |
| var v = a.Us.getOkToEdit() && a.Data.FormType != h.FormType.INQUIRY; | |
| u.$el.html(w({ | |
| okToEdit: v | |
| })); | |
| u.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| applicationFormId: a.Data.ApplicationFormId | |
| }, | |
| complete: function () { | |
| u.$(".nav-tabs li:first").trigger("selectsection"); | |
| if (a.Us.getOkToEdit()) { | |
| u.initializeSort() | |
| } | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading sections") | |
| } | |
| }) | |
| }) | |
| }, | |
| createSection: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| var w = this, | |
| v = new a.Ms.Section({ | |
| ApplicationFormId: a.Data.ApplicationFormId | |
| }); | |
| v.bind("sync", w.renderData, w); | |
| w.Modal2Extend = q.Vs.Modal2.extend({ | |
| template: "formedit/formedit.section.create.template.html", | |
| model: v, | |
| size: "md", | |
| modalRendered: function () { | |
| var x = this; | |
| x.setFocus() | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new w.Modal2Extend(), p3.Layout.Containers.Modal, true) | |
| }, | |
| initializeSort: function () { | |
| var u = this; | |
| u.$(".nav").sortable({ | |
| axis: "y", | |
| distance: 5, | |
| tolerance: "pointer", | |
| appendTo: "body", | |
| items: "li:not(.locked)", | |
| start: function () { | |
| $(".locked", this).each(function () { | |
| var v = $(this); | |
| v.data("pos", v.index()) | |
| }) | |
| }, | |
| change: function () { | |
| var x = $(this), | |
| w = $(".locked", this).detach(), | |
| v = $("<li></li>").prependTo(this); | |
| w.each(function () { | |
| var y = $(this), | |
| z = y.data("pos"); | |
| y.insertAfter($("li", x).eq(z)) | |
| }); | |
| v.remove() | |
| }, | |
| update: function (x, A) { | |
| _.each(u.$(".nav").children(), function (C, B) { | |
| $(C).trigger("sortorder", [(B + 1)]) | |
| }); | |
| var w = { | |
| applicationFormId: a.Data.ApplicationFormId | |
| }, | |
| z = u.collection.findWhere({ | |
| Locked: true, | |
| LockedType: 1 | |
| }), | |
| v = u.collection.findWhere({ | |
| Locked: true, | |
| LockedType: 2 | |
| }), | |
| y = u.collection.size(); | |
| if (v) { | |
| v.set("Position", y + 2) | |
| } | |
| if (z) { | |
| z.set("Position", y + 1) | |
| } | |
| u.collection.save({ | |
| dataParam: w | |
| }) | |
| } | |
| }).mousedown(function () { | |
| $("input,textarea").blur() | |
| }).disableSelection() | |
| } | |
| }); | |
| a.Vs.Section = Bb.View.extend({ | |
| template: "admissions/applicationformsedit.section.template.html", | |
| tagName: "li", | |
| className: "p-0", | |
| initialize: function (u) { | |
| var v = this; | |
| v.Containers = {}; | |
| v.model.bind("remove", this.deleteElement, this) | |
| }, | |
| events: { | |
| "click a.sectionItem": "selectSection", | |
| selectsection: "selectSection", | |
| sortorder: "sortOrder", | |
| editsectionsettings: "editSectionSettings", | |
| getsectionlocked: "getSectionLocked" | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| if (v.model.get("Locked")) { | |
| $(v.el).addClass("locked") | |
| } | |
| $(u).append(v.el); | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| model: u.model.toJSON() | |
| })) | |
| }) | |
| }, | |
| sortOrder: function (u, v) { | |
| var w = this; | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| w.model.set({ | |
| Position: v | |
| }) | |
| }, | |
| selectSection: function (u) { | |
| var v = this; | |
| if (u) { | |
| u.preventDefault(); | |
| u.stopPropagation() | |
| } | |
| v.$el.siblings("li").removeClass("active"); | |
| v.$el.addClass("active"); | |
| v.Containers.AppWorkspace = $("#application-workspace"); | |
| p3.rV(new a.Vs.SectionItems({ | |
| sectionId: v.model.id, | |
| locked: v.model.get("Locked"), | |
| lockedType: v.model.get("LockedType"), | |
| layoutView: v.options.layoutView | |
| }), v.Containers.AppWorkspace, true) | |
| }, | |
| editSectionSettings: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| var w = this, | |
| v = !(w.model.get("Locked") || a.Data.FormType.Value == h.FormType.INQUIRY.Value); | |
| w.model.set({ | |
| FormTypeName: a.Data.FormType.Name, | |
| okToDelete: v | |
| }, { | |
| silent: true | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new d.Vs.Modal({ | |
| template: "formedit/formedit.section.edit.template.html", | |
| model: w.model, | |
| formModel: a.Data.FormModel | |
| }), p3.Layout.Containers.Modal, true) | |
| }, | |
| deleteElement: function () { | |
| var u = this; | |
| u.trigger("sectionDeleted"); | |
| $(this.el).remove() | |
| }, | |
| getSectionLocked: function (u) { | |
| var v = this; | |
| return v.model.get("Locked") | |
| } | |
| }); | |
| a.Vs.SectionItems = Bb.View.extend({ | |
| template: "admissions/applicationformsedit.section.items.template.html", | |
| initialize: function (u) { | |
| var v = this; | |
| v.collection = new a.Cs.SectionItems(); | |
| v.Containers = {}; | |
| v.collection.bind("add", function (x) { | |
| var y, w = true; | |
| if (x.isElement()) { | |
| y = new a.Vs.ElementItem({ | |
| model: x, | |
| layoutView: v.options.layoutView, | |
| parentView: v, | |
| sectionId: x.id, | |
| locked: v.options.locked | |
| }) | |
| } else { | |
| if (x.isBlock()) { | |
| if (x.isFormField()) { | |
| y = new a.Vs.SectionItemFormField({ | |
| model: x, | |
| layoutView: v.options.layoutView, | |
| parentView: v, | |
| sectionId: x.id, | |
| locked: v.options.locked | |
| }); | |
| x.bind("sync", v.renderDataDeferred, v) | |
| } else { | |
| w = a.Us.allowElements(x.get("FieldBlockItem").Id, v.options.locked); | |
| y = new a.Vs.SectionItemBlock({ | |
| model: x, | |
| layoutView: v.options.layoutView, | |
| parentView: v, | |
| sectionId: x.id, | |
| locked: v.options.locked, | |
| allowElements: w | |
| }); | |
| x.bind("sync", v.renderDataDeferred, v) | |
| } | |
| } | |
| } | |
| v.Containers.FormSectionItems = v.$(".form-section-items"); | |
| p3.rV(y, v.Containers.FormSectionItems, false) | |
| }, this) | |
| }, | |
| events: { | |
| "click .edit": "editSectionSettings" | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| u.collection.reset(); | |
| p3.fT(u.template, function (w) { | |
| var v = a.Us.getOkToEdit(); | |
| u.$el.html(w({ | |
| locked: u.options.locked, | |
| lockedType: u.options.lockedType, | |
| okToEdit: v | |
| })); | |
| u.collection.fetch({ | |
| update: true, | |
| remove: false, | |
| cache: false, | |
| data: { | |
| applicationFormId: a.Data.ApplicationFormId, | |
| sectionId: u.options.sectionId, | |
| builder: true | |
| }, | |
| success: function () { | |
| var x = (u.collection.models.length > 0) ? false : true; | |
| if (x) { | |
| $("#emptysection").show() | |
| } else { | |
| $("#emptysection").hide() | |
| } | |
| }, | |
| complete: function () { | |
| if (a.Us.getOkToEdit()) { | |
| u.initializeSort() | |
| } else { | |
| if (u.options.locked) { | |
| u.initializeSort() | |
| } | |
| } | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading section items") | |
| } | |
| }) | |
| }) | |
| }, | |
| renderDataDeferred: function () { | |
| var u = this; | |
| _.delay(function () { | |
| u.renderData() | |
| }, 200) | |
| }, | |
| initializeSort: function () { | |
| var u = this; | |
| u.$(".form-section-items").sortable({ | |
| placeholder: "sortable-placeholder", | |
| distance: 5, | |
| tolerance: "pointer", | |
| helper: "clone", | |
| appendTo: "body", | |
| scroll: true, | |
| scrollSensitivity: 160, | |
| scrollSpeed: 40, | |
| containment: "parent", | |
| update: function (x, C) { | |
| var v = $(C.item), | |
| B = v.index(), | |
| w = null, | |
| y = null, | |
| z = B + 1, | |
| A; | |
| if (v.hasClass("drag-element") || v.hasClass("drag-block")) { | |
| if (v.data("type") === "element") { | |
| w = v.data("id") | |
| } else { | |
| if (v.data("type") === "block") { | |
| y = v.data("id") | |
| } else { | |
| if (v.data("type") === "formfield") { | |
| y = v.data("id") | |
| } | |
| } | |
| } | |
| v.remove(); | |
| A = new a.Ms.SectionItem({ | |
| ApplicationFormId: a.Data.ApplicationFormId, | |
| ApplicationSectionId: u.options.sectionId, | |
| ElementItem: { | |
| "$type": "clBLL.nOnlineApplication.ElementItem, clBLL", | |
| Id: w | |
| }, | |
| FieldBlockItem: { | |
| "$type": "clBLL.nOnlineApplication.FieldBlockItem, clBLL", | |
| Id: y | |
| } | |
| }); | |
| A.save({}, { | |
| dataParam: { | |
| returnModel: true | |
| }, | |
| success: function (D, E) { | |
| D.set({ | |
| Position: z | |
| }); | |
| u.collection.add(D, { | |
| at: B | |
| }); | |
| u.setSortOrder() | |
| }, | |
| complete: function () { | |
| if (v.data("type") === "block") { | |
| $("#blocks .blocks-holder").trigger("refreshlibrary") | |
| } | |
| } | |
| }) | |
| } else { | |
| u.setSortOrder() | |
| } | |
| }, | |
| start: function (v, w) { | |
| $("textarea.as-html").each(function (y, z) { | |
| var x = $(z); | |
| x.blur(); | |
| tinyMCE.execCommand("mceRemoveControl", false, x.attr("id")) | |
| }); | |
| u.$(".form-section-items").sortable("refresh") | |
| }, | |
| stop: function () { | |
| $("textarea.as-html").each(function (w, x) { | |
| var v = $(x).attr("id"); | |
| tinyMCE.execCommand("mceAddControl", false, v) | |
| }) | |
| } | |
| }) | |
| }, | |
| setSortOrder: function () { | |
| var w = this, | |
| v = [], | |
| u; | |
| _.each(w.$(".form-section-items").children(), function (y, x) { | |
| $(y).trigger("sortorder", [(x + 1)]) | |
| }); | |
| v = []; | |
| _.each(w.collection.toJSON(), function (x) { | |
| v.push(_.pick(x, "SectionItemId", "Position")) | |
| }); | |
| u = new a.Cs.SectionItems(v); | |
| u.save({ | |
| dataParam: { | |
| sectionId: w.options.sectionId | |
| } | |
| }); | |
| w.checkSectionItems() | |
| }, | |
| editSectionSettings: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| $("ul.nav-tabs li.active").trigger("editsectionsettings") | |
| }, | |
| checkSectionItems: function (u) { | |
| var w = this, | |
| v = (w.collection.models.length > 0) ? false : true; | |
| if (v) { | |
| $("#emptysection").show() | |
| } else { | |
| $("#emptysection").hide() | |
| } | |
| } | |
| }); | |
| a.Vs.ElementItem = Bb.View.extend({ | |
| template: "admissions/applicationformsedit.section.item.element.field.template.html", | |
| tagName: function () { | |
| if (!this.options.blockMode) { | |
| return "div" | |
| } | |
| return "tr" | |
| }, | |
| className: function () { | |
| if (this.options) { | |
| if (this.options.blockMode) { | |
| return "form-greybox" | |
| } | |
| return "form-section-item form-greybox" | |
| } | |
| return undefined | |
| }, | |
| initialize: function (u) { | |
| var v = this; | |
| switch (v.model.get("ElementItem").Id) { | |
| case h.Element.HEADER.Value: | |
| v.template = "formedit/formedit.element.header.template.html"; | |
| break; | |
| case h.Element.TEXT.Value: | |
| v.template = "formedit/formedit.element.text.template.html"; | |
| break; | |
| case h.Element.IMAGE.Value: | |
| v.template = "formedit/formedit.element.image.template.html"; | |
| break; | |
| case h.Element.SPACER.Value: | |
| v.template = "formedit/formedit.element.spacer.template.html"; | |
| break; | |
| case h.Element.HORIZONTALLINE.Value: | |
| v.template = "formedit/formedit.element.horizontalline.template.html"; | |
| break; | |
| case h.Element.LOGO.Value: | |
| v.template = "formedit/formedit.element.logo.template.html"; | |
| break; | |
| case h.Element.PAYMENTPLANLIST.Value: | |
| v.template = "formedit/formedit.element.paymentplanlist.template.html"; | |
| break; | |
| case h.Element.FEESCHEDULE.Value: | |
| v.template = "formedit/formedit.element.feeschedule.template.html"; | |
| break; | |
| case h.Element.SPECIALCONSIDERATION.Value: | |
| v.template = "formedit/formedit.element.specialconsideration.template.html"; | |
| break; | |
| case h.Element.RATINGMATRIX.Value: | |
| v.template = "formedit/formedit.element.ratingmatrix.template.html"; | |
| break; | |
| default: | |
| v.template = "admissions/applicationformsedit.section.item.element.field.template.html" | |
| } | |
| v.blockMode = u.blockMode || false; | |
| v.Containers = {}; | |
| v.model.bind("destroy", this.deleteElement, this); | |
| v.model.bind("remove", this.deleteElement, this); | |
| Bb.Validation.bind(v, { | |
| forceUpdate: true, | |
| selector: "id" | |
| }) | |
| }, | |
| events: { | |
| sortorder: "sortOrder", | |
| "change input:not(.file-upload-input):not(.financialaid)": "updateModel", | |
| "change textarea": "updateModel", | |
| "click .radio-input": "updateModel", | |
| "click .edit": "editSectionElement", | |
| "click .delete": "deleteElementItem", | |
| "click .deleteimage": "deleteImage", | |
| "change .logo": "updateModel", | |
| "blur textarea.as-html": "htmlEditorBlur" | |
| }, | |
| dispose: function () { | |
| var u = this; | |
| u.$("textarea.as-html").each(function () { | |
| var v = tinyMCE.get($(this).attr("id")); | |
| if (v) { | |
| v.remove(); | |
| v = null | |
| } | |
| }) | |
| }, | |
| render: function (w) { | |
| var y = this, | |
| x = (y.model.get("Position") - 1), | |
| v = w.children(), | |
| u; | |
| if (x > 0) { | |
| u = y.options.blockMode ? v.filter("tr:nth-child(" + x + ")") : v.filter("div:nth-child(" + x + ")"); | |
| if (u.length) { | |
| u.after(y.el) | |
| } else { | |
| w.append(y.el) | |
| } | |
| } else { | |
| if (v.length) { | |
| w.prepend(y.el) | |
| } else { | |
| w.append(y.el) | |
| } | |
| } | |
| y.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (w) { | |
| u.$el.html(w({ | |
| model: u.model.toJSON(), | |
| modelId: u.model.id, | |
| okToEdit: a.Us.getOkToEdit(), | |
| sectionLocked: (u.blockMode) ? undefined : a.Us.isSectionLocked(), | |
| isBasicElement: u.model.isBasicElement(), | |
| blockMode: u.blockMode | |
| })); | |
| u.$("#ElementItem\\.DisplayAs").trigger(jQuery.Event("keyup")); | |
| var v = u.$("textarea"); | |
| if (v.length) { | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.AutoSize, function () { | |
| if (u.model.get("ElementItem").Id !== h.Element.TEXT.Value) { | |
| v.autosize() | |
| } | |
| }) | |
| } | |
| switch (u.model.get("ElementItem").Id) { | |
| case h.Element.IMAGE.Value: | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.FileUpload, function () { | |
| u.initializeFileUpload_Photo(u) | |
| }); | |
| break; | |
| case h.Element.TEXT.Value: | |
| u.renderTextElement(); | |
| break; | |
| case h.Element.HTML.Value: | |
| u.renderHTMLElement(); | |
| break; | |
| case h.Element.LOGO.Value: | |
| u.renderLogoElement(); | |
| break; | |
| case h.Element.PAYMENTPLANLIST.Value: | |
| u.renderPaymentPlans(); | |
| break; | |
| case h.Element.FEESCHEDULE.Value: | |
| u.renderFeeSchedule(); | |
| break; | |
| case h.Element.RATINGMATRIX.Value: | |
| u.renderRatingMatrix(); | |
| break | |
| } | |
| }) | |
| }, | |
| renderTextElement: function () { | |
| var v = this, | |
| u = v.$("textarea.as-html").prop("id"); | |
| p3.showHtmlEditor(u, p3.Us.Enum.HtmlEditorCategories.CONTRACTS, false, function () { | |
| var w = tinyMCE.get(u); | |
| v.updateCharacterCounter(w); | |
| w.onChange.add(function (y, x) { | |
| v.updateCharacterCounter(y) | |
| }); | |
| w.onKeyUp.add(function (y, x) { | |
| v.updateCharacterCounter(y) | |
| }); | |
| $(w.getBody()).blur(function () { | |
| v.$("textarea.as-html").blur() | |
| }) | |
| }, p3.Us.Enum.HtmlEditorEncoding.NAMED) | |
| }, | |
| renderHTMLElement: function () { | |
| var u = this; | |
| u.$("textarea.as-html").each(function (x, v) { | |
| var w = $(v).attr("id"); | |
| p3.showHtmlEditor(w, p3.Us.Enum.HtmlEditorCategories.CONTRACTS, false, function () { | |
| var y = tinyMCE.get(w); | |
| if (y) { | |
| $(y.getBody()).blur(function () { | |
| $(v).blur() | |
| }) | |
| } | |
| }, p3.Us.Enum.HtmlEditorEncoding.NUMERIC) | |
| }) | |
| }, | |
| renderPaymentPlans: function () { | |
| var v = this, | |
| u = new a.Cs.ContractPaymentPlans(); | |
| u.fetch({ | |
| data: { | |
| formId: a.Data.ApplicationFormId | |
| }, | |
| success: function () { | |
| var w = new a.Vs.ContractPaymentPlans({ | |
| collection: u, | |
| elementModel: v.model | |
| }); | |
| v.Containers.PaymentPlans = v.$(".element-container"); | |
| p3.rV(w, v.Containers.PaymentPlans, true) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading payment plan list") | |
| } | |
| }) | |
| }, | |
| renderFeeSchedule: function () { | |
| var v = this, | |
| u = new a.Cs.FeeTypes(); | |
| a.Data.FormModel.fetch({ | |
| success: function () { | |
| u.fetch({ | |
| data: { | |
| formTypeId: a.Data.FormType.Value | |
| }, | |
| success: function () { | |
| var w = new a.Vs.FeeSchedule({ | |
| collection: u, | |
| elementModel: v.model | |
| }); | |
| v.Containers.FeeSchedule = v.$(".element-container"); | |
| p3.rV(w, v.Containers.FeeSchedule, true) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading fee types") | |
| } | |
| }) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading application form") | |
| } | |
| }) | |
| }, | |
| renderLogoElement: function (v) { | |
| var x = this, | |
| w = new m.Cs.SchoolLogoGet(), | |
| u = x.$(".logo"); | |
| w.fetch({ | |
| success: function () { | |
| w.each(function (y) { | |
| if (y.get("LogoId") === s.stringToInt(x.model.get("ElementItem").Setting1)) { | |
| u.append('<option value="' + y.get("LogoId") + '" selected="selected">' + y.get("ShortDescription") + "</option>") | |
| } else { | |
| u.append('<option value="' + y.get("LogoId") + '">' + y.get("ShortDescription") + "</option>") | |
| } | |
| }) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading logos") | |
| } | |
| }) | |
| }, | |
| renderRatingMatrix: function () { | |
| var x = this, | |
| u = x.model.get("ElementItem"), | |
| v = new a.Ms.RatingMatrix(), | |
| w = new a.Vs.RatingMatrix({ | |
| model: x.model, | |
| ratingMatrix: v | |
| }); | |
| x.Containers.RatingMatrix = x.$(".element-container"); | |
| if (u.RatingMatrixId) { | |
| v.fetch({ | |
| data: { | |
| id: u.RatingMatrixId | |
| }, | |
| success: function () { | |
| p3.rV(w, x.Containers.RatingMatrix, true) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading rating matrix") | |
| } | |
| }) | |
| } else { | |
| p3.rV(w, x.Containers.RatingMatrix, true) | |
| } | |
| }, | |
| sortOrder: function (u, v) { | |
| var w = this; | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| w.model.set({ | |
| Position: v | |
| }) | |
| }, | |
| initializeFileUpload_Photo: function (u) { | |
| window.setTimeout(function () { | |
| var v = p3.Us.Enum.UploadType.IMAGE; | |
| u.$(".imgUpload").fileupload({ | |
| url: p3.Config.RootPath + "utilities/FileTransferHandler.ashx", | |
| autoUpload: true, | |
| acceptFileTypes: v.ValidExtensions, | |
| formData: { | |
| safeName: true | |
| }, | |
| add: function (x, w) { | |
| var y = p3.Us.FileTools.isValidFile(v, w.files[0].name); | |
| if (y) { | |
| w.submit() | |
| } else { | |
| u.$(".imgUpload form .alert ").remove(); | |
| u.$(".imgUpload form").append(p3.Us.FileTools.validateFiles(v, w)) | |
| } | |
| } | |
| }).bind("fileuploaddone", function (x, w) { | |
| var y = u.model.get("ElementItem"); | |
| u.model.defaults = $.extend(true, {}, u.model.attributes); | |
| u.$(".imgNice").prop("src", "/ftpimages/pdTemp/" + w.result[0].name); | |
| u.$(".imgDisplay").show(); | |
| u.$(".imgUpload").hide(); | |
| if (!y.AttachmentFile) { | |
| y.AttachmentFile = {} | |
| } | |
| y.AttachmentFile.Attachment = w.result[0].original_name; | |
| y.AttachmentFile.AttachmentTemp = w.result[0].name; | |
| if (u.model.isValid(true)) { | |
| u.model.set({ | |
| FieldsToNull: [] | |
| }); | |
| _.each(u.model.attributes, function (B, z, A) { | |
| a.Us.recursiveFunction(u, B, z, A, "") | |
| }); | |
| u.model.save({}, { | |
| dataParam: u.options.dataParam, | |
| success: function (z, A) { | |
| p3.Layout.Containers.Modal.modal("hide") | |
| }, | |
| error: function (A, z) { | |
| p3.displayError("Error saving field") | |
| } | |
| }) | |
| } | |
| }) | |
| }, 1000) | |
| }, | |
| updateCharacterCounter: function (v) { | |
| var x = this, | |
| u = v.getContent(), | |
| w = 4000; | |
| if (u.length > w) { | |
| u = u.substring(0, w); | |
| v.setContent(u); | |
| v.focus(); | |
| v.selection.select(v.getBody(), true); | |
| v.selection.collapse(false) | |
| } | |
| x.$(".characterCounter").html(u.length) | |
| }, | |
| htmlEditorBlur: function (y) { | |
| y.preventDefault(); | |
| y.stopPropagation(); | |
| var B = this, | |
| u = $(y.currentTarget), | |
| z = u.attr("id"), | |
| x, w, A, v; | |
| if (u.hasClass("as-html")) { | |
| x = tinyMCE.get(z); | |
| w = false; | |
| if (x) { | |
| A = u.val(); | |
| v = a.Us.FixHTML(x.getContent()); | |
| w = (A !== v) | |
| } | |
| if (w) { | |
| B.updateModel(y) | |
| } | |
| } | |
| }, | |
| updateModel: function (x, z) { | |
| x.preventDefault(); | |
| var F = this, | |
| C = $(x.currentTarget), | |
| A = C.prop("id"), | |
| B = A, | |
| D = C.val(), | |
| y = C.hasClass("as-html"), | |
| u = C.closest(".section-item-container").attr("id"), | |
| v = {}, | |
| w, E; | |
| F.model.defaults = $.extend(true, {}, F.model.attributes); | |
| if (C.hasClass("radio-input")) { | |
| B = C.parent().prop("id") | |
| } else { | |
| if (C.hasClass("logo")) { | |
| D = s.stringToInt(C.val()) | |
| } else { | |
| if (y) { | |
| w = tinyMCE.get(A); | |
| if (w) { | |
| D = a.Us.FixHTML(w.save()); | |
| w.setContent(D) | |
| } | |
| B = C.prop("name") | |
| } | |
| } | |
| } | |
| if (!_.contains(B, ".")) { | |
| v[B] = D; | |
| F.model.set(v) | |
| } else { | |
| a.Us.setPropByString(F.model.attributes, B, D); | |
| E = y ? u : B; | |
| if (F.model.isValid(B)) { | |
| Bb.Validation.callbacks.valid(F, E, "id") | |
| } else { | |
| Bb.Validation.callbacks.invalid(F, E, "Entered value contains an error.", "id") | |
| } | |
| } | |
| if (F.model.isValid(true)) { | |
| F.model.set({ | |
| FieldsToNull: [] | |
| }); | |
| _.each(F.model.attributes, function (I, G, H) { | |
| a.Us.recursiveFunction(F, I, G, H, "") | |
| }); | |
| F.model.save({}, { | |
| dataParam: F.options.dataParam, | |
| success: function (G, H) { | |
| p3.Layout.Containers.Modal.modal("hide"); | |
| if (_.isFunction(z)) { | |
| z() | |
| } | |
| }, | |
| error: function (H, G) { | |
| p3.displayError("Error saving field") | |
| } | |
| }) | |
| } | |
| }, | |
| deleteImage: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| var v = this; | |
| v.model.defaults = $.extend(true, {}, v.model.attributes); | |
| v.$(".imgDisplay").hide(); | |
| v.$(".imgUpload").show(); | |
| v.model.get("ElementItem").AttachmentFile.AttachmentRemove = v.model.get("ElementItem").AttachmentFile.Attachment; | |
| v.model.get("ElementItem").AttachmentFile.Attachment = null; | |
| if (v.model.isValid(true)) { | |
| v.model.set({ | |
| FieldsToNull: [] | |
| }); | |
| _.each(v.model.attributes, function (y, w, x) { | |
| a.Us.recursiveFunction(v, y, w, x, "") | |
| }); | |
| v.model.save({}, { | |
| dataParam: v.options.dataParam, | |
| error: function (x, w) { | |
| p3.displayError("Error removing image") | |
| } | |
| }) | |
| } | |
| }, | |
| editSectionElement: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault() | |
| }, | |
| deleteElementItem: function (u) { | |
| var v = this; | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| p3.showConfirm("Remove Element", "Wait a minute. Are you really sure you want to remove this " + v.model.get("ElementItem").Name + " element from this section?", null, function () { | |
| v.model.destroy({ | |
| complete: function () { | |
| if (!v.blockMode) { | |
| v.options.parentView.checkSectionItems() | |
| } | |
| } | |
| }) | |
| }) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| a.Vs.SectionItemFormField = Bb.View.extend({ | |
| template: "formedit/formedit.main.section.item.formfield.template.html", | |
| className: function () { | |
| return "form-section-item white-bgc" | |
| }, | |
| initialize: function (u) { | |
| var v = this; | |
| v.collection = new a.Cs.BlockFields(); | |
| v.parentView = u.parentView; | |
| v.collection.bind("add", function (x) { | |
| var w; | |
| if (x.get("ElementItem").Id) { | |
| w = new a.Vs.ElementItem({ | |
| model: x, | |
| elementName: v.model.get("ElementItem").Name, | |
| blockMode: true | |
| }) | |
| } else { | |
| if (x.get("FieldItem").Id) { | |
| w = new a.Vs.BlockField({ | |
| model: x | |
| }) | |
| } | |
| } | |
| if (x.get("FieldItem").Id != 180) { | |
| p3.rV(w, v.$(".fields"), false) | |
| } | |
| }, this) | |
| }, | |
| events: { | |
| sortorder: "sortOrder", | |
| "click .delete": "deleteSectionBlock" | |
| }, | |
| render: function (w) { | |
| var y = this, | |
| x = (y.model.get("Position") - 1), | |
| v = w.children(), | |
| u; | |
| if (x > 0) { | |
| u = v.filter("div:nth-child(" + x + ")"); | |
| if (u.length) { | |
| u.after(y.el) | |
| } else { | |
| w.append(y.el) | |
| } | |
| } else { | |
| if (v.length) { | |
| w.prepend(y.el) | |
| } else { | |
| w.append(y.el) | |
| } | |
| } | |
| y.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| model: u.model.toJSON(), | |
| okToEdit: a.Us.getOkToEdit(), | |
| hasFields: u.model.hasFields(), | |
| displayOnlyFields: u.model.displayOnlyFields() | |
| })); | |
| _.each(u.model.get("FieldElementItems"), function (w) { | |
| u.collection.add(w) | |
| }) | |
| }) | |
| }, | |
| sortOrder: function (u, v) { | |
| var w = this; | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| w.model.set({ | |
| Position: v | |
| }) | |
| }, | |
| initializeSort: function () { | |
| var u = this; | |
| u.$(".fields").sortable({ | |
| distance: 5, | |
| placeholder: "sortable-placeholder", | |
| tolerance: "pointer", | |
| helper: "clone", | |
| appendTo: "body", | |
| containment: "parent", | |
| update: function (y, B) { | |
| var v = $(B.item), | |
| A = v.index(), | |
| x = null, | |
| z = A + 1, | |
| w; | |
| if (v.hasClass("drag-element")) { | |
| if (v.data("type") === "element") { | |
| x = v.data("id") | |
| } | |
| v.remove(); | |
| w = new a.Ms.ElementField({ | |
| ApplicationFormId: a.Data.ApplicationFormId, | |
| ApplicationSectionId: u.model.get("ApplicationSectionId"), | |
| SectionItemId: u.model.get("SectionItemId"), | |
| ElementItem: { | |
| "$type": "clBLL.nOnlineApplication.ElementItem, clBLL", | |
| Id: x, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }, | |
| FieldItem: { | |
| "$type": "clBLL.nOnlineApplication.FieldItem, clBLL" | |
| } | |
| }); | |
| w.save({}, { | |
| dataParam: { | |
| returnModel: true | |
| }, | |
| success: function (C, D) { | |
| C.set({ | |
| Position: z | |
| }); | |
| u.collection.add(C.toJSON(), { | |
| at: A | |
| }); | |
| u.setSortOrder() | |
| } | |
| }) | |
| } else { | |
| u.setSortOrder() | |
| } | |
| }, | |
| start: function (v, w) { | |
| $("textarea.as-html").each(function (y, z) { | |
| var x = $(z).attr("id"); | |
| tinyMCE.execCommand("mceRemoveControl", false, x) | |
| }); | |
| u.$(".form-section-items").sortable("refresh") | |
| }, | |
| stop: function (v, w) { | |
| $("textarea.as-html").each(function (y, z) { | |
| var x = $(z).attr("id"); | |
| tinyMCE.execCommand("mceAddControl", false, x) | |
| }) | |
| } | |
| }).mousedown(function () { | |
| u.$("input,textarea").blur() | |
| }) | |
| }, | |
| setSortOrder: function () { | |
| var u = this; | |
| if (u.model.get("FieldBlockItem").Id === 14) { | |
| _.each(u.$(".fields").children(), function (w, v) { | |
| $(w).trigger("sortorder", [(v + 5)]) | |
| }); | |
| _.each(u.collection.models, function (v) { | |
| if (v.attributes.FieldItem.Id === 180) { | |
| v.attributes.Position = 1 | |
| } | |
| }) | |
| } else { | |
| _.each(u.$(".fields").children(), function (w, v) { | |
| $(w).trigger("sortorder", [(v + 1)]) | |
| }) | |
| } | |
| u.collection.save({ | |
| dataParam: { | |
| sectionItemId: u.model.get("SectionItemId") | |
| } | |
| }) | |
| }, | |
| deleteSectionBlock: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| var v = this; | |
| p3.showConfirm("Remove Block", "Wait a minute. Are you really sure you want to remove the " + v.model.get("FieldBlockItem").Name + " element from this section?", null, function () { | |
| var w = {}; | |
| v.model.destroy({ | |
| dataParam: w, | |
| complete: function () { | |
| $("#blocks .blocks-holder").trigger("refreshlibrary"); | |
| v.options.parentView.checkSectionItems() | |
| } | |
| }) | |
| }) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| a.Vs.SectionItemBlock = Bb.View.extend({ | |
| template: "admissions/applicationformsedit.section.item.block.template.html", | |
| className: function () { | |
| return "form-section-item white-bgc" | |
| }, | |
| initialize: function (u) { | |
| var v = this; | |
| v.collection = new a.Cs.BlockFields(); | |
| v.parentView = u.parentView; | |
| v.collection.bind("add", function (x) { | |
| var w; | |
| if (x.get("ElementItem").Id) { | |
| w = new a.Vs.ElementItem({ | |
| model: x, | |
| elementName: v.model.get("ElementItem").Name, | |
| blockMode: true | |
| }) | |
| } else { | |
| if (x.get("FieldItem").Id) { | |
| w = new a.Vs.BlockField({ | |
| model: x | |
| }) | |
| } | |
| } | |
| if (x.get("FieldItem").Id != 180) { | |
| p3.rV(w, v.$(".fields"), false) | |
| } | |
| }, this) | |
| }, | |
| events: { | |
| sortorder: "sortOrder", | |
| "click .edit": "editBlock", | |
| "click .edit-payment": "editPaymentBlock", | |
| "click .delete": "deleteSectionBlock" | |
| }, | |
| render: function (w) { | |
| var y = this, | |
| x = (y.model.get("Position") - 1), | |
| v = w.children(), | |
| u; | |
| if (x > 0) { | |
| u = v.filter("div:nth-child(" + x + ")"); | |
| if (u.length) { | |
| u.after(y.el) | |
| } else { | |
| w.append(y.el) | |
| } | |
| } else { | |
| if (v.length) { | |
| w.prepend(y.el) | |
| } else { | |
| w.append(y.el) | |
| } | |
| } | |
| y.renderData() | |
| }, | |
| renderData: function () { | |
| var v = this, | |
| u; | |
| p3.fT(v.template, function (w) { | |
| v.$el.html(w({ | |
| model: v.model.toJSON(), | |
| okToEdit: a.Us.getOkToEdit(), | |
| hasFields: v.model.hasFields(), | |
| displayOnlyFields: v.model.displayOnlyFields(), | |
| allowElements: v.options.allowElements | |
| })); | |
| u = _.unique(v.model.get("FieldElementItems"), function (x) { | |
| return x.FieldElementItemId | |
| }); | |
| _.each(u, function (x) { | |
| v.collection.add(x) | |
| }); | |
| if (a.Us.getOkToEdit()) { | |
| v.initializeSort() | |
| } else { | |
| if (v.options.locked) { | |
| v.initializeSort() | |
| } | |
| } | |
| }) | |
| }, | |
| refreshData: function (u) { | |
| var w = this, | |
| v; | |
| w.$(".fields").empty(); | |
| w.collection.reset(); | |
| v = _.unique(u, function (x) { | |
| return x.FieldElementItemId | |
| }); | |
| _.each(v, function (x) { | |
| w.collection.add(x) | |
| }) | |
| }, | |
| sortOrder: function (u, v) { | |
| var w = this; | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| w.model.set({ | |
| Position: v | |
| }) | |
| }, | |
| initializeSort: function () { | |
| var u = this; | |
| u.$(".fields").sortable({ | |
| distance: 5, | |
| placeholder: "sortable-placeholder", | |
| tolerance: "pointer", | |
| helper: "clone", | |
| appendTo: "body", | |
| containment: "parent", | |
| update: function (y, B) { | |
| var v = $(B.item), | |
| A = v.index(), | |
| x = null, | |
| z = A + 1, | |
| w; | |
| if (v.hasClass("drag-element")) { | |
| if (v.data("type") === "element") { | |
| x = v.data("id") | |
| } | |
| v.remove(); | |
| w = new a.Ms.ElementField({ | |
| ApplicationFormId: a.Data.ApplicationFormId, | |
| ApplicationSectionId: u.model.get("ApplicationSectionId"), | |
| SectionItemId: u.model.get("SectionItemId"), | |
| ElementItem: { | |
| "$type": "clBLL.nOnlineApplication.ElementItem, clBLL", | |
| Id: x, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }, | |
| FieldItem: { | |
| "$type": "clBLL.nOnlineApplication.FieldItem, clBLL" | |
| } | |
| }); | |
| w.save({}, { | |
| dataParam: { | |
| returnModel: true | |
| }, | |
| success: function (C, D) { | |
| C.set({ | |
| Position: z | |
| }); | |
| u.collection.add(C.toJSON(), { | |
| at: A | |
| }); | |
| u.setSortOrder() | |
| } | |
| }) | |
| } else { | |
| u.setSortOrder() | |
| } | |
| }, | |
| start: function (v, w) { | |
| $("textarea.as-html").each(function (y, z) { | |
| var x = $(z); | |
| x.blur(); | |
| tinyMCE.execCommand("mceRemoveControl", false, x.attr("id")) | |
| }); | |
| u.$(".form-section-items").sortable("refresh") | |
| }, | |
| stop: function (v, w) { | |
| $("textarea.as-html").each(function (y, z) { | |
| var x = $(z).attr("id"); | |
| tinyMCE.execCommand("mceAddControl", false, x) | |
| }) | |
| } | |
| }).mousedown(function (v) { | |
| u.$("input,textarea").not(".as-html").blur() | |
| }) | |
| }, | |
| setSortOrder: function () { | |
| var u = this; | |
| if (u.model.get("FieldBlockItem").Id === 14) { | |
| _.each(u.$(".fields").children(), function (w, v) { | |
| $(w).trigger("sortorder", [(v + 5)]) | |
| }); | |
| _.each(u.collection.models, function (v) { | |
| if (v.attributes.FieldItem.Id === 180) { | |
| v.attributes.Position = 1 | |
| } | |
| }) | |
| } else { | |
| _.each(u.$(".fields").children(), function (w, v) { | |
| $(w).trigger("sortorder", [(v + 1)]) | |
| }) | |
| } | |
| u.collection.save({ | |
| dataParam: { | |
| sectionItemId: u.model.get("SectionItemId"), | |
| returnCollection: true | |
| }, | |
| success: function (v) { | |
| u.refreshData(v) | |
| } | |
| }) | |
| }, | |
| editBlock: function (w) { | |
| w.stopPropagation(); | |
| w.preventDefault(); | |
| var y = this, | |
| x = "", | |
| u, v = $(w.currentTarget).data("id"); | |
| switch (v) { | |
| case 42: | |
| case 44: | |
| case 45: | |
| case 46: | |
| x = "formedit/formedit.block.settings.update.template.html"; | |
| break; | |
| case 43: | |
| x = "formedit/formedit.block.settings.updatehousehold.template.html"; | |
| break; | |
| case 23: | |
| case 63: | |
| x = "formedit/formedit.block.settings.paymentplans.template.html"; | |
| break; | |
| case 25: | |
| case 40: | |
| y.editSignatureBlock(); | |
| break; | |
| case 36: | |
| x = "formedit/formedit.block.settings.interests.template.html"; | |
| break; | |
| case 38: | |
| x = "formedit/formedit.block.settings.address.template.html"; | |
| break; | |
| case 72: | |
| y.editRatingMatrixBlock(); | |
| break; | |
| default: | |
| if (y.model.get("FieldBlockItem").BlockMultipleInd) { | |
| x = "formedit/formedit.block.settings.multiple.template.html" | |
| } | |
| } | |
| if (x) { | |
| u = new a.Vs.BlockEdit({ | |
| template: x, | |
| model: y.model | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(u, p3.Layout.Containers.Modal, true) | |
| } | |
| }, | |
| editPaymentBlock: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| $(".workspace-sidebar-header").trigger("editpayment", { | |
| FieldBlockId: this.model.get("FieldBlockItem").Id | |
| }) | |
| }, | |
| editSignatureBlock: function () { | |
| var v = this, | |
| u; | |
| a.Data.FormModel.once("sync", function () { | |
| if (v.parentView) { | |
| v.parentView.renderDataDeferred() | |
| } | |
| }, v); | |
| u = q.Vs.Modal2.extend({ | |
| template: "formedit/formedit.block.settings.esignature.template.html", | |
| model: a.Data.FormModel, | |
| variables: { | |
| isContractForm: a.Data.FormType.IsContractForm | |
| }, | |
| size: "md", | |
| events: { | |
| "click button.delete": "deleteModel", | |
| "click .show-agreement": "showAgreement" | |
| }, | |
| modalRendered: function (x) { | |
| var w = this; | |
| q.Us.showHtmlEditor(w, "tinyeditor") | |
| }, | |
| modalUpdate: function (z) { | |
| var y = this, | |
| w = z.eventCurrentTarget, | |
| x = y.$(".agreement-holder"); | |
| if (w.children("input").prop("name") === "ESigAgreement") { | |
| if (w.children("input").is(":checked")) { | |
| x.show() | |
| } else { | |
| x.hide() | |
| } | |
| } | |
| }, | |
| modalSave: function () { | |
| var x = this, | |
| w = x.$(".agreement-holder .controls"); | |
| if (x.model.get("ESigAgreement")) { | |
| $.each(x.$(".tinyeditor"), function () { | |
| var y = {}; | |
| y[this.id] = tinyMCE.get(this.id).save(); | |
| x.model.set(y) | |
| }); | |
| if (t.isEmptier(x.model.get("ESigAgreementText"))) { | |
| w.addClass("box-validate"); | |
| return false | |
| } | |
| w.removeClass("box-validate") | |
| } else { | |
| x.model.set({ | |
| ESigAgreementText: "" | |
| }); | |
| w.removeClass("box-validate") | |
| } | |
| }, | |
| deleteModel: function (x) { | |
| x.stopPropagation(); | |
| x.preventDefault(); | |
| var B = this, | |
| A = B.$("#modal-form"), | |
| z = B.$("#modal-confirm"), | |
| w, y; | |
| y = q.Vs.Modal2.extend({ | |
| template: "utilities/utilities.smodal.confirm.html", | |
| model: a.Data.FormModel, | |
| subModal: true, | |
| variables: { | |
| title: "Remove Block", | |
| errorText: "Wait a minute. Are you really sure you want to remove the Signature block from this section?", | |
| cancelText: "Cancel", | |
| confirmText: "Confirm" | |
| }, | |
| modalSave: function () { | |
| v.model.destroy({ | |
| dataParam: { | |
| applicationFormId: B.model.get("ApplicationFormId"), | |
| deleteSectionItems: true | |
| }, | |
| success: function () { | |
| if ($("#blocks .blocks-holder").length > 0) { | |
| $("#blocks .blocks-holder").trigger("refreshlibrary") | |
| } | |
| }, | |
| error: function () { | |
| p3.displayError("Error deleting block.") | |
| } | |
| }); | |
| p3.Layout.Containers.Modal.modal("hide"); | |
| return false | |
| } | |
| }); | |
| w = new y(); | |
| A.hide(); | |
| z.show(); | |
| p3.rV(w, z, true) | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new u(), p3.Layout.Containers.Modal, true) | |
| }, | |
| editRatingMatrixBlock: function () { | |
| var w = this, | |
| v = w.model.get("FieldBlockItem").RatingMatrixId, | |
| u = { | |
| RatingMatrix: { | |
| data: new n.Cs.Dictionary(), | |
| dataParams: { | |
| name: "Rating Matrix", | |
| id: h.DictionaryData.RatingMatrix.id, | |
| inputParam: "@oa_application_form_id=" + w.model.get("ApplicationFormId") + "[i]" | |
| } | |
| } | |
| }; | |
| if (v) { | |
| u.RatingMatrix.dataParams.inputParam += ",@rating_matrix_id=" + v + "[i]" | |
| } | |
| n.Us.Fetch(u, function (x, z, y) { | |
| if (z) { | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new a.Vs.BlockEdit({ | |
| template: "formedit/formedit.block.settings.ratingMatrix.template.html", | |
| model: w.model, | |
| dictionaries: x | |
| }), p3.Layout.Containers.Modal, true) | |
| } else { | |
| p3.displayError("Error retrieving rating matrix list") | |
| } | |
| }) | |
| }, | |
| deleteSectionBlock: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| var v = this; | |
| p3.showConfirm("Remove Block", "Wait a minute. Are you really sure you want to remove the " + v.model.get("FieldBlockItem").Name + " block from this section?", null, function () { | |
| v.model.destroy({ | |
| dataParam: {}, | |
| complete: function () { | |
| $("#blocks .blocks-holder").trigger("refreshlibrary"); | |
| v.options.parentView.checkSectionItems() | |
| } | |
| }) | |
| }) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| a.Vs.BlockField = Bb.View.extend({ | |
| tagName: function () { | |
| return "tr" | |
| }, | |
| className: "form-greybox", | |
| initialize: function (u) { | |
| var v = this; | |
| Bb.Validation.bind(v, { | |
| forceUpdate: true, | |
| selector: "id" | |
| }) | |
| }, | |
| events: { | |
| sortorder: "sortOrder", | |
| "click .radio-input": "updateModel", | |
| "change input": "updateModel", | |
| "click #AllowDdlbSelection": "ddlbSelections", | |
| "click .options": "fieldOptions" | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| if (v.model.get("FieldItem").Id === 253) { | |
| n.Us.Fetch({ | |
| FormFieldType: new a.Cs.FormFieldType() | |
| }, function (w, y, x) { | |
| v.dictionaries = {}; | |
| v.dictionaries.FormFieldType = w.FormFieldType.toJSON(); | |
| v.renderData() | |
| }) | |
| } else { | |
| v.renderData() | |
| } | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| if (u.model.get("FieldItem").Id === 250) { | |
| u.template = "admissions/applicationformsedit.section.item.block.field.interests.template.html" | |
| } else { | |
| u.template = "admissions/applicationformsedit.section.item.block.field.template.html" | |
| } | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| model: u.model.toJSON(), | |
| okToEdit: a.Us.getOkToEdit(), | |
| sectionLocked: a.Us.isSectionLocked(), | |
| formType: a.Data.FormType, | |
| dictionaries: u.dictionaries | |
| })) | |
| }) | |
| }, | |
| sortOrder: function (u, v) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| var w = this; | |
| w.model.set({ | |
| Position: v | |
| }) | |
| }, | |
| updateModel: function (v) { | |
| v.stopPropagation(); | |
| v.preventDefault(); | |
| var z = this, | |
| x = $(v.currentTarget), | |
| w = x.prop("id"), | |
| y, u = {}; | |
| z.model.defaults = $.extend(true, {}, z.model.attributes); | |
| if (x.hasClass("radio-input")) { | |
| x.siblings().removeClass("active"); | |
| x.addClass("active"); | |
| y = x.prop("value"); | |
| w = $(x).parent().prop("id") | |
| } else { | |
| y = x.prop("value") | |
| } | |
| if (!_.contains(w, ".")) { | |
| u[w] = y; | |
| z.model.set(u) | |
| } else { | |
| a.Us.setPropByString(z.model.attributes, w, y); | |
| if (z.model.isValid(w)) { | |
| Bb.Validation.callbacks.valid(z, w, "id") | |
| } else { | |
| Bb.Validation.callbacks.invalid(z, w, "Entered value contains an error.", "id") | |
| } | |
| } | |
| if (z.model.isValid(true)) { | |
| z.model.set({ | |
| FieldsToNull: [] | |
| }); | |
| _.each(z.model.attributes, function (C, A, B) { | |
| a.Us.recursiveFunction(z, C, A, B, "") | |
| }); | |
| z.model.save({}, { | |
| dataParam: z.options.dataParam, | |
| success: function (A, B) { | |
| p3.Layout.Containers.Modal.modal("hide") | |
| }, | |
| error: function (B, A) { | |
| p3.displayError("Error saving field") | |
| } | |
| }) | |
| } | |
| }, | |
| ddlbSelections: function (u) { | |
| u.preventDefault(); | |
| var w = this, | |
| v = ""; | |
| if (w.model.get("FieldItem").Id === 250) { | |
| v = "Interests" | |
| } else { | |
| v = w.model.get("FieldItem").Name | |
| } | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new a.Vs.DdlbSelections({ | |
| model: w.model, | |
| variables: { | |
| name: v | |
| } | |
| }), p3.Layout.Containers.Modal, true) | |
| }, | |
| fieldOptions: function (u) { | |
| u.preventDefault(); | |
| var v = this; | |
| v.modal2Extend = q.Vs.Modal2.extend({ | |
| template: "formedit/formedit.main.section.item.formfield.options.template.html", | |
| model: v.model, | |
| dictionaries: v.dictionaries, | |
| dataParam: { | |
| returnModel: true | |
| }, | |
| events: { | |
| "click .option-add": "optionAdd", | |
| "click .option-delete": "optionDelete" | |
| }, | |
| modalRendered: function () { | |
| var w = this; | |
| if (w.$("table.options .option").length === 1) { | |
| w.$(".option-delete").hide() | |
| } | |
| w.updateDescription(w.model.get("FieldItem").UIType); | |
| w.updateOptions(w.model.get("FieldItem").UIType); | |
| w.setFocus(); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }, | |
| modalUpdate: function (x) { | |
| var w = this; | |
| if (x.eventCurrentTarget.hasClass("option")) { | |
| return false | |
| } | |
| if (x.eventCurrentTarget.attr("name") === "FieldItem.UIType") { | |
| w.updateDescription(x.eventCurrentTarget.val()); | |
| w.updateOptions(x.eventCurrentTarget.val()) | |
| } | |
| }, | |
| modalSave: function (x) { | |
| var w = this, | |
| y = []; | |
| _.each(w.$("table.options .option"), function (A) { | |
| var z = $(A); | |
| if (!t.isEmptier(z.val())) { | |
| y.push({ | |
| dd_id: z.data("id") !== 0 ? z.data("id") : null, | |
| dd_description: z.val(), | |
| dd_selected: true | |
| }) | |
| } | |
| }); | |
| q.Us.setPropByString(w.model.toJSON(), "FieldItem.LookUpList", y) | |
| }, | |
| modalSavedSuccess: function (w) { | |
| v.renderData() | |
| }, | |
| optionAdd: function (w) { | |
| var x = this; | |
| p3.fT("formedit/formedit.main.section.item.formfield.option.template.html", function (y) { | |
| x.$("table.options tbody").append(y({})); | |
| if (x.$("table.options .option").length > 1) { | |
| x.$(".option-delete").show() | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| optionDelete: function (w) { | |
| var x = this; | |
| $(w.currentTarget).parent().parent().remove(); | |
| if (x.$("table.options .option").length === 1) { | |
| x.$(".option-delete").hide() | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }, | |
| updateDescription: function (y) { | |
| var x = this, | |
| w = _.findWhere(x.dictionaries.FormFieldType, { | |
| dd_data: y | |
| }); | |
| if (t.isEmptier(w.Description)) { | |
| x.$(".description").hide() | |
| } else { | |
| x.$(".description").html(w.Description); | |
| x.$(".description").show() | |
| } | |
| }, | |
| updateOptions: function (x) { | |
| var w = this; | |
| if (x === "T" || x === "TA" || x === "RB") { | |
| w.$(".options-holder").hide() | |
| } else { | |
| w.$(".options-holder").show() | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new v.modal2Extend(), p3.Layout.Containers.Modal, true) | |
| } | |
| }); | |
| a.Vs.DdlbSelections = q.Vs.Modal2.extend({ | |
| template: "admissions/applicationformsedit.ddlb.selections.template.html", | |
| events: { | |
| "click #select-all": "selectAll", | |
| "click td .btn": "setSelectAll" | |
| }, | |
| modalRendered: function () { | |
| this.setSelectAll() | |
| }, | |
| modalUpdate: function () { | |
| var u = this; | |
| return u.model.get("FieldItem").Id === 250 | |
| }, | |
| selectAll: function (v) { | |
| var w = this, | |
| u = $(v.currentTarget); | |
| _.defer(function () { | |
| var x = u.hasClass("active"); | |
| w.$("td .btn").toggleClass("active", x) | |
| }) | |
| }, | |
| setSelectAll: function () { | |
| var u = this; | |
| _.defer(function () { | |
| var v = (u.$("td .btn").not(".active").length === 0); | |
| u.$("#select-all").toggleClass("active", v) | |
| }) | |
| }, | |
| modalSave: function () { | |
| var v = this, | |
| u = v.model.get("FieldItem").LookUpList; | |
| v.$("td .btn").each(function (z, x) { | |
| var w = $(x), | |
| y = w.data("id"), | |
| A = _.findWhere(u, { | |
| dd_id: y | |
| }); | |
| if (A) { | |
| A.dd_selected = w.hasClass("active") ? 1 : 0 | |
| } | |
| }) | |
| } | |
| }); | |
| a.Vs.Footer = Bb.View.extend({ | |
| template: "formedit/formedit.footer.template.html", | |
| events: { | |
| "click .preview": "renderPreview", | |
| "click .generate": "showGenerateModal" | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| applicationId: a.Data.ApplicationFormId, | |
| formType: a.Data.FormType, | |
| archivedInd: u.options.layoutView.ArchivedInd | |
| })) | |
| }) | |
| }, | |
| renderPreview: function (u) { | |
| u.preventDefault(); | |
| u.stopPropagation(); | |
| var v = h.FormType, | |
| w = a.Us.getSelectedPersona().Description, | |
| x = p3.Config.RootPath + w; | |
| if (a.Data.FormType.Value == v.APPLICATION.Value) { | |
| x += "#application/" + a.Data.ApplicationFormId + "/keyid=preview" | |
| } else { | |
| if (a.Data.FormType.IsContractForm) { | |
| x += "#contract/" + a.Data.ApplicationFormId + "/keyid=0" | |
| } else { | |
| if (a.Data.FormType.Value == v.INQUIRY.Value) { | |
| x += "#inquiry/" + a.Data.ApplicationFormId + "/keyid=preview" | |
| } else { | |
| if (a.Data.FormType.Value == v.RECOMMENDATION.Value || _.contains([v.ACKNOWLEDGEMENT_PERMISSION, v.EMERGENCY_CONTACTS, v.PROFILE_UPDATES, v.BLANK_FORM, v.MEDICAL_FORM], a.Data.FormType)) { | |
| x += "#schoolform/" + a.Data.ApplicationFormId + "/keyid=preview" | |
| } | |
| } | |
| } | |
| } | |
| if (x) { | |
| window.open(x, "_blank") | |
| } | |
| }, | |
| showGenerateModal: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new a.Vs.GenerateContracts({ | |
| model: a.Data.FormModel | |
| }), p3.Layout.Containers.Modal, true) | |
| } | |
| }); | |
| a.Vs.ContractPaymentPlans = Bb.View.extend({ | |
| template: "contracts/contracts.contract.edit.paymentplans.template.html", | |
| className: "element-sub-block", | |
| initialize: function (u) { | |
| this.elementModel = u.elementModel | |
| }, | |
| events: { | |
| "click .element-select-btn:not(.disabled)": "selectPlans" | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| n.Us.Fetch({ | |
| ADMTuitionInsuranceTypes: { | |
| data: new n.Cs.Dictionary(), | |
| dataParams: h.DictionaryData.ADMTuitionInsuranceTypes | |
| } | |
| }, function (w, y, x) { | |
| v.dictionaries = {}; | |
| v.dictionaries = w; | |
| v.renderData() | |
| }) | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| plans: u.collection.toJSON(), | |
| okToEdit: a.Us.getOkToEdit(), | |
| sectionLocked: a.Us.isSectionLocked(), | |
| dictionaries: u.dictionaries, | |
| formType: a.Data.FormType.Value | |
| })); | |
| g.Us.initialize(".date-input", { | |
| yearRange: "-10:+10" | |
| }) | |
| }) | |
| }, | |
| refreshData: function () { | |
| var u = this; | |
| u.collection.fetch({ | |
| data: { | |
| formId: a.Data.ApplicationFormId | |
| }, | |
| success: function () { | |
| u.renderData() | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading contract plan list") | |
| } | |
| }) | |
| }, | |
| selectPlans: function (u) { | |
| u.preventDefault(); | |
| var v = this; | |
| if (a.Data.FormType === h.FormType.SMART_TUITION_CONTRACT) { | |
| v.showSmartPlansModal(u) | |
| } else { | |
| if (a.Data.FormType === h.FormType.TMS_CONTRACT) { | |
| v.showTmsPlansModal(u) | |
| } else { | |
| v.showPlansModal(u) | |
| } | |
| } | |
| }, | |
| showPlansModal: function (v) { | |
| v.preventDefault(); | |
| var w = this, | |
| u = new a.Cs.ContractPaymentPlansSelect(); | |
| u.fetch({ | |
| data: { | |
| formId: a.Data.ApplicationFormId | |
| }, | |
| success: function () { | |
| w.modal2Extend = q.Vs.Modal2.extend({ | |
| template: "contracts/contracts.contract.edit.paymentplans.edit.template.html", | |
| collection: u, | |
| disableValidation: true, | |
| variables: { | |
| hasOnAccount: a.Data.HasOnAccount | |
| }, | |
| events: { | |
| "click #select-all": "selectAll" | |
| }, | |
| modalRendered: function (y) { | |
| var x = this; | |
| x.collection.bind("add", function (z) { | |
| var A = new a.Vs.PaymentPlan({ | |
| model: z, | |
| selector: x.selector, | |
| dictionaries: w.dictionaries | |
| }); | |
| p3.rV(A, x.$(".ui-sortable"), false) | |
| }, x); | |
| x.collection.each(function (z) { | |
| var A = new a.Vs.PaymentPlan({ | |
| model: z, | |
| selector: x.selector, | |
| dictionaries: w.dictionaries | |
| }); | |
| p3.rV(A, x.$(".ui-sortable"), false) | |
| }) | |
| }, | |
| modalUpdate: function (x) { | |
| if (x.eventCurrentTarget.attr("name") === "Selected") { | |
| return false | |
| } | |
| if (x.eventCurrentTarget.attr("name") === "PaymentPlan.NumberOfPayments") { | |
| return false | |
| } | |
| if (x.eventCurrentTarget.attr("name") === "PaymentPlan.TuitionInsuranceCode") { | |
| return false | |
| } | |
| if (x.eventCurrentTarget.attr("name") === "ExpireDate") { | |
| return false | |
| } | |
| if (x.eventCurrentTarget.hasClass("disabled")) { | |
| return false | |
| } | |
| }, | |
| saveModel: function () { | |
| var y = this, | |
| x = true; | |
| x = _.every(y.collection.models, function (z) { | |
| return z.isValid(true) | |
| }); | |
| if (x) { | |
| y.collection.save({ | |
| dataParam: { | |
| formId: a.Data.ApplicationFormId | |
| }, | |
| success: function (z) { | |
| w.refreshData(); | |
| p3.Layout.Containers.Modal.modal("hide") | |
| }, | |
| error: function (z) { | |
| w.$(".save").button("reset") | |
| } | |
| }) | |
| } | |
| return false | |
| }, | |
| selectAll: function (x) { | |
| x.preventDefault(); | |
| var y = this; | |
| y.$('[name="Selected"]:not(.active)').trigger("selectall") | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new w.modal2Extend(), p3.Layout.Containers.Modal, true) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading contract payment plans") | |
| } | |
| }) | |
| }, | |
| showSmartPlansModal: function (u) { | |
| var w = this, | |
| v; | |
| v = q.Vs.Modal2.extend({ | |
| template: "contracts/contracts.contract.edit.billingsystem.plans.edit.template.html", | |
| collection: new a.Cs.SmartPaymentPlansSelect(), | |
| events: { | |
| "click #select-all": "selectAll" | |
| }, | |
| dataParam: { | |
| formId: a.Data.ApplicationFormId | |
| }, | |
| modalRendered: function (y) { | |
| var x = this; | |
| x.collection.fetch({ | |
| cache: false, | |
| data: { | |
| formId: a.Data.ApplicationFormId | |
| }, | |
| success: function (z, A) { | |
| x.collection.each(function (C) { | |
| var B = new a.Vs.BillingSystemPlan({ | |
| model: C, | |
| selector: x.selector, | |
| dictionaries: w.dictionaries | |
| }); | |
| p3.rV(B, x.$("tbody"), false) | |
| }) | |
| }, | |
| error: function (z, B, A) { | |
| if (B.responseText.indexOf("SMART-TUITION-SETTINGS-NOTFOUND") >= 0) { | |
| j.ErrorBox("Smart Tuition settings are not available for this school year.", x.$(".modal-body"), false) | |
| } else { | |
| if (B.responseText.indexOf("SMART-TUITION-PLANS-NOTFOUND") >= 0) { | |
| j.ErrorBox("Smart Tuition payment plans are not available for this school year.", x.$(".modal-body"), false) | |
| } else { | |
| j.ErrorBox("Error retrieving Smart Tuition payment plan list.", x.$(".modal-body"), false) | |
| } | |
| } | |
| }, | |
| complete: function (z, B, A) { | |
| x.$(".spinner").hide() | |
| } | |
| }) | |
| }, | |
| modalUpdate: function () { | |
| return false | |
| }, | |
| saveModel: function () { | |
| var A = this, | |
| z = true, | |
| y = A.$(".save"), | |
| x = A.$(".cancel"); | |
| y.button("loading").prop("disabled", true); | |
| x.prop("disabled", true); | |
| z = _.every(A.collection.models, function (B) { | |
| return B.isValid(true) | |
| }); | |
| if (z) { | |
| A.collection.save({ | |
| dataParam: { | |
| formId: a.Data.ApplicationFormId | |
| }, | |
| success: function (B) { | |
| w.refreshData(); | |
| p3.Layout.Containers.Modal.modal("hide") | |
| }, | |
| complete: function () { | |
| y.button("reset").prop("disabled", false); | |
| x.prop("disabled", false) | |
| } | |
| }) | |
| } | |
| return false | |
| }, | |
| selectAll: function (x) { | |
| x.preventDefault(); | |
| var y = this; | |
| y.$('[name="Selected"]:not(.active)').trigger("selectall") | |
| } | |
| }); | |
| q.Us.renderModal(new v()) | |
| }, | |
| showTmsPlansModal: function (u) { | |
| var w = this, | |
| v; | |
| v = q.Vs.Modal2.extend({ | |
| template: "contracts/contracts.contract.edit.billingsystem.plans.edit.template.html", | |
| collection: new a.Cs.TmsPaymentPlansSelect(), | |
| events: { | |
| "click #select-all": "selectAll" | |
| }, | |
| dataParam: { | |
| formId: a.Data.ApplicationFormId | |
| }, | |
| variables: { | |
| formTypeId: a.Data.FormType.Value | |
| }, | |
| modalRendered: function (y) { | |
| var x = this; | |
| x.collection.fetch({ | |
| cache: false, | |
| data: { | |
| formId: a.Data.ApplicationFormId | |
| }, | |
| success: function (z, A) { | |
| x.collection.each(function (C) { | |
| var B = new a.Vs.BillingSystemPlan({ | |
| model: C, | |
| selector: x.selector, | |
| dictionaries: w.dictionaries, | |
| variables: { | |
| formTypeId: a.Data.FormType.Value, | |
| selectedTuitionInsuranceTypeDesc: w.dictionaries.ADMTuitionInsuranceTypes.find(function (D) { | |
| return D.dd_id === C.attributes.PaymentPlan.TuitionInsuranceCode | |
| }).dd_description | |
| } | |
| }); | |
| p3.rV(B, x.$("tbody"), false) | |
| }) | |
| }, | |
| error: function (z, B, A) { | |
| j.ErrorBox("Error retrieving Blackbaud Tuition Management payment plan list.", x.$(".modal-body"), false) | |
| }, | |
| complete: function (z, B, A) { | |
| x.$(".spinner").hide() | |
| } | |
| }) | |
| }, | |
| modalUpdate: function () { | |
| return false | |
| }, | |
| saveModel: function () { | |
| var A = this, | |
| z = true, | |
| y = A.$(".save"), | |
| x = A.$(".cancel"); | |
| y.button("loading").prop("disabled", true); | |
| x.prop("disabled", true); | |
| z = _.every(A.collection.models, function (B) { | |
| return B.isValid(true) | |
| }); | |
| if (z) { | |
| A.collection.save({ | |
| dataParam: { | |
| formId: a.Data.ApplicationFormId | |
| }, | |
| success: function (B) { | |
| w.refreshData(); | |
| p3.Layout.Containers.Modal.modal("hide") | |
| }, | |
| complete: function () { | |
| y.button("reset").prop("disabled", false); | |
| x.prop("disabled", false) | |
| } | |
| }) | |
| } | |
| return false | |
| }, | |
| selectAll: function (x) { | |
| x.preventDefault(); | |
| var y = this; | |
| y.$('[name="Selected"]:not(.active)').trigger("selectall") | |
| } | |
| }); | |
| q.Us.renderModal(new v()) | |
| } | |
| }); | |
| a.Vs.PaymentPlan = Bb.View.extend({ | |
| template: "contracts/contracts.contract.edit.paymentplan.edit.template.html", | |
| tagName: "tr", | |
| initialize: function (u) { | |
| var v = this; | |
| Bb.Validation.bind(v, { | |
| forceUpdate: true, | |
| selector: u.selector | |
| }) | |
| }, | |
| events: { | |
| 'change input[name="ExpireDate"]': "updateModel", | |
| 'change input[name="PaymentPlan.NumberOfPayments"]': "updateModel", | |
| 'change select[name="PaymentPlan.TuitionInsuranceCode"]': "updateModel", | |
| "mouseover td.inline-edit": "inlineEditOver", | |
| "mouseout td.inline-edit": "inlineEditOut", | |
| "click .inline-edit": "showInlineEdit", | |
| "blur .inline-edit .edit input": "hideInlineEdit", | |
| "blur .inline-edit .edit select": "hideInlineEdit", | |
| selectall: "selectAll", | |
| 'click [name="Selected"]': "togglePlan" | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| model: u.model.toJSON(), | |
| dictionaries: u.options.dictionaries | |
| })); | |
| g.Us.initialize(".date-input", { | |
| yearRange: "-10:+10" | |
| }); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| updateModel: function (u) { | |
| var v = this; | |
| q.Us.updateModel(u, v.model, "name") | |
| }, | |
| inlineEditOver: function (u) { | |
| $(u.currentTarget).find("i").show() | |
| }, | |
| inlineEditOut: function (u) { | |
| $(u.currentTarget).find("i").hide() | |
| }, | |
| showInlineEdit: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| var v = $(u.currentTarget); | |
| v.find(".display").hide(); | |
| v.find(".edit").show(); | |
| if (v.find(".edit input").length > 0) { | |
| v.find(".edit input").focus() | |
| } else { | |
| v.find(".edit select").focus() | |
| } | |
| }, | |
| hideInlineEdit: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| var z = this, | |
| x = $(u.currentTarget), | |
| w = x.attr("name"), | |
| y = x.val(), | |
| v; | |
| q.Us.setPropByString(z.model.toJSON(), w, y); | |
| if (z.model.isValid(w)) { | |
| Bb.Validation.callbacks.valid(z, w, "name"); | |
| if (w === "PaymentPlan.TuitionInsuranceCode") { | |
| for (v = 0; v < z.options.dictionaries.ADMTuitionInsuranceTypes.length; v++) { | |
| if (y == z.options.dictionaries.ADMTuitionInsuranceTypes[v].dd_id) { | |
| y = z.options.dictionaries.ADMTuitionInsuranceTypes[v].dd_description; | |
| break | |
| } | |
| } | |
| } | |
| x.parent().siblings(".display").html(y + '<i class="p3icon-edit edit-cell-icon pull-right" style="display: none;"></i>'); | |
| x.parent().siblings(".display").show(); | |
| x.parent().hide() | |
| } else { | |
| Bb.Validation.callbacks.invalid(z, w, k.P3.RequiredInfoNotEntered, "name"); | |
| x.parent().siblings(".display i").hide() | |
| } | |
| }, | |
| selectAll: function (u) { | |
| var v = this; | |
| v.model.set({ | |
| Selected: true | |
| }); | |
| v.$('[name="Selected"]').addClass("active"); | |
| v.$('[name="ExpireDate"]').prop("disabled", false) | |
| }, | |
| togglePlan: function (w) { | |
| var x = this, | |
| v = $(w.currentTarget), | |
| u; | |
| _.defer(function () { | |
| x.model.set({ | |
| Selected: v.hasClass("active") | |
| }); | |
| u = x.$('[name="ExpireDate"]'); | |
| if (x.model.get("Selected")) { | |
| u.prop("disabled", false) | |
| } else { | |
| x.model.set({ | |
| ExpireDate: null | |
| }); | |
| u.val(""); | |
| u.prop("disabled", true) | |
| } | |
| }) | |
| } | |
| }); | |
| a.Vs.BillingSystemPlan = Bb.View.extend({ | |
| template: "contracts/contracts.contract.edit.billingsystem.plan.edit.template.html", | |
| tagName: "tr", | |
| events: { | |
| 'change input[name="ExpireDate"]': "updateModel", | |
| "mouseover td.inline-edit": "inlineEditOver", | |
| "mouseout td.inline-edit": "inlineEditOut", | |
| "click .inline-edit": "showInlineEdit", | |
| "blur .inline-edit .edit input": "hideInlineEdit", | |
| "blur .inline-edit .edit select": "hideInlineEdit", | |
| selectall: "selectAll", | |
| 'click [name="Selected"]': "togglePlan" | |
| }, | |
| initialize: function (u) { | |
| var v = this; | |
| Bb.Validation.bind(v, { | |
| forceUpdate: true, | |
| selector: u.selector | |
| }) | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| model: u.model.toJSON(), | |
| dictionaries: u.options.dictionaries, | |
| okToEdit: a.Us.getOkToEdit(), | |
| variables: u.options.variables | |
| })); | |
| g.Us.initialize(".date-input", { | |
| yearRange: "-10:+10" | |
| }); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| updateModel: function (u) { | |
| var v = this; | |
| q.Us.updateModel(u, v.model, "name") | |
| }, | |
| inlineEditOver: function (u) { | |
| $(u.currentTarget).find("i").show() | |
| }, | |
| inlineEditOut: function (u) { | |
| $(u.currentTarget).find("i").hide() | |
| }, | |
| showInlineEdit: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| var v = $(u.currentTarget); | |
| v.find(".display").hide(); | |
| v.find(".edit").show(); | |
| if (v.find(".edit input").length > 0) { | |
| v.find(".edit input").focus() | |
| } else { | |
| v.find(".edit select").focus() | |
| } | |
| }, | |
| hideInlineEdit: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| var z = this, | |
| x = $(u.currentTarget), | |
| w = x.attr("name"), | |
| y = x.val(), | |
| v; | |
| q.Us.setPropByString(z.model.toJSON(), w, y); | |
| if (z.model.isValid(w)) { | |
| Bb.Validation.callbacks.valid(z, w, "name"); | |
| if (w === "PaymentPlan.TuitionInsuranceCode") { | |
| for (v = 0; v < z.options.dictionaries.ADMTuitionInsuranceTypes.length; v++) { | |
| if (y == z.options.dictionaries.ADMTuitionInsuranceTypes[v].dd_id) { | |
| y = z.options.dictionaries.ADMTuitionInsuranceTypes[v].dd_description; | |
| break | |
| } | |
| } | |
| } | |
| x.parent().siblings(".display").html(y + '<i class="p3icon-edit edit-cell-icon pull-right" style="display: none;"></i>'); | |
| x.parent().siblings(".display").show(); | |
| x.parent().hide() | |
| } else { | |
| Bb.Validation.callbacks.invalid(z, w, k.P3.RequiredInfoNotEntered, "name"); | |
| x.parent().siblings(".display i").hide() | |
| } | |
| }, | |
| selectAll: function (u) { | |
| var v = this; | |
| v.model.set({ | |
| Selected: true | |
| }); | |
| v.$('[name="Selected"]').addClass("active"); | |
| if (a.Data.FormType === h.FormType.TMS_CONTRACT) { | |
| v.$('[name="ExpireDate"]').prop("disabled", false) | |
| } | |
| }, | |
| togglePlan: function (w) { | |
| var x = this, | |
| v = $(w.currentTarget), | |
| u; | |
| _.defer(function () { | |
| x.model.set({ | |
| Selected: v.hasClass("active") | |
| }); | |
| if (a.Data.FormType === h.FormType.TMS_CONTRACT) { | |
| u = x.$('[name="ExpireDate"]'); | |
| if (x.model.get("Selected")) { | |
| u.prop("disabled", false) | |
| } else { | |
| x.model.set({ | |
| ExpireDate: null | |
| }); | |
| u.val(""); | |
| u.prop("disabled", true) | |
| } | |
| } | |
| }) | |
| } | |
| }); | |
| a.Vs.FeeSchedule = Bb.View.extend({ | |
| template: "contracts/contracts.feeschedule.template.html", | |
| className: "fee-schedule", | |
| initialize: function (u) { | |
| this.ElementModel = u.elementModel; | |
| this.Containers = {} | |
| }, | |
| events: { | |
| "click .btn-approve:not(.disabled)": "updateFinancialAid", | |
| "click .btn-denied:not(.disabled)": "updateFinancialAid" | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| appForm: a.Data.FormModel.toJSON(), | |
| feeTypes: u.collection.toJSON(), | |
| okToEdit: a.Us.getOkToEdit(), | |
| sectionLocked: a.Us.isSectionLocked(), | |
| isBBTMContract: (a.Data.FormType === h.FormType.TMS_CONTRACT), | |
| BBTMLink: a.Us.GetBBTMLinkForAuthorizedUsers | |
| })); | |
| u.collection.each(function (x) { | |
| var w = new a.Cs.FeeSchedule([], { | |
| applicationFormId: a.Data.ApplicationFormId, | |
| feeTypeId: x.id | |
| }); | |
| w.fetch({ | |
| data: { | |
| applicationFormId: a.Data.ApplicationFormId, | |
| feeTypeId: w.feeTypeId | |
| }, | |
| success: function () { | |
| var A = "#fee-type" + x.id, | |
| y = u.$(A), | |
| z = new a.Vs.FeeTypeList({ | |
| collection: w, | |
| feeType: x | |
| }); | |
| u.Containers[A] = y; | |
| p3.rV(z, u.Containers[A], false) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading fees") | |
| } | |
| }) | |
| }) | |
| }) | |
| }, | |
| updateFinancialAid: function (v) { | |
| v.preventDefault(); | |
| var u = $(v.currentTarget), | |
| w = u.hasClass("btn-approve"); | |
| w = s.stringToBoolean(u.children("input").prop("value")); | |
| a.Data.FormModel.set("FinancialAidVisible", w); | |
| a.Data.FormModel.save({}, { | |
| error: function () { | |
| p3.displayError("Error saving contract") | |
| } | |
| }) | |
| } | |
| }); | |
| a.Vs.FeeTypeList = Bb.View.extend({ | |
| className: "element-sub-block", | |
| template: "contracts/contracts.feeschedule.feelist.template.html", | |
| initialize: function (u) { | |
| this.feeType = u.feeType; | |
| this.elementModel = u.elementModel | |
| }, | |
| events: { | |
| "click .element-select-btn:not(.disabled)": "addEditFee", | |
| "click .edit-fee:not(.disabled)": "addEditFee", | |
| "click .delete-fee:not(.disabled)": "deleteFee" | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| feeType: u.feeType.toJSON(), | |
| fees: u.collection.toJSON(), | |
| okToEdit: a.Us.getOkToEdit(), | |
| formTypeId: a.Data.FormType.Value, | |
| sectionLocked: a.Us.isSectionLocked(), | |
| appForm: a.Data.FormModel.toJSON(), | |
| isBBTMContract: (a.Data.FormType === h.FormType.TMS_CONTRACT), | |
| BBTMLink: a.Us.GetBBTMLinkForAuthorizedUsers | |
| })); | |
| u.initializeSort() | |
| }) | |
| }, | |
| deleteFee: function (v) { | |
| v.preventDefault(); | |
| var y = this, | |
| u = $(v.currentTarget), | |
| w = u.closest("tr").data("id"), | |
| x = y.collection.get(w); | |
| if (x) { | |
| p3.showConfirm("Delete Fee", "Are you sure you want to remove this " + x.get("Name") + " fee from the fee schedule?", null, function () { | |
| x.destroy({ | |
| success: function () { | |
| y.renderData() | |
| }, | |
| error: function () { | |
| p3.displayError("Error removing fee") | |
| } | |
| }) | |
| }) | |
| } | |
| }, | |
| addEditFee: function (v) { | |
| v.preventDefault(); | |
| var z = this, | |
| u = $(v.currentTarget), | |
| x = u.hasClass("element-select-btn"), | |
| y, w; | |
| if (!x) { | |
| w = u.closest("tr").data("id") | |
| } | |
| z.getModalType(w, function (A) { | |
| if (A === "onboard") { | |
| y = new a.Ms.Fee(); | |
| y.fetch({ | |
| data: { | |
| id: w, | |
| applicationFormId: a.Data.ApplicationFormId, | |
| feeTypeId: z.feeType.id, | |
| includeEligibleGrades: true | |
| }, | |
| success: function () { | |
| z.showFeeModal(y) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading fee") | |
| } | |
| }) | |
| } else { | |
| if (A === "smart") { | |
| z.showSmartFeeModal() | |
| } else { | |
| if (A === "tms") { | |
| z.showTMSFeeModal() | |
| } | |
| } | |
| } | |
| }) | |
| }, | |
| getModalType: function (v, u) { | |
| var w = this; | |
| if (v || a.Data.FormType === h.FormType.CONTRACT) { | |
| u("onboard") | |
| } else { | |
| if (a.Data.FormType === h.FormType.TMS_CONTRACT) { | |
| u("tms") | |
| } else { | |
| if ((w.feeType.id !== h.ContractFeeType.TUITION.Value) || (w.feeType.id === h.ContractFeeType.TUITION.Value && w.collection.hasTuitionFees())) { | |
| u("smart") | |
| } else { | |
| w.getUsesTuitionFees(function (x) { | |
| if (!w.collection.length) { | |
| u(x ? "smart" : "onboard") | |
| } else { | |
| if (x && w.collection.hasOnboardTuition()) { | |
| w.modal2Extend = q.Vs.Modal2.extend({ | |
| template: "utilities/utilities.smodal.message.html", | |
| variables: { | |
| title: "Incorrect Tuition Setup", | |
| errorText: "This form has been setup with EMS tuition amounts, but should be using tuition fees.<br>Please remove all current EMS tuition entries, then click Add to add tuition fees from Smart." | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new w.modal2Extend(), p3.Layout.Containers.Modal, true) | |
| } else { | |
| u(x ? "smart" : "onboard") | |
| } | |
| } | |
| }) | |
| } | |
| } | |
| } | |
| }, | |
| getUsesTuitionFees: function (u) { | |
| if (a.Data.FormType === h.FormType.CONTRACT) { | |
| u(false) | |
| } else { | |
| if (a.Data.FormType === h.FormType.TMS_CONTRACT) { | |
| u(true) | |
| } else { | |
| var v = new a.Ms.SmartTuitionFee(); | |
| v.fetch({ | |
| data: { | |
| schoolYearLabel: a.Data.FormModel.get("SchoolYear") | |
| }, | |
| success: function (w, x) { | |
| u(x.HasTuitionFees) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading fees") | |
| } | |
| }) | |
| } | |
| } | |
| }, | |
| showFeeModal: function (v) { | |
| var w = this, | |
| u; | |
| u = q.Vs.Modal2.extend({ | |
| template: "contracts/contracts.contract.edit.fee.edit.template.html", | |
| model: v, | |
| selector: "id", | |
| variables: { | |
| feeType: w.feeType.toJSON(), | |
| isNew: v.isNew() | |
| }, | |
| modalRendered: function () { | |
| var x = this; | |
| g.Us.initialize(".date-input", { | |
| yearRange: "-2:+2" | |
| }); | |
| x.setFocus() | |
| }, | |
| modalUpdated: function (x) { | |
| var y = this, | |
| z = false; | |
| _.defer(function () { | |
| _.each(y.$(".grades-group button.active"), function (A) { | |
| if ($(A).data("smart")) { | |
| z = true | |
| } | |
| }); | |
| if (z) { | |
| y.$(".alert.alert-warning").show() | |
| } else { | |
| y.$(".alert.alert-warning").hide() | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| modalSave: function () { | |
| var B = this, | |
| A = $.extend(true, [], B.model.get("Grades")), | |
| x = B.$("#Grades"), | |
| y = x.closest("div.control-group"), | |
| z; | |
| y.removeClass("error"); | |
| x.removeClass("alert-error"); | |
| if (x.data("tooltip")) { | |
| x.tooltip("disable") | |
| } | |
| B.$(".grades-group button").each(function (G, D) { | |
| var C = $(D), | |
| F = C.data("id"), | |
| E = a.Us.findGrade(A, F); | |
| E.SelectedInd = C.hasClass("active") | |
| }); | |
| B.model.set({ | |
| Name: B.$("#Name").val(), | |
| Amount: B.$("#Amount").val(), | |
| Grades: A | |
| }); | |
| z = B.model.validateGrades(); | |
| if (z) { | |
| x.addClass("alert-error").tooltip({ | |
| placement: "right", | |
| title: z | |
| }).tooltip("enable"); | |
| y.addClass("error") | |
| } | |
| if (B.model.isValid(true) && !z) { | |
| B.model.save({}, { | |
| success: function (C, E, D) { | |
| w.collection.fetch({ | |
| data: { | |
| applicationFormId: a.Data.ApplicationFormId, | |
| feeTypeId: w.collection.feeTypeId | |
| }, | |
| success: function () { | |
| w.renderData() | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading fees") | |
| }, | |
| complete: function () { | |
| p3.showModal(p3.Layout.Containers.Modal, "hide") | |
| } | |
| }) | |
| }, | |
| error: function () { | |
| p3.showModal(p3.Layout.Containers.Modal, "hide"); | |
| p3.displayError("Error saving fee") | |
| } | |
| }) | |
| } | |
| return false | |
| } | |
| }); | |
| q.Us.renderModal(new u()) | |
| }, | |
| showSmartFeeModal: function () { | |
| var v = this, | |
| u; | |
| u = q.Vs.Modal2.extend({ | |
| template: "contracts/contracts.contract.edit.billingsystem.edit.template.html", | |
| collection: new a.Cs.SmartFeeSelect(), | |
| variables: { | |
| feeTypeName: v.feeType.get("Name") | |
| }, | |
| dataParam: { | |
| formId: a.Data.ApplicationFormId, | |
| feeTypeId: v.feeType.get("FeeTypeId") | |
| }, | |
| modalRendered: function (x) { | |
| var w = this; | |
| w.collection.fetch({ | |
| cache: false, | |
| data: { | |
| formId: a.Data.ApplicationFormId, | |
| feeTypeId: v.feeType.id | |
| }, | |
| success: function (y, z) { | |
| if (!w.collection || !w.collection.length) { | |
| j.InformationBox("There are no more Smart Tuition fees available for this school year.", w.$(".modal-body"), false); | |
| w.$("button.save").prop("disabled", true) | |
| } else { | |
| w.collection.each(function (A) { | |
| var B = new a.Vs.BillingSystemFee({ | |
| model: A, | |
| parentView: w | |
| }); | |
| p3.rV(B, w.$("tbody"), false) | |
| }) | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }, | |
| error: function (y, A, z) { | |
| if (A.responseText.indexOf("SMART-TUITION-SETTINGS-NOTFOUND") >= 0) { | |
| j.ErrorBox("Smart Tuition settings are not available for this school year.", w.$(".modal-body"), false) | |
| } else { | |
| if (A.responseText.indexOf("SMART-TUITION-FEES-NOTFOUND") >= 0) { | |
| j.ErrorBox("Smart Tuition fees are not available for this school year.", w.$(".modal-body"), false) | |
| } else { | |
| if (A.responseText.indexOf("SMART-TUITION-FEES-GRADE-NOTFOUND") >= 0) { | |
| j.ErrorBox("One or more Smart Tuition grades attached to a fee have not been mapped. Please complete the grade mapping before continuing.", w.$(".modal-body"), false) | |
| } else { | |
| j.ErrorBox("Error retrieving Smart Tuition fee list.", w.$(".modal-body"), false) | |
| } | |
| } | |
| } | |
| }, | |
| complete: function (y, A, z) { | |
| w.$(".spinner").hide() | |
| } | |
| }) | |
| }, | |
| modalUpdate: function () { | |
| return false | |
| }, | |
| modalSave: function () { | |
| var y = this, | |
| w, x, z; | |
| if (v.feeType.id === h.ContractFeeType.TUITION.Value) { | |
| w = y.collection.duplicateTuitionFees(v.collection); | |
| x = w ? _.keys(w) : null; | |
| y.collection.each(function (A) { | |
| A.view.removeError() | |
| }); | |
| if (x && x.length > 0) { | |
| _.each(x, function (A) { | |
| _.each(w[A], function (B) { | |
| if (!B.get("preSelectedFee")) { | |
| B.view.showError("Select only one tuition amount per grade") | |
| } | |
| }) | |
| }); | |
| return false | |
| } | |
| } else { | |
| z = y.collection.where({ | |
| Selected: true | |
| }); | |
| y.collection.reset(z) | |
| } | |
| }, | |
| modalSavedSuccess: function (w) { | |
| v.collection.reset(w.response); | |
| v.renderData() | |
| } | |
| }); | |
| q.Us.renderModal(new u()) | |
| }, | |
| showTMSFeeModal: function () { | |
| var v = this, | |
| u; | |
| u = q.Vs.Modal2.extend({ | |
| template: "contracts/contracts.contract.edit.billingsystem.edit.template.html", | |
| collection: new a.Cs.TmsFeeSelect(), | |
| variables: { | |
| feeTypeName: v.feeType.get("Name") | |
| }, | |
| dataParam: { | |
| formId: a.Data.ApplicationFormId, | |
| feeTypeId: v.feeType.get("FeeTypeId"), | |
| returnCollection: true | |
| }, | |
| modalRendered: function (x) { | |
| var w = this; | |
| w.collection.fetch({ | |
| cache: false, | |
| data: { | |
| formId: a.Data.ApplicationFormId, | |
| feeTypeId: v.feeType.id | |
| }, | |
| success: function (y, z) { | |
| if (!w.collection || !w.collection.length) { | |
| j.InformationBox("There are no more BBTM fees available for this school year.", w.$(".modal-body"), false); | |
| w.$("button.save").prop("disabled", true) | |
| } else { | |
| _.each(w.collection.models, function (A) { | |
| var B = new a.Vs.BillingSystemFee({ | |
| model: A, | |
| parentView: w | |
| }); | |
| p3.rV(B, w.$("tbody"), false) | |
| }) | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }, | |
| complete: function (y, A, z) { | |
| w.$(".spinner").hide() | |
| } | |
| }) | |
| }, | |
| modalUpdate: function () { | |
| return false | |
| }, | |
| modalSave: function () { | |
| var w = this, | |
| x; | |
| x = w.collection.where({ | |
| Selected: true | |
| }); | |
| w.collection.reset(x) | |
| }, | |
| modalSavedSuccess: function (w) { | |
| v.collection.reset(w.response); | |
| v.renderData() | |
| } | |
| }); | |
| q.Us.renderModal(new u()) | |
| }, | |
| initializeSort: function () { | |
| var v = this, | |
| u = v.$("tbody"); | |
| u.sortable({ | |
| items: "tr.contract-fee", | |
| placeholder: "sortable-placeholder", | |
| distance: 5, | |
| tolerance: "pointer", | |
| helper: function (y, z) { | |
| var x = z.children(), | |
| w = z.clone(); | |
| w.children().each(function (A) { | |
| $(this).width(x.eq(A).width()) | |
| }); | |
| return w.addClass("gray-boxshadow") | |
| }, | |
| containment: "tbody.fee-type" + v.feeType.id, | |
| appendTo: "body", | |
| scroll: true, | |
| scrollSensitivity: 160, | |
| scrollSpeed: 40, | |
| update: function (w, x) { | |
| v.setSortOrder() | |
| }, | |
| start: function (w, x) { | |
| u.sortable("refresh") | |
| } | |
| }) | |
| }, | |
| setSortOrder: function () { | |
| var v = this, | |
| u = v.$("tr.contract-fee"); | |
| u.each(function (A, x) { | |
| var w = $(x), | |
| y = w.data("id"), | |
| z = v.collection.get(y); | |
| z.set("SortOrder", A) | |
| }); | |
| v.collection.sync("update", v.collection, { | |
| error: function () { | |
| p3.displayError("Error saving fee sort order") | |
| } | |
| }) | |
| } | |
| }); | |
| a.Vs.BillingSystemFee = Bb.View.extend({ | |
| template: "contracts/contracts.contract.edit.billingsystem.fee.edit.template.html", | |
| tagName: "tr", | |
| events: { | |
| "click button:not(:disabled)": "updateModel", | |
| "click .checkbox-input": "updateModel" | |
| }, | |
| initialize: function () { | |
| this.model.view = this | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| model: u.model.toJSON() | |
| })); | |
| u.$el.attr("id", u.model.cid); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| updateModel: function (u) { | |
| var v = this; | |
| q.Us.updateModel(u, v.model, "name") | |
| }, | |
| showError: function (u) { | |
| var v = this; | |
| Bb.Validation.callbacks.invalid(v.options.parentView, v.model.cid, u, "id") | |
| }, | |
| removeError: function () { | |
| var u = this; | |
| Bb.Validation.callbacks.valid(u.options.parentView, u.model.cid, "id") | |
| } | |
| }); | |
| a.Vs.RatingMatrix = Bb.View.extend({ | |
| template: "ratings/rating.matrix.summary.template.html", | |
| initialize: function (u) { | |
| var v = this; | |
| v.ratingMatrix = u.ratingMatrix | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| model: u.model.toJSON(), | |
| ratingMatrix: u.ratingMatrix.toJSON(), | |
| attributeList: u.ratingMatrix.getAttributeList(), | |
| levelList: u.ratingMatrix.getLevelList() | |
| })) | |
| }) | |
| } | |
| }); | |
| a.Vs.GenerateContracts = Bb.View.extend({ | |
| template: "contracts/contracts.generate.template.html", | |
| events: { | |
| "click .save:not(:disabled)": "generateContracts", | |
| "click .cancel:not(:disabled)": "refreshContracts", | |
| "change .userContract": "enableGenerate", | |
| "click .select-all": "selectAllusers", | |
| "click .clear-all": "clearAllusers" | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.renderTemplate() | |
| }, | |
| renderTemplate: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({})); | |
| p3.loadingIcon(u.$(".modal-body"), "mt-50 mb-50"); | |
| u.collection = new a.Cs.ContractGenerateStudentList(); | |
| u.collection.fetch({ | |
| data: { | |
| applicationFormId: a.Data.ApplicationFormId | |
| }, | |
| success: function () { | |
| p3.fT("contracts/contracts.generate.info.template.html", function (B) { | |
| var D = new Bbc(u.collection.filter(function (E) { | |
| return E.get("GenerateInd") && !E.get("TooManySignersInd") && !E.get("FinancialAidNeedsMappingInd") && !E.get("CalcErrorInd") | |
| })), | |
| A = new Bbc(u.collection.filter(function (E) { | |
| return !E.get("GenerateInd") | |
| })), | |
| C = new Bbc(u.collection.filter(function (E) { | |
| return E.get("GenerateInd") && E.get("TooManySignersInd") | |
| })), | |
| y = new Bbc(u.collection.filter(function (E) { | |
| return E.get("GenerateInd") && E.get("FinancialAidNeedsMappingInd") | |
| })), | |
| w = new Bbc(u.collection.filter(function (E) { | |
| return E.get("GenerateInd") && E.get("CalcErrorInd") | |
| })), | |
| z = D.some(function (E) { | |
| return E.get("ModifiedSinceGeneratedInd") | |
| }), | |
| x = D.length ? true : false; | |
| u.$(".modal-body").html(B({ | |
| updateContracts: D.toJSON(), | |
| savedContracts: A.toJSON(), | |
| tooManySigners: C.toJSON(), | |
| financialAidNeedsMapping: y.toJSON(), | |
| calcError: w.toJSON(), | |
| totalContracts: u.collection.length, | |
| hasContracts: u.collection.length ? true : false, | |
| hasModifiedContracts: z, | |
| canGenerate: x | |
| })); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| error: function (w, y, x) { | |
| u.$(".modal-body").empty(); | |
| if (y.responseText.indexOf("SMART-TUITION-GRADES-MISSING") >= 0) { | |
| j.ErrorBox("Grade mapping must be completed under Core > Settings > Blackbaud connections > Smart Tuition prior to contracts being generated.", u.$(".modal-body"), false) | |
| } else { | |
| if (y.responseText.indexOf("VENDOR_API_ERROR") >= 0) { | |
| j.ErrorBox("There was an error communicating with Smart Tuition. Please try again.", u.$(".modal-body"), false) | |
| } else { | |
| j.ErrorBox("Error generating contracts.", u.$(".modal-body"), false) | |
| } | |
| } | |
| } | |
| }) | |
| }) | |
| }, | |
| generateContracts: function (w) { | |
| w.preventDefault(); | |
| var z = this, | |
| x, y = [], | |
| v = z.$(".save"), | |
| u = z.$(".cancel"); | |
| $.each($("input[name='UserId']:checked"), function (B, A) { | |
| y.push(parseInt($(A).val(), 10)) | |
| }); | |
| if (!z.collection.length) { | |
| return false | |
| } | |
| v.button("saving").prop("disabled", true); | |
| u.prop("disabled", true); | |
| p3.loadingIcon(z.$(".modal-body"), "mt-50 mb-50"); | |
| x = new a.Ms.GenerateContracts(); | |
| x.save({ | |
| applicationFormId: a.Data.ApplicationFormId, | |
| userIds: y | |
| }, { | |
| success: function () { | |
| a.trigger("rendermain"); | |
| p3.showModal(p3.Layout.Containers.Modal, "hide") | |
| }, | |
| error: function (A, C, B) { | |
| z.$(".modal-body").empty(); | |
| if (C.responseText.indexOf("SMART-TUITION-GRADES-MISSING") >= 0) { | |
| j.ErrorBox("Grade mapping must be completed under Core > Settings > Smart Tuition prior to contracts being generated.", z.$(".modal-body"), false) | |
| } else { | |
| j.ErrorBox("Error generating contracts.", z.$(".modal-body"), false) | |
| } | |
| v.button("reset").prop("disabled", false); | |
| u.prop("disabled", false) | |
| } | |
| }) | |
| }, | |
| refreshContracts: function (u) { | |
| a.trigger("rendermain") | |
| }, | |
| enableGenerate: function () { | |
| var v = this, | |
| u; | |
| u = $("input.userContract:checked").length; | |
| if (u !== 0) { | |
| v.$("button.save").prop("disabled", false).removeClass("disabled") | |
| } else { | |
| v.$("button.save").prop("disabled", false).addClass("disabled") | |
| } | |
| }, | |
| selectAllusers: function () { | |
| var u = 0, | |
| v; | |
| v = document.getElementsByName("UserId"); | |
| for (u; u < v.length; u++) { | |
| if (v[u].type === "checkbox") { | |
| v[u].checked = true | |
| } | |
| } | |
| this.enableGenerate() | |
| }, | |
| clearAllusers: function () { | |
| var u = 0, | |
| v; | |
| v = document.getElementsByName("UserId"); | |
| for (u; u < v.length; u++) { | |
| if (v[u].type === "checkbox") { | |
| v[u].checked = false | |
| } | |
| } | |
| this.enableGenerate() | |
| } | |
| }); | |
| a.Vs.BlockEdit = q.Vs.Modal2.extend({ | |
| modalInitialized: function () { | |
| var u = this; | |
| u.proto.template = u.options.template | |
| }, | |
| size: "md", | |
| events: { | |
| "click .delete": "deleteModel" | |
| }, | |
| deleteModel: function (v) { | |
| v.stopPropagation(); | |
| v.preventDefault(); | |
| var z = this, | |
| y = z.$("#modal-form"), | |
| x = z.$("#modal-confirm"), | |
| u, w; | |
| w = q.Vs.Modal2.extend({ | |
| template: "utilities/utilities.smodal.confirm.html", | |
| model: z.model, | |
| subModal: true, | |
| variables: { | |
| title: "Remove Block", | |
| errorText: "Wait a minute. Are you really sure you want to remove the " + z.model.get("FieldBlockItem").Name + " block from this section?", | |
| cancelText: "Cancel", | |
| confirmText: "Confirm" | |
| }, | |
| modalSave: function () { | |
| z.model.destroy({ | |
| dataParam: { | |
| applicationFormId: z.model.get("ApplicationFormId"), | |
| deleteSectionItems: true | |
| }, | |
| success: function () { | |
| if ($("#blocks .blocks-holder").length > 0) { | |
| $("#blocks .blocks-holder").trigger("refreshlibrary") | |
| } | |
| }, | |
| error: function () { | |
| p3.displayError("Error deleting block.") | |
| } | |
| }); | |
| p3.Layout.Containers.Modal.modal("hide"); | |
| return false | |
| } | |
| }); | |
| u = new w(); | |
| y.hide(); | |
| x.show(); | |
| p3.rV(u, x, true) | |
| } | |
| }); | |
| a.Us.getOkToEdit = function () { | |
| return a.Data.FormModel.get("OkToEdit") | |
| }; | |
| a.Us.isSectionLocked = function () { | |
| return $(".nav-tabs li.active").triggerHandler("getsectionlocked") | |
| }; | |
| a.Us.allowElements = function (v, w) { | |
| var u = true; | |
| switch (v) { | |
| case 19: | |
| case 21: | |
| case 22: | |
| case 23: | |
| case 25: | |
| case 62: | |
| case 63: | |
| case 39: | |
| case 40: | |
| case 72: | |
| u = false; | |
| break | |
| } | |
| if (w) { | |
| u = false | |
| } | |
| return u | |
| }; | |
| a.Us.getSelectedPersona = function (w, u) { | |
| var v = p3.Data.Context.get("Personas"), | |
| x; | |
| x = _.find(v, function (y) { | |
| return y.Selected == true | |
| }); | |
| if (!x) { | |
| x = _.first(v) | |
| } | |
| return x | |
| }; | |
| a.Us.FixHTML = function (u) { | |
| var v = $("<div>"), | |
| w; | |
| v.append(u).find("a").has("br").after("<br />").find("br").remove(); | |
| w = v.html(); | |
| return w | |
| }; | |
| a.Us.recursiveFunction = function (F, E, w, x, z) { | |
| var D = E, | |
| A = w, | |
| B = x, | |
| C = z, | |
| y, u, v; | |
| if (_.isObject(D) && !_.isArray(D)) { | |
| D.FieldsToNull = []; | |
| if (C != "") { | |
| y = C + A + "." | |
| } else { | |
| y = A + "." | |
| } | |
| _.each(D, function (I, G, H) { | |
| a.Us.recursiveFunction(F, I, G, H, y) | |
| }) | |
| } else { | |
| u = a.Us.getPropByString(F.model.attributes, C + A); | |
| v = a.Us.getPropByString(F.model.defaults, C + A); | |
| if (((D === "") || (D === null)) && (u != v)) { | |
| B.FieldsToNull.push(A) | |
| } | |
| } | |
| }; | |
| a.Us.getPropByString = function (w, z) { | |
| if (!z) { | |
| return w | |
| } | |
| var x, y = z.split("."), | |
| u, v; | |
| for (u = 0, v = y.length - 1; u < v; u++) { | |
| x = y[u]; | |
| if (typeof w === "object" && w !== null && w.hasOwnProperty(x) && w[x] !== null) { | |
| w = w[x] | |
| } else { | |
| break | |
| } | |
| } | |
| return w[y[u]] | |
| }; | |
| a.Us.setPropByString = function (w, z, A) { | |
| if (!z) { | |
| return w | |
| } | |
| var x, y = z.split("."), | |
| u, v; | |
| for (u = 0, v = y.length - 1; u < v; u++) { | |
| x = y[u]; | |
| if (typeof w === "object" && w !== null && w.hasOwnProperty(x) && w[x] !== null) { | |
| w = w[x] | |
| } else { | |
| break | |
| } | |
| } | |
| w[y[u]] = A | |
| }; | |
| a.Us.findElementById = function (u) { | |
| return _.find(h.Element, function (v) { | |
| return v.Value == u | |
| }) | |
| }; | |
| a.Us.findGrade = function (v, u) { | |
| return _.find(v, function (w) { | |
| return w.GradeId == u | |
| }) | |
| }; | |
| a.Us.GetStyle = function (v, u) { | |
| var w = new a.Cs.Style({ | |
| id: v | |
| }); | |
| w.fetch({ | |
| success: function (x, y) { | |
| u(y) | |
| } | |
| }) | |
| }; | |
| a.Us.SetStyle = function (u) { | |
| if ($("head style.form").length > 0) { | |
| $("head style.form").html("") | |
| } else { | |
| $("head").append('<style class="form"></style>') | |
| } | |
| var v = ""; | |
| _.each(u, function (w) { | |
| v += w.Selector; | |
| v += " { "; | |
| _.each(w.StyleProperties, function (x) { | |
| v += x.Name + ": " + x.PropertyValue + "; " | |
| }); | |
| v += "} " | |
| }); | |
| $("head style.form").append(v) | |
| }; | |
| a.Us.DeleteStyle = function () { | |
| if ($("head style.form").length > 0) { | |
| $("head style.form").remove("") | |
| } | |
| }; | |
| a.Us.NotificationValidation = { | |
| validation: { | |
| ActiveInd: [{ | |
| required: false, | |
| fn: function (y, u, v) { | |
| if (p3.Us.Tools.stringToBoolean(y) === true) { | |
| var x = [], | |
| w; | |
| if (v.ConfirmNotification && v.ConfirmNotification.Active) { | |
| if (!v.ConfirmNotification.ReplyAddress) { | |
| x.push("confirm notification reply address") | |
| } | |
| if (!v.ConfirmNotification.FromName) { | |
| x.push("confirm notification from name") | |
| } | |
| if (!v.ConfirmNotification.Subject) { | |
| x.push("confirm notification subject") | |
| } | |
| if (!v.ConfirmNotification.Body) { | |
| x.push("confirm notification body") | |
| } | |
| } | |
| if (v.AdminNotification && v.AdminNotification.Active) { | |
| if (!v.AdminNotification.ReplyAddress) { | |
| x.push("admin notification reply address") | |
| } | |
| if (!v.AdminNotification.FromName) { | |
| x.push("admin notification from name") | |
| } | |
| if (!v.AdminNotification.Subject) { | |
| x.push("admin notification subject") | |
| } | |
| if (!v.AdminNotification.Body) { | |
| x.push("admin notification body") | |
| } | |
| } | |
| if (v.RemindNotification && v.RemindNotification.Active) { | |
| if (!v.RemindNotification.ReplyAddress) { | |
| x.push("reminder notification reply address") | |
| } | |
| if (!v.RemindNotification.FromName) { | |
| x.push("reminder notification from name") | |
| } | |
| if (!v.RemindNotification.Subject) { | |
| x.push("reminder notification subject") | |
| } | |
| w = parseInt(v.RemindNotification.ReminderOption, 10); | |
| if (t.isEmptier(w) && !v.ReminderWhenActive) { | |
| x.push("reminder notification option") | |
| } | |
| if (!v.RemindNotification.Body) { | |
| x.push("reminder notification body") | |
| } | |
| if (!v.DueDate) { | |
| if (!v.ignoreDueDate) { | |
| if (t.isEmptier(y)) { | |
| x.push("due date") | |
| } | |
| if (!t.isDate(y)) { | |
| x.push("correct date format") | |
| } | |
| } | |
| } | |
| } | |
| if (x.length > 0) { | |
| x[0] = x[0].charAt(0).toUpperCase() + x[0].slice(1); | |
| if (x.length === 1) { | |
| return x[0] + " is required to make active." | |
| } | |
| return x.join(", ") + " are required to make active." | |
| } | |
| } | |
| } | |
| }], | |
| "ConfirmNotification.ReplyAddress": [{ | |
| required: function (w, u, v) { | |
| return this.validateNotification("ConfirmNotification", v) | |
| }, | |
| pattern: "email", | |
| msg: k.P3.EmailError | |
| }], | |
| "ConfirmNotification.FromName": [{ | |
| required: function (w, u, v) { | |
| return this.validateNotification("ConfirmNotification", v) | |
| }, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| "ConfirmNotification.Subject": [{ | |
| required: function (w, u, v) { | |
| return this.validateNotification("ConfirmNotification", v) | |
| }, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| "ConfirmNotification.Body": [{ | |
| required: function (w, u, v) { | |
| return this.validateNotification("ConfirmNotification", v) | |
| }, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| "AdminNotification.ReplyAddress": [{ | |
| required: function (w, u, v) { | |
| return this.validateNotification("AdminNotification", v) | |
| }, | |
| pattern: "email", | |
| msg: k.P3.EmailError | |
| }], | |
| "AdminNotification.FromName": [{ | |
| required: function (w, u, v) { | |
| return this.validateNotification("AdminNotification", v) | |
| }, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| "AdminNotification.Subject": [{ | |
| required: function (w, u, v) { | |
| return this.validateNotification("AdminNotification", v) | |
| }, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| "AdminNotification.Body": [{ | |
| required: function (w, u, v) { | |
| return this.validateNotification("AdminNotification", v) | |
| }, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| "RemindNotification.ReplyAddress": [{ | |
| required: function (w, u, v) { | |
| return this.validateNotification("RemindNotification", v) | |
| }, | |
| pattern: "email", | |
| msg: k.P3.EmailError | |
| }], | |
| "RemindNotification.FromName": [{ | |
| required: function (w, u, v) { | |
| return this.validateNotification("RemindNotification", v) | |
| }, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| "RemindNotification.Subject": [{ | |
| required: function (w, u, v) { | |
| return this.validateNotification("RemindNotification", v) | |
| }, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| "RemindNotification.ReminderOption": [{ | |
| required: function (w, u, v) { | |
| if (!v.ReminderWhenActive) { | |
| return this.validateNotification("RemindNotification", v) | |
| } | |
| }, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| "RemindNotification.Body": [{ | |
| required: function (w, u, v) { | |
| return this.validateNotification("RemindNotification", v) | |
| }, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }], | |
| DueDate: [{ | |
| required: function (w, u, v) { | |
| return this.validateNotification("RemindNotification", v) | |
| }, | |
| msg: k.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| validateNotification: function (v, u) { | |
| return u.ActiveInd && u[v] && u[v].Active | |
| } | |
| }; | |
| a.Us.GetBBTMLinkForAuthorizedUsers = function () { | |
| var u = r.Us.getUrlById(53757); | |
| return (u !== "#") ? u : undefined | |
| }; | |
| p3.router().route("settings/applications/:id", "applicationformsedit", function (u) { | |
| a.Data.FormModel = null; | |
| a.Data.FormType = h.FormType.APPLICATION; | |
| a.Data.ApplicationFormId = u; | |
| a.Data.EditMode = "content"; | |
| a.Data.SecurePayment = false; | |
| p3.renderMainPage(new a.Vs.Layout({ | |
| formType: h.FormType.APPLICATION | |
| })) | |
| }); | |
| p3.router().route("settings/contracts/:id", "contractsedit", function (u) { | |
| a.Data.FormModel = null; | |
| a.Data.ApplicationFormId = u; | |
| a.Data.EditMode = "content"; | |
| a.Data.SecurePayment = false; | |
| a.Data.HasOnAccount = p3.Data.SchoolContext.hasAppCategory(h.AppCategories.TUITIONMANAGEMENT); | |
| p3.renderMainPage(new a.Vs.Layout({ | |
| formType: h.FormType.CONTRACT | |
| })) | |
| }); | |
| p3.router().route("settings/inquiries/:id", "inquiriesedit", function (u) { | |
| a.Data.FormModel = null; | |
| a.Data.FormType = h.FormType.INQUIRY; | |
| a.Data.ApplicationFormId = u; | |
| a.Data.EditMode = "content"; | |
| p3.renderMainPage(new a.Vs.Layout({ | |
| formType: h.FormType.INQUIRY | |
| })) | |
| }); | |
| p3.router().route("settings/schoolforms/:id", "schoolformsedit", function (u) { | |
| a.Data.FormModel = null; | |
| a.Data.ApplicationFormId = u; | |
| a.Data.EditMode = "content"; | |
| a.Data.SecurePayment = false; | |
| p3.renderMainPage(new a.Vs.Layout()) | |
| }); | |
| p3.router().route("settings/recommendations/:id", "recommendationformsedit", function (u) { | |
| a.Data.FormModel = null; | |
| a.Data.ApplicationFormId = u; | |
| a.Data.EditMode = "content"; | |
| a.Data.SecurePayment = false; | |
| p3.renderMainPage(new a.Vs.Layout()) | |
| }) | |
| }(p3.module("admissions/applicationformsedit"))); | |
| (function (a) { | |
| var b = p3.module("admissions/candidateprogress"); | |
| a.Ms.HasOnlineApp = Bbm.extend({ | |
| url: function () { | |
| return aP + "onlineapplication/hasonlineapp" | |
| } | |
| }); | |
| p3.router().route("apply", "apply", function () { | |
| p3.setTitle("Apply"); | |
| var c = new a.Ms.HasOnlineApp(); | |
| c.fetch({ | |
| success: function () { | |
| if (c.get("Message") == "True") { | |
| b.Us.ApplyCandidate() | |
| } | |
| } | |
| }) | |
| }) | |
| }(p3.module("admissions/apply"))); | |
| (function (b) { | |
| var a = p3.module("shared/base"), | |
| g = p3.module("shared/task"), | |
| f = p3.module("utilities/multifetch"), | |
| e = p3.module("shared/mainbulletin"), | |
| c = p3.Us.Enum, | |
| d = p3.Us.InfoMessageLibrary; | |
| b.Ms.ProspectDecision = Bbm.extend({}); | |
| b.Ms.ProspectDecisionUpdate = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| idAttribute: "decisionId", | |
| url: function () { | |
| return this.id ? aP + "admissions/ProspectCandidateDecisionUpdate/" + this.id + "/" : aP + "admissions/ProspectCandidateDecisionUpdate/" | |
| } | |
| }); | |
| b.Ms.DecisionText = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| idAttribute: "SchoolId", | |
| validation: { | |
| CandidateDecisionText: [{ | |
| maxLength: 4000, | |
| required: false, | |
| msg: d.P3.MaxLengthExceeded | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "admissions/AdmissionOptions/" + this.id + "/" : aP + "admissions/AdmissionOptions/" | |
| } | |
| }); | |
| b.Cs.ProspectInstanceIds = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/ProspectInstanceIdsGet/" | |
| } | |
| }); | |
| b.Cs.ProspectDecision = Bbc.extend({ | |
| model: b.Ms.ProspectDecision, | |
| url: function () { | |
| return aP + "datadirect/ProspectDecisionGet/" | |
| } | |
| }); | |
| b.Cs.Decisions = Bbc.extend({ | |
| model: b.Ms.ProspectDecision, | |
| url: function () { | |
| return aP + "admissions/ProspectDecisionList/" | |
| } | |
| }); | |
| b.Cs.ProspectDecisionPlaceholders = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/ProspectDecisionPlaceholdersGet/" | |
| } | |
| }); | |
| b.Cs.CommentBox = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| model: b.Ms.CommentBox, | |
| url: function () { | |
| return aP + "admissions/AdmissionOptions/" | |
| } | |
| }); | |
| b.Cs.Acknowledgements = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/AcknowledgementsGet/" | |
| } | |
| }); | |
| b.Vs.Layout = Bb.View.extend({ | |
| template: "admissions/candidateview.decision.template.html", | |
| initialize: function () { | |
| var h = this; | |
| h.instanceIds = new b.Cs.ProspectInstanceIds(); | |
| b.Data.DecisionInfo = { | |
| userId: h.options.userId, | |
| instanceId: null, | |
| showDefaultText: false, | |
| schoolDecisionMadeId: null, | |
| schoolDecisionTypeComment: null, | |
| accepted: false, | |
| downloadLink: null, | |
| showDownloadLink: false, | |
| acknowledgements: null, | |
| decisionAcknowledgementId: null, | |
| decisionAcknowledgement: null | |
| }; | |
| b.Data.dictionaries = {} | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| p3.setTitle("Decision"); | |
| $(h).html(i.el); | |
| i.instanceIds.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| userId: b.Data.DecisionInfo.userId | |
| }, | |
| success: function (j, k) { | |
| b.Data.DecisionInfo.instanceId = j.models[0].get("ProspectInstanceId"); | |
| b.Data.DecisionInfo.schoolDecisionMadeId = j.models[0].get("DecisionMadeId"); | |
| i.renderData() | |
| } | |
| }) | |
| }, | |
| renderData: function () { | |
| var h = this; | |
| p3.fT(h.template, function (i) { | |
| h.$el.html(i({ | |
| decisionInfo: b.Data.DecisionInfo | |
| })); | |
| if (b.Data.DecisionInfo.schoolDecisionMadeId == null) { | |
| b.Data.DecisionInfo.showDefaultText = true; | |
| p3.rV(new b.Vs.DecisionText({}), $("#candidate-decision-text"), true) | |
| } else { | |
| p3.rV(new b.Vs.Banner({}), $("#candidate-decision-banner"), true) | |
| } | |
| }) | |
| } | |
| }); | |
| b.Vs.Banner = Bb.View.extend({ | |
| template: "admissions/candidateview.decision.banner.template.html", | |
| initialize: function () { | |
| var h = this; | |
| h.schoolDecisions = new b.Cs.Decisions(); | |
| h.prospectDecisions = new b.Cs.ProspectDecision(); | |
| h.acknowledgementList = new b.Cs.Acknowledgements() | |
| }, | |
| events: { | |
| "click .radio-sky-input": "selectDecision", | |
| "click .toggle-decision": "toggleDecision", | |
| "click .submit-decision": "submitDecision" | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| $(h).html(i.el); | |
| i.schoolDecisions.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| prospectInstanceId: b.Data.DecisionInfo.instanceId, | |
| userId: b.Data.DecisionInfo.userId | |
| }, | |
| success: function () { | |
| b.Data.DecisionInfo.admDecisionId = i.schoolDecisions.models[0].attributes.AdmDecisionId; | |
| b.Data.DecisionInfo.admDecisionTypeId = i.schoolDecisions.models[0].attributes.AdmDecisionType.AdmDecisionTypeId; | |
| b.Data.DecisionInfo.displayDeclineReason = i.schoolDecisions.models[0].attributes.AdmDecisionType.DisplayDeclineReason; | |
| b.Data.DecisionInfo.displayDeclineSchool = i.schoolDecisions.models[0].attributes.AdmDecisionType.DisplayDeclineSchool; | |
| f.Us.Fetch({ | |
| ADMReasonsDeclinedAll: { | |
| data: new f.Cs.Dictionary(), | |
| dataParams: c.DictionaryData.ADMReasonsDeclinedAll | |
| }, | |
| TransferSchool: { | |
| data: new f.Cs.Dictionary(), | |
| dataParams: { | |
| id: 94, | |
| inputParam: "@chosen_inq=1[i]" | |
| } | |
| } | |
| }, function (j, l, k) { | |
| b.Data.dictionaries = j; | |
| b.Data.DecisionInfo.accepted = (b.Data.DecisionInfo.admDecisionTypeId == 1) ? true : false; | |
| i.renderData() | |
| }) | |
| } | |
| }) | |
| }, | |
| renderData: function () { | |
| var i = this, | |
| h = new Date(); | |
| i.prospectDecisions.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| prospectInstanceId: b.Data.DecisionInfo.instanceId, | |
| decisionMadeId: b.Data.DecisionInfo.schoolDecisionMadeId | |
| }, | |
| success: function (j, k) { | |
| b.Data.DecisionInfo.decisionIsPublished = j.models[0].get("IsPublished"); | |
| b.Data.DecisionInfo.decisionAcknowledgementId = j.models[0].get("DecisionAcknowledgementId"); | |
| b.Data.DecisionInfo.decisionAcknowledgement = j.models[0].get("DecisionAcknowledgement"); | |
| if (!b.Data.DecisionInfo.decisionIsPublished) { | |
| b.Data.DecisionInfo.showDefaultText = true; | |
| p3.rV(new b.Vs.DecisionText({}), $("#candidate-decision-text"), true) | |
| } else { | |
| b.Data.DecisionInfo.schoolDecisionTypeComment = j.models[0].attributes.DecisionTypeComment; | |
| b.Data.DecisionInfo.downloadLink = g.Us.getUrlById(52681, "pk=392&tid=" + i.prospectDecisions.models[0].attributes.TemplateId + "&ext=pdf&piid=" + b.Data.DecisionInfo.instanceId + "&uid=" + b.Data.DecisionInfo.userId + "&pre=True&app=34&dol=" + h); | |
| b.Data.DecisionInfo.showDownloadLink = i.prospectDecisions.models[0].attributes.TemplateId; | |
| i.acknowledgementList.fetch({ | |
| data: { | |
| decisionId: b.Data.DecisionInfo.admDecisionId, | |
| publishedOnlyInd: true | |
| }, | |
| success: function (l, m) { | |
| b.Data.DecisionInfo.acknowledgements = i.acknowledgementList.toJSON(); | |
| if (b.Data.DecisionInfo.accepted || b.Data.DecisionInfo.showDownloadLink || b.Data.DecisionInfo.decisionAcknowledgementId || b.Data.DecisionInfo.acknowledgements.length > 0) { | |
| p3.fT(i.template, function (n) { | |
| i.$el.html(n({ | |
| decisionInfo: b.Data.DecisionInfo, | |
| dictionaries: b.Data.dictionaries | |
| })) | |
| }) | |
| } | |
| p3.rV(new b.Vs.DecisionText({ | |
| decisionInfo: b.Data.DecisionInfo | |
| }), $("#candidate-decision-text"), true) | |
| } | |
| }) | |
| } | |
| } | |
| }) | |
| }, | |
| selectDecision: function (j) { | |
| var k = this, | |
| h = $(j.currentTarget), | |
| i = h.data("type"); | |
| i = h.children("input").data("type"); | |
| if (i === 2) { | |
| if (b.Data.DecisionInfo.displayDeclineReason) { | |
| k.$(".decline-reason").show() | |
| } | |
| if (b.Data.DecisionInfo.displayDeclineSchool) { | |
| k.$(".decline-school").show() | |
| } | |
| } else { | |
| k.$(".decline-reason").hide(); | |
| k.$("#DeclinedId").val(""); | |
| k.$(".decline-school").hide(); | |
| k.$("#ChosenSchool").val("") | |
| } | |
| }, | |
| submitDecision: function (h) { | |
| h.stopPropagation(); | |
| h.preventDefault(); | |
| var j = this, | |
| i; | |
| i = new b.Ms.ProspectDecisionUpdate({ | |
| userId: b.Data.DecisionInfo.userId, | |
| prospectInstanceId: b.Data.DecisionInfo.instanceId, | |
| decisionId: b.Data.DecisionInfo.schoolDecisionMadeId, | |
| candDecisionId: j.$('[name="parent-decision"]:checked').val(), | |
| candDeclineId: j.$("#DeclinedId").val(), | |
| candChosenSchool: j.$("#ChosenSchool").val() | |
| }); | |
| i.save({}, { | |
| dataParam: j.options.dataParam, | |
| success: function (k, l) { | |
| j.$("#select-decision").html('<h5 style="margin:5px 15px 0px 0px; color:#000; text-align:right;">Thank you. Your decision has been submitted.</h5>'); | |
| e.Us.ShowMainBulletin() | |
| }, | |
| error: function (l, k) { | |
| j.$(".save").button("reset") | |
| } | |
| }) | |
| }, | |
| toggleDecision: function (h) { | |
| h.stopPropagation(); | |
| h.preventDefault(); | |
| var i = this; | |
| i.$(".info-decision").toggle() | |
| } | |
| }); | |
| b.Vs.DecisionText = Bb.View.extend({ | |
| template: "admissions/candidateview.decision.text.template.html", | |
| render: function (h) { | |
| var i = this; | |
| $(h).html(i.el); | |
| if (b.Data.DecisionInfo.showDefaultText) { | |
| i.schoolDecisionText = new b.Ms.DecisionText(); | |
| i.schoolDecisionText.fetch({ | |
| cache: false, | |
| data: { | |
| id: b.Data.DecisionInfo.instanceId | |
| }, | |
| success: function (j, k) { | |
| b.Data.DecisionInfo.schoolDecisionTypeComment = i.schoolDecisionText.toJSON().CandidateDecisionText; | |
| i.renderData() | |
| } | |
| }) | |
| } else { | |
| i.placeholders = new b.Cs.ProspectDecisionPlaceholders(); | |
| i.placeholders.fetch({ | |
| cache: false, | |
| data: { | |
| prospectInstanceId: b.Data.DecisionInfo.instanceId, | |
| decisionMadeId: b.Data.DecisionInfo.schoolDecisionMadeId | |
| }, | |
| success: function (j, k) { | |
| _.each(i.placeholders.toJSON(), function (l) { | |
| if (l.PData !== null) { | |
| b.Data.DecisionInfo.schoolDecisionTypeComment = b.Data.DecisionInfo.schoolDecisionTypeComment.replace("[" + l.DisplayName + "]", l.PData) | |
| } else { | |
| b.Data.DecisionInfo.schoolDecisionTypeComment = b.Data.DecisionInfo.schoolDecisionTypeComment.replace("[" + l.DisplayName + "]", "") | |
| } | |
| }); | |
| i.renderData() | |
| } | |
| }) | |
| } | |
| }, | |
| renderData: function () { | |
| var h = this; | |
| p3.fT(h.template, function (i) { | |
| h.$el.html(i({ | |
| decisionInfo: b.Data.DecisionInfo | |
| })) | |
| }) | |
| } | |
| }) | |
| }(p3.module("admissions/candidatedecision"))); | |
| (function (d) { | |
| var f = p3.module("shared/datepicker"), | |
| l = p3.module("shared/timepicker"), | |
| c = p3.module("admissions/managecandidates"), | |
| a = p3.module("admissions/admissionsscheduling"), | |
| k = p3.module("utilities/smodal"), | |
| g = p3.module("utilities/dictionary"), | |
| j = p3.module("utilities/multifetch"), | |
| b = p3.module("shared/base"), | |
| m = p3.Us.Tools, | |
| h = p3.Us.Enum, | |
| e = p3.Us.Culture, | |
| i = p3.Us.InfoMessageLibrary; | |
| d.Ms.DictionaryItem = Bbm.extend({}); | |
| d.Cs.Dictionary = Bbc.extend({ | |
| model: d.Ms.DictionaryItem, | |
| url: "datadirect/DictionaryGet/" | |
| }); | |
| d.Ms.Information = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "ProspectInstanceId", | |
| validation: { | |
| "CustomFields.0.Value": [{ | |
| fn: "customFields" | |
| }], | |
| "CustomFields.1.Value": [{ | |
| fn: "customFields" | |
| }], | |
| "CustomFields.2.Value": [{ | |
| fn: "customFields" | |
| }], | |
| "CustomFields.3.Value": [{ | |
| fn: "customFields" | |
| }], | |
| "CustomFields.4.Value": [{ | |
| fn: "customFields" | |
| }], | |
| "CustomFields.5.Value": [{ | |
| fn: "customFields" | |
| }], | |
| "CustomFields.6.Value": [{ | |
| fn: "customFields" | |
| }], | |
| "CustomFields.7.Value": [{ | |
| fn: "customFields" | |
| }], | |
| "CustomFields.8.Value": [{ | |
| fn: "customFields" | |
| }], | |
| "CustomFields.9.Value": [{ | |
| fn: "customFields" | |
| }] | |
| }, | |
| customFields: function (q, n, p) { | |
| var o = k.Us.getParentByString(p, n); | |
| if (o && o.Published === true) { | |
| if (o.Type === 5 && !e.isDate(q)) { | |
| return i.P3.DateError.fixDateFormat() | |
| } | |
| } | |
| }, | |
| url: function () { | |
| return this.id ? aP + "Admissions/Prospect/" + this.id + "/" : aP + "Admissions/Prospect/" | |
| } | |
| }); | |
| d.Ms.CustomFieldsDictionaries = Bbm.extend({ | |
| url: function () { | |
| return aP + "datadirect/CustomFieldsGet" | |
| } | |
| }); | |
| d.Ms.Visit = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "VisitId", | |
| validation: { | |
| VisitDate: [{ | |
| fn: function (p, n, o) { | |
| if ($("#VisitDate").val() == "" || $("#VisitTime").val() == "") { | |
| return i.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, { | |
| date: true | |
| }], | |
| "VisitType.VisitTypeId": [{ | |
| required: true, | |
| msg: i.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "Admissions/ProspectVisit/" + this.id + "/" : aP + "Admissions/ProspectVisit/" | |
| } | |
| }); | |
| d.Ms.Interview = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "InterviewId", | |
| validation: { | |
| InterviewDate: [{ | |
| fn: function (p, n, o) { | |
| if ($("#InterviewDate").val() == "" || $("#InterviewTime").val() == "") { | |
| return i.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, { | |
| date: true | |
| }], | |
| "InterviewType.InterviewTypeId": [{ | |
| required: true, | |
| msg: i.P3.RequiredInfoNotEntered | |
| }], | |
| LengthMinutes: [{ | |
| fn: function (p, n, o) { | |
| if (parseInt(p, 10) < 0 || parseInt(p, 10) > 59) { | |
| return i.Admissions.MinuteRange | |
| } | |
| } | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "Admissions/ProspectInterview/" + this.id + "/" : aP + "Admissions/ProspectInterview/" | |
| } | |
| }); | |
| d.Ms.Recommendation = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "ReferenceId", | |
| validation: { | |
| ReferenceDate: [{ | |
| required: true, | |
| msg: i.P3.RequiredInfoNotEntered | |
| }, { | |
| date: true | |
| }], | |
| "ReferenceType.ReferenceTypeId": [{ | |
| required: true, | |
| msg: i.P3.RequiredInfoNotEntered | |
| }], | |
| ReferenceName: [{ | |
| required: true, | |
| msg: i.P3.RequiredInfoNotEntered | |
| }], | |
| RelationshipMonths: [{ | |
| required: false, | |
| min: 0, | |
| max: 11, | |
| msg: i.Admissions.MonthRange | |
| }], | |
| EmailAddress: [{ | |
| required: false, | |
| pattern: "email", | |
| msg: i.P3.EmailError | |
| }], | |
| Zip: [{ | |
| required: false, | |
| fn: function (p, n, o) { | |
| if (o.Country === "US") { | |
| if (!/^\d{5}(-\d{4})?$/.test(p)) { | |
| return i.Profile.PostalCodeError | |
| } | |
| } | |
| } | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "Admissions/ProspectReference/" + this.id + "/" : aP + "Admissions/ProspectReference/" | |
| } | |
| }); | |
| d.Ms.TestScore = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "TestScoreId", | |
| validation: { | |
| TestDate: [{ | |
| required: true, | |
| msg: i.P3.RequiredInfoNotEntered | |
| }, { | |
| date: true | |
| }], | |
| RegisteredDate: [{ | |
| date: true | |
| }], | |
| "Test.TestId": [{ | |
| required: true, | |
| msg: i.P3.RequiredInfoNotEntered | |
| }], | |
| OverallScore: [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.0.Score": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.1.Score": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.2.Score": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.3.Score": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.4.Score": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.5.Score": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.6.Score": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.7.Score": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.8.Score": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.9.Score": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.0.Percentile": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.1.Percentile": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.2.Percentile": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.3.Percentile": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.4.Percentile": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.5.Percentile": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.6.Percentile": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.7.Percentile": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.8.Percentile": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.9.Percentile": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.0.Scale": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.1.Scale": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.2.Scale": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.3.Scale": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.4.Scale": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.5.Scale": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.6.Scale": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.7.Scale": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.8.Scale": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.9.Scale": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.0.Stanie": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.1.Stanie": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.2.Stanie": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.3.Stanie": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.4.Stanie": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.5.Stanie": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.6.Stanie": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.7.Stanie": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.8.Stanie": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }], | |
| "ProspectSubTests.9.Stanie": [{ | |
| required: false, | |
| pattern: "number", | |
| msg: i.P3.NotNumeric | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "Admissions/prospecttest/" + this.id + "/" : aP + "Admissions/prospecttest/" | |
| } | |
| }); | |
| d.Ms.Interest = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| validation: { | |
| CommentCandidate: [{ | |
| maxLength: 2000, | |
| required: false, | |
| msg: i.P3.MaxLengthExceeded | |
| }], | |
| CommentSchool: [{ | |
| maxLength: 2000, | |
| required: false, | |
| msg: i.P3.MaxLengthExceeded | |
| }] | |
| }, | |
| url: function () { | |
| return aP + "Admissions/prospectinterest/" | |
| } | |
| }); | |
| d.Ms.Event = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "EventId", | |
| validation: { | |
| EventDate: [{ | |
| fn: function (p, n, o) { | |
| if ($('[name="EventDate"]').val() == "" || $('[name="EventTime"]').val() == "") { | |
| return i.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, { | |
| date: true | |
| }], | |
| "EventType.EventTypeId": [{ | |
| required: true, | |
| msg: i.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "Admissions/ProspectEvent/" + this.id + "/" : aP + "Admissions/ProspectEvent/" | |
| } | |
| }); | |
| d.Ms.DeleteForm = Bbm.extend({ | |
| url: function () { | |
| return aP + "OnlineApplication/FormData/" + this.id + "/" | |
| } | |
| }); | |
| d.Ms.DeletePodiumInquiry = Bbm.extend({ | |
| url: function () { | |
| return aP + "Inquiry/ApplicationRequest/" + this.id + "/" | |
| } | |
| }); | |
| d.Ms.MiscellaneousFile = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "ProspectFileId", | |
| validation: { | |
| AttachmentFile: [{ | |
| required: true, | |
| fn: function (p, n, o) { | |
| if (this.attributes.AttachmentFile === null || this.attributes.AttachmentFile === undefined) { | |
| return "Attachment file is required" | |
| } | |
| if (this.attributes.AttachmentFile.Attachment === null || this.attributes.AttachmentFile.Attachment === undefined) { | |
| return "Attachment file is required" | |
| } | |
| } | |
| }], | |
| "FileType.FileTypeId": [{ | |
| required: true, | |
| msg: i.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "Candidate/FileDetail/" + this.id + "/" : aP + "Candidate/FileDetail/" | |
| } | |
| }); | |
| d.Cs.Visits = Bbc.extend({ | |
| model: d.Ms.Visit, | |
| url: function () { | |
| return aP + "Admissions/ProspectVisitList/" | |
| } | |
| }); | |
| d.Cs.Interviews = Bbc.extend({ | |
| model: d.Ms.Interview, | |
| url: function () { | |
| return aP + "Admissions/ProspectInterviewList/" | |
| } | |
| }); | |
| d.Cs.Recommendations = Bbc.extend({ | |
| model: d.Ms.Recommendation, | |
| url: function () { | |
| return aP + "Admissions/ProspectReferenceList/" | |
| } | |
| }); | |
| d.Cs.TestScores = Bbc.extend({ | |
| model: d.Ms.TestScore, | |
| url: function () { | |
| return aP + "Admissions/ProspectTestList/" | |
| } | |
| }); | |
| d.Cs.SubTests = Bbc.extend({ | |
| url: function () { | |
| return aP + "Admissions/ProspectSubTestList/" | |
| } | |
| }); | |
| d.Cs.Interests = Bbc.extend({ | |
| sync: b.DataParamSync, | |
| model: d.Ms.Interest, | |
| url: function () { | |
| return aP + "Admissions/ProspectInterestList/" | |
| } | |
| }); | |
| d.Cs.Events = Bbc.extend({ | |
| model: d.Ms.Event, | |
| url: function () { | |
| return aP + "Admissions/ProspectEventList/" | |
| } | |
| }); | |
| d.Cs.ChecklistItems = Bbc.extend({ | |
| url: function () { | |
| return aP + "Admissions/ProspectDataCollectionPkItems/" | |
| } | |
| }); | |
| d.Cs.ChecklistStatuses = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/ProspectDataCollectionPkStatuses/" | |
| } | |
| }); | |
| d.Cs.MiscellaneousFiles = Bbc.extend({ | |
| model: d.Ms.MiscellaneousFile, | |
| url: function () { | |
| return aP + "Candidate/FileList" | |
| } | |
| }); | |
| d.Vs.Layout = Bb.View.extend({ | |
| template: "admissions/candidate.detail.profile.template.html", | |
| events: { | |
| "click .toggleLink": "toggleSection" | |
| }, | |
| initialize: function () { | |
| if (this.options) { | |
| this.userId = this.options.userId | |
| } | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| p3.setTitle("Candidate Profile"); | |
| $(n).html(o.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var o = this, | |
| n; | |
| p3.fT(o.template, function (p) { | |
| o.$el.html(p()); | |
| n = $("#content"); | |
| p3.rV(new d.Vs.Information({ | |
| instanceId: o.options.instanceId, | |
| userId: o.options.userId | |
| }), n, false); | |
| p3.rV(new d.Vs.Visits({ | |
| instanceId: o.options.instanceId | |
| }), n, false); | |
| p3.rV(new d.Vs.Interviews({ | |
| instanceId: o.options.instanceId | |
| }), n, false); | |
| p3.rV(new d.Vs.Recommendations({ | |
| instanceId: o.options.instanceId | |
| }), n, false); | |
| p3.rV(new d.Vs.TestScores({ | |
| instanceId: o.options.instanceId, | |
| userId: o.options.userId | |
| }), n, false); | |
| p3.rV(new d.Vs.Interests({ | |
| instanceId: o.options.instanceId, | |
| userId: o.options.userId, | |
| layoutView: o | |
| }), n, false); | |
| p3.rV(new d.Vs.Events({ | |
| instanceId: o.options.instanceId, | |
| userId: o.options.userId, | |
| layoutView: o | |
| }), n, false); | |
| p3.rV(new d.Vs.MiscellaneousFiles({ | |
| instanceId: o.options.instanceId | |
| }), n, false) | |
| }) | |
| }, | |
| toggleSection: function (o) { | |
| var n = $(o.currentTarget); | |
| o.preventDefault(); | |
| o.stopPropagation(); | |
| n.closest(".bb-tile").find(".bb-tile-content").slideToggle("fast", function () { | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }); | |
| d.Us.SwapChevronClass(n.find(".fa")); | |
| d.Us.SwapActiveClass(n); | |
| return false | |
| } | |
| }); | |
| d.Vs.Information = Bb.View.extend({ | |
| template: "candidate/candidate.record.information.template.html", | |
| events: { | |
| "click button.edit": "editInformation", | |
| "click .togglebutton": "toggleInfo", | |
| "click button.delete-inquiry": "deleteInquiry" | |
| }, | |
| initialize: function () { | |
| var n = this; | |
| n.model = new d.Ms.Information() | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| j.Us.Fetch({ | |
| GradeLevel: { | |
| data: new j.Cs.Dictionary(), | |
| dataParams: { | |
| id: 35, | |
| inputParam: "@append_school_level=0[i],@level_num=null,@duration_id=null,@adm_ind=1[i],@Directory_ind=0[i]" | |
| } | |
| }, | |
| InquirySource: { | |
| data: new j.Cs.Dictionary(), | |
| dataParams: { | |
| id: 38, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| inputParam: "@exclude_web=0[i]" | |
| } | |
| }, | |
| SchoolYearCurrent: { | |
| data: new j.Cs.Dictionary(), | |
| dataParams: { | |
| id: 83, | |
| inputParam: "@display=5[i]" | |
| } | |
| }, | |
| ADMStaff: { | |
| data: new j.Cs.Dictionary(), | |
| dataParams: h.DictionaryData.ADMStaff | |
| }, | |
| ADMInactiveStatusTypes: { | |
| data: new j.Cs.Dictionary(), | |
| dataParams: h.DictionaryData.ADMInactiveStatusTypes | |
| }, | |
| ReferralTypes: { | |
| data: new j.Cs.Dictionary(), | |
| dataParams: h.DictionaryData.ReferralTypes | |
| }, | |
| DictionariesCustom: { | |
| data: new d.Ms.CustomFieldsDictionaries() | |
| }, | |
| Sessions: { | |
| data: new j.Cs.Dictionary(), | |
| dataParams: h.DictionaryData.Sessions | |
| } | |
| }, function (p, r, q) { | |
| if (q) { | |
| p3.displayError("There was an error loading data.") | |
| } | |
| o.dictionaries = p; | |
| var t, s = _.groupBy(p.DictionariesCustom.toJSON(), function (u) { | |
| return u.ordinal | |
| }); | |
| for (t in s) { | |
| if (s.hasOwnProperty(t)) { | |
| o.dictionaries["DictionaryCustom_" + t] = s[t] | |
| } | |
| } | |
| o.renderData() | |
| }) | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| n.model.unbind("sync"); | |
| p3.fT(n.template, function (o) { | |
| n.model.fetch({ | |
| cache: false, | |
| data: { | |
| id: n.options.instanceId | |
| }, | |
| success: function (p, q) { | |
| n.$el.html(o({ | |
| model: p.toJSON(), | |
| dictionaries: n.dictionaries | |
| })) | |
| }, | |
| complete: function () { | |
| n.model.bind("sync", n.renderData, n) | |
| } | |
| }) | |
| }) | |
| }, | |
| editInformation: function (n) { | |
| n.preventDefault(); | |
| n.stopPropagation(); | |
| var p = this, | |
| o = new c.Cs.StatusHistory(); | |
| o.fetch({ | |
| data: { | |
| userId: p.options.userId, | |
| prospectInstanceId: p.options.instanceId | |
| }, | |
| success: function () { | |
| var q = true; | |
| if (o.models.length === 0) { | |
| q = false | |
| } | |
| p.modal2Extend = k.Vs.Modal2.extend({ | |
| template: "candidate/candidate.record.information.edit.template.html", | |
| model: p.model, | |
| dictionaries: p.dictionaries, | |
| variables: { | |
| hasChecklist: q | |
| }, | |
| events: { | |
| "keyup textarea.counter-input": "updateCharacterCounter" | |
| }, | |
| modalRendered: function (s) { | |
| var r = this; | |
| f.Us.initialize(".date-input", { | |
| yearRange: "-30:+20" | |
| }); | |
| _.each(r.$("textarea.counter-input"), function (t) { | |
| $(t).trigger($.Event("keyup")) | |
| }); | |
| r.initializeFileUpload_File(); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.FileUpload, function () { | |
| window.setTimeout(function () { | |
| r.$(".fileupload").each(function () { | |
| var t = (!$(this).data("filetype")) ? p3.Us.Enum.UploadType.All : p3.Us.Enum.UploadType[$(this).data("filetype").toUpperCase()]; | |
| $(this).fileupload({ | |
| url: p3.Config.RootPath + "utilities/FileTransferHandler.ashx", | |
| autoUpload: true, | |
| acceptFileTypes: t.ValidExtensions, | |
| formData: { | |
| safeName: true | |
| }, | |
| dropZone: $(this), | |
| add: function (v, u) { | |
| var w = $(v.currentTarget), | |
| x = p3.Us.FileTools.isValidFile(t, u.files[0].name); | |
| if (x) { | |
| u.submit() | |
| } else { | |
| w.find(".attachment-name").empty(); | |
| w.find(".attachment-name").append(p3.Us.FileTools.validateFiles(t, u)) | |
| } | |
| } | |
| }).on("fileuploaddone", function (v, u) { | |
| var w = $(v.currentTarget); | |
| w.find(".attachment-name").html('<img style="width:90px;" class="imgNice" src="/ftpimages/pdTemp/' + u.result[0].name + '" />'); | |
| r.setPropByString(r.model.attributes, w.find(".attachment-name").attr(r.selector), u.result[0].original_name); | |
| r.setPropByString(r.model.attributes, w.find(".attachment-add").attr(r.selector), u.result[0].name); | |
| r.setPropByString(r.model.attributes, "FamilyPhotoNew.DeleteInd", false); | |
| w.find(".attachment-add").hide(); | |
| w.find(".attachment-view").show() | |
| }) | |
| }) | |
| }, 1000) | |
| }); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.TokenInput, function () { | |
| $.ajax({ | |
| url: aP + "datadirect/UsersByRole?format=json&parentRoleId=10102&resultSize=4000", | |
| cache: false, | |
| success: function (t) { | |
| var v, u = null; | |
| _.each(t, function (w) { | |
| w.FullName = ""; | |
| w.FullName += (w.FirstName) ? w.FirstName + " " : ""; | |
| w.FullName += w.LastName || ""; | |
| w.id = w.Id | |
| }); | |
| u = r.model.get("EducationalConsultant"); | |
| _.each(u, function (w) { | |
| w.FullName = ""; | |
| w.FullName += (w.FirstName) ? w.FirstName + " " : ""; | |
| w.FullName += w.LastName || ""; | |
| w.id = w.UserId | |
| }); | |
| v = "token-input-list"; | |
| r.$('[name="EducationalConsultant"]').tokenInput(t, { | |
| minChars: 2, | |
| searchDelay: 100, | |
| preventDuplicates: true, | |
| animateDropdown: false, | |
| propertyToSearch: "FullName", | |
| hintText: "Type to find an educational consultant", | |
| classes: { | |
| tokenList: v, | |
| dropdown: "token-input-dropdown input-xlarge" | |
| }, | |
| resultsFormatter: function (w) { | |
| return "<li>" + w.FullName + "</li>" | |
| }, | |
| prePopulate: u | |
| }) | |
| } | |
| }) | |
| }) | |
| }, | |
| updateCharacterCounter: function (s) { | |
| var t = this, | |
| r = t.$(s.currentTarget); | |
| r.siblings().find(".characterCounter").html(r.val().length); | |
| if (r.val().length > 4000) { | |
| r.siblings().find(".characterCounter").addClass("badge-important") | |
| } else { | |
| r.siblings().find(".characterCounter").removeClass("badge-important") | |
| } | |
| }, | |
| modalUpdate: function (u) { | |
| var t = this, | |
| v, w, s, r; | |
| if (u.eventCurrentTarget.hasClass("attachment-delete")) { | |
| t.setPropByString(t.model.attributes, "FamilyPhoto.DeleteInd", true); | |
| t.setPropByString(t.model.attributes, "FamilyPhotoNew.DeleteInd", true); | |
| u.eventCurrentTarget.parent().hide(); | |
| u.eventCurrentTarget.parent().siblings(".attachment-add").show(); | |
| return false | |
| } | |
| if (u.eventCurrentTarget.parent().hasClass("candidate-status")) { | |
| v = $('[name="InactiveStatusType\\.InactiveStatusTypeId"]'); | |
| s = u.eventCurrentTarget.attr("value"); | |
| w = v.closest("div.picklist-container"); | |
| if (m.stringToBoolean(s) === false) { | |
| t.model.set({ | |
| MakeInactiveInd: 1 | |
| }); | |
| if (!t.getPropByString(t.model.attributes, "InactiveStatusType.InactiveStatusTypeId") && v.length) { | |
| r = v[0].value; | |
| if (r) { | |
| t.setPropByString(t.model.attributes, "InactiveStatusType.InactiveStatusTypeId", r) | |
| } | |
| } | |
| w.show() | |
| } else { | |
| if (m.stringToBoolean(s) === true) { | |
| t.model.set({ | |
| MakeInactiveInd: 0 | |
| }); | |
| t.setPropByString(t.model.attributes, "InactiveStatusType.InactiveStatusTypeId", ""); | |
| w.hide() | |
| } | |
| } | |
| } | |
| }, | |
| modalSave: function (u) { | |
| var t = this, | |
| s, v, r = $("#infomessage-error"); | |
| if (t.model.get("MakeInactiveInd") && t.model.get("ActiveAndEnrollingInd")) { | |
| s = "This candidate is expected to enroll at your school and cannot be inactivated at this time. If this is incorrect, update the Candidate Decision before inactivating this candidate."; | |
| $("div.modal-body").animate({ | |
| scrollTop: 0 | |
| }, "fast"); | |
| r.html(s).show(); | |
| return false | |
| } | |
| r.html("").hide(); | |
| v = new c.Cs.TokenItems(); | |
| _.each(t.$('[name="EducationalConsultant"]').tokenInput("get"), function (w) { | |
| var x = new c.Ms.TokenItem({ | |
| UserId: w.id | |
| }); | |
| v.add(x) | |
| }); | |
| t.model.set({ | |
| EducationalConsultant: v.toJSON(), | |
| Comment: c.Data.prospectInfo.get("Comment") | |
| }) | |
| }, | |
| modalSavedSuccess: function (v) { | |
| var u = this, | |
| x, s = "", | |
| w, t, y, r; | |
| if ($("#candidateInfo #enteringyear").length > 0) { | |
| if ($("#candidateInfo #enteringyear-select").length > 0) { | |
| $("#candidateInfo #enteringyear strong").html(u.model.get("EnteringYear") + ' <span class="caret"></span>'); | |
| $("#candidateInfo #enteringyear-select li a").each(function () { | |
| if (this.id == u.model.get("ProspectInstanceId")) { | |
| $(this).html(u.model.get("EnteringYear")) | |
| } | |
| }) | |
| } else { | |
| $("#candidateInfo #enteringyear strong").html(u.model.get("EnteringYear")) | |
| } | |
| } | |
| if ($("#candidateInfo #enteringgrade").length > 0) { | |
| x = u.model.get("EnteringGrade").grade_id; | |
| for (t = 0; t < u.dictionaries.GradeLevel.length; t++) { | |
| if (x == u.dictionaries.GradeLevel[t].dd_id) { | |
| w = u.dictionaries.GradeLevel[t].dd_description; | |
| if (!isNaN(w)) { | |
| y = parseInt(w, 10); | |
| r = ["th", "st", "nd", "rd"]; | |
| s = w + r[y % 10 > 3 ? 0 : (y % 100 - y % 10 != 10) * y % 10] + " Grade" | |
| } else { | |
| s = w | |
| } | |
| break | |
| } | |
| } | |
| $("#enteringgrade strong").html(s) | |
| } | |
| $(".candidate-header").parent().trigger("renderheader") | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new p.modal2Extend(), p3.Layout.Containers.Modal, true) | |
| } | |
| }) | |
| }, | |
| toggleInfo: function (o) { | |
| var n = $(o.currentTarget); | |
| o.preventDefault(); | |
| o.stopPropagation(); | |
| n.closest("tr").find(".toggleinfo").slideToggle("fast"); | |
| d.Us.SwapChevronClass(n); | |
| d.Us.SwapActiveClass(n) | |
| }, | |
| deleteInquiry: function (p) { | |
| p.preventDefault(); | |
| p.stopPropagation(); | |
| var q = this, | |
| o = null, | |
| n = $(p.currentTarget); | |
| p3.showConfirm("Delete Inquiry", "Wait a minute. Are you really sure you want to delete this inquiry form?<br /><br /><b>This cannot be undone.</b>", null, function () { | |
| if (n.hasClass("podium")) { | |
| o = new d.Ms.DeletePodiumInquiry({ | |
| id: n.data("id") | |
| }) | |
| } else { | |
| if (n.hasClass("onboard")) { | |
| o = new d.Ms.DeleteForm({ | |
| id: n.data("id") | |
| }) | |
| } | |
| } | |
| o.destroy({ | |
| success: function () { | |
| q.renderData() | |
| }, | |
| error: function (s, r) { | |
| p3.displayError("Error deleting inquiry") | |
| } | |
| }) | |
| }) | |
| } | |
| }); | |
| d.Vs.Visits = Bb.View.extend({ | |
| template: "candidate/candidate.record.visits.template.html", | |
| initialize: function () { | |
| var n = this; | |
| this.collection = new d.Cs.Visits(); | |
| this.collection.bind("add", function (o) { | |
| var p = new d.Vs.Visit({ | |
| model: o, | |
| dictionaries: n.dictionaries, | |
| instanceId: n.options.instanceId | |
| }); | |
| o.bind("sync", n.renderData, n); | |
| p3.rV(p, this.$("#visits"), false) | |
| }, this) | |
| }, | |
| events: { | |
| "click a.toggleLink": "toggleSection", | |
| "click button.create": "createVisit" | |
| }, | |
| render: function (n) { | |
| var p = this, | |
| o = 0; | |
| $(n).append(p.el); | |
| p.dictionaries = { | |
| ADMVisitTypes: h.DictionaryData.ADMVisitTypes, | |
| dictionary_102: { | |
| id: 102, | |
| keyName: "user_id", | |
| valueName: "user_name", | |
| inputParam: "@admissions_staff_id=null,@onBoard_ind=1[i]", | |
| dictionary: {} | |
| } | |
| }; | |
| _.each(p.dictionaries, function (q) { | |
| var r = new j.Cs.Dictionary(); | |
| r.fetch({ | |
| data: { | |
| dictionaryId: q.id, | |
| key: q.keyName, | |
| value: q.valueName, | |
| inputParam: q.inputParam | |
| }, | |
| success: function (s) { | |
| q.dictionary = s.toJSON(); | |
| o++; | |
| if (o === _.size(p.dictionaries)) { | |
| p.renderData() | |
| } | |
| } | |
| }) | |
| }) | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| n.collection.reset(); | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({})); | |
| n.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| prospectInstanceId: n.options.instanceId | |
| } | |
| }) | |
| }) | |
| }, | |
| toggleSection: function (n) { | |
| d.Us.ToggleSection(n) | |
| }, | |
| createVisit: function () { | |
| var n = this; | |
| if (p3.Data.Context.findByTaskId(53624)) { | |
| a.Us.AddVisit(null, n.options.instanceId) | |
| } else { | |
| d.Us.ChecklistDictionaryGet(n.options.instanceId, 12, null, function (o) { | |
| n.dictionaries.dictionary_127 = o.dictionary_127; | |
| n.dictionaries.dictionary_128 = o.dictionary_128; | |
| var p = new d.Ms.Visit({ | |
| prospectInstanceId: n.options.instanceId, | |
| VisitType: { | |
| "$type": "clBLL.nAdmissions.VisitType, clBLL" | |
| }, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }); | |
| p.bind("sync", n.renderData, n); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new c.Vs.Modal({ | |
| template: "candidate/candidate.record.visit.edit.template.html", | |
| model: p, | |
| dictionaries: n.dictionaries | |
| }), p3.Layout.Containers.Modal, true) | |
| }) | |
| } | |
| } | |
| }); | |
| d.Vs.Visit = Bb.View.extend({ | |
| template: "candidate/candidate.record.visit.template.html", | |
| tagName: "tr", | |
| initialize: function () { | |
| this.model.bind("destroy", this.deleteElement, this); | |
| this.model.bind("remove", this.deleteElement, this) | |
| }, | |
| events: { | |
| "click .edit": "editVisit", | |
| "click .delete": "deleteVisit", | |
| "click .togglebutton": "toggleInfo" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var p = this, | |
| n = p.model.get("AttachmentFile"), | |
| o = p.model.get("Comment") || (n && n.hasOwnProperty("Attachment") && n.Attachment.length > 0); | |
| p3.fT(p.template, function (q) { | |
| p.$el.html(q({ | |
| model: p.model.toJSON(), | |
| hasSlider: o, | |
| dictionaries: p.options.dictionaries | |
| })) | |
| }) | |
| }, | |
| toggleInfo: function (n) { | |
| d.Us.ToggleComments(this, n) | |
| }, | |
| editVisit: function () { | |
| var n = this; | |
| if (p3.Data.Context.findByTaskId(53624)) { | |
| a.Us.EditVisit(n.model.get("VisitId"), n.model.get("ProspectInstanceId")) | |
| } else { | |
| d.Us.ChecklistDictionaryGet(n.options.instanceId, 12, n.model.get("VisitId"), function (o) { | |
| n.options.dictionaries.dictionary_127 = o.dictionary_127; | |
| n.options.dictionaries.dictionary_128 = o.dictionary_128; | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| n.model.fetch({ | |
| data: { | |
| prospectInstanceId: n.model.get("ProspectInstanceId") | |
| }, | |
| cache: false, | |
| success: function (p, q) { | |
| p3.rV(new c.Vs.Modal({ | |
| template: "candidate/candidate.record.visit.edit.template.html", | |
| model: n.model, | |
| dictionaries: n.options.dictionaries | |
| }), p3.Layout.Containers.Modal, true) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading visit") | |
| } | |
| }) | |
| }) | |
| } | |
| }, | |
| deleteVisit: function (n) { | |
| a.Us.DeleteAppointment(this.model) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| d.Vs.Interviews = Bb.View.extend({ | |
| template: "candidate/candidate.record.interviews.template.html", | |
| initialize: function () { | |
| var n = this; | |
| this.collection = new d.Cs.Interviews(); | |
| this.collection.bind("add", function (p) { | |
| var o = new d.Vs.Interview({ | |
| model: p, | |
| dictionaries: n.dictionaries, | |
| instanceId: n.options.instanceId | |
| }); | |
| p.bind("sync", n.renderData, n); | |
| p3.rV(o, this.$("#interviews"), false) | |
| }, this) | |
| }, | |
| events: { | |
| "click a.toggleLink": "toggleSection", | |
| "click button.create": "createInterview" | |
| }, | |
| render: function (n) { | |
| var p = this, | |
| o = 0; | |
| $(n).append(p.el); | |
| p.dictionaries = { | |
| ADMInterviewTypes: h.DictionaryData.ADMInterviewTypes, | |
| dictionary_102: { | |
| id: 102, | |
| keyName: "user_id", | |
| valueName: "user_name", | |
| inputParam: "@admissions_staff_id=null,@onBoard_ind=1[i]", | |
| dictionary: {} | |
| } | |
| }; | |
| _.each(p.dictionaries, function (q) { | |
| var r = new j.Cs.Dictionary(); | |
| r.fetch({ | |
| data: { | |
| dictionaryId: q.id, | |
| key: q.keyName, | |
| value: q.valueName, | |
| inputParam: q.inputParam | |
| }, | |
| success: function (s) { | |
| q.dictionary = s.toJSON(); | |
| o++; | |
| if (o === _.size(p.dictionaries)) { | |
| p.renderData() | |
| } | |
| } | |
| }) | |
| }) | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| n.collection.reset(); | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({})); | |
| n.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| prospectInstanceId: n.options.instanceId | |
| } | |
| }) | |
| }) | |
| }, | |
| toggleSection: function (n) { | |
| d.Us.ToggleSection(n) | |
| }, | |
| createInterview: function () { | |
| var n = this; | |
| if (p3.Data.Context.findByTaskId(53624)) { | |
| a.Us.AddInterview(null, n.options.instanceId) | |
| } else { | |
| d.Us.ChecklistDictionaryGet(n.options.instanceId, 7, null, function (o) { | |
| n.dictionaries.dictionary_127 = o.dictionary_127; | |
| n.dictionaries.dictionary_128 = o.dictionary_128; | |
| var p = new d.Ms.Interview({ | |
| ProspectInstanceId: n.options.instanceId, | |
| InterviewType: { | |
| "$type": "clBLL.nAdmissions.InterviewType, clBLL" | |
| }, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }); | |
| p.bind("sync", n.renderData, n); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new c.Vs.Modal({ | |
| template: "candidate/candidate.record.interview.edit.template.html", | |
| model: p, | |
| dictionaries: n.dictionaries | |
| }), p3.Layout.Containers.Modal, true) | |
| }) | |
| } | |
| } | |
| }); | |
| d.Vs.Interview = Bb.View.extend({ | |
| template: "candidate/candidate.record.interview.template.html", | |
| tagName: "tr", | |
| initialize: function () { | |
| var n = this; | |
| n.model.bind("destroy", n.deleteElement, n); | |
| n.model.bind("remove", n.deleteElement, n) | |
| }, | |
| events: { | |
| "click .edit": "editInterview", | |
| "click .delete": "deleteInterview", | |
| "click .togglebutton": "toggleInfo" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var p = this, | |
| n = p.model.get("AttachmentFile"), | |
| o = p.model.get("Comment") || (n && n.hasOwnProperty("Attachment") && n.Attachment.length > 0); | |
| p3.fT(p.template, function (q) { | |
| p.$el.html(q({ | |
| model: p.model.toJSON(), | |
| hasSlider: o, | |
| dictionaries: p.options.dictionaries | |
| })) | |
| }) | |
| }, | |
| toggleInfo: function (n) { | |
| d.Us.ToggleComments(this, n) | |
| }, | |
| editInterview: function () { | |
| var n = this; | |
| if (p3.Data.Context.findByTaskId(53624)) { | |
| a.Us.EditInterview(n.model.get("InterviewId"), n.model.get("ProspectInstanceId")) | |
| } else { | |
| d.Us.ChecklistDictionaryGet(n.options.instanceId, 7, n.model.get("InterviewId"), function (o) { | |
| n.options.dictionaries.dictionary_127 = o.dictionary_127; | |
| n.options.dictionaries.dictionary_128 = o.dictionary_128; | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| n.model.fetch({ | |
| data: { | |
| prospectInstanceId: n.model.get("ProspectInstanceId") | |
| }, | |
| cache: false, | |
| success: function () { | |
| p3.rV(new c.Vs.Modal({ | |
| template: "candidate/candidate.record.interview.edit.template.html", | |
| model: n.model, | |
| dictionaries: n.options.dictionaries | |
| }), p3.Layout.Containers.Modal, true) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading interview") | |
| } | |
| }) | |
| }) | |
| } | |
| }, | |
| deleteInterview: function (n) { | |
| a.Us.DeleteAppointment(this.model) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| d.Vs.Recommendations = Bb.View.extend({ | |
| template: "candidate/candidate.record.recommendations.template.html", | |
| initialize: function () { | |
| var n = this; | |
| this.collection = new d.Cs.Recommendations(); | |
| this.collection.bind("add", function (o) { | |
| var p = new d.Vs.Recommendation({ | |
| model: o, | |
| dictionaries: n.dictionaries, | |
| instanceId: n.options.instanceId | |
| }); | |
| o.bind("sync", n.renderData, n); | |
| p3.rV(p, this.$("#recommendations"), false) | |
| }, this) | |
| }, | |
| events: { | |
| "click a.toggleLink": "toggleSection", | |
| "click button.create": "createRecommendation" | |
| }, | |
| render: function (n) { | |
| var p = this, | |
| o = 0; | |
| $(n).append(p.el); | |
| p.dictionaries = { | |
| dictionary_123: { | |
| id: 123, | |
| inputParam: [], | |
| dictionary: {} | |
| }, | |
| ADMReferenceTypes: h.DictionaryData.ADMReferenceTypes, | |
| dictionary_20: { | |
| id: 20, | |
| keyName: "country_code", | |
| valueName: "country_name", | |
| inputParam: [], | |
| dictionary: {} | |
| } | |
| }; | |
| _.each(p.dictionaries, function (q) { | |
| var r = new j.Cs.Dictionary(); | |
| r.fetch({ | |
| data: { | |
| dictionaryId: q.id, | |
| key: q.keyName, | |
| value: q.valueName, | |
| inputParam: q.inputParam | |
| }, | |
| success: function (s) { | |
| q.dictionary = s.toJSON(); | |
| o++; | |
| if (o === _.size(p.dictionaries)) { | |
| p.renderData() | |
| } | |
| } | |
| }) | |
| }) | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| n.collection.reset(); | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({})); | |
| n.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| prospectInstanceId: n.options.instanceId | |
| } | |
| }) | |
| }) | |
| }, | |
| toggleSection: function (n) { | |
| d.Us.ToggleSection(n) | |
| }, | |
| createRecommendation: function () { | |
| var n = this; | |
| d.Us.ChecklistDictionaryGet(n.options.instanceId, 4, null, function (o) { | |
| n.dictionaries.dictionary_127 = o.dictionary_127; | |
| n.dictionaries.dictionary_128 = o.dictionary_128; | |
| var p = new d.Ms.Recommendation({ | |
| ProspectInstanceId: n.options.instanceId, | |
| ReferenceType: { | |
| "$type": "clBLL.nAdmissions.ReferenceType, clBLL" | |
| }, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }); | |
| p.bind("sync", n.renderData, n); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new c.Vs.Modal({ | |
| template: "candidate/candidate.record.recommendation.edit.template.html", | |
| model: p, | |
| dictionaries: n.dictionaries | |
| }), p3.Layout.Containers.Modal, true) | |
| }) | |
| } | |
| }); | |
| d.Vs.Recommendation = Bb.View.extend({ | |
| template: "candidate/candidate.record.recommendation.template.html", | |
| tagName: "tr", | |
| initialize: function () { | |
| this.model.bind("destroy", this.deleteElement, this); | |
| this.model.bind("remove", this.deleteElement, this) | |
| }, | |
| events: { | |
| "click .togglebutton": "toggleInfo", | |
| "click .edit": "editRecommendation", | |
| "click .delete": "deleteRecommendation" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var p = this, | |
| n = p.model.get("AttachmentFile"), | |
| o = p.model.get("Comment") || (n && n.hasOwnProperty("Attachment") && n.Attachment.length > 0); | |
| p3.fT(p.template, function (q) { | |
| p.$el.html(q({ | |
| model: p.model.toJSON(), | |
| hasSlider: o, | |
| dictionaries: p.options.dictionaries | |
| })) | |
| }) | |
| }, | |
| toggleInfo: function (n) { | |
| d.Us.ToggleComments(this, n) | |
| }, | |
| editRecommendation: function () { | |
| var n = this; | |
| d.Us.ChecklistDictionaryGet(n.options.instanceId, 4, n.model.get("ReferenceId"), function (o) { | |
| n.options.dictionaries.dictionary_127 = o.dictionary_127; | |
| n.options.dictionaries.dictionary_128 = o.dictionary_128; | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new c.Vs.Modal({ | |
| template: "candidate/candidate.record.recommendation.edit.template.html", | |
| model: n.model, | |
| dictionaries: n.options.dictionaries | |
| }), p3.Layout.Containers.Modal, true) | |
| }) | |
| }, | |
| deleteRecommendation: function (n) { | |
| var o = this; | |
| p3.showConfirm("Delete Recommendation", "Wait a minute. Are you really sure you want to delete this recommendation information?", null, function () { | |
| o.model.destroy({ | |
| dataParam: { | |
| prospectInstanceId: o.options.instanceId | |
| } | |
| }) | |
| }) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| d.Vs.TestScores = Bb.View.extend({ | |
| template: "admissions/candidate.detail.profile.testscores.template.html", | |
| initialize: function () { | |
| var n = this; | |
| this.collection = new d.Cs.TestScores(); | |
| this.collection.bind("add", function (o) { | |
| var p = new d.Vs.TestScore({ | |
| model: o, | |
| dictionaries: n.dictionaries, | |
| userId: n.options.userId, | |
| instanceId: n.options.instanceId | |
| }); | |
| o.bind("sync", n.renderData, n); | |
| p3.rV(p, this.$("#testscores"), false) | |
| }, this) | |
| }, | |
| events: { | |
| "click a.toggleLink": "toggleSection", | |
| "click button.create": "createTestScore" | |
| }, | |
| render: function (n) { | |
| var p = this, | |
| o = 0; | |
| $(n).append(p.el); | |
| p.dictionaries = { | |
| dictionary_105: { | |
| id: 105, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| inputParam: [], | |
| dictionary: {} | |
| }, | |
| dictionary_102: { | |
| id: 102, | |
| keyName: "user_id", | |
| valueName: "user_name", | |
| inputParam: "@admissions_staff_id=null,@onBoard_ind=1[i]", | |
| dictionary: {} | |
| } | |
| }; | |
| _.each(p.dictionaries, function (q) { | |
| var r = new j.Cs.Dictionary(); | |
| r.fetch({ | |
| data: { | |
| dictionaryId: q.id, | |
| key: q.keyName, | |
| value: q.valueName, | |
| inputParam: q.inputParam | |
| }, | |
| success: function (s) { | |
| q.dictionary = s.toJSON(); | |
| o++; | |
| if (o === _.size(p.dictionaries)) { | |
| p.renderData() | |
| } | |
| } | |
| }) | |
| }) | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| n.collection.reset(); | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({})); | |
| n.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| userId: n.options.userId | |
| } | |
| }) | |
| }) | |
| }, | |
| toggleSection: function (n) { | |
| d.Us.ToggleSection(n) | |
| }, | |
| createTestScore: function () { | |
| var n = this; | |
| d.Us.ChecklistDictionaryGet(n.options.instanceId, 2, null, function (o) { | |
| n.dictionaries.dictionary_127 = o.dictionary_127; | |
| n.dictionaries.dictionary_128 = o.dictionary_128; | |
| var p = new d.Ms.TestScore({ | |
| userId: n.options.userId, | |
| prospectInstanceId: n.options.instanceId, | |
| Test: { | |
| "$type": "clBLL.nAdmissions.Test, clBLL" | |
| }, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }); | |
| p.bind("sync", n.renderData, n); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new c.Vs.Modal({ | |
| template: "admissions/candidate.detail.profile.testscore.edit.template.html", | |
| model: p, | |
| dictionaries: n.dictionaries | |
| }), p3.Layout.Containers.Modal, true) | |
| }) | |
| } | |
| }); | |
| d.Vs.TestScore = Bb.View.extend({ | |
| template: "admissions/candidate.detail.profile.testscore.template.html", | |
| tagName: "tr", | |
| initialize: function () { | |
| this.model.bind("destroy", this.deleteElement, this); | |
| this.model.bind("remove", this.deleteElement, this) | |
| }, | |
| events: { | |
| "click .edit": "editTestScore", | |
| "click .delete": "deleteTestScore", | |
| "click .togglebutton": "toggleInfo" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var p = this, | |
| n = p.model.get("AttachmentFile"), | |
| o = p.model.get("Comment") || (n && n.hasOwnProperty("Attachment") && n.Attachment.length > 0); | |
| p3.fT(p.template, function (q) { | |
| p.$el.html(q({ | |
| model: p.model.toJSON(), | |
| hasSlider: o, | |
| dictionaries: p.options.dictionaries | |
| })) | |
| }) | |
| }, | |
| toggleInfo: function (n) { | |
| d.Us.ToggleComments(this, n) | |
| }, | |
| editTestScore: function () { | |
| var n = this; | |
| d.Us.ChecklistDictionaryGet(n.options.instanceId, 2, n.model.get("TestScoreId"), function (o) { | |
| n.options.dictionaries.dictionary_127 = o.dictionary_127; | |
| n.options.dictionaries.dictionary_128 = o.dictionary_128; | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new c.Vs.Modal({ | |
| template: "admissions/candidate.detail.profile.testscore.edit.template.html", | |
| model: n.model, | |
| dictionaries: n.options.dictionaries | |
| }), p3.Layout.Containers.Modal, true) | |
| }) | |
| }, | |
| deleteTestScore: function (n) { | |
| var o = this; | |
| p3.showConfirm("Delete Test Score", "Wait a minute. Are you really sure you want to delete this test score information?", null, function () { | |
| o.model.destroy({ | |
| dataParam: { | |
| userId: o.options.userId | |
| } | |
| }) | |
| }) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| d.Vs.Interests = Bb.View.extend({ | |
| template: "admissions/candidate.detail.profile.interests.template.html", | |
| initialize: function () { | |
| var n = this; | |
| n.collection = new d.Cs.Interests() | |
| }, | |
| events: { | |
| "click .togglebutton": "toggleInfo", | |
| "click #manageInterests": "manage" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| n.collection.reset(); | |
| p3.fT(n.template, function (o) { | |
| n.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| userId: n.options.userId | |
| }, | |
| success: function (p) { | |
| n.$el.html(o({ | |
| collection: n.collection | |
| })) | |
| } | |
| }) | |
| }) | |
| }, | |
| toggleInfo: function (o) { | |
| var n = $(o.currentTarget); | |
| o.preventDefault(); | |
| o.stopPropagation(); | |
| n.closest("tr").next("tr").find(".toggleinfo").slideToggle("fast"); | |
| d.Us.SwapChevronClass(n); | |
| d.Us.SwapActiveClass(n) | |
| }, | |
| manage: function () { | |
| var o = this, | |
| n = { | |
| userId: o.options.userId, | |
| returnModel: true | |
| }; | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new d.Vs.ManageInterestsModal({ | |
| template: "admissions/candidate.detail.profile.interests.manage.template.html", | |
| collection: o.collection, | |
| layoutView: o.options.layoutView, | |
| interestsView: o, | |
| dataParam: n | |
| }), p3.Layout.Containers.Modal, true) | |
| } | |
| }); | |
| d.Vs.Interest = Bb.View.extend({ | |
| template: "admissions/candidate.detail.profile.interest.template.html", | |
| tagName: "tr", | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({ | |
| model: n.model.toJSON(), | |
| dictionaries: n.options.dictionaries | |
| })) | |
| }) | |
| } | |
| }); | |
| d.Vs.ManageInterestsModal = Bb.View.extend({ | |
| initialize: function (n) { | |
| var o = this; | |
| o.collection.defaults = o.collection.toJSON() | |
| }, | |
| events: { | |
| "click button.cancel": "cancelCollection", | |
| "click button.save": "saveCollection", | |
| "click a.toggleLink": "toggleSection" | |
| }, | |
| render: function (n) { | |
| $(n).append(this.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| p3.fT(n.options.template, function (p) { | |
| var o = {}; | |
| o.collection = n.collection; | |
| o.access = n.options.access; | |
| o.layoutView = n.options.layoutView; | |
| o.dictionaries = n.options.dictionaries; | |
| n.$el.html(p(o)); | |
| $(".required-indicator").tooltip(); | |
| _.each(n.collection.models, function (r) { | |
| var q = new d.Vs.InterestEdit({ | |
| model: r, | |
| layoutView: n.options.layoutView | |
| }); | |
| p3.rV(q, n.$(".detail-" + q.model.get("CategoryId")), false) | |
| }) | |
| }) | |
| }, | |
| toggleSection: function (n) { | |
| $(n.currentTarget).siblings(".toggledetail").slideToggle("fast", function () { | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }); | |
| return false | |
| }, | |
| cancelCollection: function () { | |
| this.collection.reset(this.collection.defaults) | |
| }, | |
| saveCollection: function () { | |
| var p = this, | |
| o = true, | |
| n = p.$(".save"); | |
| n.button("loading"); | |
| _.each(p.collection.models, function (q) { | |
| q.isValid(true); | |
| if (!q.isValid(true)) { | |
| o = false | |
| } | |
| }); | |
| if (o) { | |
| p.collection.save({ | |
| dataParam: p.options.dataParam, | |
| success: function (q, r, s) { | |
| $(p.options.interestsView.el).find(".detail").empty(); | |
| p.options.interestsView.renderData(); | |
| p3.Layout.Containers.Modal.modal("hide") | |
| }, | |
| error: function (r, q) { | |
| n.button("reset") | |
| } | |
| }) | |
| } else { | |
| n.button("reset") | |
| } | |
| } | |
| }); | |
| d.Vs.InterestEdit = Bb.View.extend({ | |
| template: "admissions/candidate.detail.profile.interest.edit.template.html", | |
| tagName: "tr", | |
| initialize: function () { | |
| var n = this; | |
| Bb.Validation.bind(n, { | |
| forceUpdate: true, | |
| selector: "id" | |
| }) | |
| }, | |
| events: { | |
| "change textarea": "updateModel", | |
| "change input": "updateModel", | |
| "change select": "updateModel", | |
| "change .interestOption": "checkShown", | |
| "keyup textarea": "updateCharacterCounter", | |
| checkshown: "checkShown" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(this.el); | |
| p3.fT(o.template, function (q) { | |
| o.$el.html(q({ | |
| model: o.model.toJSON(), | |
| userId: o.options.layoutView.userId | |
| })); | |
| o.$("textarea#CommentCandidate").trigger(jQuery.Event("keyup")); | |
| o.$("textarea#CommentSchool").trigger(jQuery.Event("keyup")); | |
| var p = false; | |
| _.each(o.$(".interestOption"), function (r) { | |
| if ($(r).prop("type") === "checkbox") { | |
| if (m.stringToBoolean($(r).prop("checked")) === true) { | |
| p = true | |
| } | |
| } else { | |
| if ($(r).val() != "") { | |
| p = true | |
| } | |
| } | |
| }); | |
| if (m.stringToBoolean(p) === true) { | |
| o.$(".interestCheckbox").prop("disabled", "disabled") | |
| } else { | |
| o.$(".interestCheckbox").prop("disabled", "") | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| checkShown: function (n) { | |
| n.stopPropagation(); | |
| var q = this, | |
| p = $(n.currentTarget).closest("table"), | |
| o = false; | |
| _.each(p.find(".interestOption"), function (r) { | |
| if ($(r).prop("type") === "checkbox") { | |
| if (m.stringToBoolean($(r).prop("checked")) === true) { | |
| o = true | |
| } | |
| } else { | |
| if ($(r).val() != "") { | |
| o = true | |
| } | |
| } | |
| }); | |
| if (m.stringToBoolean(o) === true) { | |
| p.find(".interestCheckbox").prop("disabled", "disabled"); | |
| p.find(".interestCheckbox").prop("checked", "checked"); | |
| q.model.get("Interest").InterestShown = true | |
| } else { | |
| p.find(".interestCheckbox").prop("disabled", "") | |
| } | |
| }, | |
| updateCharacterCounter: function (o) { | |
| var p = this, | |
| n = p.$(o.currentTarget); | |
| o.stopPropagation(); | |
| o.preventDefault(); | |
| n.siblings("p").find(".characterCounter").html(n.val().length); | |
| if (n.val().length > 2000) { | |
| n.siblings("p").find(".characterCounter").addClass("badge-important") | |
| } else { | |
| n.siblings("p").find(".characterCounter").removeClass("badge-important") | |
| } | |
| }, | |
| updateModel: function (o) { | |
| var p = $(o.currentTarget), | |
| t, n = {}, | |
| q = p.prop("id").split("."), | |
| s, r, u; | |
| if (p.prop("type") === "checkbox") { | |
| t = p.prop("checked") | |
| } else { | |
| if (p.hasClass("date-input")) { | |
| if (p.siblings().hasClass("time-input")) { | |
| s = p.siblings(".time-input").prop("value"); | |
| r = p.prop("value"); | |
| t = r + " " + s | |
| } else { | |
| t = p.prop("value") | |
| } | |
| } else { | |
| if (p.hasClass("time-input")) { | |
| if (p.siblings().hasClass("date-input")) { | |
| r = p.siblings(".date-input").prop("value"); | |
| s = p.prop("value"); | |
| t = r + " " + s | |
| } else { | |
| t = p.prop("value") | |
| } | |
| } else { | |
| if (p.hasClass("url-input") && (p.prop("value") != "")) { | |
| u = /((http[s]?):\/\/|mailto:)/; | |
| t = !u.test(p.prop("value")) ? "http://" + p.prop("value") : p.prop("value") | |
| } else { | |
| if (p.prop("value") === "true") { | |
| t = true | |
| } else { | |
| if (p.prop("value") === "false") { | |
| t = false | |
| } else { | |
| t = p.prop("value") | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| if (q.length < 2) { | |
| n[q[0]] = t; | |
| this.model.set(n) | |
| } else { | |
| this.model.get(q[0])[q[1]] = t; | |
| if (this.model.isValid(p.prop("id"))) { | |
| Bb.Validation.callbacks.valid(this, p.prop("id"), "id") | |
| } else { | |
| Bb.Validation.callbacks.invalid(this, p.prop("id"), "Entered value contains an error.", "id") | |
| } | |
| } | |
| } | |
| }); | |
| d.Vs.Events = Bb.View.extend({ | |
| template: "candidate/candidate.record.events.template.html", | |
| initialize: function () { | |
| var n = this; | |
| this.collection = new d.Cs.Events(); | |
| this.collection.bind("add", function (p) { | |
| var o = new d.Vs.Event({ | |
| model: p, | |
| dictionaries: n.dictionaries, | |
| instanceId: n.options.instanceId | |
| }); | |
| p.bind("sync", n.renderData, n); | |
| p3.rV(o, this.$("#events"), false) | |
| }, this) | |
| }, | |
| events: { | |
| "click a.toggleLink": "toggleSection", | |
| "click button.create": "createEvent" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| j.Us.Fetch({ | |
| ADMEventTypes: { | |
| data: new j.Cs.Dictionary(), | |
| dataParams: h.DictionaryData.ADMEventTypes | |
| } | |
| }, function (p, r, q) { | |
| if (q) { | |
| p3.displayError("There was an error loading event data.") | |
| } | |
| o.dictionaries = p; | |
| o.renderData() | |
| }) | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| n.collection.reset(); | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({})); | |
| n.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| prospectInstanceId: n.options.instanceId | |
| } | |
| }) | |
| }) | |
| }, | |
| toggleSection: function (n) { | |
| d.Us.ToggleSection(n) | |
| }, | |
| createEvent: function () { | |
| var n = this; | |
| d.Us.ChecklistDictionaryGet(n.options.instanceId, 17, null, function (o) { | |
| var p, q; | |
| n.dictionaries.dictionary_127 = o.dictionary_127; | |
| n.dictionaries.dictionary_128 = o.dictionary_128; | |
| p = new d.Ms.Event({ | |
| prospectInstanceId: n.options.instanceId, | |
| EventType: { | |
| "$type": "clBLL.nAdmissions.EventType, clBLL" | |
| } | |
| }); | |
| p.bind("sync", n.renderData, n); | |
| q = new d.Vs.EventEditModal({ | |
| model: p, | |
| dictionaries: n.dictionaries | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(q, p3.Layout.Containers.Modal, true) | |
| }) | |
| } | |
| }); | |
| d.Vs.Event = Bb.View.extend({ | |
| template: "candidate/candidate.record.event.template.html", | |
| tagName: "tr", | |
| events: { | |
| "click .edit": "editEvent", | |
| "click .delete": "deleteEvent", | |
| "click .togglebutton": "toggleInfo" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({ | |
| model: n.model.toJSON(), | |
| dictionaries: n.options.dictionaries | |
| })) | |
| }) | |
| }, | |
| toggleInfo: function (n) { | |
| d.Us.ToggleComments(this, n) | |
| }, | |
| editEvent: function () { | |
| var n = this; | |
| d.Us.ChecklistDictionaryGet(n.options.instanceId, 17, n.model.get("EventId"), function (o) { | |
| n.options.dictionaries.dictionary_127 = o.dictionary_127; | |
| n.options.dictionaries.dictionary_128 = o.dictionary_128; | |
| var p = new d.Vs.EventEditModal({ | |
| model: n.model, | |
| dictionaries: n.options.dictionaries | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(p, p3.Layout.Containers.Modal, true) | |
| }) | |
| }, | |
| deleteEvent: function (n) { | |
| var o = this; | |
| p3.showConfirm("Delete Event", "Wait a minute. Are you really sure you want to delete this event information?", null, function () { | |
| var p = { | |
| prospectInstanceId: o.options.instanceId | |
| }; | |
| o.model.destroy({ | |
| dataParam: p, | |
| success: function () { | |
| o.deleteElement() | |
| }, | |
| error: function () { | |
| p3.displayError("There was an error deleting this event.") | |
| } | |
| }) | |
| }) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| d.Vs.EventEditModal = k.Vs.Modal2.extend({ | |
| template: "candidate/candidate.record.event.edit.template.html", | |
| events: { | |
| "keyup textarea": "updateCharacterCounter", | |
| 'change select[name="ChecklistItemId"]': "toggleChecklistStatus" | |
| }, | |
| modalRendered: function (o) { | |
| var n = this; | |
| f.Us.initialize(".date-input", { | |
| yearRange: "-20:+2" | |
| }); | |
| l.Us.initialize(".time-input"); | |
| if (n.$('[name="ChecklistItemId"] option:selected').val() != "") { | |
| n.$(".checklist-status").removeClass("hide") | |
| } | |
| }, | |
| updateCharacterCounter: function (o) { | |
| var p = this, | |
| n = p.$(o.currentTarget); | |
| o.stopPropagation(); | |
| o.preventDefault(); | |
| n.siblings("p").find(".characterCounter").html(n.val().length); | |
| if (n.val().length > 4000) { | |
| n.siblings("p").find(".characterCounter").addClass("badge-important") | |
| } else { | |
| n.siblings("p").find(".characterCounter").removeClass("badge-important") | |
| } | |
| }, | |
| toggleChecklistStatus: function (n) { | |
| var o = this; | |
| if (o.$(n.target).prop("value") == "") { | |
| o.$('[name="ChecklistItemId"]').val(""); | |
| o.$(".checklist-status").addClass("hide") | |
| } else { | |
| o.$(".checklist-status").removeClass("hide") | |
| } | |
| }, | |
| modalSavedSuccess: function () { | |
| var n = this; | |
| n.trigger("modelSaved") | |
| } | |
| }); | |
| d.Vs.MiscellaneousFiles = Bb.View.extend({ | |
| template: "candidate/candidate.record.miscellaneous.files.template.html", | |
| initialize: function () { | |
| var n = this; | |
| this.collection = new d.Cs.MiscellaneousFiles(); | |
| this.collection.bind("add", function (p) { | |
| var o = new d.Vs.MiscellaneousFile({ | |
| model: p | |
| }); | |
| p.bind("sync", n.renderData, n); | |
| p3.rV(o, this.$("#miscellaneous-files"), false) | |
| }, this) | |
| }, | |
| events: { | |
| "click button.create": "createMiscFile" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| o.renderData() | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| n.collection.reset(); | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({})); | |
| n.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| prospectInstanceId: n.options.instanceId | |
| } | |
| }) | |
| }) | |
| }, | |
| createMiscFile: function () { | |
| var q = this, | |
| o, p, n = []; | |
| o = new d.Ms.MiscellaneousFile(); | |
| o.bind("sync", q.renderData, q); | |
| d.Us.ChecklistDictionaryGet(q.options.instanceId, 18, null, function (r) { | |
| n.dictionary_127 = r.dictionary_127; | |
| n.dictionary_128 = r.dictionary_128; | |
| j.Us.Fetch({ | |
| FileTypes: { | |
| data: new j.Cs.Dictionary(), | |
| dataParams: h.DictionaryData.ProspectFileType | |
| } | |
| }, function (s, u, t) { | |
| if (t) { | |
| p3.displayError("There was an error loading data.") | |
| } | |
| if (u) { | |
| p = new d.Vs.MiscellaneousFileModal({ | |
| model: o, | |
| dictionaries: Object.assign({}, s, n), | |
| ProspectInstanceId: q.options.instanceId | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(p, p3.Layout.Containers.Modal, true) | |
| } | |
| }) | |
| }) | |
| } | |
| }); | |
| d.Vs.MiscellaneousFile = Bb.View.extend({ | |
| template: "candidate/candidate.record.miscellaneous.file.template.html", | |
| tagName: "tr", | |
| initialize: function () { | |
| this.model.bind("destroy", this.deleteElement, this); | |
| this.model.bind("remove", this.deleteElement, this) | |
| }, | |
| events: { | |
| "click .togglebutton": "toggleInfo", | |
| "click .edit": "editMiscFile", | |
| "click .delete": "deleteMiscFile" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| o.renderData() | |
| }, | |
| renderData: function () { | |
| var p = this, | |
| n = p.model.get("AttachmentFile"), | |
| o = p.model.get("Comment") || (n && n.hasOwnProperty("Attachment") && n.Attachment.length > 0); | |
| p3.fT(p.template, function (q) { | |
| p.$el.html(q({ | |
| model: p.model.toJSON(), | |
| hasSlider: o | |
| })) | |
| }) | |
| }, | |
| toggleInfo: function (n) { | |
| d.Us.ToggleComments(this, n) | |
| }, | |
| editMiscFile: function () { | |
| var p = this, | |
| o, n = []; | |
| d.Us.ChecklistDictionaryGet(p.model.get("ProspectInstanceId"), 18, p.model.get("ProspectFileId"), function (q) { | |
| n.dictionary_127 = q.dictionary_127; | |
| n.dictionary_128 = q.dictionary_128; | |
| j.Us.Fetch({ | |
| FileTypes: { | |
| data: new j.Cs.Dictionary(), | |
| dataParams: h.DictionaryData.ProspectFileType | |
| } | |
| }, function (r, t, s) { | |
| if (s) { | |
| p3.displayError("There was an error loading data.") | |
| } | |
| if (t) { | |
| o = new d.Vs.MiscellaneousFileModal({ | |
| model: p.model, | |
| dictionaries: Object.assign({}, r, n), | |
| ProspectInstanceId: p.model.attributes.ProspectInstanceId | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(o, p3.Layout.Containers.Modal, true) | |
| } | |
| }) | |
| }) | |
| }, | |
| deleteMiscFile: function (n) { | |
| var o = this; | |
| p3.showConfirm("Delete Recommendation", "Wait a minute. Are you really sure you want to delete this recommendation information?", null, function () { | |
| o.model.destroy({ | |
| dataParam: { | |
| prospectInstanceId: o.model.attributes.ProspectInstanceId | |
| } | |
| }) | |
| }) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| d.Vs.MiscellaneousFileModal = k.Vs.Modal2.extend({ | |
| template: "candidate/candidate.record.miscellaneous.file.edit.template.html", | |
| events: { | |
| "keyup textarea": "updateCharacterCounter", | |
| 'change select[name="ChecklistItemId"]': "toggleChecklistStatus", | |
| "click .attachment-delete": "deleteAttachment" | |
| }, | |
| modalRendered: function () { | |
| var n = this; | |
| _.each(n.$("textarea.counter-input"), function (o) { | |
| $(o).trigger($.Event("keyup")) | |
| }); | |
| n.initializeFileUpload_File(); | |
| n.model.attributes.ProspectInstanceId = n.options.ProspectInstanceId | |
| }, | |
| updateCharacterCounter: function (o) { | |
| var p = this, | |
| n = p.$(o.currentTarget); | |
| o.stopPropagation(); | |
| o.preventDefault(); | |
| n.siblings("p").find(".characterCounter").html(n.val().length); | |
| if (n.val().length > 4000) { | |
| n.siblings("p").find(".characterCounter").addClass("badge-important") | |
| } else { | |
| n.siblings("p").find(".characterCounter").removeClass("badge-important") | |
| } | |
| }, | |
| toggleChecklistStatus: function (n) { | |
| var o = this; | |
| if (o.$(n.target).prop("value") == "") { | |
| o.$('[name="ChecklistItemId"]').val(""); | |
| o.$(".checklist-status").addClass("hide") | |
| } else { | |
| o.$(".checklist-status").removeClass("hide") | |
| } | |
| }, | |
| deleteAttachment: function () { | |
| var n = this; | |
| n.model.unset("AttachmentFile"); | |
| n.modalRendered() | |
| }, | |
| modalSavedSuccess: function () { | |
| var n = this; | |
| n.trigger("modelSaved") | |
| } | |
| }); | |
| d.Us.ChecklistDictionaryGet = function (p, r, q, n) { | |
| var o = ""; | |
| if (q) { | |
| o = ",data_collection_pk=" + q + "[i]" | |
| } | |
| g.Us.FetchAll({ | |
| dictionary_127: { | |
| id: 127, | |
| keyName: "checklist_item_id", | |
| valueName: "checklist_item_description", | |
| inputParam: "prospect_instance_id=" + p + "[i],data_collection_type_id=" + r + "[i]" + o | |
| }, | |
| dictionary_128: { | |
| id: 128, | |
| keyName: "item_status_id", | |
| valueName: "item_status_desc", | |
| inputParam: "data_collection_type_id=" + r + "[i]" | |
| } | |
| }, function (s) { | |
| n(s) | |
| }) | |
| }; | |
| d.Us.EditEvent = function (o, q) { | |
| var p, n = new d.Ms.Event({ | |
| EventId: o | |
| }); | |
| n.fetch({ | |
| cache: false, | |
| data: { | |
| prospectInstanceId: q | |
| }, | |
| success: function () { | |
| p = { | |
| ADMEventTypes: { | |
| data: new j.Cs.Dictionary(), | |
| dataParams: h.DictionaryData.ADMEventTypes | |
| } | |
| }; | |
| j.Us.Fetch(p, function (r, t, s) { | |
| d.Us.ChecklistDictionaryGet(q, 17, o, function (u) { | |
| r.dictionary_127 = u.dictionary_127; | |
| r.dictionary_128 = u.dictionary_128; | |
| var v = new d.Vs.EventEditModal({ | |
| model: n, | |
| dictionaries: r | |
| }); | |
| k.Us.renderModal(v) | |
| }) | |
| }) | |
| }, | |
| error: function () { | |
| p3.displayError("Error opening event") | |
| } | |
| }) | |
| }; | |
| d.Us.ToggleComments = function (p, o) { | |
| var n = $(o.currentTarget); | |
| o.stopPropagation(); | |
| o.preventDefault(); | |
| p.$(".toggleinfo").slideToggle("fast"); | |
| d.Us.SwapActiveClass(n); | |
| d.Us.SwapChevronClass(n) | |
| }; | |
| d.Us.ToggleSection = function (o) { | |
| var n = $(o.currentTarget); | |
| o.preventDefault(); | |
| o.stopPropagation(); | |
| n.siblings(".toggledetail").slideToggle("fast"); | |
| d.Us.SwapActiveClass(n) | |
| }; | |
| d.Us.SwapActiveClass = function (n) { | |
| if (n.hasClass("active")) { | |
| n.removeClass("active") | |
| } else { | |
| n.addClass("active") | |
| } | |
| }; | |
| d.Us.SwapChevronClass = function (n) { | |
| if (n.hasClass("fa-chevron-up")) { | |
| n.removeClass("fa-chevron-up"); | |
| n.addClass("fa-chevron-down") | |
| } else { | |
| if (n.hasClass("fa-chevron-down")) { | |
| n.removeClass("fa-chevron-down"); | |
| n.addClass("fa-chevron-up") | |
| } | |
| } | |
| }; | |
| Hb.registerHelper("dictionaryCustom", function (s, p, n) { | |
| var q, r = p["DictionaryCustom_" + n], | |
| o; | |
| if (_.isArray(r)) { | |
| for (o = 0; o < r.length; o++) { | |
| if (s == r[o].dd_id) { | |
| q = r[o].dd_description; | |
| break | |
| } | |
| } | |
| } | |
| return q | |
| }); | |
| Hb.registerHelper("eachDictionaryCustom", function (u, s, n, t) { | |
| var o = "", | |
| v = s["DictionaryCustom_" + n], | |
| p, r, q; | |
| if (_.isArray(v)) { | |
| for (p = 0, r = v.length; p < r; p++) { | |
| q = v[p]; | |
| q.selectedId = u; | |
| o += t.fn(q) | |
| } | |
| } | |
| return o | |
| }) | |
| }(p3.module("admissions/candidateprofile"))); | |
| (function (b) { | |
| var f = p3.module("utilities/smodal"), | |
| e = p3.module("utilities/multifetch"), | |
| h = p3.module("utilities/validate"), | |
| a = p3.module("shared/base"), | |
| c = p3.Us.Enum, | |
| g = p3.Us.Tools, | |
| d = p3.Us.InfoMessageLibrary; | |
| b.Data.SettingType = { | |
| CONNECTION: { | |
| Name: "Connection Types", | |
| Value: 1 | |
| }, | |
| EVENT: { | |
| Name: "Event Types", | |
| Value: 2 | |
| }, | |
| INACTIVATION: { | |
| Name: "Candidate Inactivation Reasons", | |
| Value: 3 | |
| }, | |
| INTERVIEW: { | |
| Name: "Interview Types", | |
| Value: 4 | |
| }, | |
| RECOMMENDATION: { | |
| Name: "Recommendation Types", | |
| Value: 5, | |
| Sub: { | |
| Required: false, | |
| Unique: true | |
| }, | |
| Dictionaries: ["SaoRecommendationType"], | |
| ModalTemplate: "admprofilesettings/admprofilesettings.type.edit.recommendation.template.html", | |
| ModalRowTemplate: "admprofilesettings/admprofilesettings.type.edit.row.recommendation.template.html" | |
| }, | |
| SCHOOLPROGRAM: { | |
| Name: "School Program Types", | |
| Value: 6 | |
| }, | |
| SCHOOL: { | |
| Name: "School Types", | |
| Value: 7 | |
| }, | |
| SPECIALRELATIONSHIP: { | |
| Name: "Special Relationship Types", | |
| Value: 8 | |
| }, | |
| VISIT: { | |
| Name: "Visit Types", | |
| Value: 9 | |
| }, | |
| FINANCIALAID: { | |
| Name: "Financial Aid", | |
| Value: 10 | |
| }, | |
| REASONDECLINED: { | |
| Name: "Reason for Declining", | |
| Value: 11 | |
| }, | |
| FINANCIALAIDDECISIONS: { | |
| Name: "Financial Aid Decisions", | |
| Value: 12, | |
| Sub: { | |
| Required: true, | |
| Unique: false | |
| }, | |
| Dictionaries: ["ADMFinancialAidDecisionType"], | |
| ModalTemplate: "admprofilesettings/admprofilesettings.type.edit.financialaiddecisions.template.html", | |
| ModalRowTemplate: "admprofilesettings/admprofilesettings.type.edit.row.financialaiddecisions.template.html" | |
| }, | |
| VISITPARTICIPANT: { | |
| Name: "Visit Participant Types", | |
| Value: 13 | |
| }, | |
| INTERVIEWPARTICIPANT: { | |
| Name: "Interview Participant Types", | |
| Value: 14 | |
| }, | |
| MISCFILETYPE: { | |
| Name: "Miscellaneous File Types", | |
| Value: 15 | |
| } | |
| }; | |
| b.Ms.ProfileSettingType = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| idAttribute: "ProfileSettingTypeId", | |
| validation: { | |
| ShortDescription: [{ | |
| required: true, | |
| msg: d.P3.RequiredInfoNotEntered | |
| }, { | |
| maxLength: 50 | |
| }], | |
| SubIdentifier: [{ | |
| required: function () { | |
| return _.contains([12], this.get("SettingTypeId")) ? true : false | |
| }, | |
| msg: d.P3.RequiredInfoNotEntered | |
| }, { | |
| fn: function (l, i, j) { | |
| if (_.contains([5], this.get("SettingTypeId"))) { | |
| var k = _.chain(this.collection.toJSON()).pluck("SubIdentifier").compact().countBy().value(); | |
| if (k[l] > 1) { | |
| return "Each SAO recommendation type can only be used once." | |
| } | |
| } | |
| } | |
| }] | |
| } | |
| }); | |
| b.Cs.ProfileSettingTypes = Bbc.extend({ | |
| sync: a.DataParamSync, | |
| model: b.Ms.ProfileSettingType, | |
| url: function () { | |
| return aP + "AdmProfileSettings/AdmProfileSettingTypeList/" | |
| }, | |
| isValid: f.Us.isValidCollection | |
| }); | |
| b.Vs.Layout = Bb.View.extend({ | |
| template: "page/page.12.template.html", | |
| render: function (i) { | |
| var j = this; | |
| p3.setTitle("Candidate Profile Settings"); | |
| $(i).html(j.el); | |
| j.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this; | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({})); | |
| p3.rV(new b.Vs.Main(), i.$(".col-center"), false) | |
| }) | |
| } | |
| }); | |
| b.Vs.Main = Bb.View.extend({ | |
| template: "admprofilesettings/admprofilesettings.main.template.html", | |
| render: function (i) { | |
| var j = this; | |
| $(i).append(j.el); | |
| j.renderData() | |
| }, | |
| renderData: function () { | |
| var j = this, | |
| i; | |
| p3.fT(j.template, function (k) { | |
| j.$el.html(k({})); | |
| i = j.$(".candidate-settings-table tbody"); | |
| p3.rV(new b.Vs.Type({ | |
| collection: new b.Cs.ProfileSettingTypes(), | |
| settingType: b.Data.SettingType.INACTIVATION | |
| }), i, false); | |
| p3.rV(new b.Vs.Type({ | |
| collection: new b.Cs.ProfileSettingTypes(), | |
| settingType: b.Data.SettingType.CONNECTION | |
| }), i, false); | |
| p3.rV(new b.Vs.Type({ | |
| collection: new b.Cs.ProfileSettingTypes(), | |
| settingType: b.Data.SettingType.EVENT | |
| }), i, false); | |
| p3.rV(new b.Vs.Type({ | |
| collection: new b.Cs.ProfileSettingTypes(), | |
| settingType: b.Data.SettingType.FINANCIALAID | |
| }), i, false); | |
| p3.rV(new b.Vs.Type({ | |
| collection: new b.Cs.ProfileSettingTypes(), | |
| settingType: b.Data.SettingType.FINANCIALAIDDECISIONS | |
| }), i, false); | |
| p3.rV(new b.Vs.Type({ | |
| collection: new b.Cs.ProfileSettingTypes(), | |
| settingType: b.Data.SettingType.INTERVIEW | |
| }), i, false); | |
| p3.rV(new b.Vs.Type({ | |
| collection: new b.Cs.ProfileSettingTypes(), | |
| settingType: b.Data.SettingType.INTERVIEWPARTICIPANT | |
| }), i, false); | |
| p3.rV(new b.Vs.Type({ | |
| collection: new b.Cs.ProfileSettingTypes(), | |
| settingType: b.Data.SettingType.MISCFILETYPE | |
| }), i, false); | |
| p3.rV(new b.Vs.Type({ | |
| collection: new b.Cs.ProfileSettingTypes(), | |
| settingType: b.Data.SettingType.REASONDECLINED | |
| }), i, false); | |
| p3.rV(new b.Vs.Type({ | |
| collection: new b.Cs.ProfileSettingTypes(), | |
| settingType: b.Data.SettingType.RECOMMENDATION | |
| }), i, false); | |
| p3.rV(new b.Vs.Type({ | |
| collection: new b.Cs.ProfileSettingTypes(), | |
| settingType: b.Data.SettingType.SCHOOLPROGRAM | |
| }), i, false); | |
| p3.rV(new b.Vs.Type({ | |
| collection: new b.Cs.ProfileSettingTypes(), | |
| settingType: b.Data.SettingType.SCHOOL | |
| }), i, false); | |
| p3.rV(new b.Vs.Type({ | |
| collection: new b.Cs.ProfileSettingTypes(), | |
| settingType: b.Data.SettingType.SPECIALRELATIONSHIP | |
| }), i, false); | |
| p3.rV(new b.Vs.Type({ | |
| collection: new b.Cs.ProfileSettingTypes(), | |
| settingType: b.Data.SettingType.VISIT | |
| }), i, false); | |
| p3.rV(new b.Vs.Type({ | |
| collection: new b.Cs.ProfileSettingTypes(), | |
| settingType: b.Data.SettingType.VISITPARTICIPANT | |
| }), i, false) | |
| }) | |
| } | |
| }); | |
| b.Vs.Type = Bb.View.extend({ | |
| template: "admprofilesettings/admprofilesettings.type.template.html", | |
| tagName: "tr", | |
| initialize: function (i) { | |
| var j = this; | |
| j.settingType = j.options.settingType; | |
| j.modalTemplate = j.settingType.ModalTemplate || "admprofilesettings/admprofilesettings.type.edit.template.html"; | |
| j.modalRowTemplate = j.settingType.ModalRowTemplate || "admprofilesettings/admprofilesettings.type.edit.row.template.html" | |
| }, | |
| events: { | |
| "click .edit": "edit", | |
| "click .toggleLink": "toggleSection" | |
| }, | |
| render: function (i) { | |
| var j = this; | |
| j.dictionaries = {}; | |
| j.settingOpen = false; | |
| $(i).append(j.el); | |
| if (j.settingType.Dictionaries) { | |
| _.each(j.settingType.Dictionaries, function (l, k) { | |
| j.dictionaries[l] = { | |
| data: new e.Cs.Dictionary(), | |
| dataParams: c.DictionaryData[l] | |
| } | |
| }); | |
| e.Us.Fetch(j.dictionaries, function (k, m, l) { | |
| j.dictionaries = k; | |
| j.renderData() | |
| }) | |
| } else { | |
| j.renderData() | |
| } | |
| }, | |
| renderData: function () { | |
| var i = this; | |
| p3.fT(i.template, function (j) { | |
| i.collection.fetch({ | |
| data: { | |
| settingTypeId: i.settingType.Value | |
| }, | |
| update: true, | |
| cache: false, | |
| success: function (k, l) { | |
| i.$el.html(j({ | |
| collection: i.collection.toJSON(), | |
| settingName: i.settingType.Name, | |
| settingOpen: i.settingOpen | |
| })) | |
| } | |
| }) | |
| }) | |
| }, | |
| edit: function (i) { | |
| var k = this, | |
| j; | |
| j = f.Vs.Modal2.extend({ | |
| template: k.modalTemplate, | |
| collection: k.collection, | |
| dictionaries: k.dictionaries, | |
| variables: { | |
| settingName: k.settingType.Name | |
| }, | |
| initSortable: function () { | |
| var l = this; | |
| l.$(".ui-sortable").sortable({ | |
| startIndex: 0, | |
| stopIndex: 0, | |
| items: ".sort-drag-block", | |
| axis: "y", | |
| distance: 5, | |
| containment: ".ui-sortable", | |
| appendTo: "#edit-types-holder", | |
| placeholder: "sortable-placeholder", | |
| helper: function (n, o) { | |
| var m = '<table class="table table-striped sort-drag-block-helper"><tbody>' + o.context.outerHTML + "</tbody></table>"; | |
| return m | |
| }, | |
| start: function (m, n) { | |
| this.startIndex = n.item.index() | |
| }, | |
| update: function (m, n) { | |
| this.stopIndex = n.item.index(); | |
| l.collection.models = g.arrayMove(l.collection.models, this.startIndex, this.stopIndex) | |
| } | |
| }).disableSelection() | |
| }, | |
| modalRendered: function (m) { | |
| var l = this; | |
| l.collection.bind("add", function (o) { | |
| var n = new b.Vs.EditType({ | |
| model: o, | |
| selector: l.selector, | |
| template: k.modalRowTemplate, | |
| dictionaries: k.dictionaries | |
| }); | |
| p3.rV(n, l.$(".ui-sortable"), false) | |
| }, l); | |
| l.collection.each(function (o) { | |
| var n = new b.Vs.EditType({ | |
| model: o, | |
| selector: l.selector, | |
| template: k.modalRowTemplate, | |
| dictionaries: k.dictionaries | |
| }); | |
| p3.rV(n, l.$(".ui-sortable"), false) | |
| }); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.jQueryUI, function () { | |
| _.defer(function () { | |
| l.initSortable() | |
| }) | |
| }) | |
| }, | |
| modalUpdate: function (p) { | |
| var n = this, | |
| m, q, l, r, o; | |
| if (p.eventCurrentTarget.hasClass("add")) { | |
| m = true; | |
| q = n.$('[name="ShortDescriptionAdd"]'); | |
| l = n.$('[name="ActiveIndAdd"]'); | |
| r = n.$('[name="SubIdentifierAdd"]'); | |
| n.fieldValid("ShortDescriptionAdd"); | |
| if (q.val() == "") { | |
| n.fieldInvalid("ShortDescriptionAdd", "Required field for adding"); | |
| m = false | |
| } | |
| if (k.settingType.Sub && k.settingType.Sub.Required) { | |
| n.fieldValid("SubIdentifierAdd"); | |
| if (r.val() == "") { | |
| n.fieldInvalid("SubIdentifierAdd", "Required field for adding"); | |
| m = false | |
| } | |
| } | |
| if (m) { | |
| o = { | |
| ShortDescription: q.val(), | |
| ActiveInd: l.hasClass("active"), | |
| LockInd: 0 | |
| }; | |
| if (k.settingType.Sub) { | |
| o.SubIdentifier = g.stringToInt(r.val()) | |
| } | |
| n.collection.add(o); | |
| q.val(""); | |
| if (k.settingType.Sub) { | |
| r.val("") | |
| } | |
| } | |
| return false | |
| } | |
| if (p.eventCurrentTarget.attr("name") === "ShortDescriptionAdd") { | |
| return false | |
| } | |
| if (p.eventCurrentTarget.attr("name") === "ActiveIndAdd") { | |
| return false | |
| } | |
| if (p.eventCurrentTarget.attr("name") === "SubIdentifierAdd") { | |
| return false | |
| } | |
| if (p.eventCurrentTarget.attr("name") === "ShortDescription") { | |
| return false | |
| } | |
| if (p.eventCurrentTarget.attr("name") === "SubIdentifier") { | |
| return false | |
| } | |
| if (p.eventCurrentTarget.attr("name") === "ActiveInd") { | |
| return false | |
| } | |
| if (p.eventCurrentTarget.attr("name") === "DeleteInd") { | |
| return false | |
| } | |
| if (p.eventCurrentTarget.hasClass("disabled")) { | |
| return false | |
| } | |
| }, | |
| saveModel: function () { | |
| var l = this; | |
| if (l.collection.isValid()) { | |
| l.collection.save({ | |
| dataParam: { | |
| settingTypeId: k.settingType.Value, | |
| returnModel: true | |
| }, | |
| success: function (m) { | |
| p3.fT(k.template, function (n) { | |
| k.$(k.el).empty(); | |
| k.collection.reset(m); | |
| k.$el.html(n({ | |
| collection: k.collection.toJSON(), | |
| settingName: k.settingType.Name, | |
| settingOpen: k.settingOpen | |
| })) | |
| }); | |
| p3.Layout.Containers.Modal.modal("hide") | |
| }, | |
| error: function (n, m) { | |
| k.$(".save").button("reset") | |
| } | |
| }) | |
| } | |
| return false | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new j(), p3.Layout.Containers.Modal, true) | |
| }, | |
| toggleSection: function (j) { | |
| j.preventDefault(); | |
| j.stopPropagation(); | |
| var k = this, | |
| i = $(j.currentTarget); | |
| i.siblings(".toggledetail").slideToggle("fast"); | |
| i.find("i").toggleClass("p3icon-downArrow p3icon-sideArrow"); | |
| if (i.hasClass("active")) { | |
| i.removeClass("active"); | |
| k.settingOpen = false | |
| } else { | |
| i.addClass("active"); | |
| k.settingOpen = true | |
| } | |
| } | |
| }); | |
| b.Vs.EditType = Bb.View.extend({ | |
| tagName: "tr", | |
| className: "sort-drag-block", | |
| initialize: function (i) { | |
| var j = this; | |
| j.template = i.template; | |
| j.dictionaries = i.dictionaries; | |
| Bb.Validation.bind(j, { | |
| forceUpdate: true, | |
| selector: i.selector | |
| }) | |
| }, | |
| events: { | |
| "mouseover td.inline-edit": "inlineEditOver", | |
| "mouseout td.inline-edit": "inlineEditOut", | |
| "click .inline-edit": "showInlineEdit", | |
| "blur .inline-edit .edit input": "hideInlineEdit", | |
| "blur .inline-edit .edit select": "hideInlineEdit", | |
| sortorder: "sortOrder", | |
| 'click [name="ActiveInd"]': "activeInd", | |
| 'click [name="DeleteInd"]': "deleteInd" | |
| }, | |
| render: function (i) { | |
| var j = this; | |
| $(i).append(j.el); | |
| j.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this; | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({ | |
| model: i.model.toJSON(), | |
| dictionaries: i.dictionaries | |
| })); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| inlineEditOver: function (i) { | |
| $(i.currentTarget).find("i").show() | |
| }, | |
| inlineEditOut: function (i) { | |
| $(i.currentTarget).find("i").hide() | |
| }, | |
| showInlineEdit: function (i) { | |
| i.stopPropagation(); | |
| i.preventDefault(); | |
| var j = $(i.currentTarget); | |
| j.find(".display").hide(); | |
| j.find(".edit").show(); | |
| if (j.find(".edit input").length > 0) { | |
| j.find(".edit input").focus() | |
| } else { | |
| j.find(".edit select").focus() | |
| } | |
| }, | |
| hideInlineEdit: function (k) { | |
| k.stopPropagation(); | |
| k.preventDefault(); | |
| var p = this, | |
| m = $(k.currentTarget), | |
| l = m.attr("name"), | |
| o, n, j = "", | |
| i = {}; | |
| o = m.val(); | |
| i[l] = o; | |
| p.model.set(i); | |
| if (p.model.isValid(l)) { | |
| Bb.Validation.callbacks.valid(p, l, "name"); | |
| if (m[0].tagName === "SELECT") { | |
| n = m.find("option:selected").text(); | |
| j = !h.isEmptier(o) ? n : "" | |
| } else { | |
| j = o | |
| } | |
| m.parent().siblings(".display").html(j + '<i class="fa fa-pencil pull-right collapse" style="display: none;"></i>'); | |
| m.parent().siblings(".display").show(); | |
| m.parent().hide() | |
| } else { | |
| m.parent().siblings(".display i").hide() | |
| } | |
| }, | |
| sortOrder: function (i) { | |
| var j = this; | |
| return j.model | |
| }, | |
| activeInd: function (i) { | |
| var j = this; | |
| _.defer(function () { | |
| j.model.set({ | |
| ActiveInd: $(i.currentTarget).hasClass("active") | |
| }) | |
| }) | |
| }, | |
| deleteInd: function (i) { | |
| var j = this; | |
| _.defer(function () { | |
| j.model.set({ | |
| DeleteInd: $(i.currentTarget).hasClass("active") | |
| }) | |
| }) | |
| } | |
| }); | |
| p3.router().route("settings/candidateprofile", "settings/candidateprofile", function () { | |
| b.Data.Dictionaries = {}; | |
| p3.renderMainPage(new b.Vs.Layout({})) | |
| }) | |
| }(p3.module("admissions/CandidateProfileSettings"))); | |
| (function (d) { | |
| var c = p3.module("admissions/candidateprofile"), | |
| h = p3.module("utilities/smodal"), | |
| g = p3.module("utilities/multifetch"), | |
| b = p3.module("shared/base"), | |
| j = p3.module("utilities/validate"), | |
| i = p3.Us.Tools, | |
| e = p3.Us.Culture, | |
| a = p3.module("admissions/admissionsscheduling"), | |
| f = p3.Us.InfoMessageLibrary; | |
| d.Data.ProspectUserId = undefined; | |
| d.Ms.DictionaryItem = Bbm.extend({}); | |
| d.Ms.ListItems = Bbc.extend({}); | |
| d.Ms.ApplicationHolder = Bbm.extend({}); | |
| d.Ms.ApplicationForm = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "ApplicationFormId", | |
| validation: { | |
| Name: [{ | |
| required: true, | |
| msg: f.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "OnlineApplication/ApplicationForm/" + this.id + "/" : aP + "OnlineApplication/ApplicationForm/" | |
| } | |
| }); | |
| d.Ms.Checklist = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| hasItemWithDataCollectionType: function (k) { | |
| var m = this.toJSON(), | |
| l = false; | |
| _.each(m.ProspectChecklistStep, function (n) { | |
| _.each(n.ProspectChecklistItem, function (o) { | |
| if (o.DataCollectionTypeId == k) { | |
| l = true | |
| } | |
| }) | |
| }); | |
| return l | |
| }, | |
| url: function () { | |
| return aP + "admissions/ProspectCheckList/" | |
| } | |
| }); | |
| d.Ms.ChecklistStep = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| url: function () { | |
| return aP + "admissions/ProspectCheckList/" | |
| } | |
| }); | |
| d.Ms.ChecklistItem = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "ChecklistItemId", | |
| url: function () { | |
| return aP + "admissions/ProspectCheckList/" + this.id | |
| } | |
| }); | |
| d.Ms.CommentBox = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "SchoolId", | |
| validation: { | |
| CandidateProgressText: [{ | |
| maxLength: 4000, | |
| required: false, | |
| msg: f.P3.MaxLengthExceeded | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "admissions/AdmissionOptions/" + this.id + "/" : aP + "admissions/AdmissionOptions/" | |
| } | |
| }); | |
| d.Ms.HasOnlineApp = Bbm.extend({ | |
| url: function () { | |
| return aP + "onlineapplication/hasonlineapp" | |
| } | |
| }); | |
| d.Ms.CreateAccount = Bbm.extend({ | |
| defaults: { | |
| CandidateFirstName: null, | |
| CandidateLastName: null, | |
| NickName: null, | |
| CandidateDOB: null, | |
| EnteringYear: null, | |
| EnteringGradeId: null, | |
| Agree: false, | |
| ProspectUserId: "0", | |
| CurrentApplicant: false | |
| }, | |
| validation: { | |
| ProspectUserId: [{ | |
| required: true, | |
| msg: f.P3.RequiredInfoNotEntered | |
| }], | |
| CandidateFirstName: [{ | |
| fn: "requiredNewCandidate" | |
| }], | |
| CandidateLastName: [{ | |
| fn: "requiredNewCandidate" | |
| }], | |
| CandidateDOB: [{ | |
| fn: "requiredCandidateDOB" | |
| }], | |
| EnteringYear: [{ | |
| fn: "requiredNewAndNotCurrentCandidate" | |
| }], | |
| EnteringGradeId: [{ | |
| fn: "requiredNewAndNotCurrentCandidate" | |
| }], | |
| Agree: [{ | |
| acceptance: true, | |
| msg: f.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| url: function () { | |
| return aP + "admissions/ApplyCandidate/" | |
| }, | |
| requiredNewCandidate: function (m, k, l) { | |
| if (i.stringToInt(l.ProspectUserId) === 0) { | |
| if (j.isEmptier(m)) { | |
| return f.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, | |
| requiredNewAndNotCurrentCandidate: function (m, k, l) { | |
| if (i.stringToInt(l.ProspectUserId) === 0 || i.stringToBoolean(l.CurrentApplicant) === false) { | |
| if (j.isEmptier(m)) { | |
| return f.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, | |
| requiredCandidateDOB: function (o, k, l) { | |
| var n = new Date(o), | |
| m = new Date(); | |
| m.setFullYear(m.getFullYear() + 1); | |
| if (i.stringToInt(l.ProspectUserId) === 0 || i.stringToBoolean(l.CurrentApplicant) === false) { | |
| if (j.isEmptier(o)) { | |
| return f.P3.RequiredInfoNotEntered | |
| } | |
| if (!e.isDate(o)) { | |
| return f.P3.DateError.fixDateFormat() | |
| } | |
| if (n > m) { | |
| return f.Login.MaxDateOfBirth | |
| } | |
| } | |
| } | |
| }); | |
| d.Ms.LoginSetup = Bbm.extend({ | |
| url: function () { | |
| return aP + "OnlineApplication/CreateAcctSettings/" | |
| } | |
| }); | |
| d.Ms.ChecklistUpload = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "UploadId", | |
| url: function () { | |
| return aP + "ProspectChecklist/FileUpload/" | |
| } | |
| }); | |
| d.Ms.ChecklistRecommendation = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "RecommendationId", | |
| validation: { | |
| TeacherName: [{ | |
| required: true, | |
| msg: f.P3.RequiredInfoNotEntered | |
| }], | |
| TeacherEmail: [{ | |
| required: true, | |
| msg: f.P3.RequiredInfoNotEntered | |
| }, { | |
| pattern: "email", | |
| msg: f.P3.EmailError | |
| }] | |
| }, | |
| url: function () { | |
| return aP + "ProspectChecklist/Recommendation/" | |
| } | |
| }); | |
| d.Ms.RecommendationResend = Bbm.extend({ | |
| idAttribute: "RecommendationId", | |
| url: "ProspectChecklist/RecommendationResend/" | |
| }); | |
| d.Cs.Dictionary = Bbc.extend({ | |
| model: d.Ms.DictionaryItem, | |
| url: "datadirect/DictionaryGet/" | |
| }); | |
| d.Cs.CommentBox = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| model: d.Ms.CommentBox, | |
| url: function () { | |
| return aP + "admissions/AdmissionOptions/" | |
| } | |
| }); | |
| d.Cs.ApplicationForms = Bbc.extend({ | |
| sync: b.DataParamSync, | |
| model: d.Ms.ApplicationForm, | |
| url: function () { | |
| return aP + "OnlineApplication/ApplicationFormList/" | |
| }, | |
| getFormsForGrade: function (m, k) { | |
| var l = this.filter(function (n) { | |
| if (n.get("ActiveInd") || !k) { | |
| return _.some(n.get("Grades"), function (o) { | |
| return o.GradeId == m && o.Selected | |
| }) | |
| } | |
| return false | |
| }); | |
| return l | |
| } | |
| }); | |
| d.Cs.ChecklistSteps = Bbc.extend({ | |
| model: d.Ms.ChecklistStep | |
| }); | |
| d.Cs.ChecklistItems = Bbc.extend({ | |
| model: d.Ms.ChecklistItem | |
| }); | |
| d.Cs.ProspectInstanceIds = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/ProspectInstanceIdsGet/" | |
| } | |
| }); | |
| d.Cs.SubmittedApplicationGet = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/SubmittedApplicationGet/" | |
| } | |
| }); | |
| d.Cs.EnteringYears = Bbc.extend({ | |
| url: "admissions/EnteringAdmissionsYear/" | |
| }); | |
| d.Cs.EnteringGrades = Bbc.extend({ | |
| url: "admissions/EnteringGrade/" | |
| }); | |
| d.Cs.ChildrenNonStudent = Bbc.extend({ | |
| url: "DataDirect/ChildrenNonStudent/" | |
| }); | |
| d.Cs.Register = Bbc.extend({ | |
| url: "ProspectCheckList/ProspectCheckListRegister/" | |
| }); | |
| d.Cs.LoggedInUserSchoolFormsGet = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/GetMyFileForms" | |
| } | |
| }); | |
| d.Vs.Layout = Bb.View.extend({ | |
| template: "candidateview/candidateview.progress.layout.template.html", | |
| events: { | |
| "click #applicationBtn": "chooseApplication", | |
| "click .print-application": "printApplication", | |
| "refreshData #checklistHeader": "renderData" | |
| }, | |
| initialize: function () { | |
| var k = this; | |
| if (k.options) { | |
| k.userId = k.options.userId; | |
| d.Data.userName = k.options.userName; | |
| d.Data.ProspectUserId = k.options.userId | |
| } | |
| $(document).on("click", function (l) { | |
| if ($(l.target).closest(".popover").length === 0) { | |
| d.Us.closeDetailBubbles() | |
| } | |
| }); | |
| k.subs = {}; | |
| k.prospectInstanceIds = new d.Cs.ProspectInstanceIds(); | |
| k.applicationForms = new d.Cs.ApplicationForms(); | |
| k.submittedApps = new d.Cs.SubmittedApplicationGet(); | |
| k.loggedInUserSchoolForms = new d.Cs.LoggedInUserSchoolFormsGet(); | |
| k.model = new d.Ms.Checklist(); | |
| d.Data.AppInfo = { | |
| onlineAppInstalled: false, | |
| formId: null, | |
| appId: null, | |
| completed: false, | |
| continueApp: false, | |
| showApplicationInHeader: false, | |
| appsDisabled: false, | |
| printUrl: null, | |
| prospectOriginId: null | |
| } | |
| }, | |
| dispose: function () { | |
| d.Us.closeDetailBubbles() | |
| }, | |
| render: function (k) { | |
| var m = this, | |
| l = 0; | |
| $(k).html(m.el); | |
| p3.setTitle("Admissions Progress"); | |
| m.dictionaries = { | |
| dictionary_83: { | |
| id: 83, | |
| keyName: "dd_id", | |
| valueName: "dd_description", | |
| dictionary: {} | |
| } | |
| }; | |
| _.each(m.dictionaries, function (n) { | |
| var o = new c.Cs.Dictionary(); | |
| o.fetch({ | |
| data: { | |
| dictionaryId: n.id, | |
| key: n.keyName, | |
| value: n.valueName, | |
| inputParam: n.inputParam | |
| }, | |
| success: function (p) { | |
| n.dictionary = p.toJSON(); | |
| l++; | |
| if (l === _.size(m.dictionaries)) { | |
| m.prospectInstanceIds.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| userId: m.userId | |
| }, | |
| success: function (q, r) { | |
| if (m.prospectInstanceIds.models.length > 0) { | |
| m.prospectInstanceId = m.prospectInstanceIds.models[0].get("ProspectInstanceId") | |
| } else { | |
| m.prospectInstanceId = 0 | |
| } | |
| d.Data.ProspectInstanceId = m.prospectInstanceId; | |
| m.renderData() | |
| } | |
| }) | |
| } | |
| } | |
| }) | |
| }) | |
| }, | |
| renderData: function () { | |
| var k = this; | |
| p3.fT(k.template, function (m) { | |
| var l = new d.Ms.HasOnlineApp(); | |
| l.fetch({ | |
| success: function () { | |
| if (i.stringToBoolean(l.get("Message")) === true) { | |
| d.Data.AppInfo.onlineAppInstalled = true | |
| } | |
| k.loggedInUserSchoolForms.fetch({ | |
| cache: false, | |
| data: { | |
| userId: p3.Data.Context.get("UserInfo").UserId | |
| }, | |
| success: function () { | |
| d.Data.UserSchoolFormsInfo = k.loggedInUserSchoolForms.toJSON(); | |
| k.applicationForms.fetch({ | |
| cache: false, | |
| data: { | |
| activeApps: true, | |
| formType: 1, | |
| prospectInstanceId: k.prospectInstanceId | |
| }, | |
| success: function () { | |
| d.Data.AppInfo.appsDisabled = (k.applicationForms.models.length > 0) ? false : true; | |
| k.submittedApps.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| prospectInstanceId: k.prospectInstanceId | |
| }, | |
| success: function (n, o) { | |
| _.each(k.submittedApps.toJSON(), function (p) { | |
| if (p.date_submitted != null) { | |
| d.Data.AppInfo.completed = true; | |
| d.Data.AppInfo.formId = k.submittedApps.models[0].attributes.oa_application_form_id; | |
| d.Data.AppInfo.appId = k.submittedApps.models[0].attributes.oa_application_id; | |
| d.Data.AppInfo.printUrl = k.submittedApps.models[0].attributes.print_url; | |
| d.Data.AppInfo.prospectOriginId = k.submittedApps.models[0].attributes.si_adm_prospect_origin_id | |
| } | |
| }); | |
| if (k.submittedApps.length > 0) { | |
| d.Data.AppInfo.continueApp = true | |
| } | |
| k.model.fetch({ | |
| cache: false, | |
| data: { | |
| prospectInstanceId: k.prospectInstanceId | |
| }, | |
| success: function () { | |
| var p = k.model.get("CheckList"); | |
| d.Data.CheckListId = p ? p.CheckListId : null; | |
| if (d.Data.AppInfo.onlineAppInstalled && !k.model.hasItemWithDataCollectionType(8)) { | |
| d.Data.AppInfo.showApplicationInHeader = true | |
| } | |
| k.$el.html(m({ | |
| showApplication: d.Data.AppInfo.showApplicationInHeader, | |
| appsDisabled: d.Data.AppInfo.appsDisabled, | |
| completed: d.Data.AppInfo.completed, | |
| formId: d.Data.AppInfo.formId, | |
| appId: d.Data.AppInfo.appId, | |
| continueApp: d.Data.AppInfo.continueApp, | |
| printUrl: d.Data.AppInfo.printUrl, | |
| prospectOriginId: d.Data.AppInfo.prospectOriginId | |
| })); | |
| if ($("#candidate-viewer").triggerHandler("getmode") === "fillout") { | |
| $("#applicationBtn").click() | |
| } | |
| p3.rV(new d.Vs.Checklist({ | |
| layoutView: k, | |
| userId: k.userId, | |
| prospectInstanceId: k.prospectInstanceId, | |
| model: k.model | |
| }), $("#checklist"), true); | |
| p3.rV(new d.Vs.ContactBox({ | |
| layoutView: k, | |
| userId: k.userId | |
| }), $("#main-right"), true) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading information") | |
| } | |
| }) | |
| } | |
| }) | |
| } | |
| }) | |
| } | |
| }) | |
| } | |
| }) | |
| }) | |
| }, | |
| chooseApplication: function (k) { | |
| k.preventDefault(); | |
| var m = this, | |
| l; | |
| if ($(k.currentTarget).attr("disabled") != "disabled") { | |
| if (m.submittedApps.length > 0) { | |
| l = "#application/" + m.submittedApps.models[0].attributes.oa_application_form_id + "/keyid=" + m.prospectInstanceId; | |
| p3.router().navigate(l, true) | |
| } else { | |
| if (m.applicationForms.models.length === 1) { | |
| l = "#application/" + m.applicationForms.models[0].attributes.ApplicationFormId + "/keyid=" + m.prospectInstanceId; | |
| p3.router().navigate(l, true) | |
| } else { | |
| m.Modal2Extend = h.Vs.Modal2.extend({ | |
| template: "admissions/candidate.view.choose.application.template.html", | |
| collection: m.applicationForms, | |
| size: "md", | |
| variables: { | |
| prospectInstanceId: m.prospectInstanceId | |
| }, | |
| modalRendered: function () { | |
| var n = this; | |
| n.setFocus() | |
| }, | |
| modalUpdate: function () { | |
| return false | |
| }, | |
| modalSave: function () { | |
| var n = this; | |
| l = n.$("#ApplicationForm").prop("value"); | |
| p3.router().navigate(l, true); | |
| return false | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new m.Modal2Extend(), p3.Layout.Containers.Modal, true) | |
| } | |
| } | |
| } | |
| }, | |
| printApplication: function (k) { | |
| k.preventDefault(); | |
| k.stopPropagation(); | |
| window.open(d.Data.AppInfo.printUrl, "_blank") | |
| } | |
| }); | |
| d.Vs.Checklist = Bb.View.extend({ | |
| template: "candidateview/candidateview.progress.checklist.template.html", | |
| initialize: function () { | |
| var k = this; | |
| if (k.options) { | |
| k.userId = k.options.userId; | |
| k.prospectInstanceId = k.options.prospectInstanceId | |
| } | |
| k.subs = {}; | |
| k.collection = new d.Cs.ChecklistItems() | |
| }, | |
| render: function (k) { | |
| var l = this; | |
| $(k).append(l.el); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.CalPopover, function () { | |
| l.renderData() | |
| }) | |
| }, | |
| renderData: function () { | |
| var k = this; | |
| p3.fT(k.template, function (m) { | |
| k.$el.html(m({})); | |
| var l = new d.Cs.ChecklistSteps(k.model.get("ProspectChecklistStep")); | |
| if (l.length > 0) { | |
| $("#checklistHeader").removeClass("hide"); | |
| $("#checklist").removeClass("hide"); | |
| p3.rV(new d.Vs.ChecklistSteps({ | |
| collection: l | |
| }), k.$("#checklistItemsHolder"), false) | |
| } | |
| }) | |
| } | |
| }); | |
| d.Vs.ChecklistSteps = Bb.View.extend({ | |
| render: function (k) { | |
| var l = this; | |
| $(k).append(l.el); | |
| l.renderData() | |
| }, | |
| renderData: function () { | |
| var k = this; | |
| k.$el.html(); | |
| _.each(k.collection.models, function (l) { | |
| p3.rV(new d.Vs.ChecklistStep({ | |
| model: l | |
| }), k.$el, false) | |
| }) | |
| } | |
| }); | |
| d.Vs.ChecklistStep = Bb.View.extend({ | |
| template: "candidateview/candidateview.progress.checklist.step.template.html", | |
| render: function (k) { | |
| var l = this; | |
| $(k).append(l.el); | |
| l.renderData() | |
| }, | |
| renderData: function () { | |
| var k = this; | |
| p3.fT(k.template, function (m) { | |
| k.$el.html(m({ | |
| model: k.model.toJSON() | |
| })); | |
| var l = new d.Cs.ChecklistItems(k.model.get("ProspectChecklistItem")); | |
| p3.rV(new d.Vs.ChecklistItems({ | |
| collection: l | |
| }), k.$(".checklistitems"), false) | |
| }) | |
| } | |
| }); | |
| d.Vs.ChecklistItems = Bb.View.extend({ | |
| tagName: "tbody", | |
| render: function (k) { | |
| var l = this; | |
| $(k).append(l.el); | |
| l.renderData() | |
| }, | |
| renderData: function () { | |
| var k = this; | |
| k.$el.html(); | |
| _.each(k.collection.models, function (l) { | |
| if (l.get("ChecklistItemId")) { | |
| p3.rV(new d.Vs.ChecklistItem({ | |
| model: l | |
| }), k.$el, false) | |
| } | |
| }) | |
| } | |
| }); | |
| d.Vs.ChecklistItem = Bb.View.extend({ | |
| template: "candidateview/candidateview.progress.checklist.item.template.html", | |
| tagName: "tr", | |
| events: { | |
| "click .upload": "uploadAttachment", | |
| "click .agenda": "showAgenda", | |
| "click .delete": "deleteAttachment", | |
| "click .recommendation": "startRecommendation", | |
| startrecommendation: "startRecommendation", | |
| "click .resend": "resendRecommendation", | |
| "click .print-application": "printApplication", | |
| "click .register": "register", | |
| "click [data-collection-type]": "updateDataCollection", | |
| "click #schoolFormProceedBtn": "proceedToSchoolForm", | |
| "click #printSchoolFormBtn": "printSchoolForm" | |
| }, | |
| render: function (k) { | |
| var l = this; | |
| $(k).append(l.el); | |
| l.renderData() | |
| }, | |
| renderData: function () { | |
| var k = this; | |
| if (k.model.get("PublishDescription") || k.model.get("PublishLink") || k.model.get("PublishFile") || k.model.get("AgendaId") || (k.model.get("Recommendation") && k.model.get("Recommendation").AllowResend)) { | |
| k.model.set("ShowDetails", 1) | |
| } | |
| k.renderTemplate() | |
| }, | |
| renderTemplate: function () { | |
| var n = this, | |
| l = (_.findWhere(p3.Data.Context.attributes.Personas, { | |
| Description: "Parent", | |
| Active: true | |
| })) ? true : false, | |
| k = n.model.get("ApplicationFormId"), | |
| m; | |
| if (k > 0) { | |
| m = _.find(d.Data.UserSchoolFormsInfo, function (o) { | |
| return o.ApplicationFormId === k | |
| }) | |
| } | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({ | |
| model: n.model.toJSON(), | |
| appInfo: d.Data.AppInfo, | |
| userSchoolFormsInfo: m, | |
| prospectOriginId: d.Data.AppInfo.prospectOriginId, | |
| isParent: l | |
| })) | |
| }) | |
| }, | |
| uploadAttachment: function (k) { | |
| k.stopPropagation(); | |
| var m = this, | |
| l = new d.Ms.ChecklistUpload($.extend(true, {}, m.model.get("ProspectChecklistUpload"))); | |
| m.Modal2Extend = h.Vs.Modal2.extend({ | |
| template: "utilities/utilities.smodal.upload.html", | |
| model: l, | |
| variables: { | |
| title: "Upload", | |
| fileType: "DOCIMAGE" | |
| }, | |
| modalRendered: function (o) { | |
| var n = this; | |
| n.initializeFileUpload_File() | |
| }, | |
| modalSavedSuccess: function (o) { | |
| var n = this; | |
| m.model.set("ProspectChecklistUpload", n.model.toJSON()); | |
| _.defer(function () { | |
| m.renderData() | |
| }) | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new m.Modal2Extend(), p3.Layout.Containers.Modal, true) | |
| }, | |
| deleteAttachment: function (k) { | |
| var l = this; | |
| k.stopPropagation(); | |
| p3.showConfirm("Delete File", "Wait a minute. Are you really sure you want to delete this file?", null, function () { | |
| var m = new d.Ms.ChecklistUpload($.extend(true, {}, l.model.get("ProspectChecklistUpload"))); | |
| h.Us.setPropByString(m.toJSON(), "AttachmentFile.AttachmentRemove", h.Us.getPropByString(m.toJSON(), "AttachmentFile.Attachment")); | |
| h.Us.setPropByString(m.toJSON(), "AttachmentFile.Attachment", null); | |
| m.save({}, { | |
| success: function (n, o) { | |
| l.model.set("ProspectChecklistUpload", o); | |
| _.defer(function () { | |
| l.renderData() | |
| }) | |
| } | |
| }) | |
| }) | |
| }, | |
| startRecommendation: function (l, o, n, m) { | |
| var p = this, | |
| k = new d.Ms.ChecklistRecommendation({ | |
| ProspectInstanceId: p.model.get("ProspectInstanceId"), | |
| CheckListId: d.Data.CheckListId, | |
| ChecklistItemId: p.model.get("ChecklistItemId"), | |
| TeacherName: o || null, | |
| RequestComments: m || null | |
| }); | |
| p.Modal2Extend = h.Vs.Modal2.extend({ | |
| template: "candidateview/candidateview.progress.recommendation.template.html", | |
| model: k, | |
| variables: { | |
| ChecklistItemDesc: p.model.get("ChecklistItemDesc"), | |
| RecommendRecipientLabel: p.model.get("RecommendRecipientLabel") | |
| }, | |
| events: { | |
| "click .preview": "showPreview", | |
| "click .request": "showRequest" | |
| }, | |
| showPreview: function (t) { | |
| var u = this, | |
| v = /([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, | |
| r = u.$(".comments"), | |
| q = u.model.get("RequestComments") ? u.model.get("RequestComments").replace(v, "$1<br />$2") : null, | |
| s = p.model.get("RecommendEmailText") ? p.model.get("RecommendEmailText").replace(v, "$1<br />$2") : null, | |
| w = p3.Data.SchoolContext.get("SchoolInfo"); | |
| if (!j.isEmptier(q)) { | |
| r.removeClass("muted").html(q).append("<hr />") | |
| } else { | |
| r.addClass("muted").html("Additional Comments will appear here if filled out") | |
| } | |
| if (!j.isEmptier(u.model.get("TeacherName"))) { | |
| s = s.replace(/\[recipient_name\]/g, u.model.get("TeacherName")); | |
| s = s.replace(/\[recommender_name\]/g, u.model.get("TeacherName")) | |
| } | |
| if (!j.isEmptier(d.Data.userName)) { | |
| s = s.replace(/\[candidate_name\]/g, d.Data.userName) | |
| } | |
| s = s.replace(/\[school_name\]/g, w.SchoolName); | |
| s += "<br /><br />To complete the recommendation please follow the link below.<br />[Accept Link Placeholder]<br/><br/>"; | |
| s += "If you wish to decline this request or feel you have received this message in error please follow the link below.<br/>[Decline Link Placeholder]"; | |
| u.$(".emailText").html(s); | |
| u.$(".request-holder").hide(); | |
| u.$(".preview-holder").show(); | |
| u.$(".modal-body").addClass("bg-f6f4f4"); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }, | |
| showRequest: function (q) { | |
| var r = this; | |
| r.$(".preview-holder").hide(); | |
| r.$(".request-holder").show(); | |
| r.$(".modal-body").removeClass("bg-f6f4f4"); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }, | |
| modalSavedSuccess: function (q) { | |
| p.model.set(q.response); | |
| _.defer(function () { | |
| p.renderData() | |
| }) | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new p.Modal2Extend(), p3.Layout.Containers.Modal, true) | |
| }, | |
| resendRecommendation: function (k) { | |
| k.preventDefault(); | |
| k.stopPropagation(); | |
| var m = this, | |
| l = m.model.get("Recommendation"); | |
| m.Modal2Extend = h.Vs.Modal2.extend({ | |
| template: "candidateview/candidateview.progress.recommendation.resend.template.html", | |
| variables: { | |
| teacherName: l.TeacherName, | |
| teacherEmail: l.TeacherEmail, | |
| requestComments: l.RequestComments | |
| }, | |
| events: { | |
| "click .continue:not(.disabled)": "resend", | |
| "click input[name=resend]": "updateSaveName" | |
| }, | |
| updateSaveName: function (o) { | |
| var n = this; | |
| switch (i.stringToInt(n.$("input[name=resend]:checked").val())) { | |
| case 1: | |
| n.$(".continue").removeClass("disabled").text("Send Request"); | |
| break; | |
| case 2: | |
| case 3: | |
| n.$(".continue").removeClass("disabled").text("Continue"); | |
| break | |
| } | |
| }, | |
| resend: function (o) { | |
| var n = this, | |
| p; | |
| switch (i.stringToInt(n.$("input[name=resend]:checked").val())) { | |
| case 1: | |
| p = new d.Ms.RecommendationResend(); | |
| p.save({ | |
| RecommendationId: l.RecommendationId | |
| }, { | |
| success: function (q, s, r) { | |
| h.Us.setPropByString(s, "Recommendation.AllowResend", false); | |
| m.model.set(s); | |
| p3.Layout.Containers.Modal.modal("hide"); | |
| _.defer(function () { | |
| m.renderData() | |
| }) | |
| }, | |
| error: function (q, s, r) { | |
| p3.displayError("Error resending request.") | |
| } | |
| }); | |
| break; | |
| case 2: | |
| p3.Layout.Containers.Modal.modal("hide"); | |
| m.$el.triggerHandler("startrecommendation", [l.TeacherName, l.TeacherEmail, l.RequestComments]); | |
| break; | |
| case 3: | |
| p3.Layout.Containers.Modal.modal("hide"); | |
| m.$el.triggerHandler("startrecommendation"); | |
| break | |
| } | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new m.Modal2Extend(), p3.Layout.Containers.Modal, true) | |
| }, | |
| printApplication: function (k) { | |
| k.preventDefault(); | |
| k.stopPropagation(); | |
| var m = this, | |
| l = m.model.get("PrintUrl"); | |
| window.open(l, "_blank") | |
| }, | |
| register: function (l) { | |
| l.preventDefault(); | |
| l.stopPropagation(); | |
| var n = this, | |
| m, k = $(l.currentTarget); | |
| if (n.model.get("ActiveRegistrationInd")) { | |
| n.register = new d.Cs.Register(); | |
| n.register.fetch({ | |
| cache: false, | |
| data: { | |
| id: n.model.get("ChecklistItemId"), | |
| prospectInstanceId: d.Data.ProspectInstanceId | |
| }, | |
| success: function () { | |
| if (n.register.length > 1) { | |
| p3.fT("candidateview/candidateview.progress.checklist.item.popover.template.html", function (p) { | |
| var o = p({ | |
| collection: n.register.toJSON() | |
| }); | |
| k.removeData("popover"); | |
| d.Us.closeDetailBubbles(); | |
| k.calpopover({ | |
| title: null, | |
| html: true, | |
| content: o, | |
| trigger: "manual", | |
| placement: "auto top" | |
| }); | |
| k.addClass("has-open-popover"); | |
| k.calpopover("show"); | |
| $(".popover-close").click(function () { | |
| d.Us.closeDetailBubbles() | |
| }); | |
| $(".registerlink").click(function (q) { | |
| q.preventDefault(); | |
| q.stopPropagation(); | |
| window.location = $(q.currentTarget).data("link") | |
| }) | |
| }) | |
| } else { | |
| window.location = n.register.toJSON()[0].RegistrationLink | |
| } | |
| } | |
| }) | |
| } else { | |
| m = h.Vs.Modal2.extend({ | |
| template: "utilities/utilities.smodal.message.html", | |
| variables: { | |
| title: "Register", | |
| infoText: "There are no available events at this time." | |
| } | |
| }); | |
| h.Us.renderModal(new m({})) | |
| } | |
| }, | |
| showAgenda: function () { | |
| var k = this; | |
| a.Us.AgendaModal(k.model.get("DataCollectionTypeId"), k.model.get("DataCollectionPk"), d.Data.ProspectInstanceId, d.Data.userName) | |
| }, | |
| updateDataCollection: function (o) { | |
| o.stopPropagation(); | |
| o.preventDefault(); | |
| var p = this, | |
| m = p.model.get("DataCollectionTypeId"), | |
| l = p.model.get("DataCollectionPk"), | |
| k = p.model.get("ChecklistItemId"), | |
| n; | |
| switch (m) { | |
| case 7: | |
| if (l) { | |
| n = new c.Ms.Interview({ | |
| disabled: true | |
| }) | |
| } else { | |
| n = new c.Ms.Interview({ | |
| disabled: true, | |
| ChecklistItemId: k, | |
| ProspectInstanceId: d.Data.ProspectInstanceId, | |
| InterviewType: { | |
| "$type": "clBLL.nAdmissions.InterviewType, clBLL" | |
| }, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }) | |
| } | |
| break; | |
| case 12: | |
| if (l) { | |
| n = new c.Ms.Visit({ | |
| disabled: true | |
| }) | |
| } else { | |
| n = new c.Ms.Visit({ | |
| disabled: true, | |
| ChecklistItemId: k, | |
| prospectInstanceId: d.Data.ProspectInstanceId, | |
| VisitType: { | |
| "$type": "clBLL.nAdmissions.VisitType, clBLL" | |
| }, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }) | |
| } | |
| break | |
| } | |
| if (l) { | |
| n.fetch({ | |
| data: { | |
| prospectInstanceId: d.Data.ProspectInstanceId, | |
| id: l, | |
| userId: d.Data.ProspectUserId | |
| }, | |
| success: function (q) { | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| if (m === 7) { | |
| a.Us.EditSelfScheduleInterview(d.Data.ProspectInstanceId, k, l) | |
| } else { | |
| if (m === 12) { | |
| a.Us.EditSelfScheduleVisit(d.Data.ProspectInstanceId, k, l) | |
| } | |
| } | |
| } | |
| }) | |
| } else { | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| if (m === 7) { | |
| a.Us.AddSelfScheduleInterview(d.Data.ProspectInstanceId, k) | |
| } else { | |
| if (m === 12) { | |
| a.Us.AddSelfScheduleVisit(d.Data.ProspectInstanceId, k) | |
| } | |
| } | |
| } | |
| }, | |
| proceedToSchoolForm: function (l) { | |
| l.preventDefault(); | |
| l.stopPropagation(); | |
| var k = l.target.getAttribute("data-application-form-id"); | |
| p3.router().navigate("#schoolform/" + k + "/keyid=" + d.Data.ProspectUserId, true) | |
| }, | |
| printSchoolForm: function (k) { | |
| k.preventDefault(); | |
| k.stopPropagation(); | |
| var l = "/podium/default.aspx?t=1691&wapp=1&ch=1&pk=502&ext=pdf&fid=" + k.target.getAttribute("data-application-form-id") + "&appid=" + k.target.getAttribute("data-application-id"); | |
| window.open(l, "_blank") | |
| } | |
| }); | |
| d.Vs.ContactBox = Bb.View.extend({ | |
| template: "admissions/candidateview.contactbox.template.html", | |
| events: { | |
| "click #applyNewCandidate": "applyCandidate" | |
| }, | |
| initialize: function () { | |
| var k = this; | |
| if (k.options) { | |
| k.userId = k.options.userId | |
| } | |
| k.model = new d.Ms.CommentBox({ | |
| SchoolId: p3.Data.SchoolContext.attributes.SchoolInfo.SchoolId | |
| }); | |
| k.prospectInstanceIds = new d.Cs.ProspectInstanceIds(); | |
| k.Containers = {} | |
| }, | |
| render: function (k) { | |
| var l = this; | |
| $(k).html(l.el); | |
| l.dictionaries = {}; | |
| l.dictionaries.enteringYears = new d.Ms.LoginSetup(); | |
| l.dictionaries.enteringGrades = new d.Cs.EnteringGrades(); | |
| l.dictionaries.childrenNonStudent = new d.Cs.ChildrenNonStudent(); | |
| l.dictionaries.applicationForms = new d.Cs.ApplicationForms(); | |
| l.renderData() | |
| }, | |
| renderData: function () { | |
| var k = this; | |
| k.model.off("sync"); | |
| p3.fT(k.template, function (m) { | |
| var l = (_.findWhere(p3.Data.Context.attributes.Personas, { | |
| Description: "Parent", | |
| Active: true | |
| })) ? true : false; | |
| k.model.fetch({ | |
| cache: false, | |
| data: { | |
| id: k.options.layoutView.prospectInstanceId | |
| }, | |
| success: function (n, o) { | |
| k.$el.html(m({ | |
| model: k.model.toJSON(), | |
| showApplication: d.Data.AppInfo.onlineAppInstalled, | |
| appsDisabled: d.Data.AppInfo.appsDisabled, | |
| isParent: l | |
| })) | |
| }, | |
| complete: function () { | |
| k.model.on("sync", k.renderData, k) | |
| } | |
| }) | |
| }) | |
| }, | |
| applyCandidate: function (k) { | |
| d.Us.ApplyCandidate() | |
| } | |
| }); | |
| d.Us.closeDetailBubbles = function () { | |
| var k = $(".popover"); | |
| $(".has-open-popover").removeClass("has-open-popover"); | |
| k.hide(); | |
| k.remove() | |
| }; | |
| d.Us.ApplyCandidate = function () { | |
| var m, l = {}, | |
| n = {}, | |
| k = new d.Ms.CreateAccount(); | |
| l.enteringYears = new d.Ms.LoginSetup(); | |
| l.enteringGrades = new d.Cs.EnteringGrades(); | |
| l.childrenNonStudent = new d.Cs.ChildrenNonStudent(); | |
| g.Us.Fetch({ | |
| EnteringYears: l.enteringYears, | |
| EnteringGrades: l.enteringGrades, | |
| ChildrenNonStudent: l.childrenNonStudent | |
| }, function (o, q, p) { | |
| l.enteringYears.dictionary = o.EnteringYears.toJSON(); | |
| l.enteringGrades.dictionary = o.EnteringGrades.toJSON(); | |
| l.childrenNonStudent.dictionary = o.ChildrenNonStudent.toJSON(); | |
| l.enteringYears.dictionary = _.filter(l.enteringYears.toJSON().CreateAccountSchoolYears, function (r) { | |
| return i.stringToBoolean(r.SelectedInd) === true | |
| }); | |
| if (l.enteringYears.dictionary.length > 1) { | |
| n.singleEnteringYear = false | |
| } else { | |
| n.singleEnteringYear = true; | |
| k.set({ | |
| EnteringYear: l.enteringYears.dictionary[0].SchoolYearLabel | |
| }) | |
| } | |
| m = h.Vs.Modal2.extend({ | |
| template: "resourceboard/resourceboard.application.template.html", | |
| model: k, | |
| dictionaries: l, | |
| variables: n, | |
| size: "md", | |
| modalInitialized: function () { | |
| var r = this; | |
| r.prospectInstanceIds = new d.Cs.ProspectInstanceIds() | |
| }, | |
| modalRendered: function () { | |
| var r = this; | |
| r.disableSubmitted() | |
| }, | |
| disableSubmitted: function () { | |
| var r = this; | |
| _.each(l.childrenNonStudent.dictionary, function (s) { | |
| r.prospectInstanceIds.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| userId: s.dd_id | |
| }, | |
| success: function (t, u) { | |
| if (r.prospectInstanceIds.models[0]) { | |
| if (i.stringToInt(r.prospectInstanceIds.models[0].attributes.AppFormId) === -1) { | |
| $("input[value='" + s.dd_id + "']").attr("disabled", "disabled") | |
| } | |
| } | |
| } | |
| }) | |
| }) | |
| }, | |
| modalUpdated: function (s) { | |
| var r = this; | |
| if (s.eventCurrentTarget.hasClass("radio-sky-input") || s.eventCurrentTarget.attr("name") === "ProspectUserId") { | |
| r.prospectInstanceIds.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| userId: r.model.get("ProspectUserId") | |
| }, | |
| success: function (v, z) { | |
| var t, u, w, y, x; | |
| r.candidate = false; | |
| r.currentCandidate = false; | |
| r.currentProspectInstanceId = 0; | |
| r.enteringGradeId = null; | |
| if (v.models.length > 0) { | |
| r.candidate = true; | |
| t = _.filter(v.toJSON(), function (A) { | |
| return A.AdmCurrentYearInd == true | |
| }); | |
| u = _.chain(t).pluck("AppFormId").uniq().value(); | |
| r.appFormId = _.filter(u, function (A) { | |
| return A != null | |
| }); | |
| if (t.length > 0) { | |
| r.currentCandidate = true | |
| } | |
| w = _.chain(t).pluck("ProspectInstanceId").uniq().value(); | |
| r.currentProspectInstanceId = w[0]; | |
| y = v.find(function (A) { | |
| return A.get("ProspectInstanceId") == r.currentProspectInstanceId | |
| }); | |
| if (y) { | |
| r.enteringGradeId = y.get("EnteringGradeId") | |
| } | |
| } | |
| x = _.pluck(v.toJSON(), "EnteringYear"); | |
| r.$('[name="EnteringYear"] option').remove(); | |
| if (!n.singleEnteringYear) { | |
| r.$('[name="EnteringYear"]').append('<option value="">-- Select an Option --</option>') | |
| } | |
| _.each(l.enteringYears.dictionary, function (A) { | |
| if (!_.contains(x, A.SchoolYearLabel)) { | |
| r.$('[name="EnteringYear"]').append('<option value="' + A.SchoolYearLabel + '">' + A.SchoolYearLabel + "</option>") | |
| } | |
| }); | |
| if (i.stringToInt(r.model.get("ProspectUserId")) === 0) { | |
| r.model.set({ | |
| CurrentApplicant: false | |
| }); | |
| r.$(".new-candidate").show(); | |
| r.$(".new-candidate-year").show() | |
| } else { | |
| if (r.candidate) { | |
| if (r.currentCandidate) { | |
| r.model.set({ | |
| CurrentApplicant: true | |
| }); | |
| r.$(".new-candidate").hide(); | |
| r.$(".new-candidate-year").hide() | |
| } else { | |
| r.model.set({ | |
| CurrentApplicant: false | |
| }); | |
| r.$(".new-candidate").hide(); | |
| r.$(".new-candidate-year").show() | |
| } | |
| } else { | |
| r.model.set({ | |
| CurrentApplicant: false | |
| }); | |
| r.$(".new-candidate").hide(); | |
| r.$(".new-candidate-year").show() | |
| } | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| } | |
| }); | |
| r.model.set({ | |
| CandidateFirstName: null, | |
| CandidateLastName: null, | |
| NickName: null, | |
| CandidateDOB: null, | |
| EnteringGradeId: null, | |
| Agree: false | |
| }); | |
| r.$('[name="CandidateFirstName"]').val(""); | |
| r.$('[name="CandidateLastName"]').val(""); | |
| r.$('[name="NickName"]').val(""); | |
| r.$('[name="CandidateDOB"]').val(r.model.get("CandidateDOB")); | |
| r.$('[name="EnteringGradeId"]').val(r.model.get("EnteringGradeId")); | |
| r.$('[name="Agree"]').prop("checked", false); | |
| if (i.stringToBoolean(n.singleEnteringYear) === false) { | |
| r.model.set({ | |
| EnteringYear: null | |
| }); | |
| r.$('[name="EnteringYear"]').val(r.model.get("EnteringYear")) | |
| } | |
| Bb.Validation.callbacks.valid(r, "CandidateFirstName", "name"); | |
| Bb.Validation.callbacks.valid(r, "CandidateLastName", "name"); | |
| Bb.Validation.callbacks.valid(r, "NickName", "name"); | |
| Bb.Validation.callbacks.valid(r, "CandidateDOB", "name"); | |
| Bb.Validation.callbacks.valid(r, "EnteringYear", "name"); | |
| Bb.Validation.callbacks.valid(r, "EnteringGradeId", "name"); | |
| Bb.Validation.callbacks.valid(r, "Agree", "name"); | |
| r.$("#infomessage-error").remove() | |
| } | |
| }, | |
| modalSave: function () { | |
| var r = this; | |
| r.$(".save").button("loading"); | |
| if (r.model.isValid(true)) { | |
| if (r.currentCandidate) { | |
| if (r.appFormId > 0) { | |
| p3.router().navigate("#application/" + r.appFormId + "/keyid=" + r.currentProspectInstanceId, true) | |
| } else { | |
| d.Us.ApplicationSelect(r.enteringGradeId, r.currentProspectInstanceId) | |
| } | |
| } else { | |
| r.model.set({ | |
| FieldsToNull: [] | |
| }); | |
| _.each(r.model.attributes, function (u, s, t) { | |
| r.setFieldsToNull(r.model, u, s, t, "") | |
| }); | |
| if (r.model.get("ProspectUserId") != "0") { | |
| r.model.set({ | |
| CandidateFirstName: null, | |
| CandidateLastName: null, | |
| NickName: null | |
| }) | |
| } | |
| r.model.save({}, { | |
| dataParam: r.options.dataParam, | |
| success: function (s, t) { | |
| p3.Data.Context.forceRefresh({ | |
| success: function (u) { | |
| $("#topnav-containter").trigger("renderSiteNav"); | |
| $("#site-switcher-container").trigger("renderPersona"); | |
| d.Us.ApplicationSelect(r.model.get("EnteringGradeId"), r.model.get("ProspectInstanceId")) | |
| } | |
| }) | |
| }, | |
| error: function (t, s) { | |
| r.$(".save").button("reset") | |
| } | |
| }) | |
| } | |
| } else { | |
| r.$(".save").button("reset") | |
| } | |
| return false | |
| } | |
| }); | |
| h.Us.renderModal(new m()) | |
| }) | |
| }; | |
| d.Us.ApplicationSelect = function (m, o) { | |
| var n, l = {}, | |
| k = new d.Ms.CreateAccount(); | |
| l.applicationForms = new d.Cs.ApplicationForms(); | |
| g.Us.Fetch({ | |
| ApplicationForms: { | |
| data: l.applicationForms, | |
| dataParams: { | |
| activeApps: true, | |
| formType: 1 | |
| } | |
| } | |
| }, function (p, r, q) { | |
| l.applicationForms.models = l.applicationForms.getFormsForGrade(m, true); | |
| l.applicationForms.dictionary = l.applicationForms.toJSON(); | |
| if (l.applicationForms.dictionary.length > 0) { | |
| if (l.applicationForms.dictionary.length === 1) { | |
| p3.router().navigate("#application/" + l.applicationForms.dictionary[0].ApplicationFormId + "/keyid=" + o, true) | |
| } else { | |
| n = h.Vs.Modal2.extend({ | |
| template: "resourceboard/resourceboard.applicationselect.template.html", | |
| model: k, | |
| size: "md", | |
| dictionaries: l, | |
| variables: { | |
| prospectInstanceId: o | |
| }, | |
| modalSave: function (t) { | |
| var s = this; | |
| p3.router().navigate(s.model.get("ApplicationForm"), true); | |
| return false | |
| } | |
| }); | |
| h.Us.renderModal(new n()) | |
| } | |
| } else { | |
| n = h.Vs.Modal2.extend({ | |
| template: "utilities/utilities.smodal.message.html", | |
| size: "md", | |
| variables: { | |
| title: "Choose Application", | |
| errorText: "There are no available applications at this time." | |
| } | |
| }); | |
| h.Us.renderModal(new n()) | |
| } | |
| }) | |
| } | |
| }(p3.module("admissions/candidateprogress"))); | |
| (function (c) { | |
| var f = p3.module("shared/profilecontactcard"), | |
| b = p3.module("admissions/candidateprogress"), | |
| a = p3.module("admissions/candidatedecision"), | |
| e = p3.module("officialNote"), | |
| d = p3.module("shared/message"), | |
| g = p3.Us.Tools; | |
| c.Ms.CandidateInfo = Bbm.extend({ | |
| url: function () { | |
| return aP + "datadirect/ParentStudentUserInfo/" | |
| } | |
| }); | |
| c.Ms.NavItem = Bbm.extend({}); | |
| c.Ms.ViewTabs = Bbm.extend({ | |
| url: function () { | |
| return aP + "admissions/CandidateViewTabs/" | |
| } | |
| }); | |
| c.Cs.CandidateInfo = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/ParentStudentUserInfo/" | |
| } | |
| }); | |
| c.Cs.NavItems = Bbc.extend({ | |
| model: c.Ms.NavItem | |
| }); | |
| c.Vs.Layout = Bb.View.extend({ | |
| template: "admissions/candidateview.layout.template.html", | |
| id: "candidate-viewer", | |
| initialize: function () { | |
| var h = this; | |
| h.Containers = {} | |
| }, | |
| events: { | |
| getmode: "getMode" | |
| }, | |
| render: function (h) { | |
| var i = this, | |
| j; | |
| $(h).append(i.el); | |
| i.Containers.MainContent = $("#main-content"); | |
| i.Containers.Header = $("#header"); | |
| i.Containers.TabNav = $("#candidateHeader"); | |
| j = new c.Ms.ViewTabs(); | |
| j.fetch({ | |
| cache: false, | |
| data: { | |
| showUserId: i.options.userId | |
| }, | |
| success: function (k) { | |
| _.each(k.toJSON(), function (l) { | |
| if ((l.Key === i.options.page) && (g.stringToBoolean(l.Value) === true)) { | |
| i.pageAccess = k.toJSON(); | |
| i.renderData() | |
| } | |
| }) | |
| } | |
| }) | |
| }, | |
| renderData: function () { | |
| var i = this, | |
| h = new c.Ms.CandidateInfo(); | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j()); | |
| p3.rV(new c.Vs.Header({ | |
| userInfo: h, | |
| layoutView: i, | |
| userId: i.options.userId | |
| }), $("#header"), true) | |
| }) | |
| }, | |
| getMode: function () { | |
| var h = this; | |
| return h.options.mode | |
| } | |
| }); | |
| c.Vs.Header = Bb.View.extend({ | |
| template: "admissions/candidateview.header.template.html", | |
| initialize: function (h) { | |
| var i = this; | |
| i.model = i.options.userInfo | |
| }, | |
| events: { | |
| "click .sendmessage": "sendMessage" | |
| }, | |
| render: function (h) { | |
| $(h).append(this.el); | |
| this.renderTemplate() | |
| }, | |
| renderTemplate: function (h) { | |
| var i = this; | |
| i.model.fetch({ | |
| cache: false, | |
| data: { | |
| userId: i.options.userId | |
| }, | |
| success: function (j, k) { | |
| p3.fT(i.template, function (l) { | |
| i.$el.html(l({ | |
| collection: k[0], | |
| photoRefresh: new Date().getTime(), | |
| hasComposeAccess: d.Us.hasComposeAccess() && p3.Data.SchoolContext.get("SchoolInfo").IndividualMessageEnabled, | |
| userId: i.options.userId | |
| })); | |
| i.removeLastBar() | |
| }); | |
| c.Data.fullName = k[0] ? k[0].fullname : ""; | |
| i.navItems = new c.Cs.NavItems(); | |
| p3.rV(new c.Vs.Navigation({ | |
| collection: i.navItems, | |
| userInfo: i.options.userInfo, | |
| layoutView: i.options.layoutView, | |
| model: i.options.layoutView.profilePublishField, | |
| page: i.options.layoutView.options.page, | |
| userId: i.options.userId, | |
| hasComposeAccess: d.Us.hasComposeAccess() && p3.Data.SchoolContext.get("SchoolInfo").IndividualMessageEnabled | |
| }), $("#candidateHeader"), false) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading candidate information") | |
| } | |
| }) | |
| }, | |
| removeLastBar: function () { | |
| var i = $("#candidateInfo").html(), | |
| h = i.lastIndexOf("|"); | |
| $("#candidateInfo").html(i.substring(0, h)) | |
| }, | |
| sendMessage: function (h) { | |
| d.Us.composeMessage(["12_" + this.options.userId + "_0"]) | |
| } | |
| }); | |
| c.Vs.Navigation = Bb.View.extend({ | |
| template: "admissions/candidateview.subnav.template.html", | |
| id: "candidateNav", | |
| render: function (h) { | |
| var i = this; | |
| $(h).html(i.el); | |
| i.renderTemplate() | |
| }, | |
| renderTemplate: function (h) { | |
| var k = this, | |
| i, j = false; | |
| p3.fT(k.template, function (l) { | |
| if (k.collection.length === 0) { | |
| _.each(k.options.layoutView.pageAccess, function (m) { | |
| if (g.stringToBoolean(m.Value) === true) { | |
| switch (m.Key) { | |
| case "progress": | |
| k.collection.add([{ | |
| Key: m.Key, | |
| Route: "#candidateview", | |
| Page: "#candidateview/" + k.options.userId + "/progress", | |
| Label: "Admissions Progress", | |
| Icon: "p3icon-admissionProgress", | |
| Selected: false | |
| }]); | |
| break; | |
| case "decision": | |
| k.collection.add([{ | |
| Key: m.Key, | |
| Route: "#candidateview", | |
| Page: "#candidateview/" + k.options.userId + "/decision", | |
| Label: "Decision", | |
| Icon: "p3icon-decision", | |
| Selected: false | |
| }]); | |
| break; | |
| case "officialNotes": | |
| k.collection.add([{ | |
| Key: m.Key, | |
| Route: "#candidateview", | |
| Page: "#candidateview/" + k.options.userId + "/officialNotes", | |
| Label: "Official Notes", | |
| Icon: "p3icon-officalNote", | |
| Selected: false | |
| }]); | |
| break; | |
| case "contactcard": | |
| k.collection.add([{ | |
| Key: m.Key, | |
| Route: "#candidateview", | |
| Page: "#candidateview/" + k.options.userId + "/contactcard", | |
| Label: "Contact Card", | |
| Icon: "p3icon-contactCard", | |
| Selected: false | |
| }]); | |
| break; | |
| default: | |
| break | |
| } | |
| } | |
| }) | |
| } | |
| i = k.options.page.toLowerCase(); | |
| _.each(k.collection.models, function (m) { | |
| if (m.get("Key").toLowerCase() === i) { | |
| m.set({ | |
| Selected: true | |
| }); | |
| j = true | |
| } else { | |
| m.set({ | |
| Selected: false | |
| }) | |
| } | |
| }); | |
| if (!j) { | |
| k.collection.at(0).set({ | |
| Selected: true | |
| }) | |
| } | |
| k.$el.html(l({ | |
| collection: k.collection.toJSON(), | |
| userId: k.options.userId | |
| })); | |
| k.shown(k.options.page) | |
| }) | |
| }, | |
| shown: function (h) { | |
| var i = this; | |
| switch (h) { | |
| case "progress": | |
| p3.rV(new b.Vs.Layout({ | |
| userId: i.options.userId, | |
| userName: c.Data.fullName | |
| }), $("#maincontent"), false); | |
| $('.nav-pills li a[href="#candidateview/' + i.options.userId + '/progress"]').closest("li").addClass("active"); | |
| break; | |
| case "decision": | |
| p3.rV(new a.Vs.Layout({ | |
| userId: i.options.userId | |
| }), $("#maincontent"), false); | |
| $('.nav-pills li a[href="#candidateview/' + i.options.userId + '/decision"]').closest("li").addClass("active"); | |
| break; | |
| case "officialNotes": | |
| e.Data.currentApp = 34; | |
| e.Us.loadViewHistoryNoHeader(i.options.userId, $("#maincontent")); | |
| $('.nav-pills li a[href="#candidateview/' + i.options.userId + '/officialNotes"]').closest("li").addClass("active"); | |
| break; | |
| case "contactcard": | |
| p3.rV(new f.Vs.Layout({ | |
| userId: i.options.userId | |
| }), $("#maincontent"), false); | |
| $('.nav-pills li a[href="#candidateview/' + i.options.userId + '/contactcard"]').closest("li").addClass("active"); | |
| break; | |
| default: | |
| break | |
| } | |
| } | |
| }); | |
| p3.router().route("candidateview/:id/:page(/:mode)", "candidateview", function (h, j, i) { | |
| p3.renderMainPage(new c.Vs.Layout({ | |
| userId: h, | |
| page: j, | |
| mode: i | |
| })) | |
| }) | |
| }(p3.module("admissions/candidateview"))); | |
| (function (b) { | |
| var a = p3.module("shared/base"), | |
| f = p3.module("utilities/validate"), | |
| e = p3.module("utilities/smodal"), | |
| c = p3.module("utilities/filter"), | |
| d = p3.Us.InfoMessageLibrary; | |
| b.Ms.Checklist = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| idAttribute: "ChecklistId", | |
| validation: { | |
| Name: [{ | |
| required: true, | |
| msg: d.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "AdmChecklist/Edit/" + this.id + "/" : aP + "AdmChecklist/Edit/" | |
| } | |
| }); | |
| b.Ms.Status = Bbm.extend({ | |
| idAttribute: "StatusTypeId", | |
| defaults: { | |
| NpiReport: true | |
| }, | |
| validation: { | |
| Name: [{ | |
| required: true, | |
| msg: d.P3.RequiredInfoNotEntered | |
| }, { | |
| maxLength: 50, | |
| msg: d.P3.MaxLengthExceeded | |
| }] | |
| } | |
| }); | |
| b.Ms.ChecklistCopy = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| validation: { | |
| Name: [{ | |
| required: true, | |
| msg: d.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| url: function () { | |
| return aP + "AdmChecklist/Copy/" | |
| } | |
| }); | |
| b.Ms.ItemCategoriesIndex = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| initialize: function () { | |
| this.ItemCategories = new b.Cs.ChecklistItemCategories() | |
| }, | |
| url: function () { | |
| return aP + "AdmChecklistItemCategory/Index/" | |
| } | |
| }); | |
| b.Ms.ChecklistItemCategory = Bbm.extend({ | |
| initialize: function () { | |
| this.set("Cid", this.cid, { | |
| silent: true | |
| }) | |
| }, | |
| validation: { | |
| Name: [{ | |
| required: true, | |
| msg: d.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| isValid: function () { | |
| return (f.isEmptier(this.get("Name"))) ? false : true | |
| } | |
| }); | |
| b.Cs.Checklists = Bbc.extend({ | |
| model: b.Ms.Checklist, | |
| initialize: function () { | |
| _.extend(this, $.extend(true, {}, c.Us.CollectionFilter)) | |
| }, | |
| url: function () { | |
| return aP + "AdmChecklist/List/" | |
| } | |
| }); | |
| b.Cs.Statuses = Bbc.extend({ | |
| model: b.Ms.Status, | |
| url: "AdmChecklistStatus/List/" | |
| }); | |
| b.Cs.ChecklistItemCategories = Bbc.extend({ | |
| model: b.Ms.ChecklistItemCategory, | |
| setModelCids: function () { | |
| this.each(function (g) { | |
| g.set("Cid", g.cid, { | |
| silent: true | |
| }) | |
| }) | |
| } | |
| }); | |
| b.Cs.ChecklistItems = Bbc.extend({}); | |
| b.Vs.Layout = Bb.View.extend({ | |
| template: "page/page.10-2.template.html", | |
| initialize: function () { | |
| var g = this; | |
| g.Containers = {} | |
| }, | |
| render: function (g) { | |
| var h = this; | |
| p3.setTitle("Checklists"); | |
| $(g).html(h.el); | |
| h.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this, | |
| g, h; | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({})); | |
| i.Containers = { | |
| LeftColumn: i.$(".col-left"), | |
| RightColumn: i.$(".col-right") | |
| }; | |
| g = new b.Cs.Checklists(); | |
| g.addExceptionValue("IsSample", "true"); | |
| h = new b.Vs.Checklists({ | |
| collection: g | |
| }); | |
| p3.rV(h, i.Containers.LeftColumn, false); | |
| p3.rV(new c.Vs.Filter({ | |
| template: "checklists/checklists.filter.template.html", | |
| collection: g, | |
| callback: function () { | |
| h.renderData() | |
| } | |
| }), i.Containers.RightColumn, false) | |
| }) | |
| } | |
| }); | |
| b.Vs.Checklists = Bb.View.extend({ | |
| template: "checklists/checklists.content.template.html", | |
| events: { | |
| "click #addChecklist": "addChecklist", | |
| "click #statuses": "manageStatuses", | |
| "click #report-categories": "editReportCategories" | |
| }, | |
| initialize: function (g) { | |
| var h = this; | |
| h.collection.bind("add", function (j) { | |
| var i = new b.Vs.Checklist({ | |
| model: j, | |
| parentView: h | |
| }); | |
| j.bind("sync", h.renderData, h); | |
| p3.rV(i, h.$(".checklists-table"), false) | |
| }, this) | |
| }, | |
| render: function (g) { | |
| var h = this; | |
| $(g).append(h.el); | |
| h.renderData() | |
| }, | |
| renderData: function () { | |
| var g = this; | |
| g.collection.reset(); | |
| p3.fT(g.template, function (h) { | |
| g.$el.html(h({})); | |
| g.collection.fetch({ | |
| update: true, | |
| cache: false | |
| }) | |
| }) | |
| }, | |
| addChecklist: function () { | |
| b.Us.AddChecklist() | |
| }, | |
| manageStatuses: function () { | |
| b.Us.ManageStatuses() | |
| }, | |
| editReportCategories: function (g) { | |
| b.Us.EditReportCategories() | |
| } | |
| }); | |
| b.Vs.Checklist = Bb.View.extend({ | |
| template: "checklists/checklists.checklist.template.html", | |
| tagName: "tr", | |
| events: { | |
| "click .edit:not(.disabled)": "editChecklist", | |
| "click .delete:not(.disabled)": "deleteChecklist", | |
| "click .copy:not(.disabled)": "copyChecklist", | |
| "click a.togglebutton": "toggleInfo", | |
| "change #InactiveInd": "updateStatus", | |
| "click .inline-edit:not(.disabled)": "toggleInlineEdit", | |
| "blur .inline-edit .nameedit input": "closeInlineEdit", | |
| "change input#Name": "updateModel", | |
| "mouseover td.inline-edit": "inlineEditOver", | |
| "mouseout td.inline-edit": "inlineEditOut" | |
| }, | |
| render: function (g) { | |
| var h = this; | |
| $(g).append(h.el); | |
| h.renderData() | |
| }, | |
| renderData: function () { | |
| var g = this; | |
| p3.fT(g.template, function (h) { | |
| g.$el.html(h({ | |
| model: g.model.toJSON() | |
| })) | |
| }) | |
| }, | |
| toggleInfo: function (g) { | |
| var h = this; | |
| h.$(".toggleinfo").slideToggle("fast"); | |
| if ($(g.currentTarget).hasClass("active")) { | |
| $(g.currentTarget).removeClass("active") | |
| } else { | |
| $(g.currentTarget).addClass("active") | |
| } | |
| return false | |
| }, | |
| editChecklist: function (g) { | |
| var h = this; | |
| g.stopPropagation(); | |
| g.preventDefault(); | |
| p3.router().navigate("#settings/checklists/" + h.model.get("ChecklistId"), true) | |
| }, | |
| copyChecklist: function (i, k) { | |
| var l = this, | |
| h = { | |
| Id: l.model.get("ChecklistId") | |
| }, | |
| g = new b.Ms.ChecklistCopy({ | |
| ChecklistId: l.model.get("ChecklistId"), | |
| Name: "Copy of " + l.model.get("Name") | |
| }), | |
| j; | |
| g.bind("sync", l.options.parentView.renderData, l.options.parentView); | |
| j = e.Vs.Modal2.extend({ | |
| template: "checklists/checklists.checklist.copy.template.html", | |
| model: g, | |
| dataParam: h, | |
| variables: { | |
| name: l.model.get("Name") | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new j(), p3.Layout.Containers.Modal, true) | |
| }, | |
| updateStatus: function (h) { | |
| h.preventDefault(); | |
| var j = this, | |
| g = $(h.currentTarget), | |
| i = g.val(); | |
| j.model.set("InactiveInd", i); | |
| j.model.save({}, { | |
| error: function () { | |
| p3.displayError("Error saving checklist status") | |
| } | |
| }) | |
| }, | |
| deleteChecklist: function (g) { | |
| var h = this; | |
| p3.showConfirm("Delete Checklist", "Wait a minute. Are you really sure you want to delete " + h.model.get("Name") + "?", null, function () { | |
| $(h.el).find("button").addClass("disabled"); | |
| $(h.el).find("button.delete").prepend('<div class="textcenter"><img width="19px" height="19px" src="' + p3.Config.CssImagePath + 'spinner.gif" ></div>').find("h5").hide(); | |
| $(h.el).find("button.delete h5").hide(); | |
| h.model.destroy({ | |
| dataParam: { | |
| id: h.model.get("ChecklistId") | |
| }, | |
| success: function () { | |
| h.deleteElement() | |
| }, | |
| error: function () { | |
| $(h.el).find("button").removeClass("disabled"); | |
| $(h.el).find("button.delete div").remove(); | |
| $(h.el).find("button.delete h5").show(); | |
| p3.displayError("Error deleting checklist") | |
| } | |
| }) | |
| }) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| }, | |
| inlineEditOver: function (g) { | |
| g.stopPropagation(); | |
| g.preventDefault(); | |
| $(g.currentTarget).find("i").show() | |
| }, | |
| inlineEditOut: function (g) { | |
| g.stopPropagation(); | |
| g.preventDefault(); | |
| $(g.currentTarget).find("i").hide() | |
| }, | |
| toggleInlineEdit: function (g) { | |
| g.stopPropagation(); | |
| g.preventDefault(); | |
| var h = $(g.currentTarget); | |
| h.find(".display").hide(); | |
| h.find(".nameedit").show(); | |
| h.find(".nameedit input").focus() | |
| }, | |
| closeInlineEdit: function (g) { | |
| var h = this; | |
| g.stopPropagation(); | |
| g.preventDefault(); | |
| if (h.model.isValid(true)) { | |
| h.$(".display").show(); | |
| h.$(".nameedit").hide(); | |
| h.updateModel(g) | |
| } | |
| }, | |
| updateModel: function (i) { | |
| var m = this, | |
| k = $(i.currentTarget), | |
| j = k.attr("name"), | |
| l, g = {}, | |
| h; | |
| i.stopPropagation(); | |
| i.preventDefault(); | |
| m.model.defaults = $.extend(true, {}, m.model.attributes); | |
| if (j === "Name") { | |
| l = k.prop("value"); | |
| if (!l) { | |
| l = null | |
| } | |
| } | |
| if (!_.contains(j, ".")) { | |
| g[j] = l; | |
| m.model.set(g) | |
| } else { | |
| m.setPropByString(m.model.attributes, j, l); | |
| if (m.model.isValid(j)) { | |
| Bb.Validation.callbacks.valid(m, j, "name") | |
| } else { | |
| Bb.Validation.callbacks.invalid(m, j, "Entered value contains an error.", "name") | |
| } | |
| } | |
| if (m.model.isValid(true)) { | |
| m.model.set({ | |
| FieldsToNull: [] | |
| }); | |
| _.each(m.model.attributes, function (p, n, o) { | |
| m.recursiveFunction(p, n, o, "") | |
| }); | |
| h = { | |
| Id: m.model.get("ChecklistId") | |
| }; | |
| m.model.save({}, { | |
| dataParam: h, | |
| error: function (o, n) { | |
| p3.displayError("Error saving") | |
| } | |
| }); | |
| if (j === "Name") { | |
| k.parent().siblings(".display").html(l) | |
| } | |
| } | |
| }, | |
| recursiveFunction: function (j, g, h, i) { | |
| var k = this; | |
| e.Us.setFieldsToNull(k.model, j, g, h, i) | |
| }, | |
| getPropByString: function (g, h) { | |
| return e.Us.getPropByString(g, h) | |
| }, | |
| setPropByString: function (g, h, i) { | |
| e.Us.setPropByString(g, h, i) | |
| } | |
| }); | |
| b.Vs.Sidebar = Bb.View.extend({ | |
| template: "checklists/checklists.sidebar.template.html", | |
| className: "checklists-sidebar", | |
| events: { | |
| "click #addChecklist": "addChecklist", | |
| "click #statuses": "manageStatuses", | |
| "click #report-categories": "editReportCategories" | |
| }, | |
| render: function (g) { | |
| var h = this; | |
| $(g).html(h.el); | |
| h.renderData() | |
| }, | |
| renderData: function () { | |
| var g = this; | |
| p3.fT(g.template, function (h) { | |
| g.$el.html(h({})) | |
| }) | |
| }, | |
| addChecklist: function () { | |
| b.Us.AddChecklist() | |
| }, | |
| manageStatuses: function () { | |
| b.Us.ManageStatuses() | |
| }, | |
| editReportCategories: function (g) { | |
| b.Us.EditReportCategories() | |
| } | |
| }); | |
| b.Vs.StatusesManage = Bb.View.extend({ | |
| template: "checklists/checklists.statuses.template.html", | |
| initialize: function (g) { | |
| this.model = new b.Ms.Status(); | |
| Bb.Validation.bind(this, { | |
| forceUpdate: true, | |
| selector: "id" | |
| }); | |
| this.Containers = {} | |
| }, | |
| events: { | |
| "click #btnAdd": "addStatus", | |
| "click .save": "saveStatuses" | |
| }, | |
| render: function (g) { | |
| var h = this; | |
| $(g).append(h.el); | |
| h.renderTemplate() | |
| }, | |
| renderTemplate: function () { | |
| var g = this; | |
| p3.fT(g.template, function (i) { | |
| g.$el.html(i({})); | |
| g.Containers = { | |
| EditList: g.$("#status-list") | |
| }; | |
| var h = new b.Vs.StatusEditList({ | |
| collection: g.collection | |
| }); | |
| p3.rV(h, g.Containers.EditList, true); | |
| g.collection.on("add", function () { | |
| h.renderTemplate() | |
| }); | |
| $(".required-indicator").tooltip() | |
| }) | |
| }, | |
| addStatus: function (k) { | |
| k.preventDefault(); | |
| var l = this, | |
| i = l.$("#Name"), | |
| j = 0, | |
| g = l.$(".error-holder"), | |
| h = l.$(".error-holder .alert"); | |
| l.model.set({ | |
| Name: i.val(), | |
| InUse: false, | |
| DeleteInd: false | |
| }); | |
| _.each(l.collection.models, function (m) { | |
| if (m.attributes.Name === i.val()) { | |
| j = 1 | |
| } | |
| }); | |
| if (j !== 1) { | |
| h.html(""); | |
| g.hide(); | |
| if (l.model.isValid(true)) { | |
| l.collection.add(l.model); | |
| l.model = new b.Ms.Status(); | |
| Bb.Validation.bind(this, { | |
| forceUpdate: true, | |
| selector: "id" | |
| }); | |
| i.val("") | |
| } | |
| } else { | |
| h.html("Status name must be unique."); | |
| g.show() | |
| } | |
| }, | |
| saveStatuses: function (g) { | |
| g.preventDefault(); | |
| var h = this; | |
| h.collection.sync("update", h.collection, { | |
| success: function () { | |
| p3.showModal(p3.Layout.Containers.Modal, "hide") | |
| }, | |
| error: function () { | |
| p3.showModal(p3.Layout.Containers.Modal, "hide"); | |
| p3.displayError("Error saving statuses") | |
| } | |
| }) | |
| } | |
| }); | |
| b.Vs.StatusEditList = Bb.View.extend({ | |
| template: "checklists/checklists.statuses.edit.template.html", | |
| id: "edit-statuses-holder", | |
| events: { | |
| "click button.npi-report": "npiReportClicked", | |
| "click button.status-delete": "statusDeleteClicked", | |
| "click .inline-edit": "toggleInlineEdit", | |
| "blur .inline-edit .edit input": "closeInlineEdit", | |
| "change input#Name": "updateModel", | |
| "mouseover td.inline-edit": "inlineEditOver", | |
| "mouseout td.inline-edit": "inlineEditOut" | |
| }, | |
| render: function (g) { | |
| var h = this; | |
| $(g).append(h.el); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.jQueryUI, function () { | |
| h.renderTemplate() | |
| }) | |
| }, | |
| renderTemplate: function () { | |
| var g = this; | |
| g.collection.each(function (h) { | |
| h.set({ | |
| cid: h.cid | |
| }, { | |
| silent: true | |
| }) | |
| }); | |
| p3.fT(g.template, function (h) { | |
| g.$el.html(h({ | |
| statuses: g.collection.toJSON() | |
| })); | |
| g.initSortable(); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| initSortable: function () { | |
| var g = this; | |
| g.$(".ui-sortable").sortable({ | |
| items: ".sort-drag-block", | |
| axis: "y", | |
| distance: 5, | |
| containment: ".ui-sortable", | |
| appendTo: "#edit-statuses-holder", | |
| placeholder: "sortable-placeholder", | |
| helper: function (h, i) { | |
| return '<table class="table table-striped sort-drag-block-helper"><tbody>' + i.context.outerHTML + "</tbody></table>" | |
| }, | |
| update: function (h, l) { | |
| var j = l.item.index(), | |
| i = l.item.data("cid"), | |
| k = g.collection.get(i); | |
| if (k) { | |
| g.collection.remove(k); | |
| g.collection.add(k, { | |
| at: j, | |
| silent: true | |
| }) | |
| } | |
| } | |
| }).disableSelection() | |
| }, | |
| npiReportClicked: function (i) { | |
| i.preventDefault(); | |
| var j = this, | |
| g = $(i.currentTarget), | |
| h = g.closest("tr").data("cid"); | |
| j.model = j.collection.get(h); | |
| if (j.model) { | |
| _.defer(function () { | |
| j.model.set("NpiReport", g.hasClass("active")) | |
| }) | |
| } | |
| }, | |
| statusDeleteClicked: function (i) { | |
| i.preventDefault(); | |
| var j = this, | |
| g = $(i.currentTarget), | |
| h = g.closest("tr").data("cid"); | |
| j.model = j.collection.get(h); | |
| if (j.model && !j.model.get("InUse")) { | |
| j.model.set("DeleteInd", !j.model.get("DeleteInd")) | |
| } | |
| }, | |
| inlineEditOver: function (g) { | |
| g.stopPropagation(); | |
| g.preventDefault(); | |
| $(g.currentTarget).find("i").show() | |
| }, | |
| inlineEditOut: function (g) { | |
| g.stopPropagation(); | |
| g.preventDefault(); | |
| $(g.currentTarget).find("i").hide() | |
| }, | |
| toggleInlineEdit: function (i) { | |
| var j = this, | |
| g = $(i.currentTarget), | |
| h; | |
| i.stopPropagation(); | |
| i.preventDefault(); | |
| h = g.closest("tr").data("cid"); | |
| j.model = j.collection.get(h); | |
| g.find(".display").hide(); | |
| g.find(".edit").show(); | |
| g.find(".edit input").focus() | |
| }, | |
| closeInlineEdit: function (i) { | |
| var j = this, | |
| g = $(i.currentTarget), | |
| h; | |
| i.stopPropagation(); | |
| i.preventDefault(); | |
| h = g.closest("tr").data("cid"); | |
| j.model = j.collection.get(h); | |
| if (j.model.isValid(true)) { | |
| j.$(".display").show(); | |
| j.$(".edit").hide(); | |
| j.updateModel(i) | |
| } | |
| }, | |
| updateModel: function (h) { | |
| var l = this, | |
| j = $(h.currentTarget), | |
| i = j.attr("name"), | |
| k, g = {}; | |
| h.stopPropagation(); | |
| h.preventDefault(); | |
| l.model.defaults = $.extend(true, {}, l.model.attributes); | |
| if (i === "Name") { | |
| k = j.prop("value"); | |
| if (!k) { | |
| k = null | |
| } | |
| } else { | |
| k = j.prop("value") | |
| } | |
| if (!_.contains(i, ".")) { | |
| g[i] = k; | |
| l.model.set(g) | |
| } else { | |
| l.setPropByString(l.model.attributes, i, k); | |
| if (l.model.isValid(i)) { | |
| Bb.Validation.callbacks.valid(l, i, "name") | |
| } else { | |
| Bb.Validation.callbacks.invalid(l, i, "Entered value contains an error.", "name") | |
| } | |
| } | |
| if (l.model.isValid(true)) { | |
| l.model.set({ | |
| FieldsToNull: [] | |
| }); | |
| _.each(l.model.attributes, function (o, m, n) { | |
| l.recursiveFunction(o, m, n, "") | |
| }); | |
| if (i === "Name") { | |
| j.parent().siblings(".display").text(k) | |
| } | |
| } | |
| }, | |
| recursiveFunction: function (j, g, h, i) { | |
| var k = this; | |
| e.Us.setFieldsToNull(k.model, j, g, h, i) | |
| }, | |
| getPropByString: function (g, h) { | |
| return e.Us.getPropByString(g, h) | |
| }, | |
| setPropByString: function (g, h, i) { | |
| e.Us.setPropByString(g, h, i) | |
| } | |
| }); | |
| b.Us.AddChecklist = function () { | |
| var g = new b.Ms.Checklist({ | |
| InactiveInd: 1 | |
| }), | |
| h; | |
| h = e.Vs.Modal2.extend({ | |
| template: "checklists/checklists.checklist.create.template.html", | |
| model: g, | |
| modalSavedSuccess: function (j) { | |
| var i = this; | |
| p3.router().navigate("#settings/checklists/" + i.model.toJSON().ChecklistId, true) | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new h(), p3.Layout.Containers.Modal, true) | |
| }; | |
| b.Us.ManageStatuses = function () { | |
| var g = new b.Cs.Statuses(); | |
| g.fetch({ | |
| success: function () { | |
| p3.rV(new b.Vs.StatusesManage({ | |
| collection: g | |
| }), p3.Layout.Containers.Modal, true); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading statuses") | |
| } | |
| }) | |
| }; | |
| b.Us.EditReportCategories = function () { | |
| var g = new b.Ms.ItemCategoriesIndex(); | |
| g.fetch({ | |
| success: function (i, j) { | |
| var h = e.Vs.Modal2.extend({ | |
| template: "checklists/checklists.reportcategories.template.html", | |
| model: g, | |
| ChecklistItemCategories: new b.Cs.ChecklistItemCategories(g.toJSON().AdmChecklistItemCategories), | |
| ChecklistItems: new b.Cs.ChecklistItems(g.toJSON().AdmChecklists), | |
| events: { | |
| "click .nav-tabs li": "selectTab", | |
| "click .left-tabs div": "selectTab" | |
| }, | |
| modalRendered: function (l) { | |
| var k = this; | |
| k.tabNumber = 1; | |
| k.renderTabs() | |
| }, | |
| adjustedSelector: function (k) { | |
| var l = this; | |
| k = k.replace("nav-tabs li", "left-tabs div"); | |
| k = k.replace("nav-tabs", "left-tabs"); | |
| k = k.replace("] a", "]"); | |
| return l.$(k) | |
| }, | |
| renderTabs: function (k) { | |
| var l = this; | |
| p3.fT("checklists/checklists.reportcategories.tab.template.html", function (m) { | |
| l.$(".tab-holder").html(m({ | |
| collection: l.ChecklistItemCategories.toJSON() | |
| })); | |
| _.each(l.ChecklistItemCategories.toJSON(), function (n) { | |
| _.each(l.ChecklistItems.toJSON(), function (o) { | |
| _.each(o.ChecklistCategoryIndex, function (p) { | |
| _.each(p.ChecklistItemCategories, function (q) { | |
| if (n.ChecklistItemCategoryId === q.ChecklistItemCategoryId) { | |
| q.Cid = n.Cid | |
| } | |
| }) | |
| }) | |
| }) | |
| }); | |
| if (l.ChecklistItemCategories.toJSON().length) { | |
| l.adjustedSelector(".nav-tabs li").first().click() | |
| } else { | |
| l.$(".tab-content").html('<div class="tab-pane active mb-20" style="text-align:center;"><h3>No categories have been created.</h3><button class="btn btn-default btn-sm bb-btn-secondary add"><i class="fa fa-plus-circle"></i> Add Category</button></div>') | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| selectTab: function (l) { | |
| var m = this, | |
| n, k = m.$(l.currentTarget); | |
| l.stopPropagation(); | |
| l.preventDefault(); | |
| m.adjustedSelector(".nav-tabs li.active").removeClass("active"); | |
| k.addClass("active"); | |
| k.closest(".left-item").siblings(".left-item").removeClass("white-bgc"); | |
| k.closest(".left-item").addClass("white-bgc"); | |
| m.cId = k.data("cid"); | |
| n = _.findWhere(m.ChecklistItemCategories.toJSON(), { | |
| Cid: m.cId | |
| }); | |
| m.categoryName = n.Name; | |
| m.categoryId = n.ChecklistItemCategoryId; | |
| m.deleteInd = n.DeleteInd; | |
| m.errorInd = k.hasClass("box-validate"); | |
| m.renderContent() | |
| }, | |
| renderContent: function (k) { | |
| var l = this; | |
| p3.fT("checklists/checklists.reportcategories.content.template.html", function (m) { | |
| l.$(".tab-content").html(m({ | |
| collection: l.ChecklistItems.toJSON(), | |
| categoryName: l.categoryName, | |
| errorInd: l.errorInd, | |
| deleteInd: l.deleteInd, | |
| cid: l.cId, | |
| id: l.categoryId | |
| })); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| modalUpdate: function (m) { | |
| var l = this, | |
| o, n, k, p; | |
| if (m.eventCurrentTarget.hasClass("checklist-step")) { | |
| o = _.findWhere(l.ChecklistItems.toJSON(), { | |
| ChecklistId: m.eventCurrentTarget.data("checklistid") | |
| }); | |
| n = _.findWhere(o.ChecklistCategoryIndex, { | |
| ChecklistItemId: m.eventCurrentTarget.data("itemid") | |
| }); | |
| if (m.eventCurrentTarget.hasClass("active")) { | |
| n.ChecklistItemCategories = _.reject(n.ChecklistItemCategories, function (q) { | |
| return q.Cid === l.cId | |
| }) | |
| } else { | |
| n.ChecklistItemCategories.push({ | |
| ChecklistItemCategoryId: l.categoryId, | |
| Cid: l.cId | |
| }) | |
| } | |
| return false | |
| } | |
| if (m.eventCurrentTarget.attr("name") === "Name") { | |
| _.each(l.ChecklistItemCategories.models, function (q) { | |
| if (q.get("Cid") === l.cId) { | |
| q.set({ | |
| Name: m.eventCurrentTarget.val() | |
| }) | |
| } | |
| }); | |
| return false | |
| } | |
| if (m.eventCurrentTarget.hasClass("delete")) { | |
| if (m.eventCurrentTarget.hasClass("active")) { | |
| k = false; | |
| l.$(".category-items").show() | |
| } else { | |
| k = true; | |
| l.$(".category-items").hide() | |
| } | |
| _.each(l.ChecklistItemCategories.models, function (q) { | |
| if (q.get("Cid") === l.cId) { | |
| q.set({ | |
| DeleteInd: k | |
| }) | |
| } | |
| }); | |
| return false | |
| } | |
| if (m.eventCurrentTarget.hasClass("add")) { | |
| l.ChecklistItemCategories.add({ | |
| ChecklistItemCategoryId: null, | |
| Cid: null, | |
| DeleteInd: false, | |
| FieldsToNull: [], | |
| InsertDate: null, | |
| LastModifyDate: null, | |
| LastModifyUserId: null, | |
| LockInd: 1, | |
| Name: "Category " + l.tabNumber, | |
| SortOrder: null, | |
| UseFieldsToNull: false, | |
| insert_by: null, | |
| internal_id: null, | |
| modified_by: null, | |
| school_id: null, | |
| vendor_external_id: null | |
| }); | |
| p = l.ChecklistItemCategories.at(l.ChecklistItemCategories.length - 1).get("Cid"); | |
| l.adjustedSelector(".nav-tabs").append('<div class="left-item m-0 p-0" data-cid="' + p + '"><p class="m-0 p-10">Category ' + l.tabNumber + '</p></div><hr class="divider p-0 m-0">'); | |
| l.adjustedSelector('.nav-tabs li[data-cid="' + p + '"]').click(); | |
| l.tabNumber++ | |
| } | |
| }, | |
| modalSave: function (m) { | |
| var l = this, | |
| k = true; | |
| l.adjustedSelector(".nav-tabs li a").removeClass("box-validate"); | |
| l.adjustedSelector('.tab-content [name="Name"]').removeClass("box-validate"); | |
| l.$(".tab-content .control-label").removeClass("error"); | |
| _.each(l.ChecklistItemCategories.models, function (n) { | |
| if (!n.isValid()) { | |
| l.adjustedSelector('.nav-tabs li[data-cid="' + n.get("Cid") + '"] a').addClass("box-validate"); | |
| k = false; | |
| if (l.adjustedSelector('.nav-tabs li[data-cid="' + n.get("Cid") + '"]').hasClass("active")) { | |
| l.$('.tab-content [name="Name"]').addClass("box-validate"); | |
| l.$(".tab-content .control-label").addClass("error") | |
| } | |
| } | |
| }); | |
| g.set({ | |
| AdmChecklistItemCategories: l.ChecklistItemCategories.toJSON(), | |
| AdmChecklists: l.ChecklistItems.toJSON() | |
| }); | |
| if (!k) { | |
| return false | |
| } | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new h(), p3.Layout.Containers.Modal, true) | |
| } | |
| }) | |
| }; | |
| Hb.registerHelper("formatLength", function (h, g) { | |
| return (h.length > g) ? h.substr(0, g) + "..." : h | |
| }); | |
| Hb.registerHelper("eachChecklistCategory", function (g, n) { | |
| var k, m, l, h = ""; | |
| if (!_.isArray(g)) { | |
| g = [g] | |
| } | |
| for (k = 0, m = g.length; k < m; k++) { | |
| l = g[k]; | |
| l.startTag = ""; | |
| l.endTag = ""; | |
| if (k % 3 === 0) { | |
| l.startTag = "<tr>"; | |
| if (k !== 0) { | |
| l.endTag = "</tr>" | |
| } | |
| } | |
| h += n.fn(l) | |
| } | |
| return h | |
| }); | |
| Hb.registerHelper("isChecklistItemActive", function (g, h, j) { | |
| var i = _.some(g, function (k) { | |
| return k.Cid === h | |
| }); | |
| return new Hb.SafeString(i ? " active" : "") | |
| }); | |
| p3.router().route("settings/checklists", "settings/checklists", function () { | |
| p3.renderMainPage(new b.Vs.Layout({})) | |
| }) | |
| }(p3.module("admissions/checklists"))); | |
| (function (b) { | |
| var c = p3.module("shared/datepicker"), | |
| a = p3.module("shared/base"), | |
| h = p3.module("utilities/smodal"), | |
| d = p3.module("utilities/dictionary"), | |
| g = p3.module("utilities/multifetch"), | |
| i = p3.module("utilities/validate"), | |
| e = p3.Us.Enum, | |
| f = p3.Us.InfoMessageLibrary; | |
| b.Ms.Checklist = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| idAttribute: "ChecklistId", | |
| url: function () { | |
| return this.id ? aP + "AdmChecklist/Edit/" + this.id + "/" : aP + "AdmChecklist/Edit/" | |
| } | |
| }); | |
| b.Ms.Milestone = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| idAttribute: "ChecklistStepId", | |
| validation: { | |
| ChecklistStepDesc: [{ | |
| required: true, | |
| msg: f.P3.RequiredInfoNotEntered | |
| }], | |
| StatusChange: [{ | |
| required: true, | |
| msg: f.P3.RequiredInfoNotEntered | |
| }], | |
| NewStatusTypeId: [{ | |
| fn: function (l, j, k) { | |
| if (!i.isEmptier(k.StatusChange) && _.contains(["2", "3"], k.StatusChange.toString()) && i.isEmptier(l)) { | |
| return f.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "AdmChecklistStep/Edit/" + this.id + "/" : aP + "AdmChecklistStep/Edit/" | |
| }, | |
| getStep: function (j) { | |
| var l = this.get("AdmChecklistItem"), | |
| k; | |
| if (l && l.length) { | |
| k = _.find(l, function (m) { | |
| return m.ChecklistItemId === j | |
| }); | |
| if (k) { | |
| k = new b.Ms.Step(k) | |
| } | |
| } | |
| return k | |
| } | |
| }, { | |
| DisplayName: "Milestone" | |
| }); | |
| b.Ms.Step = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| idAttribute: "ChecklistItemId", | |
| validation: { | |
| ChecklistItemDesc: [{ | |
| required: true, | |
| msg: f.P3.RequiredInfoNotEntered | |
| }], | |
| DateDue: [{ | |
| date: true | |
| }], | |
| ReminderDays: [{ | |
| fn: function (l, j, k) { | |
| if (!i.isEmptier(k.ReminderTypeId) && _.contains(["3", "4", "5"], k.ReminderTypeId.toString()) && i.isEmptier(l)) { | |
| return f.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }], | |
| FamilyReminderDays: [{ | |
| fn: function (l, j, k) { | |
| if (!i.isEmptier(k.FamilyReminderTypeId) && _.contains(["3", "4", "5"], k.FamilyReminderTypeId.toString()) && i.isEmptier(l)) { | |
| return f.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }], | |
| RecommendTypeId: [{ | |
| fn: function (l, j, k) { | |
| if (!i.isEmptier(k.DataCollectionTypeId) && _.contains(["4", "20"], k.DataCollectionTypeId.toString()) && i.isEmptier(l) && k.Publish === true && k.RecommendInd === true) { | |
| return f.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }], | |
| RecommendRecipientLabel: [{ | |
| fn: function (l, j, k) { | |
| if (!i.isEmptier(k.DataCollectionTypeId) && _.contains(["4", "20"], k.DataCollectionTypeId.toString()) && i.isEmptier(l) && k.Publish === true && k.RecommendInd === true) { | |
| return f.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }], | |
| RecommendEmailText: [{ | |
| fn: function (l, j, k) { | |
| if (!i.isEmptier(k.DataCollectionTypeId) && _.contains(["4"], k.DataCollectionTypeId.toString()) && i.isEmptier(l) && k.Publish === true && k.RecommendInd === true) { | |
| return f.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }], | |
| RecommendPageText: [{ | |
| fn: function (l, j, k) { | |
| if (!i.isEmptier(k.DataCollectionTypeId) && _.contains(["4", "20"], k.DataCollectionTypeId.toString()) && i.isEmptier(l) && k.Publish === true && k.RecommendInd === true) { | |
| return f.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }], | |
| FormTypeId: [{ | |
| fn: function (l, j, k) { | |
| if (!i.isEmptier(k.DataCollectionTypeId) && _.contains(["19"], k.DataCollectionTypeId.toString()) && i.isEmptier(l)) { | |
| return f.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }], | |
| ApplicationFormId: [{ | |
| fn: function (l, j, k) { | |
| if (!i.isEmptier(k.DataCollectionTypeId) && _.contains(["19", "20"], k.DataCollectionTypeId.toString()) && i.isEmptier(l)) { | |
| return f.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "AdmChecklistItem/Edit/" + this.id + "/" : aP + "AdmChecklistItem/Edit/" | |
| } | |
| }, { | |
| DisplayName: "Step" | |
| }); | |
| b.Ms.CandidateApply = Bbm.extend({ | |
| defaults: { | |
| ApplyToCandidates: false, | |
| SchoolYears: [], | |
| GradeLevels: [] | |
| }, | |
| validation: { | |
| ApplyToCandidates: { | |
| required: true, | |
| msg: f.P3.RequiredInfoNotEntered | |
| } | |
| }, | |
| getOptions: function () { | |
| return { | |
| applyToCandidates: this.get("ApplyToCandidates"), | |
| schoolYears: this.get("SchoolYears").join(","), | |
| gradeLevels: this.get("GradeLevels").join(",") | |
| } | |
| } | |
| }); | |
| b.Ms.ChecklistSort = Bbm.extend({ | |
| parse: function (j) { | |
| this.MileStones = new b.Cs.Milestones(j.ChecklistSteps); | |
| this.CandidateApplyOptions = new b.Ms.CandidateApply(j.CandidateApplyOptions); | |
| return j | |
| }, | |
| urlRoot: "AdmChecklistStep/EditSort" | |
| }); | |
| b.Cs.Milestones = Bbc.extend({ | |
| sync: a.DataParamSync, | |
| model: b.Ms.Milestone, | |
| url: function () { | |
| return aP + "AdmChecklistStep/List/" | |
| } | |
| }); | |
| b.Cs.Steps = Bbc.extend({ | |
| sync: a.DataParamSync, | |
| model: b.Ms.Step | |
| }); | |
| b.Cs.AdmDataCollectionTypes = Bbc.extend({ | |
| url: function () { | |
| return aP + "DataDirect/AdmDataCollectionTypes/" | |
| } | |
| }); | |
| b.Cs.EventRegistrationTypes = Bbc.extend({ | |
| url: function () { | |
| return aP + "AdmChecklistItem/RegistrationList/" | |
| } | |
| }); | |
| b.Cs.SchoolFormTypes = Bbc.extend({ | |
| url: function () { | |
| return aP + "DataDirect/SchoolFormPermissionGet/" | |
| } | |
| }); | |
| b.Cs.SchoolForms = Bbc.extend({ | |
| url: function () { | |
| return aP + "SchoolForm/List/" | |
| } | |
| }); | |
| b.Cs.RecommendationForms = Bbc.extend({ | |
| url: function () { | |
| return aP + "RecommendationForm/FormList/" | |
| } | |
| }); | |
| b.Vs.Layout = Bb.View.extend({ | |
| template: "page/page.12.header.template.html", | |
| id: "checklistedit-main", | |
| initialize: function (j) { | |
| var k = this; | |
| j = j || {}; | |
| k.ChecklistId = j.ChecklistId | |
| }, | |
| events: {}, | |
| render: function (j) { | |
| var k = this; | |
| p3.setTitle("Checklist Edit"); | |
| $(j).append(k.el); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.jQueryUI, function () { | |
| d.Us.FetchAll({ | |
| ADMChecklistStatus: e.DictionaryData.ADMChecklistStatus, | |
| ADMStaff: e.DictionaryData.ADMStaff, | |
| ADMReminderTypes: e.DictionaryData.ADMReminderTypes, | |
| ADMReferenceTypes: e.DictionaryData.ADMReferenceTypes, | |
| GradeLevel: e.DictionaryData.GradeLevel, | |
| SchoolYearCurrentFuture: { | |
| name: "School Year Current Future", | |
| id: 83, | |
| inputParam: "display=7[i]" | |
| } | |
| }, function (l) { | |
| b.Data.Dictionaries = l; | |
| k.renderData() | |
| }) | |
| }) | |
| }, | |
| renderData: function () { | |
| var j = this; | |
| p3.fT(j.template, function (l) { | |
| var k; | |
| j.$el.html(l({})); | |
| k = $(".col-center"); | |
| p3.rV(new b.Vs.Header({}), k, false) | |
| }) | |
| } | |
| }); | |
| b.Vs.Header = Bb.View.extend({ | |
| template: "checklists/checklists.edit.header.html", | |
| id: "checklistedit-header", | |
| initialize: function (j) { | |
| var k = this; | |
| k.model = new b.Ms.Checklist(); | |
| k.dictionaries = b.Data.Dictionaries; | |
| b.Data.Checklist = k.model | |
| }, | |
| events: { | |
| "click .create-milestone": "createMilestone", | |
| "click .edit": "editSort" | |
| }, | |
| render: function (j) { | |
| var k = this; | |
| $(j).append(k.el); | |
| k.renderData() | |
| }, | |
| renderData: function () { | |
| var j = this; | |
| p3.fT(j.template, function (k) { | |
| j.model.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| id: b.Data.ChecklistId | |
| }, | |
| success: function (m, n) { | |
| var l; | |
| j.$el.html(k({ | |
| model: m.toJSON() | |
| })); | |
| l = $(".milestones-content-section"); | |
| p3.rV(new b.Vs.Milestones({ | |
| model: m | |
| }), l, false) | |
| } | |
| }) | |
| }) | |
| }, | |
| createMilestone: function (j) { | |
| var m = this, | |
| k = new b.Ms.Milestone({ | |
| ChecklistId: b.Data.ChecklistId | |
| }), | |
| l; | |
| l = h.Vs.Modal2.extend({ | |
| template: "checklists/checklists.edit.editmilestone.template.html", | |
| size: "md", | |
| model: k, | |
| dictionaries: m.dictionaries, | |
| variables: { | |
| hideNewStatusTypeId: true | |
| }, | |
| modalUpdate: function (o) { | |
| var n = this; | |
| if (o.eventCurrentTarget.parent().attr("name") === "StatusChange") { | |
| if (o.eventCurrentTarget.val() === "1" || o.eventCurrentTarget.val() === 1 || o.eventCurrentTarget.attr("value") === "1" || o.eventCurrentTarget.attr("value") === 1) { | |
| n.$(".status-options").hide(); | |
| n.setAll("NewStatusTypeId", null); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| } else { | |
| n.$(".status-options").show(); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| } | |
| } | |
| }, | |
| modalSave: function (o) { | |
| var n = this; | |
| return b.Us.ManageApplyToCandidatesView(n, k, o) | |
| }, | |
| modalSavedSuccess: function (n) { | |
| $("#main-checklist").triggerHandler("createdata", n.response) | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new l(), p3.Layout.Containers.Modal, true) | |
| }, | |
| editSort: function (k) { | |
| k.preventDefault(); | |
| var m = this, | |
| j = new b.Ms.ChecklistSort(), | |
| l; | |
| j.fetch({ | |
| data: { | |
| checklistId: m.model.id | |
| }, | |
| success: function (n, p, o) { | |
| l = new b.Vs.ChecklistSort({ | |
| model: j | |
| }); | |
| l.on("sortSaved", function () { | |
| b.trigger("refreshMilestones") | |
| }); | |
| p3.rV(l, p3.Layout.Containers.Modal, true); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }) | |
| }, | |
| error: function (n, p, o) { | |
| p3.displayError("Error loading checklist") | |
| } | |
| }) | |
| } | |
| }); | |
| b.Vs.Milestones = Bb.View.extend({ | |
| id: "main-checklist", | |
| className: "adm-well-top", | |
| initialize: function (j) { | |
| var k = this; | |
| k.collection = new b.Cs.Milestones(); | |
| k.collection.bind("add", function (m) { | |
| var l = new b.Vs.Milestone({ | |
| model: m | |
| }); | |
| p3.rV(l, this.$el, false) | |
| }, k); | |
| b.on("refreshMilestones", function () { | |
| k.$el.empty(); | |
| k.collection.reset(); | |
| k.renderData() | |
| }, k) | |
| }, | |
| events: { | |
| renderdata: "renderData", | |
| createdata: "createData" | |
| }, | |
| render: function (j) { | |
| var k = this; | |
| $(j).append(k.el); | |
| k.renderTemplate() | |
| }, | |
| renderTemplate: function () { | |
| var j = this; | |
| j.renderData() | |
| }, | |
| renderData: function () { | |
| var j = this; | |
| j.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| checklistId: b.Data.ChecklistId | |
| }, | |
| complete: function () { | |
| j.collection.reset() | |
| } | |
| }) | |
| }, | |
| createData: function (j, k) { | |
| var l = this; | |
| l.collection.add(k) | |
| } | |
| }); | |
| b.Vs.Milestone = Bb.View.extend({ | |
| template: "checklists/checklists.edit.milestone.html", | |
| initialize: function (j) { | |
| var k = this; | |
| k.dictionaries = b.Data.Dictionaries; | |
| k.model.bind("sync", k.refreshData, k); | |
| k.model.bind("destroy", k.deleteElement, k); | |
| k.model.bind("remove", k.deleteElement, k) | |
| }, | |
| events: { | |
| "click .toggleLink": "toggleSection", | |
| "click .create-step": "createStep", | |
| "click .edit-milestone": "editMilestone", | |
| "click .delete-milestone": "deleteMilestone" | |
| }, | |
| render: function (j) { | |
| var k = this; | |
| $(j).append(k.el); | |
| k.renderData() | |
| }, | |
| renderData: function () { | |
| var j = this; | |
| p3.fT(j.template, function (l) { | |
| j.$el.html(l({ | |
| model: j.model.toJSON() | |
| })); | |
| var k = new b.Vs.Steps({ | |
| data: j.model.toJSON().AdmChecklistItem, | |
| milestone: j.model.get("ChecklistStepDesc"), | |
| milestoneView: j | |
| }); | |
| p3.rV(k, j.$("table"), false) | |
| }) | |
| }, | |
| refreshData: function () { | |
| var j = this; | |
| j.model.unbind("sync"); | |
| p3.fT(j.template, function (k) { | |
| j.model.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| checklistId: b.Data.ChecklistId, | |
| checklistStepId: j.model.get("ChecklistStepId") | |
| }, | |
| success: function (l, m) { | |
| j.$el.html(k({ | |
| model: j.model.toJSON() | |
| })); | |
| var n = new b.Vs.Steps({ | |
| data: j.model.toJSON().AdmChecklistItem, | |
| milestone: j.model.get("ChecklistStepDesc"), | |
| milestoneView: j | |
| }); | |
| p3.rV(n, j.$("table"), false) | |
| }, | |
| complete: function () { | |
| j.model.bind("sync", j.renderData, j) | |
| } | |
| }) | |
| }) | |
| }, | |
| toggleSection: function (j) { | |
| j.preventDefault(); | |
| j.stopPropagation(); | |
| $(j.currentTarget).parent("div").siblings(".toggledetail").slideToggle("fast"); | |
| $(j.currentTarget).find("i").toggleClass("fa-chevron-up fa-chevron-down"); | |
| if ($(j.currentTarget).hasClass("active")) { | |
| $(j.currentTarget).removeClass("active") | |
| } else { | |
| $(j.currentTarget).addClass("active") | |
| } | |
| }, | |
| createStep: function (l) { | |
| var D = this, | |
| y = true, | |
| r = true, | |
| B = true, | |
| n = true, | |
| m = true, | |
| s = true, | |
| o = true, | |
| A = true, | |
| t = true, | |
| x = true, | |
| v = false, | |
| w = true, | |
| p = true, | |
| q = true, | |
| z = true, | |
| j = true, | |
| u = true, | |
| C, k; | |
| g.Us.Fetch({ | |
| AdmDataCollectionTypes: { | |
| data: new b.Cs.AdmDataCollectionTypes(), | |
| dataParams: { | |
| checklistId: b.Data.ChecklistId | |
| } | |
| }, | |
| ADMInterviewTypes: { | |
| data: new g.Cs.Dictionary(), | |
| dataParams: { | |
| name: "ADM Interview Types", | |
| id: 101, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| dataName: "dd_data" | |
| } | |
| }, | |
| ADMVisitTypes: { | |
| data: new g.Cs.Dictionary(), | |
| dataParams: { | |
| name: "ADM Visit Types", | |
| id: 103, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| dataName: "dd_data" | |
| } | |
| }, | |
| EventRegistrationTypes: { | |
| data: new b.Cs.EventRegistrationTypes(), | |
| dataParams: { | |
| checklistId: b.Data.ChecklistId | |
| } | |
| }, | |
| ProspectFileTypes: { | |
| data: new g.Cs.Dictionary(), | |
| dataParams: e.DictionaryData.ProspectFileType | |
| }, | |
| SchoolFormTypes: { | |
| data: new b.Cs.SchoolFormTypes(), | |
| dataParams: { | |
| personaId: p3.Data.Context.getSelectedPersona().Id | |
| } | |
| } | |
| }, function (E, G, F) { | |
| D.dictionaries.AdmDataCollectionTypes = E.AdmDataCollectionTypes.toJSON(); | |
| D.dictionaries.EventRegistrationTypes = E.EventRegistrationTypes.toJSON(); | |
| D.dictionaries.ProspectFileTypes = E.ProspectFileTypes; | |
| D.dictionaries.SchoolFormTypes = E.SchoolFormTypes.toJSON(); | |
| if (E.ADMInterviewTypes.length) { | |
| D.dictionaries.ADMInterviewTypes = _.map(E.ADMInterviewTypes, function (H) { | |
| H.InterviewType = {}; | |
| H.InterviewType.InterviewTypeName = H.dd_description; | |
| H.InterviewType.InterviewTypeId = H.dd_id; | |
| H.Selected = H.dd_data; | |
| H.IsActive = H.dd_active; | |
| H.ChecklistItemId = b.Data.ChecklistId; | |
| return H | |
| }) | |
| } | |
| if (E.ADMVisitTypes.length) { | |
| D.dictionaries.ADMVisitTypes = _.map(E.ADMVisitTypes, function (H) { | |
| H.VisitType = {}; | |
| H.VisitType.VisitTypeName = H.dd_description; | |
| H.VisitType.VisitTypeId = H.dd_id; | |
| H.Selected = H.dd_data; | |
| H.IsActive = H.dd_active; | |
| H.ChecklistItemId = b.Data.ChecklistId; | |
| return H | |
| }) | |
| } | |
| C = new b.Ms.Step({ | |
| ChecklistId: b.Data.ChecklistId, | |
| ChecklistStepId: D.model.get("ChecklistStepId"), | |
| Required: false, | |
| DataCollectionTypeId: 1, | |
| ReminderTypeId: 1, | |
| Publish: false, | |
| PublishToChecklist: false, | |
| RecommendInd: false, | |
| Registrations: [], | |
| AppointmentTypes: [], | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }); | |
| k = new b.Vs.EditChecklistStep({ | |
| model: C, | |
| milestoneView: D, | |
| dictionaries: D.dictionaries, | |
| variables: { | |
| milestone: D.model.get("ChecklistStepDesc"), | |
| hideReminderDays: y, | |
| hideInterviewToggle: r, | |
| hideVisitToggle: B, | |
| hideEventToggle: n, | |
| hideDecisionToggle: m, | |
| hidePublishOptions: s, | |
| hideFamilyNotification: o, | |
| hideUploadToggle: A, | |
| hidePublishToggle: t, | |
| hideRecommendationToggle: x, | |
| hideRecommendationNotificationToggle: v, | |
| hideRecommendationOptions: w, | |
| hideFamilyReminderDays: p, | |
| hideFileTypeToggle: q, | |
| hideSchoolFormTypeToggle: z, | |
| disableSchoolFormsSelect: j, | |
| hideRecommendationFormToggle: u, | |
| placeHolders: [{ | |
| label: "Recipient Name", | |
| holder: "recipient_name" | |
| }, { | |
| label: "Candidate Name", | |
| holder: "candidate_name" | |
| }] | |
| } | |
| }); | |
| h.Us.renderModal(k) | |
| }) | |
| }, | |
| editMilestone: function () { | |
| var l = this, | |
| j = true, | |
| k; | |
| if (_.contains(["2", "3"], l.model.get("StatusChange").toString())) { | |
| j = false | |
| } else { | |
| l.model.set({ | |
| NewStatusTypeId: null | |
| }) | |
| } | |
| k = h.Vs.Modal2.extend({ | |
| template: "checklists/checklists.edit.editmilestone.template.html", | |
| model: l.model, | |
| size: "md", | |
| dictionaries: l.dictionaries, | |
| variables: { | |
| hideNewStatusTypeId: j | |
| }, | |
| modalUpdate: function (n) { | |
| var m = this; | |
| if (n.eventCurrentTarget.parent().attr("name") === "StatusChange") { | |
| if (n.eventCurrentTarget.val() === "1" || n.eventCurrentTarget.val() === 1) { | |
| m.$(".status-options").hide(); | |
| m.setAll("NewStatusTypeId", null); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| } else { | |
| m.$(".status-options").show(); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| } | |
| } | |
| }, | |
| modalSave: function (n) { | |
| var m = this; | |
| return b.Us.ManageApplyToCandidatesView(m, l.model, n) | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new k(), p3.Layout.Containers.Modal, true) | |
| }, | |
| deleteMilestone: function (k) { | |
| var l = this, | |
| j = new b.Vs.ConfirmDeleteApply({ | |
| model: l.model, | |
| modelName: l.model.get("ChecklistStepDesc"), | |
| confirmCallback: function (m) { | |
| var n = m.getOptions(); | |
| n.id = l.model.get("ChecklistStepId"); | |
| l.model.destroy({ | |
| dataParam: n, | |
| error: function () { | |
| p3.displayError("Error deleting milestone") | |
| } | |
| }) | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(j, p3.Layout.Containers.Modal, true) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| b.Vs.Steps = Bb.View.extend({ | |
| tagName: "tbody", | |
| initialize: function (j) { | |
| var k = this; | |
| k.collection = new b.Cs.Steps(); | |
| k.collection.bind("add", function (l) { | |
| var m = new b.Vs.Step({ | |
| model: l, | |
| milestone: k.options.milestone, | |
| milestoneView: k.options.milestoneView | |
| }); | |
| p3.rV(m, k.$el, false) | |
| }, k) | |
| }, | |
| events: { | |
| createdata: "createData" | |
| }, | |
| render: function (j) { | |
| var k = this; | |
| $(j).append(k.el); | |
| k.renderData() | |
| }, | |
| renderData: function () { | |
| var j = this; | |
| _.each(j.options.data, function (k) { | |
| j.collection.add(k) | |
| }) | |
| }, | |
| createData: function (j, k) { | |
| var l = this; | |
| l.collection.add(k) | |
| } | |
| }); | |
| b.Vs.Step = Bb.View.extend({ | |
| template: "checklists/checklists.edit.step.html", | |
| tagName: "tr", | |
| initialize: function (j) { | |
| var k = this; | |
| k.dictionaries = b.Data.Dictionaries; | |
| k.model.bind("sync", k.renderData, k); | |
| k.model.bind("destroy", k.deleteElement, k); | |
| k.model.bind("remove", k.deleteElement, k) | |
| }, | |
| events: { | |
| "click .edit-step": "editStep", | |
| "click .delete-step": "deleteStep" | |
| }, | |
| render: function (j) { | |
| var k = this; | |
| $(j).append(k.el); | |
| k.renderData() | |
| }, | |
| renderData: function () { | |
| var j = this; | |
| p3.fT(j.template, function (k) { | |
| j.$el.html(k({ | |
| model: j.model.toJSON() | |
| })) | |
| }) | |
| }, | |
| editStep: function (k) { | |
| var C = this, | |
| y = true, | |
| o = true, | |
| q = true, | |
| B = true, | |
| m = true, | |
| l = true, | |
| s, A = true, | |
| t = true, | |
| r, x = true, | |
| v, w, n, p = true, | |
| z = true, | |
| j = true, | |
| u = true; | |
| C.deferModalLoad = false; | |
| g.Us.Fetch({ | |
| AdmDataCollectionTypes: { | |
| data: new b.Cs.AdmDataCollectionTypes(), | |
| dataParams: { | |
| checklistId: b.Data.ChecklistId, | |
| checklistItemId: C.model.get("ChecklistItemId") | |
| } | |
| }, | |
| ADMInterviewTypes: { | |
| data: new g.Cs.Dictionary(), | |
| dataParams: { | |
| name: "ADM Interview Types", | |
| id: 101, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| dataName: "dd_data", | |
| inputParam: "checklist_item_id =" + C.model.get("ChecklistItemId") + "[i]" | |
| } | |
| }, | |
| ADMVisitTypes: { | |
| data: new g.Cs.Dictionary(), | |
| dataParams: { | |
| name: "ADM Visit Types", | |
| id: 103, | |
| keyName: "pk", | |
| valueName: "short_description", | |
| dataName: "dd_data", | |
| inputParam: "checklist_item_id =" + C.model.get("ChecklistItemId") + "[i]" | |
| } | |
| }, | |
| EventRegistrationTypes: { | |
| data: new b.Cs.EventRegistrationTypes(), | |
| dataParams: { | |
| checklistId: b.Data.ChecklistId, | |
| id: C.model.get("ChecklistItemId") | |
| } | |
| }, | |
| ProspectFileTypes: { | |
| data: new g.Cs.Dictionary(), | |
| dataParams: e.DictionaryData.ProspectFileType | |
| }, | |
| SchoolFormTypes: { | |
| data: new b.Cs.SchoolFormTypes(), | |
| dataParams: { | |
| personaId: p3.Data.Context.getSelectedPersona().Id | |
| } | |
| } | |
| }, function (D, F, E) { | |
| C.dictionaries.AdmDataCollectionTypes = D.AdmDataCollectionTypes.toJSON(); | |
| C.dictionaries.EventRegistrationTypes = D.EventRegistrationTypes.toJSON(); | |
| C.dictionaries.ProspectFileTypes = D.ProspectFileTypes; | |
| C.dictionaries.SchoolFormTypes = D.SchoolFormTypes.toJSON(); | |
| if (D.ADMInterviewTypes.length) { | |
| C.dictionaries.ADMInterviewTypes = _.map(D.ADMInterviewTypes, function (G) { | |
| G.InterviewType = {}; | |
| G.InterviewType.InterviewTypeName = G.dd_description; | |
| G.InterviewType.InterviewTypeId = G.dd_id; | |
| G.Selected = G.dd_data; | |
| G.IsActive = G.dd_active; | |
| G.ChecklistItemId = b.Data.ChecklistId; | |
| return G | |
| }) | |
| } | |
| if (D.ADMVisitTypes.length) { | |
| C.dictionaries.ADMVisitTypes = _.map(D.ADMVisitTypes, function (G) { | |
| G.VisitType = {}; | |
| G.VisitType.VisitTypeName = G.dd_description; | |
| G.VisitType.VisitTypeId = G.dd_id; | |
| G.Selected = G.dd_data; | |
| G.IsActive = G.dd_active; | |
| G.ChecklistItemId = b.Data.ChecklistId; | |
| return G | |
| }) | |
| } | |
| if (_.contains(["3", "4", "5"], C.model.get("ReminderTypeId").toString())) { | |
| y = false | |
| } else { | |
| C.model.set({ | |
| ReminderDays: null | |
| }) | |
| } | |
| if (_.contains(["3", "4", "5"], C.model.get("FamilyReminderTypeId").toString())) { | |
| o = false | |
| } else { | |
| C.model.set({ | |
| FamilyReminderDays: null | |
| }) | |
| } | |
| switch (C.model.get("DataCollectionTypeId")) { | |
| case e.DataCollectionType.TEST: | |
| A = false; | |
| t = false; | |
| break; | |
| case e.DataCollectionType.REFERENCE: | |
| x = false; | |
| break; | |
| case e.DataCollectionType.DECISION: | |
| l = false; | |
| break; | |
| case e.DataCollectionType.INTERVIEW: | |
| q = false; | |
| A = false; | |
| t = false; | |
| h.Us.setPropByString(C.model.attributes, "AppointmentTypes", $.extend(true, [], C.dictionaries.ADMInterviewTypes)); | |
| break; | |
| case e.DataCollectionType.SCHOOL: | |
| A = false; | |
| break; | |
| case e.DataCollectionType.VISIT: | |
| B = false; | |
| t = false; | |
| h.Us.setPropByString(C.model.attributes, "AppointmentTypes", $.extend(true, [], C.dictionaries.ADMVisitTypes)); | |
| break; | |
| case e.DataCollectionType.FAMILYPHOTO: | |
| A = false; | |
| break; | |
| case e.DataCollectionType.AGEVERIFICATION: | |
| A = false; | |
| break; | |
| case e.DataCollectionType.EDUCATIONALTESTING: | |
| A = false; | |
| break; | |
| case e.DataCollectionType.EVENT: | |
| m = false; | |
| h.Us.setPropByString(C.model.attributes, "Registrations", $.extend(true, [], C.dictionaries.EventRegistrationTypes)); | |
| break; | |
| case e.DataCollectionType.MISCFILE: | |
| p = false; | |
| A = false; | |
| h.Us.setPropByString(C.model.attributes, "ProspectFileTypes", $.extend(true, [], C.dictionaries.ProspectFileTypes)); | |
| break; | |
| case e.DataCollectionType.SCHOOLFORM: | |
| z = false; | |
| t = false; | |
| j = false; | |
| C.deferModalLoad = true; | |
| C.fetchSchoolFormsAndRenderModal(); | |
| break; | |
| case e.DataCollectionType.RECOMMENDATIONFORM: | |
| u = false; | |
| x = false; | |
| v = true; | |
| r = true; | |
| C.deferModalLoad = true; | |
| C.fetchRecommendationFormsAndRenderModal(); | |
| break; | |
| default: | |
| break | |
| } | |
| s = (C.model.get("Publish").toString() === "true") ? false : true; | |
| w = (C.model.get("RecommendInd").toString() === "true") ? false : true; | |
| n = (C.model.get("FamilyNotification").toString() === "true") ? false : true; | |
| C.EditChecklistStepModal = new b.Vs.EditChecklistStep({ | |
| model: C.model, | |
| milestoneView: C.options.milestoneView, | |
| dictionaries: C.dictionaries, | |
| variables: { | |
| milestone: C.options.milestone, | |
| hideReminderDays: y, | |
| hideInterviewToggle: q, | |
| hideVisitToggle: B, | |
| hideEventToggle: m, | |
| hideDecisionToggle: l, | |
| hidePublishOptions: s, | |
| hideFamilyNotification: n, | |
| hideUploadToggle: A, | |
| hidePublishToggle: t, | |
| hidePublishFileUpload: r, | |
| hideRecommendationToggle: x, | |
| hideRecommendationNotificationToggle: v, | |
| hideRecommendationOptions: w, | |
| hideFamilyReminderDays: o, | |
| hideFileTypeToggle: p, | |
| hideSchoolFormTypeToggle: z, | |
| disableSchoolFormsSelect: j, | |
| hideRecommendationFormToggle: u, | |
| placeHolders: [{ | |
| label: "Recipient Name", | |
| holder: "recipient_name" | |
| }, { | |
| label: "Candidate Name", | |
| holder: "candidate_name" | |
| }] | |
| } | |
| }); | |
| if (!C.deferModalLoad) { | |
| h.Us.renderModal(C.EditChecklistStepModal) | |
| } | |
| }) | |
| }, | |
| deleteStep: function (k) { | |
| var l = this, | |
| j = new b.Vs.ConfirmDeleteApply({ | |
| model: l.model, | |
| modelName: l.model.get("ChecklistItemDesc"), | |
| confirmCallback: function (m) { | |
| var n = m.getOptions(); | |
| n.id = l.model.get("ChecklistItemId"); | |
| l.model.destroy({ | |
| dataParam: n, | |
| success: function () { | |
| if (l.options.milestoneView.model.get("AdmChecklistItem")) { | |
| l.options.milestoneView.model.attributes.AdmChecklistItem = _.filter(l.options.milestoneView.model.attributes.AdmChecklistItem, function (o) { | |
| return o.ChecklistItemId !== parseInt(l.model.get("ChecklistItemId"), 10) | |
| }) | |
| } | |
| }, | |
| error: function () { | |
| p3.displayError("Error deleting step") | |
| } | |
| }) | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(j, p3.Layout.Containers.Modal, true) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| }, | |
| fetchSchoolFormsAndRenderModal: function (j) { | |
| var k = this; | |
| b.Us.FetchSchoolFormsAndItems(function (n, m, l) { | |
| if (l) { | |
| k.dictionaries.SchoolForms = n; | |
| k.dictionaries.SchoolFormChecklistItems = m; | |
| h.Us.renderModal(k.EditChecklistStepModal) | |
| } | |
| }) | |
| }, | |
| fetchRecommendationFormsAndRenderModal: function (j) { | |
| var k = this; | |
| b.Us.FetchRecommendationFormsAndItems(function (n, m, l) { | |
| if (l) { | |
| k.dictionaries.RecommendationForms = n; | |
| k.dictionaries.RecommendationFormChecklistItems = m; | |
| h.Us.renderModal(k.EditChecklistStepModal) | |
| } | |
| }) | |
| } | |
| }); | |
| b.Vs.ChecklistSort = Bb.View.extend({ | |
| template: "checklists/checklists.milestones.sort.template.html", | |
| initialize: function (j) { | |
| var k = this; | |
| k.collection = k.model.MileStones | |
| }, | |
| events: { | |
| "click #btnSave": "saveSort" | |
| }, | |
| render: function (j) { | |
| var k = this; | |
| $(j).append(k.el); | |
| k.renderTemplate() | |
| }, | |
| renderTemplate: function () { | |
| var j = this; | |
| p3.fT(j.template, function (k) { | |
| j.$el.html(k({ | |
| milestones: j.collection.toJSON() | |
| })); | |
| if (j.collection.length) { | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.jQueryUI, function () { | |
| _.defer(function () { | |
| j.initSortable() | |
| }) | |
| }) | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| initSortable: function () { | |
| var j = this; | |
| j.$("#milestones").sortable({ | |
| items: "li", | |
| axis: "y", | |
| containment: "#milestones", | |
| distance: 5 | |
| }).disableSelection(); | |
| j.$("tbody.checklist-steps").sortable({ | |
| items: "tr.checklist-step", | |
| axis: "y", | |
| connectWith: "tbody.checklist-steps", | |
| containment: "#milestones", | |
| distance: 5, | |
| dropOnEmpty: true, | |
| placeholder: "sortable-placeholder", | |
| helper: function (l, n) { | |
| var m = n.find("div").text(), | |
| k = $('<div class="sort-drag-block-helper">' + m + "</div>"); | |
| return k | |
| }, | |
| start: function (k, m) { | |
| var l = m.item.siblings(".checklist-step").length; | |
| if (!l) { | |
| m.item.parent().append('<tr class="empty-row"><td></td></tr>') | |
| } | |
| }, | |
| update: function (k, m) { | |
| var l = m.item.siblings(".empty-row"); | |
| if (l.length) { | |
| l.remove() | |
| } | |
| } | |
| }).disableSelection() | |
| }, | |
| saveSort: function (j) { | |
| j.preventDefault(); | |
| var l = this, | |
| k; | |
| if (b.Us.ManageApplyToCandidatesView(l, l.model)) { | |
| if (l.collection.length) { | |
| k = new b.Cs.Milestones(); | |
| l.$(".checklist-milestone").each(function (o, p) { | |
| var n = $(p), | |
| q = new b.Ms.Milestone({ | |
| ChecklistStepId: n.data("id"), | |
| ChecklistId: b.Data.ChecklistId | |
| }), | |
| r = []; | |
| n.find(".checklist-step").each(function (m, t) { | |
| r.push({ | |
| ChecklistItemId: $(t).data("id") | |
| }) | |
| }); | |
| q.set("AdmChecklistItem", r); | |
| k.add(q) | |
| }); | |
| l.model.save({ | |
| ChecklistSteps: k.toJSON() | |
| }, { | |
| success: function (m, o, n) { | |
| l.trigger("sortSaved"); | |
| p3.showModal(p3.Layout.Containers.Modal, "hide") | |
| }, | |
| error: function (n, m) { | |
| p3.showModal(p3.Layout.Containers.Modal, "hide"); | |
| p3.displayError("Error saving checklist sort order") | |
| } | |
| }) | |
| } else { | |
| p3.showModal(p3.Layout.Containers.Modal, "hide") | |
| } | |
| } | |
| } | |
| }); | |
| b.Vs.ApplyToCandidates = Bb.View.extend({ | |
| template: "checklists/checklists.edit.candidate.apply.template.html", | |
| initialize: function (j) { | |
| var k = this; | |
| k.parentModel = j.parentModel; | |
| k.model = new b.Ms.CandidateApply(); | |
| Bb.Validation.bind(k, { | |
| forceUpdate: true, | |
| selector: "id" | |
| }) | |
| }, | |
| events: { | |
| "click .select-all": "selectAll", | |
| "click .filter-items button": "filterButtonClicked" | |
| }, | |
| render: function (j) { | |
| var k = this; | |
| $(j).append(k.el); | |
| k.renderTemplate() | |
| }, | |
| renderTemplate: function () { | |
| var j = this; | |
| p3.fT(j.template, function (k) { | |
| j.$el.html(k({ | |
| SchoolYearCurrent: b.Data.Dictionaries.SchoolYearCurrentFuture.dictionary, | |
| GradeLevels: b.Data.Dictionaries.GradeLevel.dictionary, | |
| IsNew: j.parentModel.isNew(), | |
| ModelType: j.parentModel.constructor.DisplayName, | |
| IsSchoolFormChanged: j.parentModel._previousAttributes.ApplicationFormId && (j.parentModel.get("ApplicationFormId") !== j.parentModel._previousAttributes.ApplicationFormId), | |
| IsSchoolFormRemoved: (j.parentModel._previousAttributes.ApplicationFormId === undefined && j.parentModel.get("ApplicationFormId")) || (j.parentModel._previousAttributes.DataCollectionTypeId && j.parentModel._previousAttributes.DataCollectionTypeId === e.DataCollectionType.SCHOOLFORM && !j.parentModel.get("ApplicationFormId")) | |
| })); | |
| j.$(".required-indicator").tooltip(); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| selectAll: function (l) { | |
| var k = $(l.currentTarget), | |
| m = !(k.hasClass("active")), | |
| j = k.siblings(".filter-items").find("input"); | |
| j.prop("checked", m) | |
| }, | |
| filterButtonClicked: function (m) { | |
| var l = $(m.currentTarget), | |
| k = l.closest(".control-group").find(".select-all"), | |
| j = l.closest("table").find("button"); | |
| _.defer(function () { | |
| if (j.not(".active").length) { | |
| k.removeClass("active") | |
| } else { | |
| k.addClass("active") | |
| } | |
| }) | |
| }, | |
| updateModel: function () { | |
| var p = this, | |
| l = p.$(".btn-apply").hasClass("active"), | |
| m = true, | |
| k, j, o, n; | |
| p.model.set(p.model.defaults); | |
| _.each(_.keys(p.model.attributes), function (q) { | |
| Bb.Validation.callbacks.valid(p, q, "id") | |
| }); | |
| if (l) { | |
| k = p.$("#SchoolYears input:checked"); | |
| j = p.$("#GradeLevels input:checked"); | |
| o = []; | |
| n = []; | |
| k.each(function (q, r) { | |
| o.push($(r).data("id")) | |
| }); | |
| j.each(function (r, q) { | |
| n.push($(q).data("id")) | |
| }); | |
| if (!o.length) { | |
| m = false; | |
| Bb.Validation.callbacks.invalid(p, "SchoolYears", f.P3.RequiredInfoNotEntered, "id") | |
| } | |
| if (!n.length) { | |
| m = false; | |
| Bb.Validation.callbacks.invalid(p, "GradeLevels", f.P3.RequiredInfoNotEntered, "id") | |
| } | |
| if (m) { | |
| p.model.set({ | |
| ApplyToCandidates: true, | |
| SchoolYears: o, | |
| GradeLevels: n | |
| }) | |
| } | |
| } | |
| if (m) { | |
| p.parentModel.set("CandidateApplyOptions", p.model.toJSON()) | |
| } | |
| return m | |
| } | |
| }); | |
| b.Vs.ConfirmDeleteApply = Bb.View.extend({ | |
| template: "checklists/checklists.node.delete.confirm.apply.html", | |
| events: { | |
| "click #btnConfirm": "doConfirm", | |
| "click #btnCancel": "doCancel" | |
| }, | |
| render: function (j) { | |
| var k = this; | |
| $(j).append(k.el); | |
| k.renderTemplate() | |
| }, | |
| renderTemplate: function () { | |
| var j = this; | |
| p3.fT(j.template, function (k) { | |
| j.$el.html(k({ | |
| ModelType: j.model.constructor.DisplayName, | |
| ModelName: j.options.modelName | |
| })) | |
| }) | |
| }, | |
| doConfirm: function (l) { | |
| l.preventDefault(); | |
| var m = this, | |
| k = m.options.confirmCallback, | |
| j; | |
| if (b.Us.ManageApplyToCandidatesView(m, m.model)) { | |
| j = (m.applyView) ? m.applyView.model : new b.Ms.CandidateApply(); | |
| p3.showModal(p3.Layout.Containers.Modal, "hide"); | |
| if (_.isFunction(k)) { | |
| k(j) | |
| } | |
| } | |
| }, | |
| doCancel: function (j) { | |
| j.preventDefault(); | |
| p3.showModal(p3.Layout.Containers.Modal, "hide") | |
| } | |
| }); | |
| b.Vs.EditChecklistStep = h.Vs.Modal2.extend({ | |
| template: "checklists/checklists.edit.editstep.template.html", | |
| size: "md", | |
| events: { | |
| 'keyup form input[name="ChecklistItemDesc"]': "modalKeyUp", | |
| "click button.placeholder": "addPlaceholder" | |
| }, | |
| modalRender: function () { | |
| var l = this, | |
| j = l.model.get("DataCollectionTypeId"), | |
| k = l.model.get("FormTypeId"); | |
| l.dictionaries = b.Data.Dictionaries; | |
| if (k && j === e.DataCollectionType.SCHOOLFORM) { | |
| l.dictionaries.AvailableSchoolForms = l.getFilteredSchoolForms(k) | |
| } | |
| if (j === e.DataCollectionType.RECOMMENDATIONFORM) { | |
| l.getFilteredRecommendationForms(); | |
| l.model.attributes.FormTypeId = e.FormType.RECOMMENDATION.Value | |
| } | |
| }, | |
| modalRendered: function (k) { | |
| var j = this; | |
| if (j.options.variables.hideRecommendationOptions) { | |
| j.parentHide("RecommendInd") | |
| } | |
| c.Us.initialize(".date-input", { | |
| yearRange: "-30:+20" | |
| }); | |
| j.$('input[name = "ChecklistItemDesc"]').trigger(jQuery.Event("keyup")); | |
| j.initializeFileUpload_File(); | |
| j.$interviewToggle = j.$(".interview-toggle"); | |
| j.$interviewSelect = j.$(".interview-select button.active"); | |
| j.$visitToggle = j.$(".visit-toggle"); | |
| j.$visitSelect = j.$(".visit-select button.active"); | |
| j.$eventToggle = j.$(".event-toggle"); | |
| j.$eventSelect = j.$(".event-select button.active"); | |
| j.$decisionToggle = j.$(".decision-toggle"); | |
| j.$recommendationToggle = j.$(".recommendation-toggle"); | |
| j.$recommendationNotificationToggle = j.$(".recommendation-notification-toggle"); | |
| j.$uploadToggle = j.$(".upload-toggle"); | |
| j.$publishToggle = j.$(".publish-toggle"); | |
| j.$publishOptions = j.$(".publish-options"); | |
| j.$publishFileUpload = j.$(".publish-file-upload"); | |
| j.$reminderDays = j.$('[name="ReminderDays"]'); | |
| j.$familyReminderDays = j.$('[name="FamilyReminderDays"]'); | |
| j.$fileTypeToggle = j.$(".file-type-toggle"); | |
| j.$schoolFormTypeToggle = j.$(".school-form-type-toggle"); | |
| j.$schoolFormsDropdown = j.$(".school-forms-dropdown"); | |
| j.$inactiveFormWarning = j.$(".inactive-form-warning"); | |
| j.$recommendationFormToggle = j.$(".recommendation-form-toggle"); | |
| j.$recommendationFormsDropdown = j.$(".recommendation-forms-dropdown"); | |
| j.$samplePageRef = j.$("#sample-page-ref")[0]; | |
| if (j.dictionaries.SchoolForms || j.dictionaries.RecommendationForms) { | |
| j.toggleInactiveFormWarning(j.model.get("ApplicationFormId")) | |
| } | |
| }, | |
| modalUpdate: function (o) { | |
| var l = this, | |
| p, j, n, m, s = "", | |
| r = 0, | |
| k = 0, | |
| q; | |
| if (o.eventCurrentTarget.attr("name") === "DataCollectionTypeId") { | |
| l.$eventToggle.hide(); | |
| l.setPropByString(l.model.attributes, "Registrations", []); | |
| l.$eventSelect.removeClass("active"); | |
| l.$visitToggle.hide(); | |
| l.$interviewToggle.hide(); | |
| l.setPropByString(l.model.attributes, "AppointmentTypes", []); | |
| l.$visitSelect.removeClass("active"); | |
| l.$interviewSelect.removeClass("active"); | |
| l.$decisionToggle.hide(); | |
| l.setAll("DecisionAutoWaive", null); | |
| l.$uploadToggle.hide(); | |
| l.setAll("AllowUpload", false); | |
| l.$publishToggle.hide(); | |
| l.$publishFileUpload.show(); | |
| l.setAll("PublishToChecklist", false); | |
| l.$recommendationToggle.hide(); | |
| l.$recommendationNotificationToggle.show(); | |
| l.setAll("RecommendInd", false); | |
| l.parentHide("RecommendInd"); | |
| l.$fileTypeToggle.hide(); | |
| l.setAll("FileTypeId", null); | |
| l.$schoolFormTypeToggle.hide(); | |
| l.setAll("FormTypeId", null); | |
| l.setAll("ApplicationFormId", null); | |
| l.$schoolFormsDropdown.html($("<option></option>").val("").html("-- Select an Option --")); | |
| l.$schoolFormsDropdown.prop("disabled", true); | |
| l.$inactiveFormWarning.hide(); | |
| l.fieldValid("school-forms-dropdown"); | |
| l.$recommendationFormToggle.hide(); | |
| l.$recommendationFormsDropdown.html($("<option></option>").val("").html("-- Select an Option --")); | |
| l.$recommendationFormsDropdown.prop("disabled", true); | |
| l.fieldValid("recommendation-forms-dropdown"); | |
| l.$samplePageRef.href = "//libs-e1.myschoolapp.com/p3-cache/img/recommendation.png"; | |
| switch (parseInt(o.eventCurrentTarget.val(), 10)) { | |
| case e.DataCollectionType.TEST: | |
| l.$uploadToggle.show(); | |
| l.$publishToggle.show(); | |
| break; | |
| case e.DataCollectionType.REFERENCE: | |
| l.$recommendationToggle.show(); | |
| break; | |
| case e.DataCollectionType.DECISION: | |
| l.$decisionToggle.show(); | |
| break; | |
| case e.DataCollectionType.INTERVIEW: | |
| l.$uploadToggle.show(); | |
| l.$publishToggle.show(); | |
| l.$interviewToggle.show(); | |
| l.setPropByString(l.model.attributes, "AppointmentTypes", $.extend(true, [], l.dictionaries.ADMInterviewTypes)); | |
| break; | |
| case e.DataCollectionType.SCHOOL: | |
| l.$uploadToggle.show(); | |
| break; | |
| case e.DataCollectionType.VISIT: | |
| l.$publishToggle.show(); | |
| l.$visitToggle.show(); | |
| l.setPropByString(l.model.attributes, "AppointmentTypes", $.extend(true, [], l.dictionaries.ADMVisitTypes)); | |
| break; | |
| case e.DataCollectionType.FAMILYPHOTO: | |
| l.$uploadToggle.show(); | |
| break; | |
| case e.DataCollectionType.AGEVERIFICATION: | |
| l.$uploadToggle.show(); | |
| break; | |
| case e.DataCollectionType.EDUCATIONALTESTING: | |
| l.$uploadToggle.show(); | |
| break; | |
| case e.DataCollectionType.EVENT: | |
| l.$eventToggle.show(); | |
| l.setPropByString(l.model.attributes, "Registrations", $.extend(true, [], l.dictionaries.EventRegistrationTypes)); | |
| break; | |
| case e.DataCollectionType.MISCFILE: | |
| l.$fileTypeToggle.show(); | |
| l.$uploadToggle.show(); | |
| break; | |
| case e.DataCollectionType.SCHOOLFORM: | |
| l.$schoolFormTypeToggle.show(); | |
| l.$publishToggle.show(); | |
| break; | |
| case e.DataCollectionType.RECOMMENDATIONFORM: | |
| l.$recommendationFormToggle.show(); | |
| l.$publishFileUpload.hide(); | |
| l.$recommendationToggle.show(); | |
| l.$recommendationNotificationToggle.hide(); | |
| l.getFilteredRecommendationForms(); | |
| l.model.attributes.FormTypeId = e.FormType.RECOMMENDATION.Value; | |
| l.$samplePageRef.href = "//libs-e1.myschoolapp.com/p3-cache/img/recommendation_start.png"; | |
| break; | |
| default: | |
| break | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| } else { | |
| if (o.eventCurrentTarget.attr("name") === "ReminderTypeId") { | |
| if (_.contains(["3", "4", "5"], o.eventCurrentTarget.val())) { | |
| l.$reminderDays.show() | |
| } else { | |
| l.$reminderDays.hide(); | |
| l.setPropByString(l.model.attributes, "ReminderDays", null); | |
| l.$reminderDays.val("") | |
| } | |
| } else { | |
| if (o.eventCurrentTarget.parent().attr("name") === "Publish") { | |
| if (b.Us.CheckboxIsChecked(o.eventCurrentTarget)) { | |
| l.$publishOptions.show(); | |
| l.scrollTo('[name="Publish"]') | |
| } else { | |
| l.$publishOptions.hide(); | |
| l.setAll("ExternalDesc", null); | |
| l.setAll("PublishDesc", null); | |
| l.setAll("PublishLink", null); | |
| l.setAll("AttachmentFile.Attachment", null); | |
| l.setAll("AllowUpload", false); | |
| l.setAll("PublishToChecklist", false); | |
| l.setAll("RecommendInd", false); | |
| l.parentHide("RecommendInd") | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| } else { | |
| if (o.eventCurrentTarget.parent().attr("name") === "RecommendInd") { | |
| if (b.Us.CheckboxIsChecked(o.eventCurrentTarget)) { | |
| l.parentShow("RecommendInd"); | |
| l.scrollTo('[name="RecommendInd"]') | |
| } else { | |
| l.parentHide("RecommendInd") | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| } else { | |
| if (o.eventCurrentTarget.parent().attr("name") === "FamilyNotification") { | |
| if (b.Us.CheckboxIsChecked(o.eventCurrentTarget)) { | |
| l.$(".family-notifications").show(); | |
| l.scrollTo('[name="FamilyNotification"]') | |
| } else { | |
| l.$(".family-notifications").hide(); | |
| l.setAll("FamilyReminderTypeId", 1); | |
| l.setAll("FamilyReminderDays", null) | |
| } | |
| } else { | |
| if (o.eventCurrentTarget.attr("name") === "FamilyReminderTypeId") { | |
| if (_.contains(["3", "4", "5"], o.eventCurrentTarget.val())) { | |
| l.$familyReminderDays.show() | |
| } else { | |
| l.$familyReminderDays.hide(); | |
| l.setPropByString(l.model.attributes, "FamilyReminderDays", null); | |
| l.$familyReminderDays.val("") | |
| } | |
| } else { | |
| if (o.eventCurrentTarget.hasClass("placeholder")) { | |
| p = "[" + o.eventCurrentTarget.data("value") + "]"; | |
| j = l.$('[name="RecommendEmailText"]'); | |
| n = j.val(); | |
| m = j[0]; | |
| if (m.selectionStart || m.selectionStart === 0) { | |
| r = m.selectionStart; | |
| k = m.selectionEnd; | |
| s = n.substring(0, r) + p + n.substring(k, n.length) | |
| } else { | |
| s = p | |
| } | |
| j.val(s).focus().trigger($.Event("change")); | |
| m.selectionStart = r + p.length; | |
| m.selectionEnd = r + p.length | |
| } else { | |
| if (o.eventCurrentTarget.attr("name") === "FormTypeId") { | |
| l.$schoolFormsDropdown.val("").change(); | |
| l.$schoolFormsDropdown.html($("<option></option>").val("").html("-- Select an Option --")); | |
| l.$schoolFormsDropdown.prop("disabled", true); | |
| q = function () { | |
| if (o.eventCurrentTarget.val() !== "") { | |
| l.dictionaries.AvailableSchoolForms = l.getFilteredSchoolForms(parseInt(o.eventCurrentTarget.val(), 10)); | |
| $.each(l.dictionaries.AvailableSchoolForms, function (t, u) { | |
| l.$schoolFormsDropdown.append($("<option></option>").val(u.ApplicationFormId).html(u.Name)) | |
| }); | |
| l.$schoolFormsDropdown.prop("disabled", false) | |
| } | |
| }; | |
| if (!l.dictionaries.SchoolForms || !l.dictionaries.SchoolFormChecklistItems) { | |
| b.Us.FetchSchoolFormsAndItems(function (v, u, t) { | |
| if (t) { | |
| l.dictionaries.SchoolForms = v; | |
| l.dictionaries.SchoolFormChecklistItems = u; | |
| q() | |
| } | |
| }) | |
| } else { | |
| q() | |
| } | |
| } else { | |
| if (o.eventCurrentTarget.attr("name") === "ApplicationFormId") { | |
| l.toggleInactiveFormWarning(parseInt(o.eventCurrentTarget.val(), 10)) | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| modalKeyUp: function (j) { | |
| var k = this, | |
| l = k.$(j.currentTarget).val(); | |
| k.$('[name="ExternalDesc"]').prop("placeholder", l) | |
| }, | |
| modalSave: function (k) { | |
| var j = this; | |
| if ($(".recommendation-forms-dropdown").is(":visible")) { | |
| if (!j.model.isValid("ApplicationFormId")) { | |
| j.fieldInvalid("recommendation-forms-dropdown", "") | |
| } else { | |
| j.fieldValid("recommendation-forms-dropdown") | |
| } | |
| } | |
| if ($(".school-forms-dropdown").is(":visible")) { | |
| if (!j.model.isValid("ApplicationFormId")) { | |
| j.fieldInvalid("school-forms-dropdown", "") | |
| } else { | |
| j.fieldValid("school-forms-dropdown") | |
| } | |
| } | |
| return b.Us.ManageApplyToCandidatesView(j, j.model, k) | |
| }, | |
| modalSavedSuccess: function (k) { | |
| var j = this; | |
| if (j.options.milestoneView.model.get("AdmChecklistItem")) { | |
| j.options.milestoneView.model.attributes.AdmChecklistItem = _.filter(j.options.milestoneView.model.attributes.AdmChecklistItem, function (l) { | |
| return l.ChecklistItemId !== parseInt(j.model.get("ChecklistItemId"), 10) | |
| }); | |
| j.options.milestoneView.model.attributes.AdmChecklistItem.push(j.model.toJSON()) | |
| } | |
| j.options.milestoneView.$("tbody").triggerHandler("createdata", [k.response]); | |
| if (k.eventCurrentTarget.hasClass("addanother")) { | |
| p3.Layout.Containers.Modal.modal("hide"); | |
| j.options.milestoneView.$(".create-step").click(); | |
| return false | |
| } | |
| }, | |
| getFilteredSchoolForms: function (l) { | |
| var m = this, | |
| j = m.model.get("ChecklistItemId"), | |
| n = [], | |
| k = []; | |
| if (m.dictionaries.SchoolForms) { | |
| if (m.dictionaries.SchoolFormChecklistItems) { | |
| n = _.chain(m.dictionaries.SchoolFormChecklistItems).filter(function (o) { | |
| return o.ApplicationFormId && o.ChecklistItemId !== j | |
| }).pluck("ApplicationFormId").value() | |
| } | |
| k = _.filter(m.dictionaries.SchoolForms, function (o) { | |
| return o.FormType === l && !n.includes(o.ApplicationFormId) | |
| }) | |
| } | |
| return k | |
| }, | |
| getFilteredRecommendationForms: function () { | |
| var l = this, | |
| k = l.model.get("ChecklistItemId"), | |
| j = l.model.get("ApplicationFormId"), | |
| m = [], | |
| n; | |
| n = function () { | |
| m = _.chain(l.dictionaries.RecommendationFormChecklistItems).filter(function (o) { | |
| return o.ApplicationFormId && o.ChecklistItemId !== k | |
| }).pluck("ApplicationFormId").value(); | |
| l.dictionaries.AvailableRecommendationForms = _.filter(l.dictionaries.RecommendationForms, function (p) { | |
| var o = true; | |
| if (m.includes(p.ApplicationFormId)) { | |
| o = false | |
| } else { | |
| if (p.ArchivedInd) { | |
| if (p.ApplicationFormId === j) { | |
| o = true | |
| } else { | |
| o = false | |
| } | |
| } | |
| } | |
| return o | |
| }); | |
| if (l.$recommendationFormsDropdown) { | |
| l.$recommendationFormsDropdown.val("").change(); | |
| l.$recommendationFormsDropdown.html($("<option></option>").val("").html("-- Select an Option --")); | |
| l.$recommendationFormsDropdown.prop("disabled", true); | |
| $.each(l.dictionaries.AvailableRecommendationForms, function (o, p) { | |
| l.$recommendationFormsDropdown.append($("<option></option>").val(p.ApplicationFormId).html(p.Name)) | |
| }); | |
| l.$recommendationFormsDropdown.prop("disabled", false) | |
| } | |
| }; | |
| if (!l.dictionaries.RecommendationForms || !l.dictionaries.RecommendationFormChecklistItems) { | |
| b.Us.FetchRecommendationFormsAndItems(function (q, p, o) { | |
| if (o) { | |
| l.dictionaries.RecommendationForms = q; | |
| l.dictionaries.RecommendationFormChecklistItems = p; | |
| n() | |
| } | |
| }) | |
| } else { | |
| n() | |
| } | |
| }, | |
| toggleInactiveFormWarning: function (j) { | |
| var k = this, | |
| m, l; | |
| m = _.find(k.dictionaries.SchoolForms, function (n) { | |
| return n.ApplicationFormId === j | |
| }); | |
| l = _.find(k.dictionaries.RecommendationForms, function (n) { | |
| return n.ApplicationFormId === j | |
| }); | |
| if (m) { | |
| k.$inactiveFormWarning.toggle(!(m.ActiveInd && m.PublishedInd)) | |
| } else { | |
| if (l) { | |
| k.$inactiveFormWarning.toggle(!(l.ActiveInd && l.PublishedInd)) | |
| } else { | |
| k.$inactiveFormWarning.hide() | |
| } | |
| } | |
| }, | |
| fieldValid: function (j) { | |
| var k = this; | |
| Bb.Validation.callbacks.valid(k, j, "class") | |
| }, | |
| fieldInvalid: function (j, l) { | |
| var k = this; | |
| Bb.Validation.callbacks.invalid(k, j, l, "class") | |
| }, | |
| modalDispose: function () { | |
| var j = this; | |
| j.dictionaries.SchoolForms = undefined; | |
| j.dictionaries.SchoolFormChecklistItems = undefined; | |
| j.dictionaries.RecommendationForms = undefined; | |
| j.dictionaries.RecommendationFormChecklistItems = undefined | |
| } | |
| }); | |
| b.Us.CheckboxIsChecked = function (j) { | |
| var k; | |
| k = ($(j).find("input").val()); | |
| return (k === true || k === "true") | |
| }; | |
| b.Us.ShowApplyToCandidatesView = function (n, m, l) { | |
| var k = n.$("button.save.addanother"), | |
| j = n.$("button.save").not(".addanother"); | |
| n.$(".modal-header h2").html("Confirmation"); | |
| if (l.eventCurrentTarget && l.eventCurrentTarget.hasClass("addanother")) { | |
| j.hide(); | |
| k.html("Confirm") | |
| } else { | |
| j.html("Confirm"); | |
| k.hide() | |
| } | |
| n.$("#model-form").hide(); | |
| n.$("#candidate-apply").show(); | |
| n.applyView = new b.Vs.ApplyToCandidates({ | |
| parentModel: m | |
| }); | |
| p3.rV(n.applyView, n.$("#candidate-apply"), true); | |
| n.applyViewVisible = true | |
| }; | |
| b.Us.ManageApplyToCandidatesView = function (l, k, j) { | |
| j = j || {}; | |
| if (l.applyViewVisible) { | |
| if (!l.applyView.updateModel()) { | |
| return false | |
| } | |
| } else { | |
| if (b.Data.Checklist.get("LockInd") && k.isValid(true)) { | |
| b.Us.ShowApplyToCandidatesView(l, k, j); | |
| return false | |
| } | |
| } | |
| return true | |
| }; | |
| b.Us.FetchSchoolFormsAndItems = function (j) { | |
| var l = [], | |
| k = []; | |
| g.Us.Fetch({ | |
| SchoolForms: { | |
| data: new b.Cs.SchoolForms(), | |
| dataParams: { | |
| personaId: p3.Data.Context.getSelectedPersona().Id | |
| } | |
| }, | |
| MileStones: { | |
| data: new b.Cs.Milestones(), | |
| dataParams: { | |
| checklistId: b.Data.ChecklistId | |
| } | |
| } | |
| }, function (m, o, n) { | |
| if (o) { | |
| if (m.SchoolForms) { | |
| l = m.SchoolForms.toJSON() | |
| } | |
| if (!p3.Config.IsSmallCollege) { | |
| l = _.filter(l, function (p) { | |
| return p.ESigFrom !== 1 | |
| }) | |
| } | |
| if (m.MileStones) { | |
| m.MileStones.each(function (p) { | |
| _.each(p.get("AdmChecklistItem"), function (q) { | |
| if (q.ApplicationFormId) { | |
| k.push(q) | |
| } | |
| }) | |
| }) | |
| } | |
| if (_.isFunction(j)) { | |
| j(l, k, o, n) | |
| } | |
| } | |
| }) | |
| }; | |
| b.Us.FetchRecommendationFormsAndItems = function (j) { | |
| var l = [], | |
| k = []; | |
| g.Us.Fetch({ | |
| RecommendationForms: { | |
| data: new b.Cs.RecommendationForms() | |
| }, | |
| MileStones: { | |
| data: new b.Cs.Milestones(), | |
| dataParams: { | |
| checklistId: b.Data.ChecklistId | |
| } | |
| } | |
| }, function (m, o, n) { | |
| if (o) { | |
| if (m.RecommendationForms) { | |
| l = m.RecommendationForms.toJSON() | |
| } | |
| if (m.MileStones) { | |
| m.MileStones.each(function (p) { | |
| _.each(p.get("AdmChecklistItem"), function (q) { | |
| if (q.ApplicationFormId) { | |
| k.push(q) | |
| } | |
| }) | |
| }) | |
| } | |
| if (_.isFunction(j)) { | |
| j(l, k, o, n) | |
| } | |
| } | |
| }) | |
| }; | |
| p3.router().route("settings/checklists/:id", "checklistsedit", function (j) { | |
| b.Data.ChecklistId = j; | |
| p3.renderMainPage(new b.Vs.Layout({})) | |
| }) | |
| }(p3.module("admissions/checklistsedit"))); | |
| (function (a) { | |
| a.Ms.SectionItem = Bbm.extend({}) | |
| }(p3.module("admissions/contract"))); | |
| (function (a) { | |
| var c = p3.module("utilities/multifetch"), | |
| d = p3.module("utilities/smodal"), | |
| b = p3.module("admissions/form/inquiries"); | |
| a.Vs.Layout = Bb.View.extend({ | |
| template: "page/page.12.header.template.html", | |
| render: function (e) { | |
| var f = this; | |
| p3.setTitle("Create Inquiry"); | |
| $(e).html(f.el); | |
| f.renderData() | |
| }, | |
| renderData: function () { | |
| var e = this; | |
| p3.fT(e.template, function (f) { | |
| e.$el.html(f({})); | |
| p3.rV(new a.Vs.Header(), e.$(".header"), false); | |
| p3.rV(new a.Vs.Main(), e.$(".col-center"), false) | |
| }) | |
| } | |
| }); | |
| a.Vs.Header = Bb.View.extend({ | |
| className: "subhead", | |
| render: function (e) { | |
| var f = this; | |
| $(e).html(f.el); | |
| f.renderData() | |
| }, | |
| renderData: function () { | |
| var e = this; | |
| e.$el.html("<h1>Create Inquiry</h1>") | |
| } | |
| }); | |
| a.Vs.Main = Bb.View.extend({ | |
| template: "inquiries/inquiries.inquiry.new.template.html", | |
| initialize: function () { | |
| var e = this; | |
| e.model = new b.Ms.Submit(); | |
| Bb.Validation.bind(e, { | |
| forceUpdate: true, | |
| selector: "name" | |
| }) | |
| }, | |
| events: { | |
| "change form select": "updateModel", | |
| "click .save": "saveModel" | |
| }, | |
| render: function (e) { | |
| var f = this; | |
| $(e).html(f.el); | |
| f.sources = new b.Cs.Sources(); | |
| f.inquiriesList = new b.Cs.InquiriesList(); | |
| c.Us.Fetch({ | |
| sources: { | |
| data: f.sources | |
| }, | |
| inquiriesList: { | |
| data: f.inquiriesList, | |
| dataParams: { | |
| active: 1 | |
| } | |
| } | |
| }, function (g, i, h) { | |
| if (h) { | |
| p3.displayError("There was an error loading data.") | |
| } | |
| f.renderData() | |
| }) | |
| }, | |
| renderData: function () { | |
| var e = this; | |
| p3.fT(e.template, function (f) { | |
| e.$el.html(f({ | |
| inquiriesList: e.inquiriesList.toJSON(), | |
| sources: e.sources.toJSON() | |
| })) | |
| }) | |
| }, | |
| updateModel: function (e) { | |
| var f = this; | |
| d.Us.updateModel(e, f.model, "name") | |
| }, | |
| saveModel: function (e) { | |
| var f = this; | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| if (f.model.isValid(true)) { | |
| p3.router().navigate("#inquiry/" + f.model.get("Inquiry") + "/keyid=admin/source=" + f.model.get("Source"), true) | |
| } | |
| } | |
| }); | |
| p3.router().route("createinquiry", "createinquiry", function () { | |
| a.Data.Dictionaries = {}; | |
| p3.renderMainPage(new a.Vs.Layout({})) | |
| }) | |
| }(p3.module("admissions/CreateInquiry"))); | |
| (function (c) { | |
| var d = p3.module("admissions/scheduling"), | |
| a = p3.module("admissions/admissionscalendar"), | |
| b = p3.module("admissions/analytics"); | |
| c.Ms.NavItem = Bbm.extend({}); | |
| c.Cs.NavItems = Bbc.extend({ | |
| model: c.Ms.NavItem | |
| }); | |
| c.Cs.ToProcessGet = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/DashboardProcessGet/" | |
| } | |
| }); | |
| c.Vs.Layout = Bb.View.extend({ | |
| initialize: function () { | |
| this.Containers = {} | |
| }, | |
| dispose: function () { | |
| $("BODY").removeClass("background-gray-texture") | |
| }, | |
| render: function (e) { | |
| var f = this; | |
| p3.rV(new c.Vs.ToProcess(), p3.Layout.Containers.MainPage, false); | |
| $(e).html(f.el); | |
| switch (this.options.page) { | |
| case "scheduling": | |
| p3.rV(new d.Vs.Layout(), $("#site-main"), false); | |
| break; | |
| case "admissionscalendar": | |
| p3.rV(new a.Vs.Layout(), $("#site-main"), false); | |
| break | |
| } | |
| } | |
| }); | |
| c.Vs.LowerNav = Bb.View.extend({ | |
| template: "admissions/nav.bottom.template.html", | |
| className: "admissions-nav res-container clearfix", | |
| render: function (e) { | |
| $(e).html(this.el); | |
| p3.showLowerNav(); | |
| var f = this; | |
| p3.fT(f.template, function (g) { | |
| f.collection.add([{ | |
| Route: "#dashboard", | |
| Page: "scheduling", | |
| Label: "Scheduling", | |
| Icon: "p3icon-schedule", | |
| Selected: false | |
| }, { | |
| Route: "#dashboard", | |
| Page: "analytics", | |
| Label: "Analytics", | |
| Icon: "p3icon-analytics", | |
| Selected: false | |
| }]); | |
| f.$el.html(g({ | |
| collection: f.collection.toJSON() | |
| })); | |
| f.shown(f.options.page) | |
| }) | |
| }, | |
| shown: function (e) { | |
| switch (e) { | |
| case "scheduling": | |
| p3.rV(new d.Vs.Layout(), $("#site-main"), false); | |
| $('.nav-pills li a[href="#dashboard/scheduling"]').closest("li").addClass("active"); | |
| break; | |
| case "analytics": | |
| p3.rV(new b.Vs.Layout(), $("#site-main"), false); | |
| $('.nav-pills li a[href="#dashboard/analytics"]').closest("li").addClass("active"); | |
| break; | |
| case "admissionscalendar": | |
| p3.rV(new a.Vs.Layout(), $("#site-main"), false); | |
| break | |
| } | |
| } | |
| }); | |
| c.Vs.ToProcess = Bb.View.extend({ | |
| template: "admissions/onboard.process.template.html", | |
| className: "wContainer noshadow", | |
| attributes: { | |
| style: "margin-top:-32px; margin-bottom:25px; padding:0px;" | |
| }, | |
| events: { | |
| "click a.toggle-siblings": "toggleSiblings" | |
| }, | |
| initialize: function () { | |
| this.collection = new c.Cs.ToProcessGet() | |
| }, | |
| render: function (e) { | |
| var f = this; | |
| e.before(this.el); | |
| f.renderData() | |
| }, | |
| renderData: function () { | |
| var e = this; | |
| e.collection.fetch({ | |
| success: function (f, g) { | |
| if (f.length) { | |
| p3.fT(e.template, function (h) { | |
| e.$el.html(h({ | |
| collection: g | |
| })) | |
| }) | |
| } | |
| } | |
| }) | |
| }, | |
| toggleSiblings: function (h) { | |
| h.preventDefault(); | |
| var f = $(h.currentTarget), | |
| g = f.closest("li").siblings(); | |
| if (!g.first().hasClass("hide")) { | |
| f.removeClass("p3icon-up").addClass("p3icon-down"); | |
| g.addClass("hide") | |
| } else { | |
| g.removeClass("hide"); | |
| f.removeClass("p3icon-down").addClass("p3icon-up") | |
| } | |
| return false | |
| } | |
| }); | |
| p3.router().route("dashboard/:page", "dashboard", function (e) { | |
| p3.renderMainPage(new c.Vs.Layout({ | |
| page: e | |
| }), true) | |
| }) | |
| }(p3.module("admissions/dashboard"))); | |
| (function (b) { | |
| var a = p3.module("shared/base"), | |
| d = p3.module("utilities/smodal"), | |
| c = p3.Us.InfoMessageLibrary; | |
| b.Ms.CommentBox = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| idAttribute: "SchoolId", | |
| validation: { | |
| CandidateDecisionText: [{ | |
| maxLength: 4000, | |
| msg: c.P3.MaxLengthExceeded | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "admissions/AdmissionOptions/" + this.id + "/" : aP + "admissions/AdmissionOptions/" | |
| } | |
| }); | |
| b.Vs.Layout = Bb.View.extend({ | |
| template: "admissions/admissionoptions.decisiontext.template.html", | |
| events: { | |
| "click button.save": "saveProgressText" | |
| }, | |
| initialize: function () { | |
| var e = this; | |
| e.model = new b.Ms.CommentBox({ | |
| SchoolId: p3.Data.SchoolContext.attributes.SchoolInfo.SchoolId | |
| }); | |
| e.model.defaults = $.extend(true, {}, e.model.attributes); | |
| e.Containers = {}; | |
| Bb.Validation.bind(e, { | |
| forceUpdate: true, | |
| selector: e.selector | |
| }) | |
| }, | |
| render: function (e) { | |
| var f = this; | |
| $(e).append(f.el); | |
| f.renderData() | |
| }, | |
| renderData: function () { | |
| var e = this; | |
| e.model.off("sync"); | |
| p3.fT(e.template, function (f) { | |
| e.model.fetch({ | |
| cache: false, | |
| success: function (h, i) { | |
| var g; | |
| e.$el.html(f({ | |
| model: e.model.toJSON() | |
| })); | |
| g = e.$(".tinyeditor"); | |
| d.Us.showHtmlEditor(e, "tinyeditor", function () { | |
| $.each(g, function () { | |
| var j = tinyMCE.get(this.id); | |
| e.$(".characterCounter").html(j.save().length); | |
| if (j.save().length > 4000) { | |
| e.$(".characterCounter").addClass("bb-badge-danger") | |
| } else { | |
| e.$(".characterCounter").removeClass("bb-badge-danger") | |
| } | |
| j.onChange.add(function (l, k) { | |
| e.$(".characterCounter").html(l.save().length); | |
| if (l.save().length > 4000) { | |
| e.$(".characterCounter").addClass("bb-badge-danger") | |
| } else { | |
| e.$(".characterCounter").removeClass("bb-badge-danger") | |
| } | |
| $.each(g, function () { | |
| var m = {}; | |
| m[this.name] = tinyMCE.get(this.id).save(); | |
| e.model.set(m) | |
| }) | |
| }); | |
| j.onKeyUp.add(function (l, k) { | |
| e.$(".characterCounter").html(l.save().length); | |
| if (l.save().length > 4000) { | |
| e.$(".characterCounter").addClass("bb-badge-danger") | |
| } else { | |
| e.$(".characterCounter").removeClass("bb-badge-danger") | |
| } | |
| $.each(g, function () { | |
| var m = {}; | |
| m[this.name] = tinyMCE.get(this.id).save(); | |
| e.model.set(m) | |
| }) | |
| }) | |
| }) | |
| }) | |
| } | |
| }) | |
| }) | |
| }, | |
| saveProgressText: function () { | |
| var f = this, | |
| e = f.$(".save"); | |
| e.button("loading").prop("disabled", true); | |
| $.each(f.$(".tinyeditor"), function () { | |
| var g = {}; | |
| g[this.id] = tinyMCE.get(this.id).save(); | |
| f.model.set(g) | |
| }); | |
| if (f.model.isValid(true)) { | |
| f.model.set({ | |
| FieldsToNull: [] | |
| }); | |
| _.each(f.model.attributes, function (i, g, h) { | |
| d.Us.setFieldsToNull(f.model, i, g, h, "") | |
| }); | |
| f.model.save({}, { | |
| dataParam: f.options.dataParam, | |
| complete: function () { | |
| e.button("reset") | |
| } | |
| }) | |
| } else { | |
| e.button("reset") | |
| } | |
| } | |
| }); | |
| p3.router().route("decisionText", "decisionText", function (e) { | |
| p3.renderMainPage(new b.Vs.Layout({})) | |
| }) | |
| }(p3.module("admissions/decisionText"))); | |
| (function (b) { | |
| var c = p3.module("utilities/smodal"), | |
| d = p3.Us.Tools, | |
| a = p3.Us.InfoMessageLibrary; | |
| b.Ms.Interest = Bbm.extend({ | |
| idAttribute: "InterestId", | |
| validation: { | |
| InterestName: [{ | |
| required: true, | |
| msg: a.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "Interest/Edit/" + this.id + "/" : aP + "Interest/Edit/" | |
| } | |
| }); | |
| b.Ms.Category = Bbm.extend({ | |
| idAttribute: "CategoryId", | |
| validation: { | |
| CategoryName: [{ | |
| required: true, | |
| msg: a.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "InterestCategory/Edit/" + this.id + "/" : aP + "InterestCategory/Edit/" | |
| } | |
| }); | |
| b.Cs.InterestsSort = Bbc.extend({ | |
| url: function () { | |
| return aP + "InterestCategory/EditSort/" | |
| } | |
| }); | |
| b.Cs.Categories = Bbc.extend({ | |
| model: b.Ms.Category, | |
| url: function () { | |
| return aP + "InterestCategory/List/" | |
| } | |
| }); | |
| b.Vs.Layout = Bb.View.extend({ | |
| template: "page/page.12.template.html", | |
| render: function (e) { | |
| var f = this; | |
| p3.setTitle("Interests"); | |
| $(e).html(f.el); | |
| f.renderData() | |
| }, | |
| renderData: function () { | |
| var e = this; | |
| p3.fT(e.template, function (h) { | |
| e.$el.html(h({})); | |
| var f = new b.Cs.Categories(), | |
| g = new b.Vs.Interests({ | |
| collection: f | |
| }); | |
| p3.rV(g, e.interestsElement(), false) | |
| }) | |
| }, | |
| interestsElement: function () { | |
| var e = this; | |
| return e.$(".col-center") | |
| } | |
| }); | |
| b.Vs.Interests = Bb.View.extend({ | |
| template: "interests/interests.interests.template.html", | |
| initialize: function (e) { | |
| var f = this; | |
| f.collection.bind("add", function (h) { | |
| var g = new b.Vs.Category({ | |
| model: h | |
| }); | |
| p3.rV(g, this.interestListElement(this), false) | |
| }, f); | |
| f.collection.on("refreshInterests", function () { | |
| var g = this.interestListElement(this); | |
| g.empty(); | |
| f.collection.reset(); | |
| f.renderData() | |
| }, f) | |
| }, | |
| interestListElement: function (e) { | |
| return e.$("#interestList") | |
| }, | |
| sidebarElement: function (e) { | |
| return e.$(".col-sidebar") | |
| }, | |
| render: function (e) { | |
| var f = this; | |
| $(e).html(f.el); | |
| f.renderData() | |
| }, | |
| renderData: function () { | |
| var e = this; | |
| p3.fT(e.template, function (f) { | |
| e.$el.empty(); | |
| e.$el.html(f({})); | |
| p3.rV(new b.Vs.Sidebar({ | |
| collection: e.collection | |
| }), e.sidebarElement(e), false); | |
| e.collection.fetch({ | |
| update: true, | |
| cache: false | |
| }) | |
| }) | |
| } | |
| }); | |
| b.Vs.Category = Bb.View.extend({ | |
| template: "interests/interests.category.template.html", | |
| initialize: function (e) { | |
| var f = this; | |
| f.model.on("sync", f.renderData, f) | |
| }, | |
| dispose: function () { | |
| var e = this; | |
| e.model.off() | |
| }, | |
| events: { | |
| "click .toggleLink": "toggleSection", | |
| "click .create-interest": "createInterest", | |
| "click .edit-category": "editCategory", | |
| "click .delete-category": "deleteCategory" | |
| }, | |
| render: function (e) { | |
| var f = this; | |
| $(e).append(f.el); | |
| f.renderData() | |
| }, | |
| renderData: function () { | |
| var e = this; | |
| p3.fT(e.template, function (f) { | |
| e.$el.html(f({ | |
| model: e.model.toJSON() | |
| })); | |
| _.each(e.model.get("InterestDetail"), function (h, g) { | |
| p3.rV(new b.Vs.Interest({ | |
| model: new b.Ms.Interest(h), | |
| parent: e.model.toJSON(), | |
| path: "InterestDetail." + g | |
| }), e.$("tbody"), false) | |
| }) | |
| }) | |
| }, | |
| toggleSection: function (e) { | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| $(e.currentTarget).siblings(".toggledetail").slideToggle("fast"); | |
| $(e.currentTarget).find("i").toggleClass("p3icon-downArrow p3icon-sideArrow"); | |
| if ($(e.currentTarget).hasClass("active")) { | |
| $(e.currentTarget).removeClass("active") | |
| } else { | |
| $(e.currentTarget).addClass("active") | |
| } | |
| }, | |
| editCategory: function (e) { | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| var f = this; | |
| f.modal2Extend = c.Vs.Modal2.extend({ | |
| template: "interests/interests.category.create.template.html", | |
| model: f.model, | |
| modalRendered: function () { | |
| var g = this; | |
| g.setFocus() | |
| }, | |
| modalUpdate: function (i) { | |
| var h = this, | |
| g = h.$(".active-alert"); | |
| if (i.eventCurrentTarget.parent().attr("name") === "Inactive") { | |
| if (d.stringToBoolean(i.eventCurrentTarget.val()) === true) { | |
| g.hide() | |
| } else { | |
| g.show() | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| } | |
| }, | |
| modalSavedSuccess: function (g) { | |
| f.renderData() | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new f.modal2Extend(), p3.Layout.Containers.Modal, true) | |
| }, | |
| deleteCategory: function (e) { | |
| var f = this; | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| f.$(".delete").prop("disabled", true); | |
| p3.showConfirm("Delete Category", "Wait a minute. Are you really sure you want to delete " + f.model.get("CategoryName") + "?", null, function () { | |
| f.model.destroy({ | |
| success: function () { | |
| f.deleteElement() | |
| }, | |
| error: function () { | |
| p3.displayError("Error deleting category"); | |
| f.$(".delete").prop("disabled", false) | |
| } | |
| }) | |
| }) | |
| }, | |
| createInterest: function (e) { | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| var g = this, | |
| f = new b.Ms.Interest({ | |
| CategoryId: g.model.id | |
| }); | |
| g.modal2Extend = c.Vs.Modal2.extend({ | |
| template: "interests/interests.interest.create.template.html", | |
| model: f, | |
| modalRendered: function () { | |
| var h = this; | |
| h.setFocus() | |
| }, | |
| modalSavedSuccess: function (h) { | |
| g.model.get("InterestDetail").push(h.response); | |
| g.renderData() | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new g.modal2Extend(), p3.Layout.Containers.Modal, true) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| b.Vs.Interest = Bb.View.extend({ | |
| template: "interests/interests.interest.template.html", | |
| tagName: "tr", | |
| initialize: function () { | |
| Bb.Validation.bind(this, { | |
| forceUpdate: true, | |
| selector: "name" | |
| }) | |
| }, | |
| events: { | |
| "click .checkbox-input": "updateModel", | |
| "click .delete-interest": "deleteInterest", | |
| "click .inline-edit": "toggleInlineEdit", | |
| "blur .inline-edit .edit input": "closeInlineEdit", | |
| "change input": "updateModel", | |
| "mouseover td.inline-edit": "inlineEditOver", | |
| "mouseout td.inline-edit": "inlineEditOut" | |
| }, | |
| render: function (e) { | |
| var f = this; | |
| $(e).append(f.el); | |
| f.renderData() | |
| }, | |
| renderData: function () { | |
| var e = this; | |
| p3.fT(e.template, function (f) { | |
| e.$el.html(f({ | |
| model: e.model.toJSON() | |
| })) | |
| }) | |
| }, | |
| inlineEditOver: function (e) { | |
| e.stopPropagation(); | |
| $(e.currentTarget).find("i").show() | |
| }, | |
| inlineEditOut: function (e) { | |
| e.stopPropagation(); | |
| $(e.currentTarget).find("i").hide() | |
| }, | |
| toggleInlineEdit: function (f) { | |
| f.stopPropagation(); | |
| f.preventDefault(); | |
| var e = $(f.currentTarget); | |
| e.find(".display").hide(); | |
| e.find(".edit").show(); | |
| e.find(".edit input").focus() | |
| }, | |
| closeInlineEdit: function (e) { | |
| e.stopPropagation(); | |
| e.preventDefault(); | |
| var f = this; | |
| if (f.model.isValid(true)) { | |
| f.$(".display").show(); | |
| f.$(".edit").hide(); | |
| f.updateModel(e) | |
| } | |
| }, | |
| updateModel: function (g) { | |
| var j = this, | |
| e = $(g.currentTarget), | |
| h = e.attr("name"), | |
| i, f = false; | |
| j.model.defaults = $.extend(true, {}, j.model.attributes); | |
| if (e.hasClass("checkbox-input")) { | |
| e.find("h5").find("i").toggleClass("p3icon-ok").toggleClass("p3icon-check"); | |
| f = true; | |
| _.defer(function () { | |
| if (h === "Inactive") { | |
| i = (e.hasClass("active")) ? false : true | |
| } else { | |
| i = (e.hasClass("active")) ? true : false | |
| } | |
| i = i ? false : true; | |
| c.Us.setPropByString(j.model.attributes, h, i); | |
| j.saveModel() | |
| }) | |
| } else { | |
| i = e.prop("value") | |
| } | |
| if (!f) { | |
| c.Us.setPropByString(j.model.attributes, h, i); | |
| j.saveModel() | |
| } | |
| }, | |
| saveModel: function () { | |
| var e = this; | |
| if (e.model.isValid(true)) { | |
| e.model.set({ | |
| FieldsToNull: [] | |
| }); | |
| _.each(e.model.attributes, function (h, f, g) { | |
| c.Us.setFieldsToNull(e.model, h, f, g, "") | |
| }); | |
| e.model.save({}, { | |
| success: function (f, g) { | |
| c.Us.setPropByString(e.options.parent, e.options.path, g); | |
| e.renderData() | |
| }, | |
| error: function (g, f) { | |
| p3.displayError("Error updating interest"); | |
| e.model.set(e.model.defaults); | |
| e.renderData() | |
| } | |
| }) | |
| } else { | |
| e.model.set(e.model.defaults); | |
| e.renderData() | |
| } | |
| }, | |
| deleteInterest: function (e) { | |
| var f = this; | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| f.$(".delete").prop("disabled", true); | |
| p3.showConfirm("Delete Interest", "Wait a minute. Are you really sure you want to delete " + f.model.get("InterestName") + "?", null, function () { | |
| f.model.destroy({ | |
| success: function () { | |
| c.Us.removeObjByString(f.options.parent, f.options.path); | |
| f.deleteElement() | |
| }, | |
| error: function () { | |
| p3.displayError("Error deleting interest"); | |
| f.$(".delete").prop("disabled", false) | |
| } | |
| }) | |
| }) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| b.Vs.Sidebar = Bb.View.extend({ | |
| template: "interests/interests.sidebar.template.html", | |
| className: "checklists-sidebar", | |
| events: { | |
| "click .create-category": "createCategory", | |
| "click .edit-order": "editOrder" | |
| }, | |
| render: function (e) { | |
| var f = this; | |
| $(e).html(f.el); | |
| f.renderData() | |
| }, | |
| renderData: function () { | |
| var e = this; | |
| p3.fT(e.template, function (f) { | |
| e.$el.html(f({})) | |
| }) | |
| }, | |
| createCategory: function (f) { | |
| f.preventDefault(); | |
| f.stopPropagation(); | |
| var g = this, | |
| e = new b.Ms.Category({ | |
| Inactive: false | |
| }); | |
| g.modal2Extend = c.Vs.Modal2.extend({ | |
| template: "interests/interests.category.create.template.html", | |
| model: e, | |
| modalRendered: function () { | |
| var h = this; | |
| h.setFocus() | |
| }, | |
| modalUpdate: function (j) { | |
| var i = this, | |
| h = i.$(".active-alert"); | |
| if (j.eventCurrentTarget.parent().attr("name") === "Inactive") { | |
| if (d.stringToBoolean(j.eventCurrentTarget.val()) === true) { | |
| h.hide() | |
| } else { | |
| h.show() | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| } | |
| }, | |
| modalSavedSuccess: function (h) { | |
| g.collection.add(h.response) | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new g.modal2Extend(), p3.Layout.Containers.Modal, true) | |
| }, | |
| editOrder: function (e) { | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| var f = this; | |
| f.modal2Extend = c.Vs.Modal2.extend({ | |
| template: "interests/interests.category.sort.template.html", | |
| collection: f.collection, | |
| modalRendered: function (h) { | |
| var g = this; | |
| g.$("#categories").sortable({ | |
| items: "li", | |
| axis: "y", | |
| containment: "#categories", | |
| distance: 5 | |
| }).disableSelection(); | |
| g.$("tbody.interests").sortable({ | |
| items: "tr.interest", | |
| axis: "y", | |
| connectWith: "tbody.interests", | |
| containment: "#categories", | |
| distance: 5, | |
| dropOnEmpty: true, | |
| placeholder: "sortable-placeholder", | |
| helper: function (j, k) { | |
| var i = '<table class="table table-striped sort-drag-block-helper"><tbody>' + k.context.outerHTML + "</tbody></table>"; | |
| return i | |
| }, | |
| start: function (i, k) { | |
| var j = k.item.siblings(".interest").length; | |
| if (!j) { | |
| k.item.parent().append('<tr class="empty-row"><td></td></tr>') | |
| } | |
| }, | |
| update: function (j, k) { | |
| var i = k.item.siblings(".empty-row"); | |
| if (i.length) { | |
| i.remove() | |
| } | |
| } | |
| }).disableSelection() | |
| }, | |
| modalSave: function (i) { | |
| var h = this, | |
| g; | |
| if (h.collection.length) { | |
| g = new b.Cs.InterestsSort(); | |
| _.each(h.$(".category"), function (k) { | |
| var j = $(k), | |
| l = []; | |
| _.each(j.find(".interest"), function (m) { | |
| l.push({ | |
| InterestId: $(m).data("id") | |
| }) | |
| }); | |
| g.add({ | |
| CategoryId: j.data("id"), | |
| InterestDetail: l | |
| }) | |
| }); | |
| g.save({ | |
| success: function (j, l, k) { | |
| h.collection.trigger("refreshInterests"); | |
| p3.Layout.Containers.Modal.modal("hide") | |
| }, | |
| error: function (j, k) { | |
| p3.displayError("Error saving interest sort order") | |
| } | |
| }); | |
| return false | |
| } | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new f.modal2Extend(), p3.Layout.Containers.Modal, true) | |
| } | |
| }); | |
| p3.router().route("settings/interests", "settings/interests", function () { | |
| p3.renderMainPage(new b.Vs.Layout({})) | |
| }) | |
| }(p3.module("admissions/interests"))); | |
| (function (c) { | |
| var a = p3.module("app"), | |
| r = p3.module("shared/task"), | |
| i = p3.module("shared/datepicker"), | |
| s = p3.module("shared/timepicker"), | |
| d = p3.module("admissions/candidateprofile"), | |
| e = p3.module("admissions/candidate/checklist"), | |
| p = p3.module("admissions/candidate/schools"), | |
| k = p3.module("admissions/candidate/financialaid"), | |
| g = p3.module("admissions/candidate/contracts"), | |
| o = p3.module("shared/profilecontactcard"), | |
| f = p3.module("admissions/candidate/connections"), | |
| b = p3.module("shared/base"), | |
| n = p3.module("officialNote"), | |
| q = p3.module("utilities/smodal"), | |
| l = p3.module("admissions/form/forms"), | |
| j = p3.Us.Enum, | |
| m = p3.Us.InfoMessageLibrary, | |
| h = p3.Us.Culture, | |
| t = p3.Us.Tools; | |
| c.Ms.DictionaryItem = Bbm.extend({}); | |
| c.Cs.Dictionary = Bbc.extend({ | |
| model: c.Ms.DictionaryItem, | |
| url: "datadirect/DictionaryGet/" | |
| }); | |
| c.Ms.NavItem = Bbm.extend({}); | |
| c.Ms.ParentStudentUserInfo = Bbm.extend({}); | |
| c.Ms.ProspectInstanceIds = Bbm.extend({}); | |
| c.Ms.UserViewed = Bbm.extend({ | |
| url: function () { | |
| return aP + "user/UserViewedSave/" | |
| } | |
| }); | |
| c.Ms.RecentlyViewed = Bbm.extend({}); | |
| c.Ms.TokenItem = Bbm.extend({}); | |
| c.Ms.Information = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "ProspectInstanceId", | |
| validation: { | |
| Comment: [{ | |
| maxLength: 4000, | |
| required: false, | |
| msg: m.P3.MaxLengthExceeded | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "admissions/prospect/" + this.id + "/" : aP + "admissions/prospect/" | |
| } | |
| }); | |
| c.Ms.StudentHeader = Bbm.extend({ | |
| idAttribute: "UserId", | |
| urlRoot: "Admissions/ProfileStudentHeader" | |
| }); | |
| c.Ms.MailMerge = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "CommunicationId", | |
| validation: { | |
| ContactDate: [{ | |
| required: true, | |
| msg: m.P3.RequiredInfoNotEntered | |
| }, { | |
| date: true | |
| }], | |
| Subject: [{ | |
| required: true, | |
| msg: m.P3.RequiredInfoNotEntered | |
| }], | |
| "MailMergeJob.TemplateId": [{ | |
| required: true, | |
| msg: m.P3.RequiredInfoNotEntered | |
| }], | |
| Comment: [{ | |
| maxLength: 4000, | |
| required: false, | |
| msg: m.P3.MaxLengthExceeded | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "admissions/ProspectCommunication/" + this.id + "/" : aP + "admissions/ProspectCommunication/" | |
| } | |
| }); | |
| c.Ms.ProspectDelete = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "ProspectInstanceId", | |
| validation: { | |
| DeleteReason: [{ | |
| required: true, | |
| msg: m.P3.RequiredInfoNotEntered | |
| }, { | |
| maxLength: 1000, | |
| msg: m.P3.MaxLengthExceeded | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "admissions/prospect/" + this.id + "/" : aP + "admissions/prospect/" | |
| } | |
| }); | |
| c.Cs.ParentStudentUserInfo = Bbc.extend({ | |
| model: c.Ms.ParentStudentUserInfo, | |
| url: function () { | |
| return aP + "datadirect/ParentStudentUserInfo/" | |
| } | |
| }); | |
| c.Cs.NavItems = Bbc.extend({ | |
| model: c.Ms.NavItem | |
| }); | |
| c.Cs.ProspectInstanceIds = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/ProspectInstanceIdsGet/" | |
| } | |
| }); | |
| c.Cs.RecentlyViewed = Bbc.extend({ | |
| model: c.Ms.RecentlyViewed, | |
| url: function () { | |
| return aP + "datadirect/UserLastViewed/" | |
| } | |
| }); | |
| c.Cs.TokenItems = Bbc.extend({ | |
| model: c.Ms.TokenItem | |
| }); | |
| c.Cs.StatusHistory = Bbc.extend({ | |
| sync: b.DataParamSync, | |
| url: function () { | |
| return aP + "Admissions/ProspectStatusHistoryList/" | |
| } | |
| }); | |
| c.Cs.SchoolYears = Bbc.extend({ | |
| url: function () { | |
| return aP + "DataDirect/SchoolYearsGet/" | |
| } | |
| }); | |
| c.Cs.MailMerge = Bbc.extend({ | |
| model: c.Ms.MailMerge, | |
| url: function () { | |
| return aP + "admissions/ProspectCommunicationList/" | |
| } | |
| }); | |
| c.Cs.MailMergeTemplates = Bbc.extend({ | |
| model: c.Ms.ParentStudentUserInfo, | |
| url: function () { | |
| return aP + "datadirect/MailMergeTemplatesGet/" | |
| } | |
| }); | |
| c.Cs.FilesAndForms = Bbc.extend({ | |
| url: "Candidate/ProspectAttachments" | |
| }); | |
| c.Vs.Layout = Bb.View.extend({ | |
| template: "admissions/candidate.detail.layout.template.html", | |
| events: { | |
| renderdata: "renderData" | |
| }, | |
| initialize: function () { | |
| var u = this, | |
| v; | |
| u.Containers = {}; | |
| u.schoolyears = new c.Cs.SchoolYears(); | |
| v = new c.Ms.UserViewed(); | |
| v.save({ | |
| userId: c.Data.userId, | |
| viewType: 1 | |
| }); | |
| c.Data.profilePublishField = new o.Ms.ProfilePublishField() | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).html(v.el); | |
| p3.fT(v.template, function (w) { | |
| v.$el.html(w({})); | |
| c.Data.profilePublishField.fetch({ | |
| data: { | |
| showUserId: c.Data.userId | |
| }, | |
| success: function (x) { | |
| v.schoolyears.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| userId: c.Data.userId, | |
| display: 5 | |
| }, | |
| success: function (y, z) { | |
| _.each(v.schoolyears.toJSON(), function (A) { | |
| if (A.AdmCurrentYearInd) { | |
| c.Data.AdmCurrentYear = A.Id | |
| } | |
| }); | |
| v.renderData() | |
| } | |
| }) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading publish fields") | |
| } | |
| }) | |
| }) | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.rV(new c.Vs.Header({ | |
| layoutView: u | |
| }), $("#header"), true); | |
| p3.rV(new c.Vs.Sidebar({ | |
| layoutView: u, | |
| access: c.Data.profilePublishField.get("editList") | |
| }), $("#page-2col-slimright"), true); | |
| p3.rV(new c.Vs.Navigation({ | |
| layoutView: u, | |
| model: c.Data.profilePublishField, | |
| page: u.options.page | |
| }), $("#candidateHeader"), false) | |
| } | |
| }); | |
| c.Vs.Header = Bb.View.extend({ | |
| template: "admissions/candidate.detail.header.template.html", | |
| events: { | |
| renderheader: "renderData", | |
| "mouseover #candidatePhoto": "showedit", | |
| "mouseout #candidatePhoto": "hideedit", | |
| "click .editPhotoIcon": "editphoto", | |
| "click .yearselect": "selectYear", | |
| "click .statushistory": "statusHistory", | |
| "click #currentYearLink": "selectCurrentYear", | |
| "click .delete-entering-year": "deleteEnteringYear" | |
| }, | |
| initialize: function (u) { | |
| var v = this; | |
| v.hideWarning = 1; | |
| c.Data.prospectInfo = new c.Ms.Information(); | |
| v.generalInformation = new o.Ms.GeneralInformation({ | |
| id: c.Data.userId | |
| }) | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.generalInformation.off("sync"); | |
| v.generalInformation.fetch({ | |
| data: { | |
| propertylist: "FieldsToNull,LastName,FirstName,NickName,ProfilePhotoFile,BirthDate,Status" | |
| }, | |
| success: function (w, x) { | |
| v.ageString = "None"; | |
| if (v.generalInformation.get("BirthDate") != null) { | |
| v.ageString = h.getAgeString(v.generalInformation.get("BirthDate")) | |
| } | |
| v.renderData() | |
| } | |
| }) | |
| }, | |
| renderData: function () { | |
| var v = this, | |
| u; | |
| p3.fT(v.template, function (w) { | |
| if (c.Data.instanceId) { | |
| c.Data.prospectInfo.fetch({ | |
| cache: false, | |
| data: { | |
| id: c.Data.instanceId | |
| }, | |
| success: function (y, z) { | |
| v.hideWarning = y.get("CurrentYearInd"); | |
| c.Data.statusId = y.get("Status"); | |
| v.currentYearIndex = null; | |
| var x = 0; | |
| _.each(c.Data.pidCollection.models, function (A) { | |
| x++; | |
| if (A.get("EnteringYear") == c.Data.AdmCurrentYear) { | |
| v.currentYearIndex = x; | |
| v.currentYearProspectInstanceId = A.get("ProspectInstanceId") | |
| } | |
| }); | |
| v.$el.html(w({ | |
| model: v.generalInformation.toJSON(), | |
| status: c.Data.statusId, | |
| studentWithdrawn: y.get("StudentWithdrawn"), | |
| ageString: v.ageString, | |
| collection: c.Data.pidCollection, | |
| candidate: c.Data.pidCollection.models[c.Data.modelIndex].toJSON(), | |
| hideWarning: v.hideWarning, | |
| showLink: v.currentYearIndex, | |
| access: c.Data.profilePublishField.get("editList") | |
| })); | |
| p3.rV(new c.Vs.CandidateNote({}), $("#candidate-note-holder"), true) | |
| } | |
| }) | |
| } else { | |
| u = new c.Ms.StudentHeader({ | |
| UserId: c.Data.userId | |
| }); | |
| u.fetch({ | |
| success: function (x, y) { | |
| v.$el.html(w({ | |
| model: v.generalInformation.toJSON(), | |
| studentWithdrawn: x.get("StudentWithdrawn"), | |
| ageString: v.ageString, | |
| hideWarning: v.hideWarning, | |
| showLink: v.currentYearIndex | |
| })); | |
| p3.rV(new c.Vs.CandidateNote({}), $("#candidate-note-holder"), true) | |
| } | |
| }) | |
| } | |
| }) | |
| }, | |
| showedit: function (u) { | |
| $(".editPhotoIcon").removeClass("hide") | |
| }, | |
| hideedit: function (u) { | |
| $(".editPhotoIcon").addClass("hide") | |
| }, | |
| editphoto: function (u) { | |
| var v = this; | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new c.Vs.Modal({ | |
| template: "parentchild/contactcard.modal.edit.profilephoto.template.html", | |
| model: v.generalInformation, | |
| layoutView: v.options.layoutView, | |
| photoRefresh: new Date().getTime() | |
| }), p3.Layout.Containers.Modal, true) | |
| }, | |
| selectYear: function (u) { | |
| var v = this; | |
| u.preventDefault(); | |
| c.Data.modelIndex = parseInt(u.target.getAttribute("data"), 10) - 1; | |
| p3.setSessionState(p3.Data.Context.attributes.UserInfo.UserId + "_" + c.Data.userId, c.Data.modelIndex); | |
| c.Data.instanceId = $(u.currentTarget).prop("id"); | |
| v.options.layoutView.renderData() | |
| }, | |
| selectCurrentYear: function (u) { | |
| var v = this; | |
| u.preventDefault(); | |
| c.Data.modelIndex = v.currentYearIndex - 1; | |
| p3.setSessionState(p3.Data.Context.attributes.UserInfo.UserId + "_" + c.Data.userId, c.Data.modelIndex); | |
| c.Data.instanceId = v.currentYearProspectInstanceId; | |
| v.options.layoutView.renderData() | |
| }, | |
| statusHistory: function (u) { | |
| u.preventDefault(); | |
| u.stopPropagation(); | |
| var w = this, | |
| v = new c.Cs.StatusHistory(); | |
| v.fetch({ | |
| data: { | |
| userId: c.Data.userId, | |
| prospectInstanceId: c.Data.instanceId | |
| }, | |
| success: function (x) { | |
| w.Modal2Extend = q.Vs.Modal2.extend({ | |
| template: "admissions/candidate.detail.header.statushistory.template.html", | |
| collection: v | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new w.Modal2Extend(), p3.Layout.Containers.Modal, true) | |
| } | |
| }) | |
| }, | |
| deleteEnteringYear: function (w) { | |
| w.preventDefault(); | |
| w.stopPropagation(); | |
| var x, y = new c.Ms.ProspectDelete({ | |
| ProspectInstanceId: t.stringToInt(c.Data.instanceId) | |
| }), | |
| u = c.Data.pidCollection.findWhere({ | |
| ProspectInstanceId: y.id | |
| }), | |
| v = u.get("EnteringYear"); | |
| if (c.Data.statusId === 2) { | |
| x = q.Vs.Modal2.extend({ | |
| template: "utilities/utilities.smodal.message.html", | |
| variables: { | |
| title: "Delete entering year " + v, | |
| infoText: "The candidate has already been enrolled and must first be withdrawn before any entering years can be deleted." | |
| } | |
| }) | |
| } else { | |
| x = q.Vs.Modal2.extend({ | |
| template: "candidate/candidate.header.deleteyear.template.html", | |
| model: y, | |
| size: "md", | |
| events: { | |
| "keyup textarea.counter-input": "updateCharacterCounter" | |
| }, | |
| variables: { | |
| enteringYear: v | |
| }, | |
| modalRendered: function (A) { | |
| var z = this; | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.AutoSize, function () { | |
| z.$("textarea").autosize() | |
| }); | |
| _.each(z.$("textarea.counter-input"), function (B) { | |
| $(B).trigger($.Event("keyup")) | |
| }) | |
| }, | |
| modalSave: function () { | |
| var B = this, | |
| A = B.$(".save"), | |
| z = B.$(".cancel"), | |
| C = p3.Data.Context.attributes.UserInfo.UserId + "_" + c.Data.userId; | |
| if (B.model.isValid(true)) { | |
| A.button("loading").prop("disabled", true); | |
| z.prop("disabled", true); | |
| B.model.save({}, { | |
| method: "delete", | |
| success: function () { | |
| p3.Layout.Containers.Modal.modal("hide"); | |
| if (c.Data.pidCollection.models.length > 1) { | |
| c.Data.instanceId = null; | |
| c.Data.modelIndex = 0; | |
| if (p3.getSessionState(C)) { | |
| p3.setSessionState(C, 0) | |
| } | |
| c.Us.RenderMainPage() | |
| } else { | |
| p3.router().navigate("#dashboard/scheduling", true) | |
| } | |
| }, | |
| error: function () { | |
| p3.displayError("Error deleting entering year."); | |
| A.button("reset").prop("disabled", false); | |
| z.prop("disabled", false) | |
| } | |
| }) | |
| } | |
| return false | |
| }, | |
| updateCharacterCounter: function (A) { | |
| var B = this, | |
| z = B.$(A.currentTarget); | |
| z.siblings().find(".characterCounter").html(z.val().length); | |
| if (z.val().length > 4000) { | |
| z.siblings().find(".characterCounter").addClass("badge-important") | |
| } else { | |
| z.siblings().find(".characterCounter").removeClass("badge-important") | |
| } | |
| } | |
| }) | |
| } | |
| q.Us.renderModal(new x()) | |
| } | |
| }); | |
| c.Vs.CandidateNote = Bb.View.extend({ | |
| template: "admissions/candidate.detail.note.template.html", | |
| id: "candidateNote", | |
| className: "sticky taped2", | |
| events: { | |
| "click button.editCommentIcon": "editcomment" | |
| }, | |
| initialize: function () { | |
| var u = this; | |
| if (this.options) { | |
| this.userId = this.options.userId | |
| } | |
| u.model = c.Data.prospectInfo | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).html(v.el); | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| u.model.off("sync"); | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| model: u.model.toJSON() | |
| })); | |
| u.model.on("sync", u.renderData, u) | |
| }) | |
| }, | |
| editcomment: function (u) { | |
| var v = this; | |
| v.modal2Extend = q.Vs.Modal2.extend({ | |
| template: "admissions/candidate.detail.edit.comment.template.html", | |
| model: v.model, | |
| modalRendered: function (x) { | |
| var w = this; | |
| o.Us.showHtmlEditor(w, "tinyeditor", function () { | |
| $.each(w.$(".tinyeditor"), function () { | |
| var y = tinyMCE.get(this.id); | |
| w.$(".characterCounter").html(y.save().length); | |
| if (y.save().length > 4000) { | |
| w.$(".characterCounter").addClass("badge-important") | |
| } else { | |
| w.$(".characterCounter").removeClass("badge-important") | |
| } | |
| y.onChange.add(function (A, z) { | |
| w.$(".characterCounter").html(A.save().length); | |
| if (A.save().length > 4000) { | |
| w.$(".characterCounter").addClass("badge-important") | |
| } else { | |
| w.$(".characterCounter").removeClass("badge-important") | |
| } | |
| }); | |
| y.onKeyUp.add(function (A, z) { | |
| w.$(".characterCounter").html(A.save().length); | |
| if (A.save().length > 4000) { | |
| w.$(".characterCounter").addClass("badge-important") | |
| } else { | |
| w.$(".characterCounter").removeClass("badge-important") | |
| } | |
| }) | |
| }) | |
| }) | |
| }, | |
| modalSave: function () { | |
| var w = this; | |
| $.each(w.$(".tinyeditor"), function () { | |
| var x = {}; | |
| x[this.id] = tinyMCE.get(this.id).save(); | |
| w.model.set(x) | |
| }) | |
| } | |
| }); | |
| q.Us.renderModal(new v.modal2Extend()) | |
| } | |
| }); | |
| c.Vs.Navigation = Bb.View.extend({ | |
| template: "admissions/candidate.detailnav.template.html", | |
| id: "candidateNav", | |
| events: { | |
| "click a": "clickCandidateTab" | |
| }, | |
| initialize: function () { | |
| var u = this; | |
| u.collection = new c.Cs.NavItems() | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).html(v.el); | |
| v.collection.comparator = function (w) { | |
| return w.get("id") | |
| }; | |
| p3.fT(v.template, function (D) { | |
| if (v.collection.length === 0) { | |
| var A = p3.Data.Context.findByTaskId(53090), | |
| y = p3.Data.Context.findByTaskId(53693), | |
| C = null, | |
| w = null, | |
| B = null, | |
| z = null, | |
| x = null; | |
| if (c.Data.instanceId) { | |
| C = { | |
| Route: "#candidate", | |
| Page: "#candidate/" + c.Data.userId + "/record", | |
| Label: "Record", | |
| Icon: "p3icon-roster", | |
| Selected: false | |
| }; | |
| w = { | |
| Route: "#candidate", | |
| Page: "#candidate/" + c.Data.userId + "/checklist", | |
| Label: "Checklist", | |
| Icon: "p3icon-admissionProgress", | |
| Selected: false | |
| }; | |
| x = { | |
| Route: "#candidate", | |
| Page: "#candidate/" + c.Data.userId + "/connections", | |
| Label: "Connections", | |
| Icon: "p3icon-connections", | |
| Selected: false | |
| } | |
| } | |
| if (A) { | |
| B = { | |
| Route: "#candidate", | |
| Page: A.HashString.replace(":id", c.Data.userId), | |
| Label: "Financial Aid", | |
| Icon: "p3icon-finAid", | |
| Selected: false | |
| } | |
| } | |
| if (y) { | |
| z = { | |
| Route: "#candidate", | |
| Page: y.HashString.replace(":id", c.Data.userId), | |
| Label: "Contracts", | |
| Icon: "p3icon-editContent", | |
| Selected: false | |
| } | |
| } | |
| v.collection.add([C, w, { | |
| Route: "#candidate", | |
| Page: "#candidate/" + c.Data.userId + "/schools", | |
| Label: "Schools", | |
| Icon: "p3icon-school", | |
| Selected: false | |
| }, B, z, { | |
| Route: "#candidate", | |
| Page: "#candidate/" + c.Data.userId + "/contactcard", | |
| Label: "Contact Card", | |
| Icon: "p3icon-contactCard", | |
| Selected: false | |
| }, x]) | |
| } | |
| v.$el.html(D({ | |
| collection: v.collection.toJSON(), | |
| userId: c.Data.userId | |
| })); | |
| v.shown(v.options.page) | |
| }) | |
| }, | |
| clickCandidateTab: function (u) { | |
| u.preventDefault(); | |
| u.stopPropagation(); | |
| p3.router().navigate(u.currentTarget.hash, true) | |
| }, | |
| shown: function (u) { | |
| var v = this; | |
| switch (u) { | |
| case "record": | |
| p3.rV(new d.Vs.Layout({ | |
| instanceId: c.Data.instanceId, | |
| userId: c.Data.userId | |
| }), $("#main-content"), false); | |
| $('.nav-tabs li a[href="#candidate/' + c.Data.userId + '/record"]').closest("li").addClass("active"); | |
| break; | |
| case "checklist": | |
| p3.rV(new e.Vs.Layout({ | |
| instanceId: c.Data.instanceId, | |
| userId: c.Data.userId, | |
| enteringYear: c.Data.enteringYear, | |
| enteringGrade: c.Data.enteringGrade, | |
| statusId: c.Data.statusId | |
| }), $("#main-content"), false); | |
| $('.nav-tabs li a[href="#candidate/' + c.Data.userId + '/checklist"]').closest("li").addClass("active"); | |
| break; | |
| case "schools": | |
| p3.rV(new p.Vs.Layout({ | |
| instanceId: c.Data.instanceId, | |
| userId: c.Data.userId | |
| }), $("#main-content"), false); | |
| $('.nav-tabs li a[href="#candidate/' + c.Data.userId + '/schools"]').closest("li").addClass("active"); | |
| break; | |
| case "financialaid": | |
| p3.rV(new k.Vs.Layout({ | |
| instanceId: c.Data.instanceId, | |
| userId: c.Data.userId | |
| }), $("#main-content"), false); | |
| $('.nav-tabs li a[href="#candidate/' + c.Data.userId + '/financialaid"]').closest("li").addClass("active"); | |
| break; | |
| case "contracts": | |
| p3.rV(new g.Vs.Layout({ | |
| instanceId: c.Data.instanceId, | |
| userId: c.Data.userId | |
| }), $("#main-content"), false); | |
| $('.nav-tabs li a[href="#candidate/' + c.Data.userId + '/contracts"]').closest("li").addClass("active"); | |
| break; | |
| case "contactcard": | |
| p3.rV(new o.Vs.Layout({ | |
| userId: c.Data.userId, | |
| showPhoto: false | |
| }), $("#main-content"), false); | |
| $('.nav-tabs li a[href="#candidate/' + c.Data.userId + '/contactcard"]').closest("li").addClass("active"); | |
| break; | |
| case "connections": | |
| p3.rV(new f.Vs.Layout({ | |
| instanceId: c.Data.instanceId, | |
| layoutView: v, | |
| userId: c.Data.userId | |
| }), $("#main-content"), false); | |
| $('.nav-tabs li a[href="#candidate/' + c.Data.userId + '/connections"]').closest("li").addClass("active"); | |
| break; | |
| default: | |
| break | |
| } | |
| p3.rV(new c.Vs.WorklistNav({ | |
| userId: c.Data.userId | |
| }), $("#site-nav-lower"), false) | |
| } | |
| }); | |
| c.Vs.WorklistNav = Bb.View.extend({ | |
| template: "admissions/candidate.detail.worklistnav.template.html", | |
| className: "admissions-nav res-container clearfix", | |
| initialize: function () { | |
| var u = this; | |
| u.navArgs = { | |
| user: null, | |
| list: null, | |
| prev: null, | |
| pos: null, | |
| count: null, | |
| next: null, | |
| worklistId: null, | |
| worklistName: null, | |
| timerstart: null, | |
| timernow: null, | |
| worklistState: null, | |
| render: false, | |
| remove: false, | |
| task: null | |
| } | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| v.navArgs.user = v.options.userId; | |
| v.navArgs.worklistState = p3.getSessionState("AdmWorkList"); | |
| v.navArgs.task = _.find(Bb.history.fragment.split("/").reverse()); | |
| if (v.navArgs.worklistState) { | |
| v.navArgs.remove = true; | |
| if (v.navArgs.worklistState.length > 3) { | |
| v.navArgs.timerstart = v.navArgs.worklistState[0]; | |
| v.navArgs.timernow = Date.parse(new Date().toString()); | |
| if (!(v.navArgs.timerstart && v.navArgs.timernow - v.navArgs.timerstart > 1800000)) { | |
| v.navArgs.worklistId = v.navArgs.worklistState[1]; | |
| v.navArgs.worklistName = v.navArgs.worklistState[2]; | |
| v.navArgs.list = _.rest(v.navArgs.worklistState, 3); | |
| if (v.navArgs.list) { | |
| v.navArgs.count = v.navArgs.list.length; | |
| if (v.navArgs.count) { | |
| v.navArgs.remove = false; | |
| v.navArgs.pos = _.indexOf(v.navArgs.list, v.navArgs.user) + 1; | |
| if (v.navArgs.pos > 0) { | |
| v.navArgs.prev = (v.navArgs.pos > 1) ? v.navArgs.list[v.navArgs.pos - 2] : 0; | |
| v.navArgs.next = (v.navArgs.pos >= 1 && v.navArgs.pos < v.navArgs.count) ? v.navArgs.list[v.navArgs.pos] : 0; | |
| v.navArgs.render = true; | |
| if (v.navArgs.timerstart) { | |
| v.navArgs.worklistState[0] = 0; | |
| p3.setSessionState("AdmWorkList", v.navArgs.worklistState) | |
| } | |
| } else { | |
| if (!v.navArgs.worklistState[0]) { | |
| v.navArgs.worklistState[0] = v.navArgs.timernow; | |
| p3.setSessionState("AdmWorkList", v.navArgs.worklistState) | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| if (v.navArgs.render) { | |
| $(u).html(v.el); | |
| p3.showLowerNav(); | |
| v.renderData() | |
| } else { | |
| if (v.navArgs.remove) { | |
| p3.setSessionState("AdmWorkList", null) | |
| } | |
| } | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| args: u.navArgs | |
| })) | |
| }) | |
| } | |
| }); | |
| c.Vs.Sidebar = Bb.View.extend({ | |
| template: "admissions/candidate.detail.sidebar.template.html", | |
| events: { | |
| "click a.toggleLink": "toggleSection", | |
| "click .sendmessage": "sendMessage" | |
| }, | |
| initialize: function () { | |
| var u = this; | |
| u.model = new c.Ms.Information(); | |
| u.Containers = {} | |
| }, | |
| render: function (u) { | |
| $(u).html(this.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var w = this, | |
| v, u; | |
| if (c.Data.instanceId) { | |
| v = r.Us.getUrlById(1691, "pk=316&ext=word&piid=" + c.Data.instanceId + "&o_pk=|" + c.Data.enteringYear + "|" + c.Data.instanceId + "|" + c.Data.checklistId + "|"); | |
| u = r.Us.getUrlById(1691, "pk=316&ext=pdf&piid=" + c.Data.instanceId + "&o_pk=|" + c.Data.enteringYear + "|" + c.Data.instanceId + "|" + c.Data.checklistId + "|"); | |
| w.model.unbind("sync"); | |
| p3.fT(w.template, function (x) { | |
| w.$el.html(x({ | |
| wordLink: v, | |
| pdfLink: u, | |
| userId: c.Data.userId | |
| })); | |
| p3.rV(new c.Vs.MailMerge({ | |
| layoutView: w, | |
| instanceId: c.Data.instanceId, | |
| userId: c.Data.userId | |
| }), $("#mailmerge"), false); | |
| p3.rV(new c.Vs.OfficialNotes({ | |
| layoutView: w, | |
| instanceId: c.Data.instanceId, | |
| userId: c.Data.userId | |
| }), $("#officialNotesHolder"), false); | |
| p3.rV(new c.Vs.FilesAndForms({ | |
| layoutView: w, | |
| instanceId: c.Data.instanceId, | |
| userId: c.Data.userId | |
| }), $("#attachmentsHolder"), false); | |
| n.PrepopulateData = c.Data.userId | |
| }) | |
| } | |
| }, | |
| toggleSection: function (u) { | |
| $(u.currentTarget).siblings(".toggledetail").slideToggle("fast", function () { | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }); | |
| return false | |
| }, | |
| sendMessage: function (u) { | |
| u.preventDefault(); | |
| p3.router().navigate("#admissionsofficialnote/compose/0", true) | |
| } | |
| }); | |
| c.Vs.MailMerge = Bb.View.extend({ | |
| template: "admissions/candidate.detail.sidebar.mailmergeholder.template.html", | |
| initialize: function () { | |
| var u = this; | |
| u.collection = new c.Cs.MailMerge(); | |
| u.collection.bind("add", function (w) { | |
| var v = new c.Vs.MailMergeRow({ | |
| model: w, | |
| dictionaries: u.dictionaries, | |
| instanceId: c.Data.instanceId, | |
| parentView: u, | |
| userId: c.Data.userId | |
| }); | |
| w.bind("sync", u.renderData, u); | |
| if (w.attributes.DeliveryMethodType.Name.toLowerCase().indexOf("mail merge") >= 0) { | |
| p3.rV(v, this.$("#mailMergeHolder"), false) | |
| } else { | |
| if (this.$("#communicationHolder").hasClass("hide")) { | |
| this.$("#communicationHolder").removeClass("hide") | |
| } | |
| p3.rV(v, this.$("#communicationHolder"), false) | |
| } | |
| }, this) | |
| }, | |
| events: { | |
| "click a.toggleLink": "toggleSection", | |
| "click .create": "createMailMerge" | |
| }, | |
| render: function (u) { | |
| var w = this, | |
| v = 0; | |
| $(u).append(w.el); | |
| w.dictionaries = { | |
| ADMVisitTypes: j.DictionaryData.ADMVisitTypes, | |
| dictionary_102: { | |
| id: 102, | |
| keyName: "user_id", | |
| valueName: "user_name", | |
| inputParam: "@admissions_staff_id=null,@onBoard_ind=1[i]", | |
| dictionary: {} | |
| } | |
| }; | |
| _.each(w.dictionaries, function (x) { | |
| var y = new c.Cs.Dictionary(); | |
| y.fetch({ | |
| data: { | |
| dictionaryId: x.id, | |
| key: x.keyName, | |
| value: x.valueName, | |
| inputParam: x.inputParam | |
| }, | |
| success: function (z) { | |
| x.dictionary = z.toJSON(); | |
| v++; | |
| if (v === _.size(w.dictionaries)) { | |
| w.dictionaries.mailMergeTemplates = new c.Cs.MailMergeTemplates(); | |
| w.dictionaries.mailMergeTemplates.fetch({ | |
| cache: false, | |
| success: function (A, B) { | |
| w.dictionaries.mailMergeTemplates.dictionary = B; | |
| w.renderData() | |
| } | |
| }) | |
| } | |
| } | |
| }) | |
| }) | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| u.collection.reset(); | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| userId: c.Data.userId | |
| })); | |
| u.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| prospectInstanceId: c.Data.instanceId | |
| } | |
| }) | |
| }) | |
| }, | |
| toggleSection: function (u) { | |
| $(u.currentTarget).siblings(".toggledetail").slideToggle("fast"); | |
| if ($(u.currentTarget).hasClass("active")) { | |
| $(u.currentTarget).removeClass("active") | |
| } else { | |
| $(u.currentTarget).addClass("active") | |
| } | |
| return false | |
| }, | |
| createMailMerge: function (u) { | |
| var w = this, | |
| v = new c.Ms.MailMerge({ | |
| prospectInstanceId: c.Data.instanceId, | |
| ContactDate: h.getDateString(), | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| }, | |
| MailMergeJob: { | |
| "$type": "clBLL.nAdmissions.MailMergeJob, clBLL" | |
| } | |
| }); | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| v.bind("sync", w.renderData, w); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new c.Vs.Modal({ | |
| template: "admissions/candidate.detail.sidebar.mailmerge.create.template.html", | |
| model: v, | |
| dictionaries: w.dictionaries, | |
| layoutView: w | |
| }), p3.Layout.Containers.Modal, true) | |
| } | |
| }); | |
| c.Vs.MailMergeRow = Bb.View.extend({ | |
| template: "admissions/candidate.detail.sidebar.mailmerge.template.html", | |
| tagName: function () { | |
| return "div" | |
| }, | |
| initialize: function () { | |
| this.model.bind("destroy", this.deleteElement, this); | |
| this.model.bind("remove", this.deleteElement, this) | |
| }, | |
| events: { | |
| "click .mmEdit": "mmEdit", | |
| "click .commEdit": "commEdit", | |
| "click .togglebutton": "toggleInfo" | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.userId = c.Data.userId; | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var v = this, | |
| u = v.model.attributes.DeliveryMethodType.Name.toLowerCase().indexOf("mail merge") >= 0; | |
| p3.fT(v.template, function (w) { | |
| v.$el.html(w({ | |
| model: v.model.toJSON(), | |
| dictionaries: v.options.dictionaries, | |
| mailMerge: u | |
| })) | |
| }) | |
| }, | |
| toggleInfo: function (v) { | |
| var w = this, | |
| u = $(v.currentTarget); | |
| w.$(".toggleinfo").slideToggle("fast"); | |
| if (u.hasClass("active")) { | |
| u.removeClass("active") | |
| } else { | |
| u.addClass("active") | |
| } | |
| if (u.hasClass("fa-chevron-up")) { | |
| u.removeClass("fa-chevron-up").addClass("fa-chevron-down") | |
| } else { | |
| if (u.hasClass("fa-chevron-down")) { | |
| u.removeClass("fa-chevron-down").addClass("fa-chevron-up") | |
| } | |
| } | |
| return false | |
| }, | |
| mmEdit: function (u) { | |
| var v = this; | |
| u.preventDefault(); | |
| u.stopPropagation(); | |
| v.editModel = new c.Ms.MailMerge(); | |
| v.editModel.fetch({ | |
| update: true, | |
| data: { | |
| prospectInstanceId: c.Data.instanceId, | |
| id: v.model.get("CommunicationId") | |
| }, | |
| success: function (w) { | |
| v.editModel.bind("sync", v.options.parentView.renderData, v.options.parentView); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new c.Vs.Modal({ | |
| template: "admissions/candidate.detail.sidebar.mailmerge.edit.template.html", | |
| model: v.editModel, | |
| dictionaries: v.options.dictionaries, | |
| layoutView: v | |
| }), p3.Layout.Containers.Modal, true) | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading mail merge get") | |
| } | |
| }) | |
| }, | |
| commEdit: function (u) { | |
| var v = this; | |
| u.preventDefault(); | |
| u.stopPropagation(); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new c.Vs.Modal({ | |
| template: "admissions/candidate.detail.sidebar.communication.edit.template.html", | |
| model: v.model, | |
| dictionaries: v.options.dictionaries, | |
| layoutView: v | |
| }), p3.Layout.Containers.Modal, true) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| c.Vs.OfficialNotes = Bb.View.extend({ | |
| template: "admissions/candidate.detail.sidebar.communication.template.html", | |
| tagName: "table", | |
| className: function () { | |
| return "table table-sky message-list" | |
| }, | |
| events: { | |
| "click .detail": "noteDetail", | |
| renderData: "renderData" | |
| }, | |
| initialize: function () { | |
| var u = this; | |
| u.collection = new n.Cs.Inbox(); | |
| n.Data.inbox = {} | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var x = this, | |
| v = n.Us.GetStatus(), | |
| w = n.Us.GetTypes(), | |
| u = n.Us.GetSearchText(); | |
| x.collection.fetch({ | |
| data: { | |
| currentInd: (n.Us.GetYear() == 5) ? 0 : 1, | |
| statusXml: (v.length > 0) ? JSON.stringify(v) : "", | |
| commentTypeXml: (w.length > 0) ? JSON.stringify(w) : "", | |
| fromDate: n.Us.getFromDateForDataCall(), | |
| toDate: n.Us.getToDateForDataCall(), | |
| searchText: u, | |
| studentUserId: c.Data.userId, | |
| categoryId: 34 | |
| }, | |
| success: function () { | |
| p3.fT("admissions/candidate.detail.sidebar.officialnote.template.html", function (y) { | |
| n.Data.currentApp = 34; | |
| $(".message-list").html(y({ | |
| imagePath: p3.Config.FtpImagePath + "user/", | |
| officalnote: x.collection.toJSON(), | |
| nonHistoryView: n.Data.nonHistoryView | |
| })) | |
| }) | |
| } | |
| }) | |
| }, | |
| noteDetail: function (u) { | |
| var v = this; | |
| p3.rV(new c.Vs.NoteDetail({ | |
| commentId: $(u.target).attr("data-comment-id"), | |
| conversationId: $(u.target).attr("data-convo-id"), | |
| notesList: v.collection.pluck("CommentId"), | |
| displayArchive: this.options.displayArchive, | |
| layoutView: v | |
| }), p3.Layout.Containers.Modal, true) | |
| } | |
| }); | |
| c.Vs.NoteDetail = Bb.View.extend({ | |
| template: "officialnote/officialnote.detail.template.html", | |
| events: { | |
| "click #send": "sendMessage", | |
| "click #delete": "deleteMessage", | |
| initPlugin: "initPlugin", | |
| "click [data-note-id]": "showNoteDetail" | |
| }, | |
| initialize: function (u) { | |
| var v = this; | |
| v.categoryId = n.Us.GetApp(); | |
| v.model = new n.Ms.Detail().on("change", v.renderTemplate, this); | |
| v.fetchDetail(function () { | |
| p3.showModal(p3.Layout.Containers.Modal) | |
| }); | |
| if (v.categoryId == 34) { | |
| v.template = "officialnote/officialnote.adm.conversation.messages.template.html" | |
| } | |
| this.Containers = {}; | |
| _.bindAll(this, "sendMessage") | |
| }, | |
| dispose: function () { | |
| var u = tinyMCE.get("comment-text"); | |
| if (u) { | |
| u.remove() | |
| } | |
| this.options.layoutView.renderData() | |
| }, | |
| render: function (u) { | |
| $(u).append(this.el) | |
| }, | |
| renderTemplate: function (v) { | |
| var w = this, | |
| u = (p3.Data.Context.attributes.UserInfo.FirstName + " " + p3.Data.Context.attributes.UserInfo.LastName); | |
| p3.fT(w.template, function (x) { | |
| w.$el.html(x({ | |
| imagePath: p3.Config.FtpImagePath + "user/", | |
| conversation: v, | |
| FromSelf: u | |
| })); | |
| setTimeout(function () { | |
| w.$("#comment-type").trigger("change"); | |
| w.$el.trigger("initPlugin"); | |
| w.$(".required-indicator").tooltip(); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }, 200) | |
| }) | |
| }, | |
| loadPrevNext: function () { | |
| var x = this, | |
| w = this.options.notesList.indexOf(parseInt(this.options.commentId, 10)), | |
| v = $("<button>", { | |
| type: "button", | |
| "class": "btn btn-default btn-primary disabled", | |
| "data-note-id": this.options.notesList[w - 1] | |
| }).html("Prev"), | |
| u = $("<button>", { | |
| type: "button", | |
| "class": "btn btn-default btn-primary disabled", | |
| "data-note-id": this.options.notesList[w + 1] | |
| }).html("Next"); | |
| if (x.categoryId == 34) { | |
| this.$el.find(".navBtns").prepend(v, u) | |
| } else { | |
| this.$el.find(".modal-footer").prepend(v, u) | |
| } | |
| if (v.is("[data-note-id]")) { | |
| v.removeClass("disabled") | |
| } | |
| if (u.is("[data-note-id]")) { | |
| u.removeClass("disabled") | |
| } | |
| }, | |
| showNoteDetail: function (u) { | |
| var v = this; | |
| v.options.commentId = $(u.target).attr("data-note-id"); | |
| v.conversationId = $(u.target).attr("data-convo-id"); | |
| v.fetchDetail(function () { | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| fetchDetail: function (u) { | |
| var v = this; | |
| if (v.options.commentId) { | |
| v.model.fetch({ | |
| update: true, | |
| data: { | |
| Id: v.options.commentId, | |
| conversationId: v.options.conversationId | |
| }, | |
| success: function () { | |
| u() | |
| } | |
| }) | |
| } | |
| }, | |
| initPlugin: function () { | |
| p3.showHtmlEditor("comment-text", p3.Us.Enum.HtmlEditorCategories.FULL, false, function () { | |
| setTimeout(function () { | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }, 200) | |
| }, p3.Us.Enum.HtmlEditorEncoding.NUMERIC) | |
| }, | |
| sendMessage: function () { | |
| this.createMessage(2); | |
| return false | |
| }, | |
| deleteMessage: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| var y = this, | |
| x = y.$("#modal-form"), | |
| w = y.$("#modal-confirm"), | |
| v, z = new n.Ms.OfficialNoteDelete({ | |
| SchoolId: p3.Data.SchoolContext.attributes.SchoolInfo.SchoolId | |
| }); | |
| v = q.Vs.Modal2.extend({ | |
| template: "utilities/utilities.smodal.confirm.html", | |
| model: z, | |
| subModal: true, | |
| variables: { | |
| title: "Delete Official Note", | |
| errorText: "Wait a minute. Are you really sure you want to delete this official note?", | |
| cancelText: "Cancel", | |
| confirmText: "Confirm" | |
| }, | |
| modalSave: function () { | |
| z.destroy({ | |
| dataParam: { | |
| commentId: y.model.get("0").ConversationId, | |
| categoryId: 34 | |
| }, | |
| success: function () { | |
| $("#site-modal").modal("hide"); | |
| y.options.layoutView.renderData() | |
| }, | |
| error: function () { | |
| p3.displayError("Error deleting official note") | |
| } | |
| }); | |
| return false | |
| } | |
| }); | |
| x.hide(); | |
| w.show(); | |
| p3.rV(new v(), w, true) | |
| }, | |
| createMessage: function (y) { | |
| var z = this, | |
| x = true, | |
| w = new Bbc(), | |
| v = new Bbm({ | |
| StudentId: z.model.attributes[0].StudentUserId | |
| }), | |
| u = new Bbc(); | |
| w.add(v); | |
| u.add({ | |
| GroupId: 0 | |
| }); | |
| new n.Ms.Compose().save({ | |
| commentTypeId: z.model.attributes[0].CommentTypeId, | |
| student: JSON.stringify(w), | |
| comment: (tinyMCE.get("comment-text") == undefined) ? "" : tinyMCE.get("comment-text").getContent(), | |
| statusInd: z.model.attributes[0].StatusInd, | |
| accessGroup: JSON.stringify(u), | |
| sendEmail: x, | |
| inboxInd: true, | |
| categoryId: 34, | |
| templateId: null, | |
| conversationId: z.options.conversationId | |
| }, { | |
| success: function (A, B) { | |
| $("#site-modal").modal("hide"); | |
| z.options.layoutView.renderData() | |
| }, | |
| error: function (B, A) { | |
| p3.displayError("Error Saving Official Note") | |
| } | |
| }); | |
| return false | |
| } | |
| }); | |
| c.Vs.FilesAndForms = Bb.View.extend({ | |
| template: "admissions/candidate.detail.sidebar.attachments.template.html", | |
| events: { | |
| renderData: "renderData" | |
| }, | |
| initialize: function () { | |
| var u = this; | |
| u.collection = new c.Cs.FilesAndForms(); | |
| u.collection.bind("add", function (w) { | |
| var v = new c.Vs.Attachment({ | |
| model: w | |
| }); | |
| p3.rV(v, u.$(".attachments-list"), false) | |
| }, this) | |
| }, | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| u.collection.reset(); | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({})); | |
| u.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| prospectInstanceId: u.options.instanceId | |
| } | |
| }) | |
| }) | |
| } | |
| }); | |
| c.Vs.Attachment = Bb.View.extend({ | |
| template: "admissions/candidate.detail.sidebar.attachment.template.html", | |
| tagName: "tr", | |
| render: function (u) { | |
| var v = this; | |
| $(u).append(v.el); | |
| v.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.template, function (v) { | |
| u.$el.html(v({ | |
| model: u.model.toJSON() | |
| })) | |
| }) | |
| } | |
| }); | |
| c.Vs.Modal = Bb.View.extend({ | |
| initialize: function (u) { | |
| var v = this; | |
| v.model.defaults = $.extend(true, {}, v.model.attributes); | |
| v.selector = v.options.selector || "id"; | |
| Bb.Validation.bind(v, { | |
| forceUpdate: true, | |
| selector: v.selector | |
| }) | |
| }, | |
| events: { | |
| "click button.cancel": "cancelModel", | |
| "click button.save": "saveModel", | |
| "click button.delete": "deleteModel", | |
| "click button.delete-attachment-file": "deleteAttachmentFile", | |
| "click button.select-all": "selectAll", | |
| "click button.btn-select-toggle": "toggleSelection", | |
| "click label.toggleGrades": "toggleGrades", | |
| "change form input": "updateModel", | |
| "blur form input.time-input": "updateModel", | |
| "blur form input.date-input": "updateModel", | |
| "change form select": "updateModel", | |
| "click form .radio-input": "updateModel", | |
| "change form textarea": "updateModel", | |
| "change select.country-input": "changeCountry", | |
| "change select.testtype": "changeTestType", | |
| "change select#ChecklistItemId": "toggleChecklistStatus", | |
| "keyup textarea": "updateCharacterCounter", | |
| "change select.GatewayAccount_AccountId": "changeGateway", | |
| "change select#ContractTypeId": "changeContractType" | |
| }, | |
| dispose: function () { | |
| var u = this; | |
| $.each(u.$(".tinyeditor"), function () { | |
| var v = tinyMCE.get(this.id); | |
| if (v) { | |
| v.remove() | |
| } | |
| }) | |
| }, | |
| render: function (u) { | |
| $(u).append(this.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var u = this; | |
| p3.fT(u.options.template, function (x) { | |
| var w = {}, | |
| v; | |
| w.model = u.model.toJSON(); | |
| w.layoutView = u.options.layoutView; | |
| w.dictionaries = u.options.dictionaries; | |
| w.variables = u.options.variables; | |
| w.options = u.options; | |
| v = new l.Cs.FeeRules(u.model.get("FeeRules")); | |
| w.ruleType1 = v.ruleTypeExists(1); | |
| w.ruleType2 = v.ruleTypeExists(2); | |
| w.ruleType3 = v.ruleTypeExists(3); | |
| if (w.ruleType1) { | |
| w.firstRuleType = 1 | |
| } else { | |
| if (w.ruleType2) { | |
| w.firstRuleType = 2 | |
| } else { | |
| if (w.ruleType3) { | |
| w.firstRuleType = 3 | |
| } | |
| } | |
| } | |
| u.$el.html(x(w)); | |
| u.setFocus(); | |
| i.Us.initialize(".date-input", { | |
| yearRange: "-30:+20" | |
| }); | |
| o.Us.showHtmlEditor(u, "tinyeditor"); | |
| $(".required-indicator").tooltip(); | |
| u.$("textarea").trigger(jQuery.Event("keyup")); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.AutoSize, function () { | |
| u.$("textarea").autosize() | |
| }); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.jQueryUI, function () { | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.FileUpload, function () { | |
| u.initializeFileUpload_Photo(u); | |
| u.initializeFileUpload_File(u) | |
| }) | |
| }); | |
| s.Us.initialize(".time-input"); | |
| u.changeCountry(); | |
| if (w.dictionaries && w.dictionaries.dictionary_paymentgateway) { | |
| u.changeGateway() | |
| } | |
| u.$("textarea#Comment").trigger(jQuery.Event("keyup")); | |
| if ($("#ChecklistItemId option:selected").val() != "") { | |
| $(".checklist-status").removeClass("hide") | |
| } | |
| }) | |
| }, | |
| initializeFileUpload_Photo: function (u) { | |
| window.setTimeout(function () { | |
| var v = p3.Us.Enum.UploadType.IMAGE; | |
| $("#photoUpload").fileupload({ | |
| url: p3.Config.RootPath + "utilities/FileTransferHandler.ashx", | |
| autoUpload: true, | |
| acceptFileTypes: v.ValidExtensions, | |
| formData: { | |
| safeName: true | |
| }, | |
| add: function (x, w) { | |
| var y = p3.Us.FileTools.isValidFile(v, w.files[0].name); | |
| if (y) { | |
| w.submit() | |
| } else { | |
| u.$("#attachment-file").empty(); | |
| u.$("#attachment-file").append(p3.Us.FileTools.validateFiles(v, w)) | |
| } | |
| } | |
| }).bind("fileuploaddone", function (x, w) { | |
| $(".profilePhoto").prop("src", "/ftpimages/pdTemp/" + w.result[0].name); | |
| u.model.get("ProfilePhoto").LargeFilename = w.result[0].name; | |
| u.model.get("ProfilePhoto").LargeFilenameUrl = "/ftpimages/pdTemp/" + w.result[0].name; | |
| u.model.photo = true; | |
| u.model.forceReset = true | |
| }) | |
| }, 1000) | |
| }, | |
| initializeFileUpload_File: function (u) { | |
| window.setTimeout(function () { | |
| var v = p3.Us.Enum.UploadType.All; | |
| $("#fileUpload").fileupload({ | |
| url: p3.Config.RootPath + "utilities/FileTransferHandler.ashx", | |
| autoUpload: true, | |
| acceptFileTypes: v.ValidExtensions, | |
| formData: { | |
| safeName: true | |
| }, | |
| add: function (x, w) { | |
| var y = p3.Us.FileTools.isValidFile(v, w.files[0].name); | |
| if (y) { | |
| w.submit() | |
| } else { | |
| u.$("#attachment-file").empty(); | |
| u.$("#attachment-file").append(p3.Us.FileTools.validateFiles(v, w)) | |
| } | |
| } | |
| }).bind("fileuploaddone", function (x, w) { | |
| $("#attachment-file").html(w.result[0].original_name); | |
| u.model.get("AttachmentFile").Attachment = w.result[0].original_name; | |
| u.model.get("AttachmentFile").AttachmentTemp = w.result[0].name; | |
| $("#fileUpload").hide(); | |
| $(".delete-attachment-file").show() | |
| }) | |
| }, 1000) | |
| }, | |
| deleteAttachmentFile: function (u) { | |
| var v = this; | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| v.model.get("AttachmentFile").AttachmentRemove = v.model.get("AttachmentFile").Attachment; | |
| v.model.get("AttachmentFile").Attachment = null; | |
| $("#attachment-file").empty(); | |
| $("#fileUpload").show(); | |
| $(".delete-attachment-file").hide() | |
| }, | |
| changeCountry: function (u) { | |
| var v = this; | |
| if ((v.$("#Country").length) && (v.$("#Country").val().toLowerCase() === "united states")) { | |
| v.$("#State").parents(".control-group").show(); | |
| v.$("#Province").parents(".control-group").hide(); | |
| v.$("#Province").val("") | |
| } else { | |
| v.$("#State").parents(".control-group").hide(); | |
| v.$("#Province").parents(".control-group").show(); | |
| v.$("#State").val("") | |
| } | |
| }, | |
| changeTestType: function (u) { | |
| var v = this; | |
| v.collection = new d.Cs.SubTests(); | |
| v.collection.fetch({ | |
| cache: false, | |
| data: { | |
| testid: u.target.value | |
| }, | |
| success: function (w) { | |
| $("#subtestHolder").html(""); | |
| if (w.length > 0) { | |
| v.model.attributes.ProspectSubTests = w.toJSON(); | |
| p3.fT("admissions/candidate.detail.profile.subtest.template.html", function (x) { | |
| $("#subtestHolder").html(x({ | |
| model: v.model.toJSON() | |
| })) | |
| }) | |
| } | |
| } | |
| }) | |
| }, | |
| toggleChecklistStatus: function (u) { | |
| if ($(u.target).prop("value") === "") { | |
| $("#ChecklistItemStatus").val(""); | |
| $(".checklist-status").addClass("hide") | |
| } else { | |
| $(".checklist-status").removeClass("hide") | |
| } | |
| }, | |
| changeGateway: function (y) { | |
| var v = $("button.paymentoptions-input[value='5']").filter(".btn-denied"), | |
| x = $(".GatewayAccount_AccountId").val(), | |
| u = $("div.pm-opt-eft"), | |
| w = $("div#no-sup-msg"), | |
| z = this.options.dictionaries.dictionary_paymentgateway.dictionary.filter(function (A) { | |
| return A.AccountId === Number(x) | |
| }); | |
| if (z && z.length > 0) { | |
| if (z[0].GatewayId == 5) { | |
| w.html("<i>Not supported by selected gateway.</i>"); | |
| w.show(); | |
| v.click(); | |
| u.hide() | |
| } else { | |
| w.html(""); | |
| w.hide(); | |
| u.show() | |
| } | |
| } | |
| }, | |
| changeContractType: function (y) { | |
| var B = this, | |
| w = $(y.currentTarget), | |
| x = w.val(), | |
| u = B.$("#SchoolYear"), | |
| v = u.find("option"), | |
| z = B.options.dictionaries.contractTypes.get(x), | |
| A = z.get("SchoolYears"); | |
| u.val(""); | |
| v.each(function () { | |
| var C = $(this), | |
| D = C.prop("value"); | |
| if (_.contains(A, D)) { | |
| C.attr("disabled", "disabled") | |
| } else { | |
| C.removeAttr("disabled") | |
| } | |
| }) | |
| }, | |
| updateCharacterCounter: function (u) { | |
| u.stopPropagation(); | |
| u.preventDefault(); | |
| var v = this; | |
| v.$(u.currentTarget).siblings("p").find(".characterCounter").html($(u.currentTarget).val().length); | |
| if ($(u.currentTarget).val().length > 4000) { | |
| v.$(u.currentTarget).siblings("p").find(".characterCounter").addClass("badge-important") | |
| } else { | |
| v.$(u.currentTarget).siblings("p").find(".characterCounter").removeClass("badge-important") | |
| } | |
| }, | |
| selectAll: function (w) { | |
| w.preventDefault(); | |
| var y = this, | |
| v = $(w.currentTarget), | |
| x = v.data("selector"), | |
| u = y.$("." + x + ":not(.active)"); | |
| u.click() | |
| }, | |
| toggleSelection: function (v) { | |
| v.preventDefault(); | |
| var B = this, | |
| u = $(v.currentTarget), | |
| A = u.closest("tr"), | |
| y = A.data("prop"), | |
| w = A.data("id"), | |
| x = $.extend(true, [], B.model.get(y)), | |
| z; | |
| if (y === "FeeRules" && x) { | |
| z = _.find(x, function (C) { | |
| return C.FeeRuleId == w | |
| }); | |
| if (z) { | |
| z.InUseOnForm = !z.InUseOnForm; | |
| B.model.set("FeeRules", x) | |
| } | |
| } | |
| }, | |
| toggleGrades: function (u) { | |
| if (!$("#DepositByGrade").prop("checked")) { | |
| $(".toggleGrades").removeClass("active"); | |
| $(".depositsByGrade").addClass("hide"); | |
| $("#Fee").removeAttr("disabled") | |
| } else { | |
| $(".toggleGrades").addClass("active"); | |
| $(".depositsByGrade").removeClass("hide"); | |
| $("#Fee").attr("disabled", "disabled") | |
| } | |
| }, | |
| updateModel: function (v) { | |
| var D = this, | |
| z = $(v.currentTarget), | |
| y = z.attr(D.selector), | |
| B, u = {}, | |
| A, x, C, w; | |
| if (z.prop("type") === "checkbox") { | |
| B = z.prop("checked") | |
| } else { | |
| if (z.hasClass("date-input")) { | |
| if (z.siblings().hasClass("time-input")) { | |
| A = z.siblings(".time-input").prop("value"); | |
| x = z.prop("value"); | |
| B = x; | |
| if (A != "") { | |
| B += " " + A | |
| } | |
| } else { | |
| B = z.prop("value") | |
| } | |
| if (B == "") { | |
| B = null | |
| } | |
| } else { | |
| if (z.hasClass("time-input")) { | |
| if (z.siblings().hasClass("date-input")) { | |
| x = z.siblings(".date-input").prop("value"); | |
| A = z.prop("value"); | |
| B = x; | |
| if (A != "") { | |
| B += " " + A | |
| } | |
| y = z.siblings(".date-input").prop(D.selector) | |
| } else { | |
| B = z.prop("value") | |
| } | |
| if (B == "") { | |
| B = null | |
| } | |
| } else { | |
| if (z.hasClass("radio-input")) { | |
| if (z.hasClass("paymentoptions-input")) { | |
| B = parseInt(z.prop("value"), 10); | |
| if (D.model.get("PaymentOptions") == null) { | |
| D.model.set({ | |
| PaymentOptions: [] | |
| }) | |
| } | |
| if (z.data("action") == "add") { | |
| if (D.model.get("PaymentOptions").indexOf(B) == -1) { | |
| D.model.get("PaymentOptions").push(B) | |
| } | |
| } else { | |
| if (z.data("action") === "remove") { | |
| if (D.model.get("PaymentOptions").indexOf(B) > -1) { | |
| D.model.get("PaymentOptions").splice(D.model.get("PaymentOptions").indexOf(B), 1) | |
| } | |
| } | |
| } | |
| B = D.model.get("PaymentOptions"); | |
| y = $(z).parent().prop(D.selector) | |
| } else { | |
| B = z.prop("value"); | |
| y = $(z).parent().prop(D.selector) | |
| } | |
| } else { | |
| if (z.hasClass("url-input") && (z.prop("value") != "")) { | |
| C = /((http[s]?):\/\/|mailto:)/; | |
| B = !C.test(z.prop("value")) ? "http://" + z.prop("value") : z.prop("value") | |
| } else { | |
| if (z.prop("value") === "true") { | |
| B = true | |
| } else { | |
| if (z.prop("value") === "false") { | |
| B = false | |
| } else { | |
| if (z.hasClass("wholenumber-input")) { | |
| if (z.prop("value") == "") { | |
| B = null | |
| } else { | |
| w = z.val().replace(/[^0-9.]/g, "").split("."); | |
| B = parseInt(w[0], 10); | |
| if (isNaN(B)) { | |
| B = null | |
| } | |
| z.val(B) | |
| } | |
| } else { | |
| B = z.prop("value") | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| if (!_.contains(y, ".")) { | |
| u[y] = B; | |
| D.model.set(u) | |
| } else { | |
| D.setPropByString(D.model.attributes, y, B); | |
| if (D.model.isValid(y)) { | |
| Bb.Validation.callbacks.valid(D, y, D.selector) | |
| } else { | |
| Bb.Validation.callbacks.invalid(D, y, "Entered value contains an error.", D.selector) | |
| } | |
| } | |
| }, | |
| cancelModel: function (u) { | |
| this.model.set(this.model.defaults) | |
| }, | |
| saveModel: function (u) { | |
| var w = this, | |
| v; | |
| w.$(".save").button("loading"); | |
| $.each(w.$(".url-input"), function () { | |
| if ($(this).prop("value") != "") { | |
| var A = /((http[s]?):\/\/|mailto:)/, | |
| x = {}, | |
| z = $(this).prop("value"), | |
| y = $(this).prop(w.selector); | |
| x[y] = !A.test(z) ? "http://" + z : z; | |
| w.model.set(x) | |
| } | |
| }); | |
| if (w.model.isValid(true)) { | |
| $.each(w.$(".tinyeditor"), function () { | |
| var x = {}; | |
| x[this.id] = tinyMCE.get(this.id).save(); | |
| w.model.set(x) | |
| }); | |
| if (w.$(".token-input").length > 0) { | |
| v = new c.Cs.TokenItems(); | |
| _.each($("#EducationalConsultant").tokenInput("get"), function (x) { | |
| var y = new c.Ms.TokenItem({ | |
| UserId: x.id | |
| }); | |
| v.add(y) | |
| }); | |
| w.model.set({ | |
| EducationalConsultant: v.toJSON() | |
| }) | |
| } | |
| w.model.set({ | |
| FieldsToNull: [] | |
| }); | |
| _.each(w.model.attributes, function (z, x, y) { | |
| w.recursiveFunction(z, x, y, "") | |
| }); | |
| w.model.save({}, { | |
| dataParam: w.options.dataParam, | |
| success: function (x, y) { | |
| if (w.model.forceReset) { | |
| w.model.forceReset = false; | |
| y.forceReset = new Date().getTime() | |
| } | |
| if (x.get("ApplicationSectionId") && $("ul.nav-tabs li.active a.sectionItem").length > 0) { | |
| $("ul.nav-tabs li.active a.sectionItem").html(x.get("Name")) | |
| } | |
| $(".candidate-header").parent().parent().trigger("renderdata"); | |
| w.trigger("modalsave"); | |
| p3.Layout.Containers.Modal.modal("hide") | |
| }, | |
| error: function (y, x) { | |
| if (x.responseText.indexOf("School Name Other or Sending School has to be unique per school year.") > -1) { | |
| Bb.Validation.callbacks.invalid(w, "TransferSchool.TransferSchoolId", m.Admissions.UniqueSchool, "id"); | |
| Bb.Validation.callbacks.invalid(w, "SchoolNameOther", m.Admissions.UniqueSchool, "id") | |
| } | |
| w.$(".save").button("reset") | |
| } | |
| }) | |
| } else { | |
| w.$(".save").button("reset") | |
| } | |
| }, | |
| deleteModel: function (y) { | |
| y.preventDefault(); | |
| y.stopPropagation(); | |
| var A = this, | |
| v, w, u, z, x; | |
| A.Containers = {}; | |
| A.Containers.Form = A.$("#modal-form"); | |
| A.Containers.Confirm = A.$("#modal-confirm"); | |
| A.Containers.Confirm.hide(); | |
| v = function () { | |
| var B = { | |
| applicationFormId: A.model.get("ApplicationFormId"), | |
| deleteSectionItems: true | |
| }; | |
| A.model.destroy({ | |
| dataParam: B, | |
| success: function () { | |
| if ($("#blocks .blocks-holder").length > 0) { | |
| $("#blocks .blocks-holder").trigger("refreshlibrary") | |
| } | |
| }, | |
| error: function () { | |
| p3.displayError("Error deleting section.") | |
| } | |
| }); | |
| p3.Layout.Containers.Modal.modal("hide") | |
| }; | |
| w = function () { | |
| A.model.destroy({ | |
| dataParam: { | |
| prospectInstanceId: A.model.get("ProspectInstanceId") | |
| }, | |
| error: function () { | |
| p3.displayError("Error deleting mail merge.") | |
| } | |
| }); | |
| p3.Layout.Containers.Modal.modal("hide") | |
| }; | |
| u = function () { | |
| A.Containers.Confirm.fadeOut("fast", function () { | |
| A.Containers.Form.fadeIn("fast") | |
| }) | |
| }; | |
| if (A.model.get("FieldBlockItem")) { | |
| z = A.model.get("FieldBlockItem").Name; | |
| x = new a.Vs.Confirm({ | |
| ConfirmationTitle: "Remove Block", | |
| ConfirmationText: "Wait a minute. Are you really sure you want to remove the " + z + " block from this section?", | |
| ConfirmCallback: v, | |
| CancelCallback: u, | |
| KeepOpen: true | |
| }) | |
| } else { | |
| if (_.isObject(A.model.get("MailMergeJob"))) { | |
| z = A.model.get("Subject"); | |
| x = new a.Vs.Confirm({ | |
| ConfirmationTitle: "Delete Mail Merge", | |
| ConfirmationText: "Are you sure you want to delete this mail merge " + z + "? This cannot be undone.", | |
| ConfirmCallback: w, | |
| CancelCallback: u, | |
| KeepOpen: true | |
| }) | |
| } else { | |
| z = A.model.get("FormType") == j.FormType.CONTRACT.Value ? A.options.formModel.get("SchoolYear") + " " + A.options.formModel.get("ContractTypeName") + " " + A.model.get("FormTypeName") : A.model.get("FormTypeName") + " Form"; | |
| x = new a.Vs.Confirm({ | |
| ConfirmationTitle: "Delete Section", | |
| ConfirmationText: "Are you sure you want to delete this section and all the blocks and elements within it from the " + z + "? This cannot be undone.", | |
| ConfirmCallback: v, | |
| CancelCallback: u, | |
| KeepOpen: true | |
| }) | |
| } | |
| } | |
| x.on("render", function () { | |
| A.Containers.Form.fadeOut("fast", function () { | |
| A.Containers.Confirm.fadeIn("fast") | |
| }) | |
| }); | |
| p3.rV(x, A.Containers.Confirm, true) | |
| }, | |
| recursiveFunction: function (E, w, x, z) { | |
| var F = this, | |
| D = E, | |
| A = w, | |
| B = x, | |
| C = z, | |
| y, u, v; | |
| if (_.isObject(D) && !_.isArray(D)) { | |
| D.FieldsToNull = []; | |
| if (C != "") { | |
| y = C + A + "." | |
| } else { | |
| y = A + "." | |
| } | |
| _.each(D, function (I, G, H) { | |
| F.recursiveFunction(I, G, H, y) | |
| }) | |
| } else { | |
| u = F.getPropByString(F.model.attributes, C + A); | |
| v = F.getPropByString(F.model.defaults, C + A); | |
| if (((D === "") || (D === null)) && (u != v)) { | |
| B.FieldsToNull.push(A) | |
| } | |
| } | |
| }, | |
| getPropByString: function (w, z) { | |
| if (!z) { | |
| return w | |
| } | |
| var x, y = z.split("."), | |
| u, v; | |
| for (u = 0, v = y.length - 1; u < v; u++) { | |
| x = y[u]; | |
| if (typeof w === "object" && w !== null && w.hasOwnProperty(x)) { | |
| w = w[x] | |
| } else { | |
| break | |
| } | |
| } | |
| return w[y[u]] | |
| }, | |
| setPropByString: function (w, z, A) { | |
| if (!z) { | |
| return w | |
| } | |
| var x, y = z.split("."), | |
| u, v; | |
| for (u = 0, v = y.length - 1; u < v; u++) { | |
| x = y[u]; | |
| if (typeof w === "object" && w !== null && w.hasOwnProperty(x)) { | |
| w = w[x] | |
| } else { | |
| break | |
| } | |
| } | |
| w[y[u]] = A | |
| }, | |
| setFocus: function () { | |
| $("form :input[type=text],[type=password],[type=button],[type=checkbox],[type=radio],:input[type=submit]:visible:enabled,select").filter(":first").focus() | |
| } | |
| }); | |
| c.Us.RenderMainPage = function () { | |
| c.Data.pidCollection.fetch({ | |
| cache: false, | |
| reset: true, | |
| data: { | |
| userId: c.Data.userId, | |
| alwaysReturn: true | |
| }, | |
| success: function (u, v) { | |
| c.Data.instanceId = u.models[c.Data.modelIndex].get("ProspectInstanceId"); | |
| c.Data.enteringYear = u.models[c.Data.modelIndex].get("EnteringYear"); | |
| c.Data.enteringGrade = u.models[c.Data.modelIndex].get("EnteringGrade"); | |
| c.Data.checklistId = u.models[c.Data.modelIndex].get("ChecklistId"); | |
| if ((!c.Data.instanceId) && (c.Data.page === "record" || c.Data.page === "checklist" || c.Data.page === "connections")) { | |
| c.Data.page = "schools"; | |
| p3.router().navigate("candidate/" + c.Data.userId + "/" + c.Data.page, false) | |
| } | |
| p3.renderMainPage(new c.Vs.Layout({ | |
| userId: c.Data.userId, | |
| page: c.Data.page | |
| })) | |
| } | |
| }) | |
| }; | |
| p3.router().route("candidate/:id/:page", "candidate", function (u, v) { | |
| c.Data.userId = u; | |
| c.Data.page = v; | |
| c.Data.instanceId = null; | |
| c.Data.pidCollection = new c.Cs.ProspectInstanceIds(); | |
| if (p3.getSessionState(p3.Data.Context.attributes.UserInfo.UserId + "_" + c.Data.userId)) { | |
| c.Data.modelIndex = p3.getSessionState(p3.Data.Context.attributes.UserInfo.UserId + "_" + c.Data.userId) | |
| } else { | |
| c.Data.modelIndex = 0 | |
| } | |
| c.Us.RenderMainPage() | |
| }) | |
| }(p3.module("admissions/managecandidates"))); | |
| (function (OfficialNotes) { | |
| var Task = p3.module("shared/task"), | |
| InfoMessage = p3.module("utilities/infomessage"); | |
| OfficialNotes.Ms.OfficialNoteTemplateEdit = Bbm.extend({ | |
| idAttribute: "TemplateId", | |
| urlRoot: "OfficialNoteTemplate/edit", | |
| validation: { | |
| Description: [{ | |
| required: true, | |
| msg: p3.Us.InfoMessageLibrary.P3.RequiredInfoNotEntered | |
| }] | |
| } | |
| }); | |
| OfficialNotes.Ms.Type = Bbm.extend({ | |
| idAttribute: "OfficialNoteTypeId", | |
| urlRoot: "officialnotetype/edit/", | |
| validation: { | |
| OfficialNoteDescription: [{ | |
| required: true, | |
| msg: p3.Us.InfoMessageLibrary.P3.RequiredInfoNotEntered | |
| }], | |
| validateAccess: [{ | |
| fn: function (value, attr, computedState) { | |
| var list = eval(value); | |
| if (_.find(list, function (item) { | |
| return item.email && !item.required && !item.display | |
| })) { | |
| return 'Either "Display" or "Required" must be selected when "E-Mail" is selected.' | |
| } | |
| } | |
| }] | |
| } | |
| }); | |
| OfficialNotes.Ms.MonitorTeam = Bbm.extend({ | |
| idAttribute: "MonitorTeamId", | |
| urlRoot: "monitorteam/edit/", | |
| validation: { | |
| ShortDescription: [{ | |
| required: true, | |
| msg: p3.Us.InfoMessageLibrary.P3.RequiredInfoNotEntered | |
| }] | |
| } | |
| }); | |
| OfficialNotes.Ms.MonitorTeamMemberDelete = Bbm.extend({ | |
| idAttribute: "MemberId", | |
| url: "monitorteammember/memberdelete/" | |
| }); | |
| OfficialNotes.Ms.AdmissionOptions = Bbm.extend({ | |
| idAttribute: "SchoolId", | |
| url: function () { | |
| return this.id ? aP + "admissions/AdmissionOptions/" + this.id + "/" : aP + "admissions/AdmissionOptions/" | |
| } | |
| }); | |
| OfficialNotes.Cs.OfficialNotesPlaceholderGet = Bbc.extend({ | |
| url: "DataDirect/OfficialNotesPlaceholderGet/" | |
| }); | |
| OfficialNotes.Cs.AccessGroupList = Bbc.extend({ | |
| url: "datadirect/OfficialNoteAccessGroupList/" | |
| }); | |
| OfficialNotes.Cs.TemplateList = Bbc.extend({ | |
| model: OfficialNotes.Ms.OfficialNoteTemplateEdit, | |
| url: "OfficialNoteTemplate/List/" | |
| }); | |
| OfficialNotes.Cs.TypeList = Bbc.extend({ | |
| model: OfficialNotes.Ms.Type, | |
| url: "officialnotetype/list/", | |
| comparator: function (item) { | |
| return item.get("Inactive") + item.get("ShortDescription") | |
| } | |
| }); | |
| OfficialNotes.Cs.UsersGet = Bbc.extend({ | |
| url: "DataDirect/UsersGet/" | |
| }); | |
| OfficialNotes.Cs.MonitorTeamList = Bbc.extend({ | |
| model: OfficialNotes.Ms.MonitorTeam, | |
| url: "monitorteam/monitorteamlist/", | |
| comparator: function (item) { | |
| return (1000 + (item.get("SortOrder") || 0)) + item.get("MonitorTeamDescription") | |
| } | |
| }); | |
| OfficialNotes.Cs.MonitoringCommentTypeGet = Bbc.extend({ | |
| url: "DataDirect/MonitoringCommentTypeGet/" | |
| }); | |
| OfficialNotes.Cs.MonitoringMemberGet = Bbc.extend({ | |
| url: "DataDirect/MonitoringMemberGet/" | |
| }); | |
| OfficialNotes.Vs.Layout = Bb.View.extend({ | |
| template: "officialnote/officialnote.sky.layout.template.html", | |
| initialize: function (options) { | |
| options.settings = new Bbm() | |
| }, | |
| render: function (container) { | |
| p3.setTitle("Official Notes"); | |
| var view = this; | |
| p3.fT(view.template, function (tmpl) { | |
| view.$el.html(tmpl({})); | |
| view.Containers = { | |
| Header: view.$("#header"), | |
| LeftColumn: view.$(".col-left"), | |
| RightColumn: view.$(".col-right") | |
| }; | |
| view.Containers.Header.addClass("subhead").html($('<H1 class="was-jmbtrn">').html("Official Notes")); | |
| p3.rV(new OfficialNotes.Vs.Templates(view.options), view.$("#first-left-tile"), true); | |
| p3.rV(new OfficialNotes.Vs.Types(view.options), view.$("#additional-left-tiles"), false); | |
| p3.rV(new OfficialNotes.Vs.DeleteOfficialNotes(), view.$("#delete-official-notes"), false); | |
| p3.rV(new OfficialNotes.Vs.Monitors(view.options), view.Containers.RightColumn, false) | |
| }); | |
| this.$el.appendTo(container) | |
| }, | |
| dispose: function () { | |
| this.options.settings.off() | |
| } | |
| }); | |
| OfficialNotes.Vs.Templates = Bb.View.extend({ | |
| template: "OfficialNote/officialnote.settings.tile.template.html", | |
| className: "bottom-spaced", | |
| events: { | |
| 'click button[data-action="add-template"]': "addTemplate" | |
| }, | |
| initialize: function (options) { | |
| this.collection = new OfficialNotes.Cs.TemplateList().on("add", this.renderTemplateRow, this).on("destroy", this.deleteRow, this); | |
| this.syncTemplate(this.model, null, {}) | |
| }, | |
| render: function (container) { | |
| var view = this; | |
| p3.fT(view.template, function (tmpl) { | |
| view.$el.appendTo(container); | |
| view.$el.html(tmpl({ | |
| tileHeader: "Templates", | |
| listName: "template-list", | |
| dataAction: "add-template", | |
| buttonText: " Add Template", | |
| emptyId: "no-templates", | |
| emptyMessage: "No Official Note Templates" | |
| })); | |
| view.Containers = { | |
| Tbody: view.$("tbody") | |
| } | |
| }) | |
| }, | |
| renderTemplateRow: function (model) { | |
| var view = this; | |
| if (view.collection.indexOf(model) == 0) { | |
| view.$("#no-templates").hide() | |
| } | |
| p3.rV(new OfficialNotes.Vs.TemplateRow({ | |
| model: model.on("sync", view.syncTemplate, view) | |
| }), view.Containers.Tbody, false) | |
| }, | |
| syncTemplate: function (model, response, options) { | |
| var view = this; | |
| if (!options.silent) { | |
| if (options.isSave) { | |
| this.clearTemplate(); | |
| this.collection.fetch({ | |
| update: true, | |
| success: function (collection) { | |
| if (view.$el.find("tbody tr").length == 0) { | |
| collection.each(function (model) { | |
| view.renderTemplateRow(model) | |
| }) | |
| } | |
| } | |
| }) | |
| } else { | |
| this.collection.fetch({ | |
| update: true | |
| }) | |
| } | |
| if (options.addAnother) { | |
| this.addTemplate() | |
| } | |
| } | |
| }, | |
| addTemplate: function () { | |
| p3.rV(new OfficialNotes.Vs.TemplateModal({ | |
| model: new OfficialNotes.Ms.OfficialNoteTemplateEdit().once("sync", this.syncTemplate, this) | |
| }), p3.Layout.Containers.Modal, true) | |
| }, | |
| clearTemplate: function () { | |
| this.Containers.Tbody.empty() | |
| }, | |
| deleteRow: function (model) { | |
| if (this.collection.length == 0) { | |
| this.$("#no-templates").show() | |
| } | |
| }, | |
| dispose: function () { | |
| this.collection.off("add") | |
| } | |
| }); | |
| OfficialNotes.Vs.TemplateRow = Bb.View.extend({ | |
| tagName: "TR", | |
| events: { | |
| 'click button[data-action="edit"]': "editItem", | |
| 'click button[data-action="delete"]': "deleteItem" | |
| }, | |
| render: function (container) { | |
| this.$el.appendTo(container).append($("<td>", { | |
| "class": "span10 col-md-10" | |
| }).html(this.model.get("Description")), $("<td>", { | |
| "class": "span12 col-md-12" | |
| }).append($("<div>", { | |
| "class": "btn-group-spaced pull-right" | |
| }).append($("<button>", { | |
| "class": "btn btn-default btn-sm", | |
| "data-action": "edit" | |
| }).html($("<i>", { | |
| "class": "fa fa-pencil" | |
| })), $("<button>", { | |
| "class": "btn btn-default btn-sm", | |
| "data-action": "delete" | |
| }).html($("<i>", { | |
| "class": "fa fa-trash" | |
| }))))) | |
| }, | |
| editItem: function () { | |
| this.model.fetch({ | |
| silent: true, | |
| success: function (model) { | |
| p3.rV(new OfficialNotes.Vs.TemplateModal({ | |
| model: model | |
| }), p3.Layout.Containers.Modal, true) | |
| } | |
| }) | |
| }, | |
| deleteItem: function (event) { | |
| var view = this; | |
| p3.showConfirm("Delete Template", "Are you sure you want to remove this template?", null, function () { | |
| view.model.destroy({ | |
| silent: true, | |
| success: function () { | |
| view.remove(); | |
| p3.displaySiteMessage("Template deleted successfully.", "alert-success") | |
| }, | |
| destroySport: true, | |
| error: function () { | |
| p3.displayError("Error deleting template.") | |
| } | |
| }) | |
| }) | |
| } | |
| }); | |
| OfficialNotes.Vs.TemplateModal = Bb.View.extend({ | |
| template: "OfficialNote/officialnote.template.modal.html", | |
| events: { | |
| initPlugin: "initPlugin", | |
| "click .placeholder": "addPlaceHolder", | |
| "click .toggle-placeholders": "slideContent", | |
| 'click button[data-action="another"]': "save", | |
| 'click button[data-action="save"]': "save" | |
| }, | |
| initialize: function (options) { | |
| this.options.placeHolders = new OfficialNotes.Cs.OfficialNotesPlaceholderGet().on("reset", this.renderTemplate, this); | |
| this.model.on("validated:invalid", this.invalidModel, this); | |
| Bb.Validation.bind(this) | |
| }, | |
| dispose: function () { | |
| this.options.placeHolders.off("reset"); | |
| this.model.off("validated:invalid"); | |
| var ed = tinyMCE.get("editor"); | |
| if (ed) { | |
| ed.remove() | |
| } | |
| }, | |
| render: function (container) { | |
| $(container).append(this.el); | |
| this.fetchPlaceHolders() | |
| }, | |
| renderTemplate: function (collection) { | |
| var view = this; | |
| p3.fT(view.template, function (tmpl) { | |
| view.$el.html(tmpl({ | |
| placeholders: collection.toJSON(), | |
| model: view.model.toJSON() | |
| })); | |
| view.$(".required-indicator").tooltip(); | |
| p3.showModal(p3.Layout.Containers.Modal); | |
| view.$el.trigger("initPlugin") | |
| }) | |
| }, | |
| invalidModel: function () { | |
| this.$(".modal-footer BUTTON").button("reset") | |
| }, | |
| initPlugin: function () { | |
| p3.showHtmlEditor("editor", p3.Us.Enum.HtmlEditorCategories.FULL, false, function () { | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }, p3.Us.Enum.HtmlEditorEncoding.NUMERIC) | |
| }, | |
| addPlaceHolder: function (e) { | |
| tinyMCE.execCommand("mceReplaceContent", false, "[" + $(e.target).html() + "]"); | |
| return false | |
| }, | |
| fetchPlaceHolders: function () { | |
| this.options.placeHolders.fetch({ | |
| data: { | |
| categoryId: 34 | |
| } | |
| }, { | |
| error: function () { | |
| p3.displayError("Error loading placeholders") | |
| } | |
| }) | |
| }, | |
| slideContent: function (event) { | |
| var $slideContent = $(event.target).closest("div .toggle-placeholders").next("div.data-box"), | |
| $icon = $(event.target).closest("div").find("i"), | |
| isOpenClass = "fa fa-chevron-up", | |
| isClosedClass = "fa fa-chevron-down"; | |
| if ($slideContent.is(":visible")) { | |
| $icon.attr("class", isClosedClass) | |
| } else { | |
| $icon.attr("class", isOpenClass) | |
| } | |
| $slideContent.slideToggle(200, function () { | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| save: function (e) { | |
| var view = this, | |
| edit = false, | |
| $btnClicked = $(e.target), | |
| templatetxt = tinyMCE.activeEditor.getContent(), | |
| checkText, placeHolders; | |
| if (view.model.get("TemplateId") > 0) { | |
| edit = true | |
| } | |
| $btnClicked.button("loading"); | |
| checkText = templatetxt.replace(new RegExp('(<span style="white-space: pre;">)', "g"), ""); | |
| checkText = checkText.replace(new RegExp("(</span>)", "g"), ""); | |
| checkText = checkText.replace(new RegExp("(<br />)", "g"), ""); | |
| checkText = checkText.replace(new RegExp("( )", "g"), ""); | |
| checkText = checkText.replace(new RegExp("(<div>)", "g"), ""); | |
| checkText = checkText.replace(new RegExp("(</div>)", "g"), ""); | |
| checkText = checkText.replace(/( )*/g, ""); | |
| checkText = checkText.replace(/\s/g, ""); | |
| placeHolders = OfficialNotes.Us.GetPlaceholders(templatetxt, view.options.placeHolders); | |
| view.model.save({ | |
| Description: view.$("#Description").val(), | |
| TemplateType: 0, | |
| TemplateStyle: 1, | |
| Status: 0, | |
| Body: (checkText != "") ? templatetxt : "", | |
| SchoolLogo: 0, | |
| SchoolWatermark: 0, | |
| AppCategoryId: 34, | |
| PlaceHolders: (placeHolders.length > 0) ? placeHolders : null, | |
| TemplateMode: 2, | |
| NewTemplateId: 0, | |
| SubjectLine: view.$("#SubjectLine").val() | |
| }, { | |
| validate: true, | |
| isSave: edit ? true : false, | |
| addAnother: ($btnClicked.attr("data-action") === "another") ? true : false, | |
| success: function () { | |
| p3.showModal(p3.Layout.Containers.Modal, "hide"); | |
| p3.displaySiteMessage("Your template has been saved.", "alert-success") | |
| }, | |
| error: function () { | |
| p3.displayError("Error saving template") | |
| } | |
| }) | |
| } | |
| }); | |
| OfficialNotes.Vs.Types = Bb.View.extend({ | |
| template: "OfficialNote/officialnote.settings.tile.template.html", | |
| className: "bottom-spaced", | |
| events: { | |
| 'click button[data-action="add"]': "addType" | |
| }, | |
| initialize: function (options) { | |
| options.settings.on("change:refreshTypes", this.fetchCollection, this); | |
| this.collection = new OfficialNotes.Cs.TypeList().on("add", this.renderTypeRow, this).on("destroy", this.deleteRow, this) | |
| }, | |
| render: function (container) { | |
| var view = this; | |
| p3.fT(view.template, function (tmpl) { | |
| view.$el.appendTo(container); | |
| view.$el.html(tmpl({ | |
| tileHeader: "Note Types", | |
| listName: "type-list", | |
| dataAction: "add", | |
| buttonText: " Add Type", | |
| emptyId: "no-types", | |
| emptyMessage: "No Official Note Types" | |
| })); | |
| view.Containers = { | |
| Tbody: view.$("tbody") | |
| }; | |
| view.fetchCollection(view.options.settings, null, {}) | |
| }) | |
| }, | |
| renderTypeRow: function (model, response, options) { | |
| if (this.collection.indexOf(model) == 0) { | |
| this.$("#no-types").hide() | |
| } | |
| p3.rV(new OfficialNotes.Vs.TypesRow({ | |
| model: model | |
| }), this.Containers.Tbody, false) | |
| }, | |
| addType: function (event) { | |
| p3.rV(new OfficialNotes.Vs.TypeModal({ | |
| model: new OfficialNotes.Ms.Type().once("sync", this.fetchCollection, this) | |
| }), p3.Layout.Containers.Modal, true) | |
| }, | |
| fetchCollection: function (model, response, options) { | |
| this.collection.fetch({ | |
| data: { | |
| categoryId: 34 | |
| }, | |
| update: true, | |
| refreshTypes: model.get("refreshTypes") | |
| }); | |
| model.unset("refreshTypes", { | |
| silent: true | |
| }); | |
| if (options.addAnother) { | |
| this.addType() | |
| } | |
| }, | |
| deleteRow: function (model) { | |
| if (this.collection.length === 0) { | |
| this.$("#no-types").show() | |
| } | |
| }, | |
| dispose: function () { | |
| this.collection.off() | |
| } | |
| }); | |
| OfficialNotes.Vs.TypesRow = Bb.View.extend({ | |
| tagName: "TR", | |
| initialize: function (options) { | |
| this.model.on("change", this.changeType, this).on("sync", this.syncType, this).on("remove", this.removeType, this) | |
| }, | |
| events: { | |
| 'click [data-action="edit"]': "editType", | |
| 'click [data-action="delete"]': "deleteType" | |
| }, | |
| render: function (container) { | |
| var index = this.model.collection.indexOf(this.model), | |
| children = $(container).children(); | |
| if (index < children.length) { | |
| children.eq(index).after(this.el) | |
| } else { | |
| container.append(this.el) | |
| } | |
| this.$el.append($("<td>", { | |
| "class": "col-md-8" | |
| }).html(this.model.get("ShortDescription")), $("<td>", { | |
| "class": "col-md-4" | |
| }).append($("<div>", { | |
| "class": "btn-group-spaced pull-right" | |
| }).append($("<a>", { | |
| "class": "btn btn-default bb-btn-secondary btn-xs", | |
| "data-action": "notifications", | |
| href: Task.Us.getUrlById(52859, "cid=18&cv=" + this.model.get("OfficialNoteTypeId") + "&aid=9&btnc=1&tid=-1&st=-1&clid=20&ct=" + this.model.get("ShortDescription")) | |
| }).html("E-mail Notifications"), $("<button>", { | |
| "class": "btn btn-default bb-btn-secondary btn-xs", | |
| "data-action": "edit" | |
| }).html($("<i>", { | |
| "class": "fa fa-pencil" | |
| })), (this.model.get("CanDelete")) ? $("<button>", { | |
| "class": "btn btn-default bb-btn-secondary btn-xs", | |
| "data-action": "delete" | |
| }).html($("<i>", { | |
| "class": "fa fa-trash" | |
| })) : $("<button>", { | |
| "class": "btn btn-default bb-btn-secondary btn-xs" | |
| }).html($("<i>", { | |
| "class": "fa fa-lock" | |
| }))))) | |
| }, | |
| editType: function (event) { | |
| this.model.fetch({ | |
| success: function (model) { | |
| p3.rV(new OfficialNotes.Vs.TypeModal({ | |
| model: model | |
| }), p3.Layout.Containers.Modal, true) | |
| } | |
| }) | |
| }, | |
| deleteType: function (event) { | |
| var view = this; | |
| p3.showConfirm("Delete Official Note Type", "Are you sure you want to remove this official note type?", null, function () { | |
| view.model.destroy({ | |
| wait: true, | |
| success: function () { | |
| view.remove(); | |
| p3.displaySiteMessage("Official note type deleted successfully.", "alert-success") | |
| } | |
| }) | |
| }) | |
| }, | |
| changeType: function (model, resposne, options) { | |
| if (resposne.refreshTypes) { | |
| this.syncType(model, {}, { | |
| isSave: true | |
| }) | |
| } | |
| }, | |
| syncType: function (model, resposne, options) { | |
| var collection; | |
| if (options.isSave) { | |
| if (model.hasChanged("ShortDescription") || model.hasChanged("Inactive") || model.hasChanged("CanDelete")) { | |
| if (model.get("Inactive")) { | |
| model.set({ | |
| ShortDescription: model.get("ShortDescription") + " (Inactive)" | |
| }, { | |
| silent: true | |
| }) | |
| } | |
| collection = model.collection; | |
| collection.remove(model); | |
| collection.add(model) | |
| } | |
| } else { | |
| model.set({ | |
| CanDelete: model.previousAttributes().CanDelete | |
| }, { | |
| silent: true | |
| }) | |
| } | |
| }, | |
| removeType: function (model) { | |
| this.remove(); | |
| this.dispose() | |
| }, | |
| dispose: function () { | |
| this.model.off() | |
| } | |
| }); | |
| OfficialNotes.Vs.TypeModal = Bb.View.extend({ | |
| template: "officialnote/officialnote.type.modal.template.html", | |
| events: { | |
| 'click button[data-action="save"]': "saveType", | |
| 'click button[data-action="another"]': "saveType", | |
| 'click button[data-action="access"].active': "accessOff", | |
| 'click button[data-action="access"]:not(.active)': "accessOn", | |
| 'click button[data-action="template"].active': "templateOff", | |
| 'click button[data-action="template"]:not(.active)': "templateOn" | |
| }, | |
| initialize: function (options) { | |
| Bb.Validation.bind(this); | |
| this.model.bind("validated:invalid", this.invalidModel, this); | |
| this.saveAccess = new Bbc(this.model.get("AccessGroupList")); | |
| this.saveTemplate = new Bbc(this.model.get("Templates")); | |
| this.listAccess = new OfficialNotes.Cs.AccessGroupList().on("reset", this.renderTemplate, this); | |
| this.listTemplate = new OfficialNotes.Cs.TemplateList().on("reset", this.renderTemplate, this); | |
| this.listAccess.fetch({ | |
| data: { | |
| categoryId: 34 | |
| }, | |
| success: function (collection) { | |
| collection.isLoaded = true | |
| } | |
| }); | |
| this.listTemplate.fetch({ | |
| success: function (collection) { | |
| collection.isLoaded = true | |
| } | |
| }) | |
| }, | |
| render: function (container) { | |
| $(container).append(this.el) | |
| }, | |
| renderTemplate: function (collection) { | |
| if (this.listAccess.isLoaded || this.listTemplate.isLoaded) { | |
| this.saveTemplate.each(function (template) { | |
| _.each(this.listTemplate.where({ | |
| TemplateId: template.get("id") | |
| }), function (item) { | |
| item.set({ | |
| Selected: true | |
| }, { | |
| silent: true | |
| }) | |
| }) | |
| }, this); | |
| this.saveAccess.each(function (access) { | |
| _.each(this.listAccess.where({ | |
| AccessGroupId: access.get("id") | |
| }), function (item) { | |
| item.set({ | |
| Display: access.get("display"), | |
| Required: access.get("required"), | |
| Email: access.get("email") | |
| }, { | |
| silent: true | |
| }) | |
| }) | |
| }, this); | |
| var view = this; | |
| p3.fT(view.template, function (tmpl) { | |
| view.$el.html(tmpl({ | |
| model: view.model.toJSON(), | |
| access: view.listAccess.toJSON(), | |
| template: view.listTemplate.toJSON() | |
| })); | |
| view.$el.find(".required-indicator").tooltip(); | |
| p3.showModal(p3.Layout.Containers.Modal); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| } | |
| }, | |
| saveType: function (event) { | |
| this.model.save({ | |
| CategoryId: 34, | |
| ShortDescription: this.$('[name="ShortDescription"]').val(), | |
| Inactive: (this.$('[name="Inactive"] > .active').attr("data-value") == 1) ? true : false, | |
| validateAccess: JSON.stringify(this.saveAccess), | |
| AccessGroupList: this.saveAccess, | |
| Templates: this.saveTemplate | |
| }, { | |
| wait: true, | |
| isSave: true, | |
| addAnother: ($(event.currentTarget).attr("data-action") === "another") ? true : false, | |
| success: function (model, response) { | |
| p3.showModal(p3.Layout.Containers.Modal, "hide") | |
| } | |
| }) | |
| }, | |
| accessOff: function (event) { | |
| var button = $(event.currentTarget); | |
| this.saveAccess.find(function (item) { | |
| return item.get("id") == button.val() | |
| }).set(button.attr("data-access-value"), false) | |
| }, | |
| accessOn: function (event) { | |
| var button = $(event.currentTarget), | |
| model = { | |
| id: button.val() | |
| }; | |
| model[button.attr("data-access-value")] = true; | |
| this.saveAccess.update(model, { | |
| remove: false | |
| }) | |
| }, | |
| templateOff: function (event) { | |
| this.saveTemplate.remove(this.saveTemplate.get($(event.currentTarget).val())) | |
| }, | |
| templateOn: function (event) { | |
| this.saveTemplate.add({ | |
| id: $(event.currentTarget).val() | |
| }) | |
| }, | |
| invalidModel: function (model, error) { | |
| this.$("#infomessage-error").remove(); | |
| if (error.validateAccess) { | |
| InfoMessage.ErrorBox(error.validateAccess, ".modal-body", false); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| } | |
| }, | |
| dispose: function () { | |
| this.listAccess.off(); | |
| this.listTemplate.off(); | |
| Bb.Validation.unbind(this) | |
| } | |
| }); | |
| OfficialNotes.Vs.DeleteOfficialNotes = Bb.View.extend({ | |
| template: "officialnote/officialnote.adm.deleteofficialnotes.html", | |
| events: { | |
| "click .checkbox-sky-input": "updateModel" | |
| }, | |
| initialize: function () { | |
| var view = this; | |
| view.model = new OfficialNotes.Ms.AdmissionOptions({ | |
| SchoolId: p3.Data.SchoolContext.attributes.SchoolInfo.SchoolId | |
| }) | |
| }, | |
| render: function (container) { | |
| var view = this; | |
| $(container).html(view.el); | |
| view.renderData() | |
| }, | |
| renderData: function () { | |
| var view = this; | |
| p3.fT(view.template, function (tmpl) { | |
| view.model.fetch({ | |
| cache: false, | |
| success: function (model, response) { | |
| view.$el.html(tmpl({ | |
| model: view.model.toJSON() | |
| })) | |
| }, | |
| error: function (model, response, options) { | |
| p3.displayError("Error loading admissions options") | |
| } | |
| }) | |
| }) | |
| }, | |
| updateModel: function (event) { | |
| var view = this, | |
| $thisTarget = $(event.currentTarget), | |
| thisSelector = $thisTarget.children("input").attr("name"), | |
| thisValue = $thisTarget.children("input").is(":checked") ? true : false, | |
| data = {}; | |
| data[thisSelector] = thisValue; | |
| view.model.set(data); | |
| view.model.save() | |
| } | |
| }); | |
| OfficialNotes.Vs.Monitors = Bb.View.extend({ | |
| className: function () { | |
| var className = ""; | |
| return className | |
| }, | |
| attributes: { | |
| style: "padding:20px;" | |
| }, | |
| events: { | |
| 'click button[data-action="add-new"]': "addNew" | |
| }, | |
| initialize: function (options) { | |
| this.Containers = { | |
| TeamList: $("<div>") | |
| }; | |
| this.model = new OfficialNotes.Ms.MonitorTeam().on("sync", this.syncMonitorTeam, this); | |
| this.collection = new OfficialNotes.Cs.MonitorTeamList().on("add", this.addMonitorTeam, this).on("sync", this.syncMonitorTeam, this).on("destroy", this.deleteTeam, this); | |
| this.fetchCollection() | |
| }, | |
| render: function (container) { | |
| var view = this; | |
| view.$el.appendTo(container).append(view.Containers.TeamList); | |
| view.$el.css("padding", "0px"); | |
| $("#add-team-button").bind("click", function (e) { | |
| view.addNew(e) | |
| }) | |
| }, | |
| addNew: function () { | |
| p3.rV(new OfficialNotes.Vs.MonitorTeamModal({ | |
| model: this.model | |
| }), p3.Layout.Containers.Modal, true) | |
| }, | |
| addMonitorTeam: function (model) { | |
| p3.rV(new OfficialNotes.Vs.MonitorTeam({ | |
| model: model | |
| }), this.Containers.TeamList, false) | |
| }, | |
| deleteTeam: function () { | |
| this.options.settings.set("refreshTypes", true) | |
| }, | |
| fetchCollection: function () { | |
| this.collection.fetch({ | |
| data: { | |
| categoryId: 34 | |
| }, | |
| update: true | |
| }) | |
| }, | |
| syncMonitorTeam: function (model, response, options) { | |
| if (options.fetch) { | |
| this.fetchCollection(); | |
| this.options.settings.set("refreshTypes", true) | |
| } | |
| if (options.addAnother) { | |
| this.addNew() | |
| } | |
| }, | |
| dispose: function () { | |
| this.model.off(); | |
| this.collection.off() | |
| } | |
| }); | |
| OfficialNotes.Vs.MonitorTeam = Bb.View.extend({ | |
| attributes: { | |
| style: "margin-top:10px;" | |
| }, | |
| events: { | |
| 'click [data-action="delete"]': "deleteTeam", | |
| 'click [data-action="edit"]': "editTeam" | |
| }, | |
| initialize: function (options) { | |
| this.Containers = { | |
| Tbody: $("<tbody>") | |
| }; | |
| this.model.on("change", this.changeTeam, this).on("remove", this.removeTeam, this); | |
| this.collection = new Bbc([], { | |
| model: OfficialNotes.Ms.MonitorTeamMemberDelete | |
| }).on("add", this.addMember, this); | |
| this.collection.update(this.model.get("TeamMemberList")) | |
| }, | |
| render: function (container) { | |
| var index = this.model.collection.indexOf(this.model), | |
| children = $(container).children(); | |
| if (index < children.length) { | |
| children.eq(index).before(this.el) | |
| } else { | |
| container.append(this.el) | |
| } | |
| this.$el.append($("<div>").append($("<div>", { | |
| "class": "btn-group-spaced pull-right", | |
| style: "margin:0px 5px 5px 0px;" | |
| }).append($("<button>", { | |
| type: "button", | |
| "class": "btn btn-default btn-sm", | |
| "data-action": "edit" | |
| }).html($("<i>", { | |
| "class": "fa fa-pencil", | |
| style: "margin:0px" | |
| })), $("<button>", { | |
| type: "button", | |
| "class": "btn btn-default btn-sm", | |
| "data-action": "delete" | |
| }).html($("<i>", { | |
| "class": "fa fa-trash", | |
| style: "margin:0px" | |
| }))), $("<h4>", { | |
| style: "margin: 6px 5px;" | |
| }).html(this.model.get("MonitorTeamDescription"))), $("<table>", { | |
| "class": "table table-striped table-condensed" | |
| }).append(this.Containers.Tbody)) | |
| }, | |
| addMember: function (model) { | |
| p3.rV(new OfficialNotes.Vs.MonitorTeamMember({ | |
| model: model | |
| }), this.Containers.Tbody, false) | |
| }, | |
| deleteTeam: function (event) { | |
| var view = this; | |
| p3.showConfirm("Delete Monitoring Team", "Are you sure you want to remove this team?", null, function () { | |
| view.model.destroy({ | |
| wait: true, | |
| success: function (model, response, options) { | |
| p3.displaySiteMessage("Monitoring Team deleted successfully.", "alert-success") | |
| }, | |
| error: function () { | |
| p3.displayError("Error deleting Monitoring Team") | |
| } | |
| }) | |
| }) | |
| }, | |
| editTeam: function () { | |
| p3.rV(new OfficialNotes.Vs.MonitorTeamModal({ | |
| model: this.model | |
| }), p3.Layout.Containers.Modal, true) | |
| }, | |
| changeTeam: function (model, response, options) { | |
| if (response.update) { | |
| model.collection.remove(model).add(model) | |
| } | |
| }, | |
| removeTeam: function () { | |
| this.remove() | |
| }, | |
| dispose: function () { | |
| this.collection.off() | |
| } | |
| }); | |
| OfficialNotes.Vs.MonitorTeamMember = Bb.View.extend({ | |
| tagName: "TR", | |
| events: { | |
| 'click [data-action="delete-member"]': "deleteMember" | |
| }, | |
| initialize: function (options) { | |
| this.model.on("remove", this.removeMember, this) | |
| }, | |
| render: function (container) { | |
| this.$el.appendTo(container).append($("<TD>").html(this.model.get("MemberName")), $("<TD>").append($("<button>", { | |
| type: "button", | |
| "class": "btn btn-default btn-sm pull-right", | |
| "data-action": "delete-member" | |
| }).html($("<i>", { | |
| "class": "fa fa-trash", | |
| style: "margin:0px" | |
| })))) | |
| }, | |
| deleteMember: function (event) { | |
| var view = this; | |
| p3.showConfirm("Delete Monitoring Team Member", "Are you sure you want to remove this team member?", null, function () { | |
| view.model.save({}, { | |
| wait: true, | |
| success: function (model, response, options) { | |
| p3.displaySiteMessage("Monitoring Team Member deleted successfully.", "alert-success"); | |
| model.collection.remove(model) | |
| }, | |
| error: function () { | |
| p3.displayError("Error deleting Monitoring Team Member") | |
| } | |
| }) | |
| }) | |
| }, | |
| removeMember: function (model) { | |
| this.remove() | |
| }, | |
| dispose: function () { | |
| this.model.off() | |
| } | |
| }); | |
| OfficialNotes.Vs.MonitorTeamModal = Bb.View.extend({ | |
| template: "OfficialNote/officialnote.monitoring.team.modal.html", | |
| events: { | |
| 'click button[data-action="select-all"]': "selectAllBtn", | |
| "click .type-list-item": "handleTypeListItem", | |
| 'click button[data-action="another"]': "save", | |
| 'click button[data-action="save"]': "save" | |
| }, | |
| initialize: function (options) { | |
| this.options.typeList = new OfficialNotes.Cs.TypeList(); | |
| this.options.membersList = new Bbc(); | |
| Bb.Validation.bind(this); | |
| this.model.bind("validated:invalid", this.invalidModel, this) | |
| }, | |
| render: function (container) { | |
| $(container).append(this.el); | |
| var view = this; | |
| p3.fT(view.template, function (tmpl) { | |
| view.$el.html(tmpl({ | |
| model: view.model.toJSON() | |
| })); | |
| view.Containers = { | |
| TypeTbody: view.$el.find(".type-list tbody:last"), | |
| MemberTbody: view.$el.find(".member-list tbody:last") | |
| }; | |
| view.$(".required-indicator").tooltip(); | |
| view.fetchTypeCollection(); | |
| if (view.model.get("MonitorTeamId") > 0) { | |
| new OfficialNotes.Cs.MonitoringMemberGet().fetch({ | |
| data: { | |
| monitorTeamId: view.model.get("MonitorTeamId") | |
| }, | |
| success: function (collection) { | |
| collection.each(function (model) { | |
| view.options.membersList.add(new Bbm({ | |
| Id: model.get("MemberUserId"), | |
| Name: model.get("MemberName") | |
| })); | |
| model.set({ | |
| id: model.get("MemberUserId"), | |
| name: model.get("MemberName") | |
| }); | |
| p3.rV(new OfficialNotes.Vs.MonitoringTeamMember({ | |
| model: model.toJSON(), | |
| membersList: view.options.membersList | |
| }), $(".member-list tbody:last"), false) | |
| }) | |
| } | |
| }) | |
| } | |
| p3.showModal(p3.Layout.Containers.Modal); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.TokenInput, view.initializeTokenInput, view) | |
| }) | |
| }, | |
| initializeTokenInput: function (view) { | |
| $.ajax({ | |
| url: aP + "DataDirect/UsersGet?format=json", | |
| cache: false, | |
| success: function (data) { | |
| var prePopulateData = null; | |
| $("#members-search").tokenInput(data, { | |
| minChars: 2, | |
| searchDelay: 100, | |
| preventDuplicates: true, | |
| animateDropdown: false, | |
| classes: { | |
| tokenList: "token-input-list span4 col-md-4", | |
| dropdown: "token-input-dropdown input-xlarge span4 col-md-4" | |
| }, | |
| resultsFormatter: function (item) { | |
| var result = ""; | |
| if (item.thumb_filename) { | |
| result += '<img class="img-small" src="' + p3.Config.FtpImagePath + "/user/" + item.thumb_filename + '"/> ' | |
| } | |
| result += item.name; | |
| return "<li>" + result + "</li>" | |
| }, | |
| tokenFormatter: function (item) { | |
| return "<li></li>" | |
| }, | |
| hintText: "To Add a member search for a name", | |
| onAdd: function (item) { | |
| $("li.token-input-token").remove(); | |
| var canAdd = true; | |
| view.options.membersList.each(function (model) { | |
| var modelValue; | |
| if (typeof model.get("Id") === "string") { | |
| modelValue = model.get("Id").split("_")[1] | |
| } else { | |
| modelValue = model.get("Id") | |
| } | |
| if (modelValue == parseInt(item.id.split("_")[1], 10)) { | |
| canAdd = false | |
| } | |
| }); | |
| if (canAdd) { | |
| view.options.membersList.add(new Bbm({ | |
| Id: item.id, | |
| Name: item.name | |
| })); | |
| p3.rV(new OfficialNotes.Vs.MonitoringTeamMember({ | |
| model: item, | |
| membersList: view.options.membersList | |
| }), $(".member-list tbody:last"), false); | |
| if (view.$(".alert-error").length > 0) { | |
| view.$(".alert-error").remove() | |
| } | |
| } else { | |
| if (view.$(".alert-error").length === 0) { | |
| InfoMessage.ErrorBox("This member has already been selected.", ".modal-body", false) | |
| } | |
| } | |
| }, | |
| prePopulate: prePopulateData | |
| }) | |
| } | |
| }) | |
| }, | |
| invalidModel: function () { | |
| this.$(".modal-footer BUTTON").button("reset") | |
| }, | |
| fetchTypeCollection: function () { | |
| var view = this; | |
| view.$('button[data-action="save"]').hide(); | |
| view.$('button[data-action="another"]').hide(); | |
| this.options.typeList.fetch({ | |
| data: { | |
| categoryId: 34 | |
| }, | |
| success: function () { | |
| if (view.model.get("MonitorTeamId") > 0) { | |
| new OfficialNotes.Cs.MonitoringCommentTypeGet().fetch({ | |
| data: { | |
| monitorTeamId: view.model.get("MonitorTeamId") | |
| }, | |
| cache: false, | |
| wait: true, | |
| success: function (collection) { | |
| view.options.typeList.each(function (model, count) { | |
| collection.each(function (item) { | |
| if (item.get("CommentTypeId") == model.get("OfficialNoteTypeId")) { | |
| if (!model.has("Active")) { | |
| model.set({ | |
| Active: true | |
| }, { | |
| silent: true | |
| }) | |
| } else { | |
| if (model.get("Active")) { | |
| model.set({ | |
| Active: false | |
| }, { | |
| silent: true | |
| }) | |
| } else { | |
| model.set({ | |
| Active: true | |
| }, { | |
| silent: true | |
| }) | |
| } | |
| } | |
| } | |
| }); | |
| model.set({ | |
| Index: count | |
| }); | |
| view.addTypeRow(model) | |
| }); | |
| view.$('button[data-action="save"]').show(); | |
| view.$('button[data-action="another"]').show() | |
| } | |
| }) | |
| } else { | |
| view.options.typeList.each(function (model, count) { | |
| model.set({ | |
| Index: count | |
| }); | |
| view.addTypeRow(model) | |
| }); | |
| view.$('button[data-action="save"]').show(); | |
| view.$('button[data-action="another"]').show() | |
| } | |
| } | |
| }) | |
| }, | |
| addTypeRow: function (model) { | |
| p3.rV(new OfficialNotes.Vs.MonitorTeamModalTypeRow({ | |
| model: model | |
| }), this.Containers.TypeTbody, false); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }, | |
| selectAllBtn: function (e) { | |
| this.options.typeList.each(function (model) { | |
| model.set({ | |
| Active: true | |
| }, { | |
| silent: true | |
| }) | |
| }); | |
| $(e.target).closest("div").find("table td button").addClass("active"); | |
| return false | |
| }, | |
| handleTypeListItem: function (e) { | |
| var model = this.options.typeList.at(parseInt($(e.target).closest("button").attr("data-index"), 10)); | |
| if (!model.has("Active")) { | |
| model.set({ | |
| Active: true | |
| }, { | |
| silent: true | |
| }) | |
| } else { | |
| if (model.get("Active")) { | |
| model.set({ | |
| Active: false | |
| }, { | |
| silent: true | |
| }) | |
| } else { | |
| model.set({ | |
| Active: true | |
| }, { | |
| silent: true | |
| }) | |
| } | |
| } | |
| }, | |
| save: function (e) { | |
| var $btnClicked = $(e.target), | |
| commentTypes = []; | |
| $btnClicked.button("loading"); | |
| this.options.typeList.each(function (model) { | |
| if (model.get("Active")) { | |
| commentTypes.push({ | |
| Id: model.get("OfficialNoteTypeId") | |
| }) | |
| } | |
| }); | |
| this.options.membersList.each(function (model) { | |
| var value; | |
| if (typeof model.get("Id") === "string") { | |
| value = model.get("Id").split("_")[1] | |
| } else { | |
| value = model.get("Id") | |
| } | |
| model.set({ | |
| MemberId: parseInt(value, 10) | |
| }) | |
| }); | |
| this.model.save({ | |
| SortOrder: parseInt(this.$("#SortOrder").val(), 10), | |
| ShortDescription: this.$("#ShortDescription").val(), | |
| EmailAccess: (this.$(".email-access.active").attr("data-value") === "yes") ? true : false, | |
| ApprovalAccess: false, | |
| TeamMemberList: (this.options.membersList.length > 0) ? this.options.membersList.toJSON() : null, | |
| CommentTypes: (commentTypes.length > 0) ? commentTypes : null, | |
| CategoryId: 34 | |
| }, { | |
| wait: true, | |
| fetch: true, | |
| addAnother: ($btnClicked.attr("data-action") === "another") ? true : false, | |
| success: function () { | |
| p3.showModal(p3.Layout.Containers.Modal, "hide"); | |
| p3.displaySiteMessage("Your Monitoring Team has been saved.", "alert-success") | |
| }, | |
| error: function () { | |
| p3.displayError("Error saving Monitoring Team") | |
| } | |
| }) | |
| }, | |
| dispose: function () { | |
| if ((!this.model.has("MonitorTeamId")) || (this.model.get("MonitorTeamId") == 0)) { | |
| this.model.clear() | |
| } | |
| this.options.typeList.remove(); | |
| $(".token-input-dropdown").remove() | |
| } | |
| }); | |
| OfficialNotes.Vs.MonitorTeamModalTypeRow = Bb.View.extend({ | |
| tagName: "TR", | |
| events: { | |
| "click button": "handleBtn" | |
| }, | |
| render: function (container) { | |
| var classList = "btn btn-default btn-mini btn-sm btn-approve type-list-item"; | |
| if (this.model.get("Active")) { | |
| classList = classList + " active" | |
| } | |
| this.$el.appendTo(container).append($("<td>").html($("<button>", { | |
| type: "button", | |
| "data-toggle": "button", | |
| "class": classList, | |
| style: "margin-right:10px", | |
| "data-index": this.model.get("Index") | |
| }).html('<i class="p3icon-check"></i>'))); | |
| this.$el.find("td button").after(this.model.get("ShortDescription")) | |
| }, | |
| handleBtn: function (e) { | |
| e.preventDefault() | |
| } | |
| }); | |
| OfficialNotes.Vs.MonitoringTeamMember = Bb.View.extend({ | |
| tagName: "TR", | |
| events: { | |
| "click button": "removeItem" | |
| }, | |
| render: function (container) { | |
| this.$el.appendTo(container).append($("<td>").html($("<button>", { | |
| "class": "btn btn-default btn-mini pull-right" | |
| }).html($("<i>", { | |
| "class": "fa fa-trash" | |
| })))); | |
| this.$el.find("td button").after(this.model.name); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }, | |
| removeItem: function (e) { | |
| this.options.membersList.each(function (item) { | |
| if (item.get("Id") == this.model.id) { | |
| item.destroy() | |
| } | |
| }, this); | |
| this.remove(); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| } | |
| }); | |
| OfficialNotes.Us.GetPlaceholders = function (text, placeHolderList) { | |
| var list = []; | |
| placeHolderList.each(function (model) { | |
| if (text.indexOf("[" + model.get("DisplayName") + "]") > -1) { | |
| list.push({ | |
| PlaceholderId: model.get("PlaceholderId") | |
| }) | |
| } | |
| }); | |
| return list | |
| }; | |
| p3.router().route("onBoardofficialnotes", "officialnotes", function () { | |
| p3.renderMainPage(new OfficialNotes.Vs.Layout({})) | |
| }) | |
| }(p3.module("admissions/officialnotes"))); | |
| (function (a) { | |
| a.Ms.Inquiry = Bbm.extend({}); | |
| a.Cs.Inquiries = Bbc.extend({ | |
| model: a.Ms.Inquiry, | |
| url: function () { | |
| return aP + "AdmProcess/SubmittedForms/" | |
| } | |
| }); | |
| a.Vs.Layout = Bb.View.extend({ | |
| template: "page/page.12.header.template.html", | |
| dispose: function () { | |
| p3.closeFixedSidebar() | |
| }, | |
| render: function (b) { | |
| var c = this; | |
| p3.setTitle("Process " + a.Data.FormType); | |
| $(b).append(c.el); | |
| c.renderData() | |
| }, | |
| renderData: function () { | |
| var b = this; | |
| p3.fT(b.template, function (c) { | |
| b.$el.html(c({})); | |
| p3.renderFixedSidebar(new a.Vs.Sidebar({})); | |
| $("BODY.sidebar-fixed").css("background-color", "#ffffff").css("background-image", "none") | |
| }) | |
| } | |
| }); | |
| a.Vs.Sidebar = Bb.View.extend({ | |
| template: "process/process.sidebar.template.html", | |
| className: "process-sidebar", | |
| initialize: function (b) { | |
| var c = this; | |
| switch (a.Data.FormTypeId) { | |
| case 1: | |
| break; | |
| case 2: | |
| break; | |
| case 4: | |
| c.collection = new a.Cs.Inquiries(); | |
| break | |
| } | |
| c.collection.bind("add", function (d) { | |
| var e = new a.Vs.SidebarItem({ | |
| model: d | |
| }); | |
| d.bind("sync", c.renderData, c); | |
| p3.rV(e, c.$(".process-sidebar-content"), false) | |
| }, c) | |
| }, | |
| events: { | |
| renderdata: "renderData" | |
| }, | |
| render: function (b) { | |
| var c = this; | |
| $(b).append(c.el); | |
| c.renderData() | |
| }, | |
| renderData: function () { | |
| var b = this; | |
| p3.fT(b.template, function (c) { | |
| b.$el.html(c({ | |
| formType: a.Data.FormType | |
| })); | |
| b.collection.fetch({ | |
| data: { | |
| formId: null, | |
| formTypeId: a.Data.FormTypeId | |
| }, | |
| update: true, | |
| cache: false, | |
| complete: function () { | |
| b.$(".process-sidebar-header .badge").html(b.collection.length); | |
| b.$(".process-sidebar-item").first().click() | |
| } | |
| }) | |
| }) | |
| } | |
| }); | |
| a.Vs.SidebarItem = Bb.View.extend({ | |
| className: "process-sidebar-item", | |
| initialize: function (b) { | |
| var c = this; | |
| switch (a.Data.FormTypeId) { | |
| case 1: | |
| c.template = "process/process.sidebar.item.template.html"; | |
| break; | |
| case 2: | |
| c.template = "process/process.sidebar.item.template.html"; | |
| break; | |
| case 4: | |
| c.template = "process/process.sidebar.item.template.html"; | |
| break | |
| } | |
| }, | |
| events: { | |
| click: "showContent" | |
| }, | |
| render: function (b) { | |
| var c = this; | |
| $(b).append(c.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var b = this; | |
| p3.log(b.template); | |
| p3.fT(b.template, function (c) { | |
| b.$el.html(c({ | |
| model: b.model.toJSON() | |
| })); | |
| b.$el.after('<div style="margin:0px 20px; padding:0px;"><hr class="divider"></hr></div>') | |
| }) | |
| }, | |
| showContent: function (b) { | |
| var c = this; | |
| c.$el.siblings(".process-sidebar-item").removeClass("active pri-100-bgc"); | |
| c.$el.addClass("active pri-100-bgc"); | |
| switch (a.Data.FormTypeId) { | |
| case 1: | |
| break; | |
| case 2: | |
| break; | |
| case 4: | |
| p3.rV(new a.Vs.InquiryContent({ | |
| model: c.model | |
| }), $(".col-center"), true); | |
| break | |
| } | |
| } | |
| }) | |
| }(p3.module("admissions/processforms"))); | |
| (function (c) { | |
| var d = p3.module("utilities/smodal"), | |
| f = p3.Us, | |
| e = p3.Us.Tools, | |
| a = p3.module("shared/base"), | |
| b = p3.Us.Enum; | |
| c.Ms.Recommendation = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| url: function () { | |
| return this.id ? aP + "ProspectChecklist/SecureRecommendation/" + this.id + "/" : aP + "ProspectChecklist/SecureRecommendation/" | |
| } | |
| }); | |
| c.Cs.ManagerGroupAccess = Bbc.extend({ | |
| url: function () { | |
| return aP + "DataDirect/ManagerGroupAccess/" | |
| } | |
| }); | |
| c.Vs.Layout = Bb.View.extend({ | |
| template: "page/page.12.template.html", | |
| initialize: function () { | |
| var g = this; | |
| g.model = new c.Ms.Recommendation() | |
| }, | |
| dispose: function () { | |
| $("BODY").removeClass("background-gray-texture") | |
| }, | |
| render: function (g) { | |
| var h = this; | |
| $("BODY").addClass("background-gray-texture"); | |
| p3.setTitle(b.FormType.RECOMMENDATION.Name); | |
| $(g).html(h.el); | |
| h.renderData() | |
| }, | |
| renderData: function () { | |
| var h = this, | |
| g; | |
| p3.fT(h.template, function (i) { | |
| h.$el.html(i({ | |
| model: h.model.toJSON() | |
| })); | |
| $("#site-main").prepend('<div id="site-top-spacer" style="height:70px"></div>'); | |
| h.model.fetch({ | |
| data: { | |
| schoolKey: c.Data.schoolkey, | |
| recommendKey: c.Data.recommendkey, | |
| authKey: c.Data.authkey, | |
| declineInd: c.Data.declineind | |
| }, | |
| success: function () { | |
| p3.rV(new c.Vs.SiteHeader({ | |
| model: h.model | |
| }), $("#app > div"), false); | |
| if (h.model.get("RequestExpired")) { | |
| g = "This link has expired" | |
| } else { | |
| if (h.model.get("DataCollectionTypeId") === b.DataCollectionType.RECOMMENDATIONFORM && (h.model.get("RecommendStatusDescription") === "Completed" || h.model.get("RecommendStatusDescription") === "Submitted")) { | |
| g = "This recommendation has already been submitted" | |
| } else { | |
| if (h.model.get("RecommendationUpload").Processed) { | |
| g = "This recommendation has already been submitted and processed" | |
| } else { | |
| if (h.model.get("Decline")) { | |
| g = "This recommendation has already been declined" | |
| } | |
| } | |
| } | |
| } | |
| if (e.stringToInt(c.Data.declineind)) { | |
| p3.rV(new c.Vs.Decline({ | |
| model: h.model, | |
| errorMsg: g | |
| }), h.$(".col-center"), true) | |
| } else { | |
| p3.rV(new c.Vs.Accept({ | |
| model: h.model, | |
| errorMsg: g | |
| }), h.$(".col-center"), true) | |
| } | |
| }, | |
| error: function (k, j) { | |
| g = "Unauthorized Access"; | |
| p3.rV(new c.Vs.Unauthorized({ | |
| model: h.model, | |
| errorMsg: g | |
| }), h.$(".col-center"), true) | |
| } | |
| }) | |
| }) | |
| } | |
| }); | |
| c.Vs.SiteHeader = Bb.View.extend({ | |
| template: "recommend/recommend.siteheader.template.html", | |
| id: "site-header-parent-container", | |
| render: function (g) { | |
| var h = this; | |
| $(g).append(h.el); | |
| h.renderData() | |
| }, | |
| renderData: function () { | |
| var g = this; | |
| p3.fT(g.template, function (h) { | |
| g.$el.html(h({ | |
| model: g.model.toJSON() | |
| })); | |
| g.renderSchoolContext() | |
| }) | |
| }, | |
| renderSchoolContext: function () { | |
| var l = this, | |
| g = l.$("#site-logo"), | |
| j = p3.Data.SchoolContext.get("SchoolInfo"), | |
| k = p3.Data.SchoolContext.get("Style"), | |
| i, h = true; | |
| if (k && k.Logo && k.Logo.length > 0) { | |
| g.addClass("logoimg"); | |
| i = '<img src="' + k.Logo + '"/>'; | |
| h = false | |
| } else { | |
| if (j) { | |
| i = j.SchoolName | |
| } | |
| } | |
| if (k.LogoNavUrl) { | |
| g.html('<a href="' + k.LogoNavUrl + '" class="white-fgc">' + i + "</a>") | |
| } else { | |
| g.html(i) | |
| } | |
| if (h) { | |
| g.fitText(1.5, { | |
| minFontSize: "12px", | |
| maxFontSize: "28px" | |
| }) | |
| } | |
| } | |
| }); | |
| c.Vs.Accept = Bb.View.extend({ | |
| template: "recommend/recommend.accept.template.html", | |
| initialize: function () { | |
| var g = this; | |
| g.selector = "name"; | |
| Bb.Validation.bind(g, { | |
| forceUpdate: true, | |
| selector: g.selector | |
| }) | |
| }, | |
| events: { | |
| "click .save": "saveRecommend", | |
| "click .recommendationProceedBtn": "proceedToRecommendationForm" | |
| }, | |
| render: function (g) { | |
| var h = this; | |
| $(g).html(h.el); | |
| h.renderData() | |
| }, | |
| renderData: function () { | |
| var g = this; | |
| p3.fT(g.template, function (h) { | |
| g.$el.html(h({ | |
| model: g.model.toJSON(), | |
| errorMsg: g.options.errorMsg | |
| })); | |
| if (!g.options.errorMsg) { | |
| if (g.model.get("DataCollectionTypeId") === b.DataCollectionType.RECOMMENDATIONFORM) { | |
| p3.Us.Captcha.Initialize({}) | |
| } else { | |
| if (g.model.get("DataCollectionTypeId") === b.DataCollectionType.REFERENCE) { | |
| g.initializeFileUpload_File() | |
| } | |
| } | |
| } | |
| }) | |
| }, | |
| initializeFileUpload_File: function (h) { | |
| var i = this, | |
| g = i.model.get("AuthToken"); | |
| h = (!h) ? 1 : h; | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.jQueryUI, function () { | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.FileUpload, function () { | |
| $(document).on("drop dragover", function (j) { | |
| j.preventDefault() | |
| }); | |
| window.setTimeout(function () { | |
| i.$(".attachment").each(function () { | |
| var j = (!$(this).data("filetype")) ? p3.Us.Enum.UploadType.All : p3.Us.Enum.UploadType[$(this).data("filetype").toUpperCase()]; | |
| $(this).fileupload({ | |
| url: p3.Config.RootPath + "utilities/FileTransferHandler.ashx", | |
| autoUpload: true, | |
| acceptFileTypes: j.ValidExtensions, | |
| formData: { | |
| safeName: true | |
| }, | |
| dropZone: $(this), | |
| maxNumberOfFiles: h, | |
| add: function (l, k) { | |
| var m = f.FileTools.isValidFile(j, k.files[0].name); | |
| if (m) { | |
| Bb.Validation.callbacks.valid(i, "AttachmentFile", i.selector); | |
| k.submit() | |
| } else { | |
| Bb.Validation.callbacks.invalid(i, "AttachmentFile", f.InfoMessageLibrary.Assignment.FileTypeUnsupported, i.selector) | |
| } | |
| }, | |
| beforeSend: function (l, k) { | |
| if (g) { | |
| l.setRequestHeader("App-Auth-Id", "Recommendation"); | |
| l.setRequestHeader("App-Auth-Token", g) | |
| } | |
| } | |
| }).on("fileuploaddone", function (m, l) { | |
| var k = $(m.currentTarget), | |
| n = k.attr(i.selector); | |
| k.find(".attachment-view .attachment-name").html(l.result[0].original_name); | |
| d.Us.setPropByString(i.model.attributes, n + ".Attachment", l.result[0].original_name); | |
| d.Us.setPropByString(i.model.attributes, n + ".AttachmentTemp", l.result[0].name); | |
| k.find(".attachment-view").show(); | |
| k.find(".attachment-add").hide() | |
| }).on("click", ".attachment-delete", function (n) { | |
| n.stopPropagation(); | |
| var k = $(n.currentTarget).parents(".attachment"), | |
| o = k.attr(i.selector), | |
| l = d.Us.getPropByString(i.model.attributes, o + ".Attachment"), | |
| m = d.Us.getPropByString(i.model.attributes, o + ".AttachmentTemp"); | |
| if (m) { | |
| d.Us.setPropByString(i.model.attributes, o + ".AttachmentTemp", null); | |
| d.Us.setPropByString(i.model.attributes, o + ".Attachment", null) | |
| } else { | |
| d.Us.setPropByString(i.model.attributes, o + ".AttachmentRemove", l); | |
| d.Us.setPropByString(i.model.attributes, o + ".Attachment", null) | |
| } | |
| k.find(".attachment-view").hide(); | |
| k.find(".attachment-add").show() | |
| }) | |
| }) | |
| }, 1000) | |
| }) | |
| }) | |
| }, | |
| saveRecommend: function (g) { | |
| g.preventDefault(); | |
| g.stopPropagation(); | |
| var h = this; | |
| if (!h.options.errorMsg) { | |
| h.model.save({}, { | |
| success: function (i, j) { | |
| h.$(".recommend").hide(); | |
| h.$(".recommend-success").show() | |
| }, | |
| error: function (j, i) { | |
| p3.displayError("Error saving recommendation") | |
| } | |
| }) | |
| } | |
| }, | |
| proceedToRecommendationForm: function (h) { | |
| h.stopPropagation(); | |
| var j = this, | |
| g = p3.Us.Captcha.GetResponse(), | |
| i = j.$("#recommendation-proceed-form"); | |
| p3.Us.Captcha.HideError(); | |
| if (!g) { | |
| h.preventDefault(); | |
| p3.Us.Captcha.DisplayError() | |
| } else { | |
| i.submit(function (k) { | |
| i.append('<input type="hidden" name="applicationFormId" value="' + j.model.get("ApplicationFormId") + '">'); | |
| i.append('<input type="hidden" name="checklistRecommendId" value="' + j.model.get("RecommendationId") + '">'); | |
| i.append('<input type="hidden" name="authToken" value="' + encodeURIComponent(j.model.get("AuthToken")) + '">'); | |
| i.append('<input type="hidden" name="captchaResponse" value="' + g + '">') | |
| }) | |
| } | |
| } | |
| }); | |
| c.Vs.Decline = Bb.View.extend({ | |
| template: "recommend/recommend.decline.template.html", | |
| events: { | |
| "change input": "updateModel", | |
| "click .decline": "declineConfirm" | |
| }, | |
| render: function (g) { | |
| var h = this; | |
| $(g).html(h.el); | |
| h.renderData() | |
| }, | |
| renderData: function () { | |
| var g = this; | |
| p3.fT(g.template, function (h) { | |
| g.$el.html(h({ | |
| model: g.model.toJSON(), | |
| errorMsg: g.options.errorMsg | |
| })) | |
| }) | |
| }, | |
| updateModel: function (h) { | |
| h.preventDefault(); | |
| var i = this, | |
| g = $(h.currentTarget); | |
| if (g.attr("name") === "RecommendationDisallowed") { | |
| i.model.set("RecommendationDisallowed", g.prop("checked")) | |
| } | |
| }, | |
| declineConfirm: function (g) { | |
| g.preventDefault(); | |
| var i = this, | |
| h = "Are you sure you want to decline the " + i.model.get("ChecklistItemDesc") + " for " + i.model.get("StudentName") + "?"; | |
| if (i.model.get("RecommendationDisallowed")) { | |
| h += "<br><br>This response will be sent to this school as well as the family." | |
| } else { | |
| h += "<br><br>This response will only be sent to the family." | |
| } | |
| if (!i.options.errorMsg) { | |
| i.model.set("Decline", true); | |
| i.declineConfirmModal = d.Vs.Modal2.extend({ | |
| template: "utilities/utilities.smodal.confirm.html", | |
| model: i.model, | |
| variables: { | |
| title: "Decline " + i.model.get("ChecklistItemDesc"), | |
| text: h, | |
| cancelText: "Cancel", | |
| confirmText: "Decline" | |
| }, | |
| dataParam: { | |
| authKey: c.Data.authkey | |
| }, | |
| modalRendered: function () { | |
| var j = this; | |
| j.setFocus() | |
| }, | |
| modalSavedSuccess: function () { | |
| _.defer(function () { | |
| i.$(".recommend").hide(); | |
| i.$(".recommend-success").show() | |
| }) | |
| }, | |
| modalSavedError: function () { | |
| _.defer(function () { | |
| p3.displayError("Error saving recommendation") | |
| }) | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new i.declineConfirmModal(), p3.Layout.Containers.Modal, true) | |
| } | |
| } | |
| }); | |
| c.Vs.Unauthorized = Bb.View.extend({ | |
| template: "recommend/recommend.unauthorized.template.html", | |
| render: function (g) { | |
| var h = this; | |
| $(g).html(h.el); | |
| h.renderData() | |
| }, | |
| renderData: function () { | |
| var g = this; | |
| p3.fT(g.template, function (h) { | |
| g.$el.html(h({ | |
| errorMsg: g.options.errorMsg, | |
| model: g.model.toJSON() | |
| })) | |
| }) | |
| } | |
| }); | |
| p3.router().route("admissions/recommend/:schoolkey/:recommendkey/:authkey/:declineind", "admissions/recommend", function (j, i, g, h) { | |
| c.Data.schoolkey = j; | |
| c.Data.recommendkey = i; | |
| c.Data.authkey = g; | |
| c.Data.declineind = h; | |
| p3.renderMainPage(new c.Vs.Layout({})) | |
| }) | |
| }(p3.module("admissions/recommend"))); | |
| (function (f) { | |
| var a = p3.module("shared/base"), | |
| g = p3.module("utilities/smodal"), | |
| d = p3.module("utilities/filter"), | |
| e = p3.module("utilities/multifetch"), | |
| b = p3.Us.Culture, | |
| c = p3.Us.Enum, | |
| h = p3.Us.Tools; | |
| f.Ms.Fee = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| idAttribute: "ApplicationDataId", | |
| url: function () { | |
| return this.id ? aP + "onlineapplication/ApplicationUpdateHandledInd/" + this.id + "/" : aP + "onlineapplication/ApplicationUpdateHandledInd/" | |
| } | |
| }); | |
| f.Cs.ReconcileList = Bbc.extend({ | |
| initialize: function () { | |
| _.extend(this, $.extend(true, {}, d.Us.CollectionFilter)) | |
| }, | |
| preFilter: function (i) { | |
| _.each(i, function (j) { | |
| j.DatePaidShort = b.getDateString(j.DatePaid) | |
| }) | |
| }, | |
| model: f.Ms.Fee, | |
| url: function () { | |
| return aP + "OnlineApplication/ApplicationList/" | |
| } | |
| }); | |
| f.Cs.ReconcileApplicationsList = Bbc.extend({ | |
| initialize: function () { | |
| _.extend(this, $.extend(true, {}, d.Us.CollectionFilter)) | |
| }, | |
| preFilter: function (i) { | |
| _.each(i, function (j) { | |
| j.DatePaidShort = b.getDateString(j.DatePaid) | |
| }) | |
| }, | |
| model: f.Ms.Fee, | |
| url: function () { | |
| return aP + "OnlineApplication/ApplicationFees/" | |
| } | |
| }); | |
| f.Cs.ReconcileContractsList = Bbc.extend({ | |
| initialize: function () { | |
| _.extend(this, $.extend(true, {}, d.Us.CollectionFilter)) | |
| }, | |
| preFilter: function (i) { | |
| _.each(i, function (j) { | |
| j.DatePaidShort = b.getDateString(j.DatePaid) | |
| }) | |
| }, | |
| model: f.Ms.Fee, | |
| url: function () { | |
| return aP + "OnlineApplication/ContractDeposits/" | |
| } | |
| }); | |
| f.Cs.RoleList = Bbc.extend({ | |
| url: function () { | |
| return aP + "Role/" | |
| } | |
| }); | |
| f.Vs.Layout = Bb.View.extend({ | |
| template: "page/page.10-2.header.template.html", | |
| initialize: function () { | |
| var i = this; | |
| i.Containers = {}; | |
| i.forms = [] | |
| }, | |
| render: function (i) { | |
| var j = this; | |
| $(i).html(j.el); | |
| e.Us.Fetch({ | |
| RoleCollection: { | |
| data: new f.Cs.RoleList(), | |
| dataParams: { | |
| userId: p3.Data.Context.attributes.UserInfo.UserId | |
| } | |
| }, | |
| ADMPaymentStatus: { | |
| data: new e.Cs.Dictionary(), | |
| dataParams: c.DictionaryData.ADMPaymentStatus | |
| } | |
| }, function (k, m, l) { | |
| if (l) { | |
| p3.displayError("There was an error loading data.") | |
| } | |
| f.Data.dictionaries.ADMPaymentStatus = k.ADMPaymentStatus; | |
| j.renderData() | |
| }) | |
| }, | |
| renderData: function () { | |
| var l = this, | |
| j, k, i; | |
| p3.fT(l.template, function (m) { | |
| l.$el.html(m({})); | |
| l.Containers = { | |
| Header: l.$(".header"), | |
| LeftColumn: l.$(".col-left"), | |
| RightColumn: l.$(".col-right") | |
| }; | |
| p3.rV(new f.Vs.Header(), l.Containers.Header, false); | |
| p3.rV(new f.Vs.Error(), l.Containers.LeftColumn, false); | |
| if (f.Data.FormType.Type === "Application") { | |
| p3.setTitle("Reconcile Fees"); | |
| j = new f.Cs.ReconcileApplicationsList() | |
| } | |
| if (f.Data.FormType.Type === "Contract") { | |
| p3.setTitle("Reconcile Deposits"); | |
| j = new f.Cs.ReconcileContractsList() | |
| } | |
| j.updateSearch("ReconcileType", 0); | |
| j.updateSearch("PaymentStatus", 1); | |
| j.filterReturnType("model"); | |
| j.filterParse(false); | |
| k = new f.Vs.Fees({ | |
| collection: j | |
| }); | |
| p3.rV(k, l.Containers.LeftColumn, false); | |
| i = d.Vs.Filter.extend({ | |
| template: "reconcilefees/reconcilefees.filter.template.html", | |
| collection: j, | |
| variables: { | |
| dictionaries: f.Data.dictionaries, | |
| forms: l.forms | |
| }, | |
| preFilter: function (r) { | |
| var o = r.eventCurrentTarget, | |
| p = o.attr("name"), | |
| n = $("#date-error"), | |
| q; | |
| if (o.hasClass("date-input")) { | |
| q = new Date(); | |
| q.setDate(1); | |
| q.setMonth(q.getMonth() - 18); | |
| q.setDate(0); | |
| q = b.getDateString(q); | |
| if (b.dateCompare(o.val(), q, "<=")) { | |
| Bb.Validation.callbacks.invalid(this, p, "Date can only be 18 months in the past.", "name") | |
| } else { | |
| Bb.Validation.callbacks.valid(this, p, "name") | |
| } | |
| if (l.$("input.date-input").hasClass("box-validate")) { | |
| n.show() | |
| } else { | |
| n.hide() | |
| } | |
| } | |
| }, | |
| postFilter: function (o) { | |
| var n = o.eventCurrentTarget; | |
| if (n.hasClass("db")) { | |
| k.renderData() | |
| } else { | |
| k.refreshTemplate() | |
| } | |
| } | |
| }); | |
| p3.rV(new i(), l.Containers.RightColumn, false) | |
| }) | |
| } | |
| }); | |
| f.Vs.Error = Bb.View.extend({ | |
| id: "date-error", | |
| className: "collapse", | |
| render: function (i) { | |
| var j = this; | |
| $(i).html(j.el); | |
| j.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this; | |
| i.$el.html('<div class="alert alert-error">Payment data is only searchable for the past 18 months.</div>') | |
| } | |
| }); | |
| f.Vs.Header = Bb.View.extend({ | |
| template: "reconcilefees/reconcilefees.header.template.html", | |
| render: function (i) { | |
| var j = this; | |
| $(i).html(j.el); | |
| j.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this; | |
| p3.fT(i.template, function (j) { | |
| if (f.Data.FormType.Type === "Application") { | |
| i.$el.html(j({ | |
| header: "Reconcile Fees" | |
| })) | |
| } | |
| if (f.Data.FormType.Type === "Contract") { | |
| i.$el.html(j({ | |
| header: "Reconcile Deposits" | |
| })) | |
| } | |
| }) | |
| } | |
| }); | |
| f.Vs.Fees = Bb.View.extend({ | |
| template: "reconcilefees/reconcilefees.fees.template.html", | |
| render: function (i) { | |
| var j = this; | |
| $(i).append(j.el); | |
| j.renderData() | |
| }, | |
| renderData: function () { | |
| var l = this, | |
| k = "", | |
| i, j; | |
| l.collection.reset(); | |
| p3.fT(l.template, function (m) { | |
| k = h.stringToInt(l.collection._searches.ReconcileType) === 0 ? "Unhandled" : "Handled"; | |
| l.$el.html(m({ | |
| reconcileTypeName: k | |
| })); | |
| i = l.$("#loading"); | |
| j = l.$("#reconcilefees"); | |
| i.show(); | |
| j.hide(); | |
| l.collection.fetch({ | |
| cache: false, | |
| data: { | |
| reconcileType: l.collection._searches.ReconcileType, | |
| paymentStatus: l.collection._searches.PaymentStatus | |
| }, | |
| success: function (n, p, o) { | |
| _.each(l.collection.filter(), function (r) { | |
| var q = new f.Vs.Fee({ | |
| model: r | |
| }); | |
| r.bind("sync", l.refreshTemplate, l); | |
| p3.rV(q, j, false) | |
| }); | |
| i.hide(); | |
| j.show() | |
| } | |
| }) | |
| }) | |
| }, | |
| refreshTemplate: function () { | |
| var l = this, | |
| k, i, j; | |
| p3.fT(l.template, function (m) { | |
| k = h.stringToInt(l.collection._searches.ReconcileType) === 0 ? "Unhandled" : "Handled"; | |
| l.$el.html(m({ | |
| reconcileTypeName: k | |
| })); | |
| i = l.$("#loading"); | |
| j = l.$("#reconcilefees"); | |
| i.show(); | |
| j.hide(); | |
| _.each(l.collection.filter(), function (o) { | |
| var n = new f.Vs.Fee({ | |
| model: o | |
| }); | |
| o.bind("sync", l.refreshTemplate, l); | |
| p3.rV(n, j, false) | |
| }); | |
| i.hide(); | |
| j.show() | |
| }) | |
| } | |
| }); | |
| f.Vs.Fee = Bb.View.extend({ | |
| template: "reconcilefees/reconcilefees.fee.template.html", | |
| tagName: "tr", | |
| events: { | |
| "click a.togglebutton": "toggleInfo", | |
| "click .edit": "editDetails", | |
| "click .delete": "deleteFee" | |
| }, | |
| render: function (i) { | |
| var j = this; | |
| $(i).append(j.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this; | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({ | |
| model: i.model.toJSON() | |
| })) | |
| }) | |
| }, | |
| toggleInfo: function (j) { | |
| var k = this, | |
| i = $(j.currentTarget); | |
| k.$(".toggleinfo").slideToggle("fast"); | |
| if (i.hasClass("active")) { | |
| i.removeClass("active") | |
| } else { | |
| i.addClass("active") | |
| } | |
| return false | |
| }, | |
| editDetails: function (j) { | |
| j.stopPropagation(); | |
| j.preventDefault(); | |
| var l = this, | |
| i, k; | |
| if (l.model.get("ReconcileType") === 1) { | |
| i = { | |
| handledInd: 0 | |
| } | |
| } else { | |
| i = { | |
| handledInd: 1 | |
| } | |
| } | |
| if ((l.model.attributes.AmountPaid == 0 || l.model.attributes.AmountPaid == null) && l.model.attributes.FailedMsg == "") { | |
| k = "reconcilefees/reconcilefees.waiver.edit.template.html" | |
| } else { | |
| k = "reconcilefees/reconcilefees.fee.edit.template.html" | |
| } | |
| l.modal2Extend = g.Vs.Modal2.extend({ | |
| template: k, | |
| model: l.model, | |
| dataParam: i, | |
| size: "md", | |
| modalRendered: function () { | |
| var m = this; | |
| m.model.set({ | |
| ReconcileType: i.handledInd | |
| }) | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new l.modal2Extend({}), p3.Layout.Containers.Modal, true) | |
| }, | |
| deleteFee: function (i) { | |
| var k = this, | |
| j; | |
| j = g.Vs.Modal2.extend({ | |
| template: "utilities/utilities.smodal.confirm.html", | |
| model: k.model, | |
| variables: { | |
| title: "Delete Fee", | |
| errorText: "Wait a minute. Are you really sure you want to delete this fee?", | |
| cancelText: "Cancel", | |
| confirmText: "Confirm" | |
| }, | |
| dataParam: { | |
| handledInd: -99 | |
| }, | |
| modalRendered: function () { | |
| var l = this; | |
| l.model.set({ | |
| ReconcileType: -99 | |
| }) | |
| }, | |
| modalSavedSuccess: function () { | |
| k.deleteElement() | |
| }, | |
| modalSavedError: function () { | |
| p3.displayError("Error deleting fee") | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new j({}), p3.Layout.Containers.Modal, true) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| p3.router().route("process/fees", "reconcilefees", function () { | |
| f.Data.dictionaries = {}; | |
| p3.renderMainPage(new f.Vs.Layout({})) | |
| }); | |
| p3.router().route("process/applicationfees", "processapplicationfees", function () { | |
| f.Data.dictionaries = {}; | |
| f.Data.FormType = c.FormType.APPLICATION; | |
| p3.renderMainPage(new f.Vs.Layout({})) | |
| }); | |
| p3.router().route("process/contractdeposits", "processcontractdeposits", function () { | |
| f.Data.dictionaries = {}; | |
| f.Data.FormType = c.FormType.CONTRACT; | |
| p3.renderMainPage(new f.Vs.Layout({})) | |
| }) | |
| }(p3.module("admissions/reconcilefees"))); | |
| (function (d) { | |
| var b = p3.module("shared/base"), | |
| a = p3.module("admissions/admissionsscheduling"), | |
| c = p3.Us.Culture, | |
| e = p3.Us.Tools; | |
| d.Ms.Assignment = Bbm.extend({}); | |
| d.Ms.RecentlyViewed = Bbm.extend({}); | |
| d.Ms.RecentlyAdded = Bbm.extend({}); | |
| d.Ms.ListItem = Bbm.extend({}); | |
| d.Ms.Schedule = Bbm.extend({}); | |
| d.Ms.Reminder = Bbm.extend({ | |
| idAttribute: "ReminderDismissId", | |
| url: function () { | |
| return this.id ? aP + "ProspectChecklist/Reminder/" + this.id + "/" : aP + "ProspectChecklist/Reminder/" | |
| } | |
| }); | |
| d.Ms.ChecklistVisit = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "VisitId", | |
| url: function () { | |
| return this.id ? aP + "Admissions/ParentProspectVisit/" + this.id + "/" : aP + "Admissions/ParentProspectVisit/" | |
| } | |
| }); | |
| d.Ms.ChecklistInterview = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "InterviewId", | |
| url: function () { | |
| return this.id ? aP + "Admissions/ParentProspectInterview/" + this.id + "/" : aP + "Admissions/ParentProspectInterview/" | |
| } | |
| }); | |
| d.Cs.Assignments = Bbc.extend({ | |
| model: d.Ms.Assignment, | |
| url: function () { | |
| return aP + "datadirect/ParentStudentUserAssignments/" | |
| } | |
| }); | |
| d.Cs.RecentlyViewed = Bbc.extend({ | |
| model: d.Ms.RecentlyViewed, | |
| url: function () { | |
| return aP + "datadirect/UserLastViewed/" | |
| } | |
| }); | |
| d.Cs.RecentlyAdded = Bbc.extend({ | |
| model: d.Ms.RecentlyAdded, | |
| url: function () { | |
| return aP + "datadirect/CandidatesLastAdded/" | |
| } | |
| }); | |
| d.Cs.FindACandidate = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/CandidateSearch/" | |
| } | |
| }); | |
| d.Cs.FindACandidateUsers = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/DashboardFindMeNowUserGet/" | |
| } | |
| }); | |
| d.Cs.Schedules = Bbc.extend({ | |
| model: d.Ms.Schedule, | |
| url: function () { | |
| return aP + "datadirect/AdmissionSchedulingGet/" | |
| } | |
| }); | |
| d.Cs.ReminderGroups = Bbc.extend({ | |
| model: d.Ms.Reminder, | |
| url: function () { | |
| return aP + "ProspectChecklist/Reminder/" | |
| } | |
| }); | |
| d.Cs.ListItems = Bbc.extend({ | |
| model: d.Ms.ListItem | |
| }); | |
| d.Cs.EventAttendees = Bbc.extend({ | |
| url: "admissions/AdmissionEventRegistrantGroupGet" | |
| }); | |
| d.Vs.Layout = Bb.View.extend({ | |
| template: "admissions/onboard.layout.template.html", | |
| initialize: function () { | |
| this.subs = {}; | |
| this.todayDate = c.localDateTime() | |
| }, | |
| render: function (f) { | |
| var g = this; | |
| p3.setTitle("Scheduling"); | |
| $(f).html(g.el); | |
| g.renderData() | |
| }, | |
| renderData: function () { | |
| var f = this; | |
| p3.fT(f.template, function (g) { | |
| f.$el.html(g()); | |
| f.Containers = { | |
| leftColumn: f.$el.find("#page-2col-wideleft"), | |
| rightColumn: f.$el.find("#page-2col-slimright") | |
| }; | |
| p3.rV(new d.Vs.SchedulesList(), f.Containers.leftColumn, false); | |
| p3.rV(new d.Vs.FindACandidate(), f.Containers.rightColumn, true) | |
| }) | |
| } | |
| }); | |
| d.Vs.FindACandidate = Bb.View.extend({ | |
| template: "admissions/onboard.findacandidate.template.html", | |
| className: "row-fluid", | |
| events: { | |
| "click .tab": "switchTab" | |
| }, | |
| render: function (f) { | |
| var g = this; | |
| g.$el.appendTo(f); | |
| g.renderTemplate() | |
| }, | |
| renderTemplate: function () { | |
| var f = this; | |
| p3.fT(f.template, function (g) { | |
| f.$el.html(g()); | |
| p3.rV(new d.Vs.RecentCandidates(), f.$("#recentlyViewed"), false); | |
| p3.rV(new d.Vs.RecentlyAdded(), f.$("#recentlyAdded"), false); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.jQueryUI, function () { | |
| f.initializeAutoComplete() | |
| }) | |
| }) | |
| }, | |
| switchTab: function (g) { | |
| g.stopPropagation(); | |
| g.preventDefault(); | |
| var i = this, | |
| f = $(g.currentTarget), | |
| h; | |
| i.$(".tab").removeClass("active"); | |
| f.addClass("active"); | |
| h = f.attr("data-toggle"); | |
| i.$(".tab-pane").removeClass("active"); | |
| $("#" + h).addClass("active") | |
| }, | |
| initializeAutoComplete: function () { | |
| var f = $("#candidateSearch"); | |
| if (f.length) { | |
| f.autocomplete({ | |
| candidatesAll: null, | |
| minLength: 2, | |
| previousSearch: "", | |
| source: function (h, i) { | |
| var g = this; | |
| g.collection = new d.Cs.FindACandidate(); | |
| g.fetchComplete = function (j) { | |
| var r = new RegExp($.ui.autocomplete.escapeRegex(e.removeDiacritics(this.term)), "i"), | |
| k = j.where({ | |
| TypeParentRoleId: 554 | |
| }), | |
| m = j.where({ | |
| TypeParentRoleId: 22 | |
| }), | |
| p = j.where({ | |
| TypeParentRoleId: 555 | |
| }), | |
| o = j.where({ | |
| TypeParentRoleId: 563 | |
| }), | |
| n = j.where({ | |
| TypeParentRoleId: 23 | |
| }), | |
| q = j.where({ | |
| TypeParentRoleId: 564 | |
| }), | |
| l = []; | |
| l = l.concat(k); | |
| l = l.concat(m); | |
| l = l.concat(p); | |
| l = l.concat(o); | |
| l = l.concat(n); | |
| l = l.concat(q); | |
| i($.map(l, function (t) { | |
| if (e.removeDiacritics(t.attributes.SearchFirstName).match(r) || e.removeDiacritics(t.attributes.SearchLastName).match(r)) { | |
| var u = "", | |
| s = []; | |
| if (t.attributes.TypeParentRoleId == 563 || t.attributes.TypeParentRoleId == 23 || t.attributes.TypeParentRoleId == 564) { | |
| if (t.attributes.SearchFirstName != "") { | |
| u += t.attributes.SearchFirstName | |
| } | |
| if (t.attributes.SearchLastName != "") { | |
| u += " " + t.attributes.SearchLastName | |
| } | |
| s.push({ | |
| value: u, | |
| obj: t, | |
| parent: true | |
| }); | |
| u = "" | |
| } | |
| if (t.attributes.DisplayFirstName != "") { | |
| u += t.attributes.DisplayFirstName | |
| } | |
| if (t.attributes.DisplayLastName != "") { | |
| u += " " + t.attributes.DisplayLastName | |
| } | |
| s.push({ | |
| value: u, | |
| obj: t, | |
| parent: false, | |
| userId: t.attributes.DisplayUserId | |
| }); | |
| return s | |
| } | |
| })) | |
| }; | |
| g.collection.fetch({ | |
| cache: false, | |
| data: { | |
| searchString: $("#candidateSearch").prop("value").slice(0, 2), | |
| searchType: 0 | |
| }, | |
| success: function (j) { | |
| g.fetchComplete(j) | |
| } | |
| }) | |
| }, | |
| select: function (g, h) { | |
| if (!h.item.parent) { | |
| window.location.href = "#candidate/" + h.item.userId + "/record" | |
| } | |
| return false | |
| }, | |
| appendTo: "#searchResults" | |
| }).data("ui-autocomplete")._renderItem = function (h, g) { | |
| if (g.parent) { | |
| return $("<li></li>").addClass("ui-autocomplete-category").append(g.label).appendTo(h) | |
| } | |
| return $("<li></li>").append(g.label).appendTo(h) | |
| }; | |
| f.focus(function () { | |
| var g = $(this); | |
| if (g.val().length > 1) { | |
| g.autocomplete("search") | |
| } | |
| }) | |
| } | |
| } | |
| }); | |
| d.Vs.RecentCandidates = Bb.View.extend({ | |
| template: "admissions/onboard.recentlyviewed.template.html", | |
| id: "candidate-recent", | |
| tagName: "tbody", | |
| initialize: function () { | |
| var f = this; | |
| f.collection = new d.Cs.RecentlyViewed() | |
| }, | |
| render: function (f) { | |
| var g = this; | |
| $(f).append(g.el); | |
| g.renderData() | |
| }, | |
| renderData: function () { | |
| var f = this; | |
| p3.loadingIcon(this.$el.html('<div style="padding: 15px 15px 25px 0px></div>"')); | |
| f.collection.fetch({ | |
| cache: false, | |
| data: { | |
| viewerId: p3.Data.Context.get("UserInfo").UserId, | |
| viewType: 1 | |
| }, | |
| success: function (g) { | |
| p3.fT(f.template, function (h) { | |
| f.$el.html(h({ | |
| collection: g.toJSON(), | |
| photoRefresh: new Date().getTime() | |
| })) | |
| }) | |
| } | |
| }) | |
| } | |
| }); | |
| d.Vs.RecentlyAdded = Bb.View.extend({ | |
| template: "admissions/onboard.recentlyadded.template.html", | |
| id: "candidate-recent", | |
| tagName: "tbody", | |
| initialize: function () { | |
| var f = this; | |
| f.collection = new d.Cs.RecentlyAdded() | |
| }, | |
| render: function (f) { | |
| var g = this; | |
| $(f).append(g.el); | |
| g.renderData() | |
| }, | |
| renderData: function () { | |
| var f = this; | |
| p3.loadingIcon(this.$el.html('<div style="padding: 15px 15px 25px 0px></div>"')); | |
| f.collection.fetch({ | |
| cache: false, | |
| data: {}, | |
| success: function (g) { | |
| p3.fT(f.template, function (h) { | |
| f.$el.html(h({ | |
| collection: g.toJSON(), | |
| photoRefresh: new Date().getTime() | |
| })) | |
| }) | |
| } | |
| }) | |
| } | |
| }); | |
| d.Vs.SchedulesList = Bb.View.extend({ | |
| template: "admissions/onboard.scheduling.scheduleslist.template.html", | |
| initialize: function () { | |
| var f = this; | |
| f.collection = new d.Cs.Schedules(); | |
| f.reminders = new d.Cs.ReminderGroups(); | |
| f.date = c.getDateString(c.localDateTime()).ApiFormat(); | |
| f.listenTo(f.collection, "reset", f.renderData); | |
| this.sort = {} | |
| }, | |
| events: { | |
| "listRefresh #assignment-center-assignment-items": "fetchData", | |
| "click .schedule-date .prev": "datePrev", | |
| "click .schedule-date .next": "dateNext", | |
| "click .schedule-date .today": "dateToday", | |
| "refreshData #sort-table": "fetchData" | |
| }, | |
| render: function (f) { | |
| var g = this; | |
| $(f).append(g.el); | |
| p3.fT(g.template, function (h) { | |
| g.$el.html(h({})); | |
| g.Containers = { | |
| tBody: g.$("tbody") | |
| }; | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.TableSort, function (k) { | |
| k.$("#sort-table").stupidtable(); | |
| k.fetchData(); | |
| var j = "sorting-asc", | |
| i = "sorting-desc"; | |
| k.$("#sort-table").on("aftertablesort", { | |
| sort: k.sort | |
| }, function (m, l) { | |
| m.data.sort.column = l.column; | |
| m.data.sort.direction = l.direction; | |
| $(m.currentTarget).find("th").removeClass(j).removeClass(i).eq(l.column).addClass((l.direction === "asc") ? j : i) | |
| }) | |
| }, g) | |
| }) | |
| }, | |
| fetchData: function () { | |
| this.$("h4").html(c.displayDateFromInvariant(this.date, "longDate")); | |
| this.$(".today").attr("disabled", c.isSameDay(this.date, c.getDateString(c.localDateTime()).ApiFormat())); | |
| p3.clearContainer(this.Containers.tBody); | |
| this.collection.fetch({ | |
| data: { | |
| date: this.date | |
| } | |
| }); | |
| this.renderReminders(false) | |
| }, | |
| renderData: function (f, g) { | |
| var h = jQuery.Event("aftertablesort"), | |
| j = this.$("tfoot"), | |
| i = _.sortBy(f.reject(function (k) { | |
| return k.get("ScheduleType").includes("O") | |
| }), function (k) { | |
| switch (this.sort.column) { | |
| case 2: | |
| switch (k.get("ScheduleType")) { | |
| case "I": | |
| return "Interview"; | |
| case "R": | |
| return "Event"; | |
| case "V": | |
| return "Visit" | |
| } | |
| break; | |
| case 3: | |
| return k.get("ScheduleDesc"); | |
| case 4: | |
| return k.get("AttendeeCount") || k.get("Name"); | |
| case 5: | |
| return k.get("ScheduledWith"); | |
| default: | |
| return k.get("ScheduleDateTicks") | |
| } | |
| }, this); | |
| if (f.length === 0) { | |
| j.show() | |
| } else { | |
| j.hide() | |
| } | |
| _.each((this.sort.direction === "desc") ? i.reverse() : i, function (k) { | |
| p3.rV(new d.Vs.ScheduleRow({ | |
| model: k | |
| }), this.Containers.tBody, false) | |
| }, this); | |
| if (_.isEmpty(this.sort)) { | |
| h.data = { | |
| sort: this.sort | |
| }; | |
| this.$("#sort-table").trigger(h, { | |
| column: 1, | |
| direction: "desc" | |
| }) | |
| } | |
| }, | |
| renderReminders: function (f) { | |
| var g = this; | |
| g.reminders.fetch({ | |
| cache: false, | |
| data: { | |
| targetDate: g.date | |
| }, | |
| success: function (i, k) { | |
| var h = g.$(".adm-schedule"), | |
| j; | |
| if (g.reminders.length) { | |
| j = new d.Vs.Reminders({ | |
| collection: g.reminders, | |
| date: g.date, | |
| expand: f | |
| }); | |
| h.parent().parent().show(); | |
| p3.rV(j, h, true); | |
| g.listenTo(j, "ReminderDismissed", function () { | |
| g.renderReminders(true) | |
| }) | |
| } else { | |
| h.empty(); | |
| h.parent().parent().hide() | |
| } | |
| } | |
| }) | |
| }, | |
| datePrev: function (f) { | |
| f.stopPropagation(); | |
| f.preventDefault(); | |
| var g = this; | |
| g.date = new Date(g.date); | |
| g.date.setDate(g.date.getDate() - 1); | |
| g.date = c.getDateString(g.date).ApiFormat(); | |
| g.fetchData() | |
| }, | |
| dateNext: function (f) { | |
| f.stopPropagation(); | |
| f.preventDefault(); | |
| var g = this; | |
| g.date = new Date(g.date); | |
| g.date.setDate(g.date.getDate() + 1); | |
| g.date = c.getDateString(g.date).ApiFormat(); | |
| g.fetchData() | |
| }, | |
| dateToday: function (f) { | |
| f.stopPropagation(); | |
| f.preventDefault(); | |
| var g = this; | |
| g.date = c.getDateString(c.localDateTime()).ApiFormat(); | |
| g.fetchData() | |
| } | |
| }); | |
| d.Vs.ScheduleRow = Bb.View.extend({ | |
| tagName: "tr", | |
| template: "admissions/onboard.scheduling.schedule.row.template.html", | |
| events: { | |
| 'click [data-action="manage-schedule"]': "clickManage", | |
| 'click [data-action="delete-schedule"]': "clickDelete", | |
| 'click [value="schedule-attendee"]': "clickAttendees", | |
| "click .agenda": "showAgenda" | |
| }, | |
| render: function (f) { | |
| var g = this; | |
| p3.fT(g.template, function (h) { | |
| g.$el.appendTo(f).html(h({ | |
| model: g.model.toJSON() | |
| })) | |
| }) | |
| }, | |
| clickManage: function (f) { | |
| f.preventDefault(); | |
| switch (this.model.get("ScheduleType")) { | |
| case "I": | |
| a.Us.EditInterview(this.model.get("ScheduleId"), this.model.get("ProspectInstanceId")); | |
| break; | |
| case "V": | |
| a.Us.EditVisit(this.model.get("ScheduleId"), this.model.get("ProspectInstanceId")); | |
| break | |
| } | |
| }, | |
| clickDelete: function (f) { | |
| f.preventDefault(); | |
| var h = this, | |
| g; | |
| switch (h.model.get("ScheduleType")) { | |
| case "I": | |
| g = new a.Ms.Interview({ | |
| InterviewId: h.model.get("ScheduleId") | |
| }); | |
| break; | |
| case "V": | |
| g = new a.Ms.Visit({ | |
| VisitId: h.model.get("ScheduleId") | |
| }); | |
| break | |
| } | |
| g.set({ | |
| prospectInstanceId: h.model.get("ProspectInstanceId") | |
| }); | |
| this.listenTo(g, "destroy", function () { | |
| h.remove() | |
| }); | |
| a.Us.DeleteAppointment(g) | |
| }, | |
| clickAttendees: function () { | |
| p3.rV(new d.Vs.ScheduleAttendees({ | |
| model: this.model | |
| }), p3.Layout.Containers.Modal, true) | |
| }, | |
| showAgenda: function () { | |
| var g = this, | |
| f; | |
| switch (g.model.get("ScheduleType")) { | |
| case "I": | |
| f = 7; | |
| break; | |
| case "V": | |
| f = 12; | |
| break | |
| } | |
| a.Us.AgendaModal(f, g.model.get("ScheduleId"), g.model.get("ProspectInstanceId"), g.model.get("Name")) | |
| } | |
| }); | |
| d.Vs.ScheduleAttendees = Bb.View.extend({ | |
| className: "modal-dialog", | |
| template: "admissions/onboard.scheduling.schedule.attendees.template.html", | |
| render: function (f) { | |
| var g = this; | |
| new d.Cs.EventAttendees().fetch({ | |
| data: { | |
| registrationId: this.model.get("ScheduleId") | |
| }, | |
| success: function (h) { | |
| p3.fT(g.template, function (i) { | |
| g.$el.appendTo(f).html(i({ | |
| model: g.model.toJSON(), | |
| collection: _.sortBy(h.toJSON(), function (k) { | |
| var j = _.findWhere(k.AttendeeGroupList, { | |
| Attendee: "Candidate" | |
| }); | |
| if (j) { | |
| return j.Lastname + " " + j.Firstname | |
| } | |
| }) | |
| })); | |
| p3.showModal(p3.Layout.Containers.Modal) | |
| }) | |
| } | |
| }) | |
| } | |
| }); | |
| d.Vs.Reminders = Bb.View.extend({ | |
| template: "admissions/onboard.scheduling.reminders.template.html", | |
| initialize: function (f) { | |
| var g = this; | |
| g.date = f.date; | |
| g.expand = f.expand || false | |
| }, | |
| events: { | |
| "click .toggleinfo": "toggleInfo" | |
| }, | |
| render: function (f) { | |
| $(f).append(this.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var f = this; | |
| p3.fT(f.template, function (g) { | |
| f.$el.html(g({ | |
| collection: f.collection.toJSON(), | |
| totalReminders: f.collection.length ? f.collection.at(0).get("TotalUniqueReminders") : 0, | |
| expand: f.expand | |
| })); | |
| f.collection.each(function (h) { | |
| var i = h.get("Reminders"); | |
| _(i).each(function (k) { | |
| var j = f.$(".adm-schedule-reminders[data-id=" + h.get("AdmOfficerId") + "]"), | |
| l = new d.Vs.Reminder({ | |
| model: new d.Ms.Reminder(k) | |
| }); | |
| p3.rV(l, j, false); | |
| f.listenTo(l, "ReminderDismissed", function (m) { | |
| f.trigger("ReminderDismissed", m) | |
| }) | |
| }) | |
| }) | |
| }) | |
| }, | |
| toggleInfo: function (f) { | |
| var g = this; | |
| f.stopPropagation(); | |
| f.preventDefault(); | |
| if (g.collection.length) { | |
| g.$(".info").slideToggle("fast") | |
| } | |
| } | |
| }); | |
| d.Vs.Reminder = Bb.View.extend({ | |
| template: "admissions/onboard.scheduling.reminder.template.html", | |
| tagName: "table", | |
| className: "table table-condensed white-bgc mb-0", | |
| events: { | |
| "click .dismiss": "dismissReminder" | |
| }, | |
| render: function (f) { | |
| $(f).append(this.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var f = this; | |
| p3.fT(f.template, function (g) { | |
| f.$el.html(g({ | |
| model: f.model.toJSON(), | |
| args: f.model.get("ProspectUserId") + "/checklist" | |
| })) | |
| }) | |
| }, | |
| dismissReminder: function (f) { | |
| var g = this; | |
| f.stopPropagation(); | |
| f.preventDefault(); | |
| g.model.save({ | |
| DismissInd: true | |
| }, { | |
| success: function () { | |
| g.trigger("ReminderDismissed", g.model) | |
| } | |
| }) | |
| } | |
| }) | |
| }(p3.module("admissions/scheduling"))); | |
| (function (e) { | |
| var f = p3.module("utilities/smodal"), | |
| a = p3.module("shared/base"), | |
| d = p3.module("utilities/multifetch"), | |
| g = p3.Us.Tools, | |
| b = p3.Us.Enum, | |
| c = p3.Us.InfoMessageLibrary; | |
| e.Ms.Decision = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| idAttribute: "AdmDecisionId", | |
| url: function () { | |
| return this.id ? aP + "AdmDecision/Edit/" + this.id + "/" : aP + "AdmDecision/Edit/" | |
| }, | |
| validation: { | |
| AdmDecisionName: [{ | |
| required: true, | |
| msg: c.P3.RequiredInfoNotEntered | |
| }], | |
| AdmDecisionTypeId: [{ | |
| required: true, | |
| msg: c.P3.RequiredInfoNotEntered | |
| }] | |
| } | |
| }); | |
| e.Ms.CandidateDecision = Bbm.extend({ | |
| idAttribute: "CandDecisionId", | |
| validation: { | |
| CandDecisionName: [{ | |
| required: true, | |
| msg: c.P3.RequiredInfoNotEntered | |
| }], | |
| CandDecisionTypeId: [{ | |
| required: true, | |
| msg: c.P3.RequiredInfoNotEntered | |
| }] | |
| } | |
| }); | |
| e.Cs.Decisions = Bbc.extend({ | |
| useSort: false, | |
| sync: a.DataParamSync, | |
| model: e.Ms.Decision, | |
| url: function () { | |
| if (this.useSort) { | |
| this.useSort = false; | |
| return aP + "AdmDecision/EditSort/" | |
| } | |
| return aP + "AdmDecision/List/" | |
| } | |
| }); | |
| e.Cs.CandidateDecisions = Bbc.extend({ | |
| model: e.Ms.CandidateDecision | |
| }); | |
| e.Vs.Layout = Bb.View.extend({ | |
| template: "page/page.12.template.html", | |
| initialize: function (h) { | |
| var i = this; | |
| i.Containers = {}; | |
| i.collection = new e.Cs.Decisions() | |
| }, | |
| render: function (i) { | |
| var j = this, | |
| h; | |
| p3.setTitle("Decisions"); | |
| $(i).html(j.el); | |
| h = $.extend({}, b.DictionaryData.ADMCommTempActiveUserTemp); | |
| h.inputParam = h.inputParam.replace("@user_id=0[i]", "@user_id=" + p3.Data.Context.attributes.UserInfo.UserId + "[i]"); | |
| d.Us.Fetch({ | |
| ADMDecisionPlaceholder: { | |
| data: new d.Cs.Dictionary(), | |
| dataParams: b.DictionaryData.ADMDecisionPlaceholder | |
| }, | |
| ADMDecisionType: { | |
| data: new d.Cs.Dictionary(), | |
| dataParams: b.DictionaryData.ADMDecisionType | |
| }, | |
| ADMCommTempActiveUserTemp: { | |
| data: new d.Cs.Dictionary(), | |
| dataParams: h | |
| }, | |
| ADMCandDecisionType: { | |
| data: new d.Cs.Dictionary(), | |
| dataParams: b.DictionaryData.ADMCandDecisionType | |
| } | |
| }, function (k, m, l) { | |
| if (l) { | |
| p3.displayError("There was an error loading data.") | |
| } | |
| e.Data.Dictionaries = k; | |
| j.renderData() | |
| }) | |
| }, | |
| renderData: function () { | |
| var h = this; | |
| p3.fT(h.template, function (i) { | |
| h.$el.html(i({})); | |
| p3.rV(new e.Vs.Main({ | |
| collection: h.collection | |
| }), h.$(".col-center"), false) | |
| }) | |
| } | |
| }); | |
| e.Vs.Main = Bb.View.extend({ | |
| template: "schooldecisions/schooldecisions.main.template.html", | |
| className: "subhead", | |
| events: { | |
| "click #add-decision": "addDecision" | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| $(h).html(i.el); | |
| i.renderData() | |
| }, | |
| renderData: function () { | |
| var h = this; | |
| p3.fT(h.template, function (i) { | |
| h.$el.html(i()); | |
| p3.rV(new e.Vs.Decisions({ | |
| collection: h.collection | |
| }), h.$(".school-decisions-container"), true) | |
| }) | |
| }, | |
| addDecision: function (i) { | |
| i.preventDefault(); | |
| var j = this, | |
| h = new e.Vs.DecisionModal({ | |
| model: new e.Ms.Decision({ | |
| CandDecisions: [{ | |
| "$type": "clBLL.nAdmissions.CandDecision, clBLL" | |
| }] | |
| }), | |
| dictionaries: e.Data.Dictionaries | |
| }); | |
| j.listenToOnce(h, "modelSaved", function () { | |
| j.collection.add(h.model) | |
| }); | |
| f.Us.renderModal(h) | |
| } | |
| }); | |
| e.Vs.Decisions = Bb.View.extend({ | |
| template: "schooldecisions/schooldecisions.decisions.template.html", | |
| initialize: function (h) { | |
| var i = this; | |
| i.collection.bind("add", function (k) { | |
| var j = new e.Vs.Decision({ | |
| model: k, | |
| parentView: i | |
| }); | |
| p3.rV(j, i.$(".decisions-table tbody"), false) | |
| }, this) | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| $(h).append(i.el); | |
| i.renderData() | |
| }, | |
| renderData: function () { | |
| var h = this; | |
| p3.fT(h.template, function (i) { | |
| h.$el.html(i({})); | |
| h.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| complete: function () { | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.jQueryUI, function () { | |
| _.defer(function () { | |
| h.initSortable() | |
| }) | |
| }) | |
| } | |
| }) | |
| }) | |
| }, | |
| initSortable: function () { | |
| var h = this; | |
| h.$(".ui-sortable").sortable({ | |
| items: ".sort-drag-block", | |
| axis: "y", | |
| distance: 5, | |
| containment: ".ui-sortable", | |
| appendTo: "#school-decisions-holder", | |
| placeholder: "sortable-placeholder", | |
| helper: function (j, k) { | |
| var i = '<table class="table table-striped sort-drag-block-helper"><tbody>' + k.context.outerHTML + "</tbody></table>"; | |
| return i | |
| }, | |
| update: function (j, m) { | |
| var i = $(m.item), | |
| k = i.index(), | |
| l = m.item.triggerHandler("sortorder"); | |
| h.collection.remove(h.collection.at(h.collection.indexOf(l))); | |
| h.collection.add(l, { | |
| at: k, | |
| silent: true | |
| }); | |
| h.collection.useSort = true; | |
| h.collection.save({}) | |
| } | |
| }).disableSelection() | |
| } | |
| }); | |
| e.Vs.Decision = Bb.View.extend({ | |
| template: "schooldecisions/schooldecisions.decision.template.html", | |
| tagName: "tr", | |
| className: "sort-drag-block", | |
| initialize: function () { | |
| var h = this; | |
| Bb.Validation.bind(this, { | |
| forceUpdate: true, | |
| selector: "name" | |
| }); | |
| h.model.bind("sync", h.renderData, h); | |
| _.bind(h.getModel, h) | |
| }, | |
| events: { | |
| "click .edit": "editDecision", | |
| "click .delete:not(:disabled)": "deleteDecision", | |
| sortorder: "getModel" | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| $(h).append(i.el); | |
| i.renderData() | |
| }, | |
| renderData: function () { | |
| var j = this, | |
| h = "", | |
| i = ""; | |
| p3.fT(j.template, function (k) { | |
| _.each(j.model.get("CandDecisions"), function (l) { | |
| h += l.CandDecisionName + "<br />" | |
| }); | |
| i += j.model.get("DisplayContractAfterAccept") ? "Display contract only when candidate has accepted. <br />" : ""; | |
| i += j.model.get("DisplayDeclineReason") ? "When a candidate declines, show Reason for Declining list. <br />" : ""; | |
| i += j.model.get("DisplayDeclineSchool") ? "When a candidate declines, show Chosen School list. <br />" : ""; | |
| j.$el.html(k({ | |
| model: j.model.toJSON(), | |
| candDecisions: h, | |
| displayOptions: i | |
| })); | |
| $(".tooltip-link").tooltip() | |
| }) | |
| }, | |
| editDecision: function (i) { | |
| i.preventDefault(); | |
| var j = this, | |
| h = new e.Vs.DecisionModal({ | |
| model: j.model, | |
| dictionaries: e.Data.Dictionaries | |
| }); | |
| f.Us.renderModal(h) | |
| }, | |
| deleteDecision: function (i) { | |
| var j = this, | |
| h = j.$(".delete"); | |
| h.prop("disabled", true); | |
| p3.showConfirm("Delete Decision", "Wait a minute. Are you really sure you want to delete " + j.model.get("AdmDecisionName") + "?", null, function () { | |
| j.model.destroy({ | |
| success: function () { | |
| j.deleteElement() | |
| }, | |
| error: function () { | |
| p3.displayError("Error deleting decision"); | |
| h.prop("disabled", false) | |
| } | |
| }) | |
| }) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| }, | |
| getModel: function () { | |
| var h = this; | |
| return h.model | |
| } | |
| }); | |
| e.Vs.DecisionModal = f.Vs.Modal2.extend({ | |
| template: "schooldecisions/schooldecisions.edit.template.html", | |
| events: { | |
| "click .add": "addCandidateDecision" | |
| }, | |
| initSortable: function () { | |
| var h = this; | |
| h.$(".ui-sortable").sortable({ | |
| startIndex: 0, | |
| stopIndex: 0, | |
| items: ".sort-drag-block", | |
| axis: "y", | |
| distance: 5, | |
| containment: ".ui-sortable", | |
| appendTo: "#candidate-decisions-holder", | |
| placeholder: "sortable-placeholder", | |
| helper: function (j, k) { | |
| var i = '<table class="table table-striped sort-drag-block-helper"><tbody>' + k.context.outerHTML + "</tbody></table>"; | |
| return i | |
| }, | |
| start: function (i, j) { | |
| this.startIndex = j.item.index() | |
| }, | |
| update: function (i, j) { | |
| this.stopIndex = j.item.index(); | |
| h.candidateDecision.models = g.arrayMove(h.candidateDecision.models, this.startIndex, this.stopIndex) | |
| } | |
| }).disableSelection() | |
| }, | |
| modalInitialized: function () { | |
| var h = this; | |
| h.candidateDecision = new e.Cs.CandidateDecisions(); | |
| h.candidateDecision.bind("add", function (i) { | |
| p3.rV(new e.Vs.CandidateDecision({ | |
| model: i | |
| }), h.$("#candidate-decisions-holder tbody"), false) | |
| }, h) | |
| }, | |
| modalDispose: function () { | |
| var h = this; | |
| $.each(h.$(".tinyeditor"), function () { | |
| var i = tinyMCE.get(this.id); | |
| if (i) { | |
| i.remove() | |
| } | |
| }) | |
| }, | |
| modalRendered: function () { | |
| var h = this; | |
| f.Us.showHtmlEditor(h, "tinyeditor"); | |
| h.candidateDecision.add(h.model.get("CandDecisions")); | |
| p3.Us.PluginManager.Load(p3.Us.PluginManager.Plugins.jQueryUI, function () { | |
| _.defer(function () { | |
| h.initSortable() | |
| }) | |
| }); | |
| h.setFocus() | |
| }, | |
| modalUpdate: function (l) { | |
| var i = this, | |
| h = l.eventCurrentTarget, | |
| j = h.attr("name"), | |
| m = h.val(), | |
| k; | |
| if (h.hasClass("placeholder")) { | |
| tinyMCE.execCommand("mceReplaceContent", false, h.data("value")) | |
| } else { | |
| if (j === "AdmDecisionTypeId") { | |
| k = g.stringToInt(m) !== 1; | |
| i.$(".accepted-options").toggleClass("hide", k); | |
| if (k) { | |
| i.$(".accepted-options button").removeClass("active"); | |
| i.model.set({ | |
| DisplayContractAfterAccept: false, | |
| DisplayDeclineReason: false, | |
| DisplayDeclineSchool: false | |
| }) | |
| } | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| } | |
| } | |
| }, | |
| modalSave: function () { | |
| var i = this, | |
| h = true; | |
| $.each(i.$(".tinyeditor"), function () { | |
| var j = {}; | |
| j[this.name] = tinyMCE.get(this.id).save(); | |
| i.model.set(j) | |
| }); | |
| h = _.every(i.candidateDecision.models, function (j) { | |
| return j.isValid(true) | |
| }); | |
| if (h) { | |
| i.model.set({ | |
| CandDecisions: i.candidateDecision.toJSON() | |
| }) | |
| } else { | |
| return false | |
| } | |
| }, | |
| modalSavedSuccess: function () { | |
| var h = this; | |
| h.trigger("modelSaved") | |
| }, | |
| addCandidateDecision: function (i) { | |
| var j = this, | |
| h = { | |
| "$type": "clBLL.nAdmissions.CandDecision, clBLL", | |
| AdmDecisionId: j.model.get("AdmDecisionId"), | |
| CandDecisionName: "", | |
| CandDecisionTypeId: "", | |
| DeleteInd: false, | |
| InUse: false, | |
| Publish: false | |
| }; | |
| j.candidateDecision.add(h) | |
| } | |
| }); | |
| e.Vs.CandidateDecision = Bb.View.extend({ | |
| template: "schooldecisions/schooldecisions.edit.candidatedecision.template.html", | |
| tagName: "tr", | |
| className: "sort-drag-block", | |
| initialize: function (h) { | |
| Bb.Validation.bind(this, { | |
| forceUpdate: true, | |
| selector: "name" | |
| }) | |
| }, | |
| events: { | |
| "change input": "updateCandidateDecision", | |
| "change select": "updateCandidateDecision", | |
| "click .checkbox-input": "updateCandidateDecision" | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| $(h).append(i.el); | |
| i.renderData() | |
| }, | |
| renderData: function () { | |
| var h = this; | |
| p3.fT(h.template, function (i) { | |
| h.$el.html(i({ | |
| model: h.model.toJSON(), | |
| dictionaries: e.Data.Dictionaries | |
| })) | |
| }) | |
| }, | |
| updateCandidateDecision: function (h) { | |
| f.Us.updateModel(h, this.model, "name") | |
| } | |
| }); | |
| p3.router().route("settings/schooldecisions", "settings/schooldecisions", function () { | |
| e.Data.Dictionaries = {}; | |
| p3.renderMainPage(new e.Vs.Layout({})) | |
| }) | |
| }(p3.module("admissions/SchoolDecisions"))); | |
| (function (e) { | |
| var d = p3.module("admissions/formrender/form"), | |
| c = p3.module("shared/filesreview"), | |
| a = p3.module("shared/base"), | |
| f = p3.module("utilities/smodal"), | |
| g = p3.Us.Tools, | |
| b = p3.Us.Enum; | |
| e.Ms.SelectSchoolFamily = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| url: function () { | |
| return aP + "SmartTuition/SelectSchoolFamily/" | |
| } | |
| }, { | |
| type: "SmartAccount.Ms.SelectSchoolFamily" | |
| }); | |
| e.Ms.Login = Bbm.extend({ | |
| url: function () { | |
| return aP + "SmartTuition/FamilyLogin/" | |
| } | |
| }, { | |
| type: "SmartAccount.Ms.Login" | |
| }); | |
| e.Ms.GenerateSchoolFamilyId = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| url: function () { | |
| return aP + "SmartTuition/GenerateSchoolFamilyId/" | |
| } | |
| }, { | |
| type: "SmartAccount.Ms.GenerateSchoolFamilyId" | |
| }); | |
| e.Ms.ExistingPayer = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| url: function () { | |
| return aP + "SmartTuition/GetExistingPayer" | |
| } | |
| }, { | |
| type: "SmartAccount.Ms.ExistingPayer" | |
| }); | |
| e.Ms.LinkExistingFamily = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| url: function () { | |
| return aP + "SmartTuition/LinkExistingFamily" | |
| } | |
| }, { | |
| type: "SmartAccount.Ms.LinkExistingFamily" | |
| }); | |
| e.Ms.PasswordUrl = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| url: function () { | |
| return aP + "SmartTuition/GetPasswordResetUrl" | |
| } | |
| }, { | |
| type: "SmartAccount.Ms.PasswordUrl" | |
| }); | |
| e.Cs.SmartFamilySnapshotsByUserId = Bbc.extend({ | |
| sync: a.DataParamSync, | |
| url: function () { | |
| return aP + "SmartTuition/SmartSchoolFamilyCheck/" | |
| } | |
| }, { | |
| type: "SmartAccount.Cs.SmartFamilySnapshotsByUserId" | |
| }); | |
| e.Cs.SmartFamilySnapshotsByPhoneEmail = Bbc.extend({ | |
| sync: a.DataParamSync, | |
| url: function () { | |
| return aP + "SmartTuition/FamilySearchPhoneEmail/" | |
| } | |
| }, { | |
| type: "SmartAccount.Cs.SmartFamilySnapshotsByPhoneEmail" | |
| }); | |
| e.Vs.SmartAccount = Bb.View.extend({ | |
| template: "form/form.smart.account.template.html", | |
| events: { | |
| "click .radio-input": "hasAccount", | |
| "click #continue-to-contract:not(.disabled)": "continueToContract", | |
| "click #proceed-with-this-account": "continueToContractWithValidatedAccount", | |
| "click #sign-in-to-a-different-account": "resetSignInForm" | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| $(h).append(i.el); | |
| i.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this, | |
| h = new e.Ms.PasswordUrl(); | |
| h.fetch({ | |
| data: { | |
| schoolYearLabel: i.model.get("SchoolYear") | |
| }, | |
| success: function (j, k) { | |
| p3.fT(i.template, function (l) { | |
| i.$el.html(l({ | |
| form: i.model.toJSON(), | |
| schoolName: p3.Data.SchoolContext.get("SchoolInfo").SchoolName, | |
| url: h.get("PasswordURL"), | |
| rejectMessage: i.options.rejectMessage | |
| })); | |
| i.options.rejectMessage = undefined; | |
| if (i.options.triggerSelection === "yes") { | |
| document.getElementById("btn-yes-to-account").click() | |
| } | |
| if (i.options.triggerSelection === "no") { | |
| document.getElementById("btn-no-to-account").click() | |
| } | |
| }) | |
| }, | |
| error: function (k, j) { | |
| p3.displayError("Error getting smart password url") | |
| } | |
| }) | |
| }, | |
| hasAccount: function (j) { | |
| var k = this, | |
| h = $("#has-smart-holder"), | |
| i = $("#no-smart-holder"); | |
| $("#continue-btn-holder").show(); | |
| $("#different-smart-account-selected-holder").hide(); | |
| $("#proceed-or-not-btn-holder").hide(); | |
| e.Us.VerifySmartSetupType(k.options.smartSetupTypeId, function () { | |
| k.hasAccount = g.stringToBoolean($(j.currentTarget).children("input").prop("value")); | |
| $("#continue-to-contract").removeClass("disabled"); | |
| h.toggle(k.hasAccount); | |
| i.toggle(!k.hasAccount) | |
| }) | |
| }, | |
| continueToContract: function (h) { | |
| var i = this; | |
| e.Us.VerifySmartSetupType(i.options.smartSetupTypeId, function () { | |
| if (i.hasAccount) { | |
| i.signIn() | |
| } else { | |
| i.createAccount() | |
| } | |
| }) | |
| }, | |
| resetSignInForm: function () { | |
| $("#user-name-box").val(""); | |
| $("#password-box").val(""); | |
| $("#has-smart-holder").toggle(true); | |
| $("#continue-btn-holder").show(); | |
| $("#different-smart-account-selected-holder").hide(); | |
| $("#proceed-or-not-btn-holder").hide(); | |
| $("#continue-to-contract").removeClass("disabled") | |
| }, | |
| signIn: function () { | |
| var p = this, | |
| j = $("#user-name-box"), | |
| n = j.val(), | |
| k = $("#password-box"), | |
| m = k.val(), | |
| o = true, | |
| i = $("#error-msg"), | |
| h = p.$("#continue-to-contract"), | |
| l; | |
| i.hide(); | |
| p.$(".control-group").removeClass("error"); | |
| p.$(".form-control").removeClass("box-validate"); | |
| if (n.length === 0) { | |
| o = false; | |
| $("#user-name-group").addClass("error"); | |
| j.addClass("box-validate"); | |
| i.html("Please enter a username and password").show() | |
| } | |
| if (m.length === 0) { | |
| o = false; | |
| $("#password-group").addClass("error"); | |
| k.addClass("box-validate"); | |
| i.html("Please enter a username and password").show() | |
| } | |
| if (o) { | |
| h.addClass("disabled"); | |
| l = new e.Ms.Login({ | |
| schoolYearLabel: p.model.get("SchoolYear"), | |
| userName: n, | |
| password: m, | |
| contractId: p.options.KeyId, | |
| skipFamilyIdSave: !g.isEmpty(p.model.get("EmailPhoneMatchSnapshotSelected")) | |
| }); | |
| l.save({}, { | |
| success: function (q, r) { | |
| p.model.attributes.ValidatedLoginResponseSnapshot = r; | |
| if (jQuery.isEmptyObject(r)) { | |
| h.removeClass("disabled"); | |
| i.html("Invalid username/password").show() | |
| } else { | |
| if (!r.SchoolFamilyId) { | |
| p.createAccount() | |
| } else { | |
| if (!g.isEmpty(p.model.get("EmailPhoneMatchSnapshotSelected"))) { | |
| if (p.model.get("EmailPhoneMatchSnapshotSelected").FamilyId !== r.FamilyId) { | |
| $("#has-smart-holder").toggle(false); | |
| $("#continue-btn-holder").hide(); | |
| $("#different-smart-account-selected-holder").show(); | |
| $("#proceed-or-not-btn-holder").show(); | |
| $("#validated-smart-account").text(r.FirstName + " " + r.LastName + " - " + r.FamilyId) | |
| } else { | |
| p.continueToContractWithValidatedAccount() | |
| } | |
| } else { | |
| p.loadContract() | |
| } | |
| } | |
| } | |
| }, | |
| error: function (q, r) { | |
| var s = e.Us.ParseErrorResponse(r.responseText, "SMART-ID-REJECTED:") || "Error logging in to smart"; | |
| h.removeClass("disabled"); | |
| i.text(s).show() | |
| } | |
| }) | |
| } | |
| }, | |
| continueToContractWithValidatedAccount: function (i) { | |
| var k = this, | |
| j = new e.Ms.SelectSchoolFamily(k.model.get("ValidatedLoginResponseSnapshot")), | |
| h = $("#continue-to-contract"); | |
| h.addClass("disabled"); | |
| e.Us.VerifySmartSetupType(k.options.smartSetupTypeId, function () { | |
| j.save({}, { | |
| dataParam: { | |
| contractId: e.Data.KeyId | |
| }, | |
| success: function (l, m) { | |
| window.location.replace("#contract/" + e.Data.FormId + "/keyid=" + e.Data.KeyId) | |
| }, | |
| error: function (m, l) { | |
| h.removeClass("disabled"); | |
| p3.displayError("Error saving smart tuition family") | |
| } | |
| }) | |
| }) | |
| }, | |
| createAccount: function () { | |
| var j = this, | |
| h = j.$("#continue-to-contract"), | |
| i = new e.Ms.GenerateSchoolFamilyId(); | |
| h.addClass("disabled"); | |
| i.fetch({ | |
| data: { | |
| contractId: j.options.KeyId, | |
| secondPayer: false | |
| }, | |
| success: function (k, l) { | |
| j.loadContract() | |
| }, | |
| error: function (l, k) { | |
| h.removeClass("disabled"); | |
| p3.displayError("Error generating family id") | |
| } | |
| }) | |
| }, | |
| loadContract: function () { | |
| var h = this; | |
| window.location.replace("#contract/" + h.options.ApplicationFormId + "/keyid=" + h.options.KeyId) | |
| } | |
| }); | |
| e.Vs.SmartAccountMultiple = Bb.View.extend({ | |
| template: "form/form.smart.account.multiple.template.html", | |
| events: { | |
| "click .radio-sky-input": "selectAccount", | |
| "click #continue-to-contract:not(.disabled)": "continueToContract", | |
| "click #email-phone-match-yes-btn:not(.disabled)": "returnToSmartAccountViewAndSelectYes", | |
| "click #email-phone-match-no-btn": "returnToSmartAccountViewAndSelectNo" | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| $(h).append(i.el); | |
| i.renderData() | |
| }, | |
| renderData: function () { | |
| var h = this; | |
| p3.fT(h.template, function (i) { | |
| h.$el.html(i({ | |
| schoolName: p3.Data.SchoolContext.get("SchoolInfo").SchoolName, | |
| form: h.model.toJSON(), | |
| collection: h.collection.toJSON() | |
| })) | |
| }) | |
| }, | |
| selectAccount: function (i) { | |
| var k = this, | |
| h = $(i.currentTarget), | |
| j = h.children("input").prop("value"); | |
| k.snapshot = _.findWhere(k.collection.toJSON(), { | |
| FamilyId: j | |
| }); | |
| $("#sign-in-notice").show(); | |
| $("#continue-to-contract").removeClass("disabled"); | |
| $("#email-phone-match-yes-btn").removeClass("disabled") | |
| }, | |
| continueToContract: function (i) { | |
| var k = this, | |
| j = new e.Ms.SelectSchoolFamily(k.snapshot), | |
| h = $("#continue-to-contract"); | |
| h.addClass("disabled"); | |
| e.Us.VerifySmartSetupType(k.options.smartSetupTypeId, function () { | |
| j.save({}, { | |
| dataParam: { | |
| contractId: e.Data.KeyId | |
| }, | |
| success: function (l, m) { | |
| window.location.replace("#contract/" + e.Data.FormId + "/keyid=" + e.Data.KeyId) | |
| }, | |
| error: function (m, l) { | |
| h.removeClass("disabled"); | |
| p3.displayError("Error saving smart tuition family") | |
| } | |
| }) | |
| }) | |
| }, | |
| returnToSmartAccountViewAndSelectYes: function () { | |
| var h = this; | |
| h.model.attributes.EmailPhoneMatchSnapshotSelected = h.snapshot; | |
| p3.renderMainPage(new e.Vs.SmartAccount({ | |
| ApplicationFormId: h.options.ApplicationFormId, | |
| KeyId: h.options.KeyId, | |
| model: h.model, | |
| smartSetupTypeId: h.options.smartSetupTypeId, | |
| triggerSelection: "yes" | |
| })) | |
| }, | |
| returnToSmartAccountViewAndSelectNo: function () { | |
| var h = this; | |
| p3.renderMainPage(new e.Vs.SmartAccount({ | |
| ApplicationFormId: h.options.ApplicationFormId, | |
| KeyId: h.options.KeyId, | |
| model: h.model, | |
| smartSetupTypeId: h.options.smartSetupTypeId, | |
| triggerSelection: "no" | |
| })) | |
| } | |
| }); | |
| e.Vs.ExistingPayer = Bb.View.extend({ | |
| template: "form/form.smart.second.payer.template.html", | |
| events: { | |
| "click #new-account-button": "createAccount", | |
| "click #existing-account-button": "useExisting" | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| $(h).append(i.el); | |
| i.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this, | |
| h = new e.Ms.ExistingPayer(); | |
| h.fetch({ | |
| data: { | |
| contractId: i.options.KeyId | |
| }, | |
| success: function () { | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({ | |
| form: i.model.toJSON(), | |
| ExistingUser: h.get("FirstName") + " " + h.get("LastName") | |
| })) | |
| }) | |
| }, | |
| error: function () { | |
| p3.displayError("Error checking existing payer") | |
| } | |
| }) | |
| }, | |
| createAccount: function (i) { | |
| var j = this, | |
| h; | |
| e.Us.VerifySmartSetupType(j.options.SetupTypeId, function () { | |
| h = f.Vs.Modal2.extend({ | |
| template: "utilities/utilities.smodal.confirm.html", | |
| size: "md", | |
| variables: { | |
| title: "Joint or split accounts", | |
| text: "<p><b>Are you sure you want to have a different Smart Tuition account than the other person responsible for paying tuition and fees for this student?</b><p><p>If yes, an account will be set up for 50% of the tuition and fees due. If your school charges a tuition deposit or enrollment fees, the first payer completing the contract will be responsible for paying 100% of those at the time the contract is completed. If you need to change this arrangement, please contact your school directly.", | |
| cancelText: "Cancel", | |
| confirmText: "Yes, create a second Smart Tuition Account" | |
| }, | |
| modalSave: function () { | |
| p3.Layout.Containers.Modal.modal("hide"); | |
| j.$(".smart-option-content-section").hide(); | |
| j.$(".smart-option-loading").show(); | |
| e.Us.CheckForSmartAccountByUserId(j.model, j.options.ApplicationFormId, j.options.KeyId); | |
| return false | |
| } | |
| }); | |
| f.Us.renderModal(new h({})) | |
| }) | |
| }, | |
| useExisting: function (h) { | |
| var i = this; | |
| e.Us.VerifySmartSetupType(i.options.SetupTypeId, function () { | |
| i.$(".smart-option-loading").show(); | |
| i.$(".smart-option-container").hide(); | |
| e.Us.AddSecondPayerToSmartFamily(i.options.ApplicationFormId, i.options.KeyId) | |
| }) | |
| } | |
| }); | |
| e.Vs.SecondChild = Bb.View.extend({ | |
| template: "form/form.smart.second.child.template.html", | |
| events: { | |
| "click #new-account-button": "createAccount", | |
| "click #existing-account-button": "useExisting" | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| $(h).append(i.el); | |
| i.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this, | |
| h = p3.Data.SchoolContext.get("SchoolInfo").SchoolName; | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({ | |
| form: i.model.toJSON(), | |
| schoolName: h | |
| })) | |
| }) | |
| }, | |
| createAccount: function (i) { | |
| var j = this, | |
| h; | |
| e.Us.VerifySmartSetupType(j.options.SetupTypeId, function () { | |
| h = f.Vs.Modal2.extend({ | |
| template: "utilities/utilities.smodal.confirm.html", | |
| size: "md", | |
| variables: { | |
| title: "Create a second Smart Tuition account", | |
| text: "<p><b>Are you sure you want to create a separate Smart Tuition account for this child?</b><p><p>Only choose to create a separate Smart Tuition account if there will be different responsible payers, different payment plans or different payment methods for each child.<p><p>Having separate Smart Tuition accounts means your children's school expenses will appear on different invoices. Also, if your payment plans charge an administrative fee, you will need to pay it for each child.<p>", | |
| cancelText: "Cancel", | |
| confirmText: "Yes, create a second Smart Tuition Account" | |
| }, | |
| modalSave: function () { | |
| p3.Layout.Containers.Modal.modal("hide"); | |
| j.$(".smart-option-loading").show(); | |
| j.$(".bb-tile-content-section").hide(); | |
| e.Us.CheckForSmartAccountByUserId(j.model, j.options.ApplicationFormId, j.options.KeyId, b.SmartFamilySetupMode.Enroll2ndStudentSeparate.Value); | |
| return false | |
| } | |
| }); | |
| f.Us.renderModal(new h({})) | |
| }) | |
| }, | |
| useExisting: function (h) { | |
| var i = this; | |
| e.Us.VerifySmartSetupType(i.options.SetupTypeId, function () { | |
| i.$(".smart-option-loading").show(); | |
| i.$(".bb-tile-content-section").hide(); | |
| e.Us.LinkSmartFamilyToContract(i.model, i.options.KeyId, i.options.SetupTypeId) | |
| }) | |
| } | |
| }); | |
| e.Vs.SecondParentNoSplit = Bb.View.extend({ | |
| template: "form/form.smart.second.payer.nosplit.template.html", | |
| events: { | |
| "click #continue-button": "addPayer" | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| $(h).append(i.el); | |
| i.renderData() | |
| }, | |
| renderData: function () { | |
| var i = this, | |
| h = new e.Ms.ExistingPayer(); | |
| h.fetch({ | |
| data: { | |
| contractId: i.options.KeyId | |
| }, | |
| success: function () { | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({ | |
| form: i.model.toJSON(), | |
| ExistingUser: h.get("FirstName") + " " + h.get("LastName") | |
| })) | |
| }) | |
| }, | |
| error: function () { | |
| p3.displayError("Error checking existing payer") | |
| } | |
| }) | |
| }, | |
| addPayer: function (h) { | |
| var i = this; | |
| e.Us.AddSecondPayerToSmartFamily(i.options.ApplicationFormId, i.options.KeyId) | |
| } | |
| }); | |
| e.Us.AddSecondPayerToSmartFamily = function (h, j) { | |
| var i = new e.Ms.GenerateSchoolFamilyId(); | |
| i.fetch({ | |
| data: { | |
| contractId: j, | |
| secondPayer: true | |
| }, | |
| success: function (k, l) { | |
| window.location.replace("#contract/" + h + "/keyid=" + j) | |
| }, | |
| error: function (k, l) { | |
| $("#site-main .smart-option-loading").hide(); | |
| $("#site-main .smart-option-container").show(); | |
| p3.displayError("Error adding second payer to school family id") | |
| } | |
| }) | |
| }; | |
| e.Us.CreateFamilyForSecondPayer = function (h, j) { | |
| var i = new e.Ms.GenerateSchoolFamilyId(); | |
| i.fetch({ | |
| data: { | |
| contractId: j, | |
| secondPayer: false | |
| }, | |
| success: function (k, l) { | |
| window.location.replace("#contract/" + h + "/keyid=" + j) | |
| }, | |
| error: function (k, l) { | |
| $("#site-main .smart-option-loading").hide(); | |
| $("#site-main .smart-option-container").show(); | |
| p3.displayError("Error creating family for second payer") | |
| } | |
| }) | |
| }; | |
| e.Us.LinkSmartFamilyToContract = function (i, j, l) { | |
| var k = new e.Ms.LinkExistingFamily(), | |
| h = i.get("ApplicationFormId"); | |
| k.save({}, { | |
| dataParam: { | |
| contractId: j, | |
| setupTypeId: l | |
| }, | |
| success: function (m, n) { | |
| if (!n || !n.SchoolFamilyId) { | |
| e.Us.CheckForSmartAccountByUserId(i, h, j) | |
| } else { | |
| window.location.replace("#contract/" + h + "/keyid=" + j) | |
| } | |
| }, | |
| error: function (n, m) { | |
| $("#site-main .smart-option-loading").hide(); | |
| $("#site-main .smart-option-container").show(); | |
| p3.displayError("Error linking smart family") | |
| } | |
| }) | |
| }; | |
| e.Us.CheckForSmartAccountByUserId = function (i, h, j, k) { | |
| var l = new e.Cs.SmartFamilySnapshotsByUserId(); | |
| l.fetch({ | |
| data: { | |
| schoolYearLabel: i.get("SchoolYear"), | |
| contractId: j, | |
| smartSetupTypeId: k | |
| }, | |
| success: function (m, n) { | |
| if (n.length === 0) { | |
| e.Us.CheckForSmartAccountByPhoneEmail(i, h, j, k) | |
| } else { | |
| if (n.length === 1) { | |
| window.location.replace("#contract/" + h + "/keyid=" + j) | |
| } else { | |
| if (n.length > 1) { | |
| p3.renderMainPage(new e.Vs.SmartAccountMultiple({ | |
| ApplicationFormId: h, | |
| KeyId: j, | |
| model: i, | |
| collection: l, | |
| smartSetupTypeId: k | |
| })) | |
| } | |
| } | |
| } | |
| }, | |
| error: function (m, n) { | |
| var o = e.Us.ParseErrorResponse(n.responseText, "SMART-ID-REJECTED:"); | |
| $("#site-main .smart-option-loading").hide(); | |
| $("#site-main .smart-option-container").show(); | |
| if (o) { | |
| p3.renderMainPage(new e.Vs.SmartAccount({ | |
| ApplicationFormId: h, | |
| KeyId: j, | |
| model: i, | |
| rejectMessage: o, | |
| smartSetupTypeId: k | |
| })) | |
| } else { | |
| p3.displayError("Error checking smart family") | |
| } | |
| } | |
| }) | |
| }; | |
| e.Us.CheckForSmartAccountByPhoneEmail = function (i, h, j, k) { | |
| var l = new e.Cs.SmartFamilySnapshotsByPhoneEmail(); | |
| l.fetch({ | |
| data: { | |
| schoolYearLabel: i.get("SchoolYear"), | |
| contractId: j | |
| }, | |
| success: function (m, n) { | |
| if (n.length === 0) { | |
| p3.renderMainPage(new e.Vs.SmartAccount({ | |
| ApplicationFormId: h, | |
| KeyId: j, | |
| model: i, | |
| smartSetupTypeId: k | |
| })) | |
| } else { | |
| if (n.length === 1) { | |
| i.attributes.PhoneOrEmailMatched = true; | |
| p3.renderMainPage(new e.Vs.SmartAccountMultiple({ | |
| ApplicationFormId: h, | |
| KeyId: j, | |
| model: i, | |
| collection: l, | |
| smartSetupTypeId: k | |
| })) | |
| } else { | |
| if (n.length > 1) { | |
| i.attributes.PhoneOrEmailMatched = true; | |
| p3.renderMainPage(new e.Vs.SmartAccountMultiple({ | |
| ApplicationFormId: h, | |
| KeyId: j, | |
| model: i, | |
| collection: l, | |
| smartSetupTypeId: k | |
| })) | |
| } | |
| } | |
| } | |
| }, | |
| error: function (m, n) { | |
| var o = e.Us.ParseErrorResponse(n.responseText, "SMART-ID-REJECTED:"); | |
| $("#site-main .smart-option-loading").hide(); | |
| $("#site-main .smart-option-container").show(); | |
| if (o) { | |
| p3.renderMainPage(new e.Vs.SmartAccount({ | |
| ApplicationFormId: h, | |
| KeyId: j, | |
| model: i, | |
| rejectMessage: o, | |
| smartSetupTypeId: k | |
| })) | |
| } else { | |
| p3.displayError("Error checking smart family") | |
| } | |
| } | |
| }) | |
| }; | |
| e.Us.VerifySmartSetupType = function (m, h) { | |
| var i, l, j, k; | |
| if (m) { | |
| l = new c.Ms.SmartTuitionContractSetup(); | |
| l.fetch({ | |
| data: { | |
| contractId: e.Data.KeyId | |
| }, | |
| success: function (n, o) { | |
| i = l.get("SmartSetupTypeId"); | |
| if (i === m || (i === b.SmartFamilySetupMode.Enroll2ndStudent.Value && m === b.SmartFamilySetupMode.Enroll2ndStudentSeparate.Value)) { | |
| h() | |
| } else { | |
| k = f.Vs.Modal2.extend({ | |
| template: "utilities/utilities.smodal.message.html", | |
| size: "md", | |
| variables: { | |
| title: "Smart Tuition setup has changed", | |
| infoText: "Your Smart Tuition contract setup has changed since this page was displayed. Please click OK to view new options.", | |
| cancelText: "OK" | |
| }, | |
| modalCanceled: function () { | |
| j = "#smartaccount/" + e.Data.FormId + "/" + e.Data.KeyId + "/" + i; | |
| p3.router().navigate(j, true) | |
| } | |
| }); | |
| f.Us.renderModal(new k({})) | |
| } | |
| }, | |
| error: function (o, n) { | |
| p3.displayError("Error loading Smart Tuition family setup type") | |
| } | |
| }) | |
| } else { | |
| h() | |
| } | |
| }; | |
| e.Us.ParseErrorResponse = function (m, j, h) { | |
| var k = m.indexOf(j), | |
| l = (k >= 0) ? k + j.length : -1, | |
| i; | |
| h = h || "."; | |
| if (l >= 0) { | |
| i = m.substring(l, 1 + m.indexOf(h, l)) | |
| } | |
| return i | |
| }; | |
| p3.router().route("smartaccount/:formid/:keyid/:smartSetupTypeId", "contract", function (h, j, m) { | |
| var i = new d.Ms.ApplicationForm({ | |
| ApplicationFormId: h | |
| }), | |
| k = g.stringToInt(m), | |
| l = b.SmartFamilySetupMode; | |
| e.Data.FormId = g.stringToInt(h); | |
| e.Data.KeyId = g.stringToInt(j); | |
| i.fetch({ | |
| cache: false, | |
| success: function (n, o) { | |
| if (k === l.Enroll2ndStudent.Value) { | |
| p3.renderMainPage(new e.Vs.SecondChild({ | |
| ApplicationFormId: h, | |
| KeyId: j, | |
| SetupTypeId: k, | |
| model: i | |
| })) | |
| } else { | |
| if (k === l.ForceParent2Split.Value) { | |
| e.Us.CheckForSmartAccountByUserId(i, h, j, k) | |
| } else { | |
| if (k === l.EnrollParent2NoSplit.Value) { | |
| p3.renderMainPage(new e.Vs.SecondParentNoSplit({ | |
| ApplicationFormId: h, | |
| KeyId: j, | |
| model: i | |
| })) | |
| } else { | |
| if (k === l.PromptParent2Split.Value) { | |
| p3.renderMainPage(new e.Vs.ExistingPayer({ | |
| ApplicationFormId: h, | |
| KeyId: j, | |
| SetupTypeId: k, | |
| model: i | |
| })) | |
| } else { | |
| if (k === l.EnrollParent2OneAccount.Value) { | |
| e.Us.AddSecondPayerToSmartFamily(h, j) | |
| } else { | |
| if (k === l.LinkFamilyToContract.Value) { | |
| p3.renderMainPage(new e.Vs.SecondChild({ | |
| ApplicationFormId: h, | |
| KeyId: j, | |
| SetupTypeId: k, | |
| model: i | |
| })) | |
| } else { | |
| e.Us.CheckForSmartAccountByUserId(i, h, j, k) | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| error: function () { | |
| p3.displayError("Error loading form") | |
| } | |
| }) | |
| }) | |
| }(p3.module("admissions/SmartAccount"))); | |
| (function (b) { | |
| var a = p3.module("shared/base"); | |
| b.Ms.Log = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| idAttribute: "ApplicationFormId" | |
| }); | |
| b.Cs.Logs = Bbc.extend({ | |
| sync: a.DataParamSync, | |
| model: b.Ms.Log, | |
| url: function () { | |
| return aP + "SmartTuition/APILogBrowse/" | |
| } | |
| }); | |
| b.Vs.Layout = Bb.View.extend({ | |
| template: "page/page.10-2.header.template.html", | |
| render: function (c) { | |
| var d = this; | |
| p3.setTitle("Smart Log"); | |
| $(c).append(d.el); | |
| d.renderData() | |
| }, | |
| renderData: function () { | |
| var c = this; | |
| p3.fT(c.template, function (d) { | |
| c.$el.html(d({})); | |
| p3.rV(new b.Vs.Header(), c.$(".header"), false); | |
| p3.rV(new b.Vs.Logs(), c.$(".col-left"), false) | |
| }) | |
| } | |
| }); | |
| b.Vs.Header = Bb.View.extend({ | |
| className: "subhead", | |
| render: function (c) { | |
| var d = this; | |
| $(c).html(d.el); | |
| d.renderData() | |
| }, | |
| renderData: function () { | |
| p3.log("Header") | |
| } | |
| }); | |
| b.Vs.Logs = Bb.View.extend({ | |
| className: "subhead", | |
| render: function (c) { | |
| var d = this; | |
| $(c).html(d.el); | |
| d.renderData() | |
| }, | |
| renderData: function () { | |
| p3.log("Logs") | |
| } | |
| }); | |
| b.Vs.Log = Bb.View.extend({ | |
| className: "subhead", | |
| render: function (c) { | |
| var d = this; | |
| $(c).html(d.el); | |
| d.renderData() | |
| }, | |
| renderData: function () { | |
| p3.log("Log") | |
| } | |
| }); | |
| p3.router().route("smartlog", "smartlog", function () { | |
| p3.renderMainPage(new b.Vs.Layout()) | |
| }) | |
| }(p3.module("admissions/smartlog"))); | |
| (function (e) { | |
| var d = p3.module("utilities/smodal"), | |
| a = p3.module("shared/base"), | |
| c = p3.module("utilities/multifetch"), | |
| b = p3.Us.Enum; | |
| e.Ms.SsatbSettingType = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| idAttribute: "ProfileSettingTypeId" | |
| }); | |
| e.Cs.ProfileSettingTypes = Bbc.extend({ | |
| sync: a.DataParamSync, | |
| model: e.Ms.SsatbSettingType, | |
| url: function () { | |
| return aP + "Ssatb/SettingTypeList/" | |
| } | |
| }); | |
| e.Vs.Layout = Bb.View.extend({ | |
| template: "page/page.12.template.html", | |
| render: function (f) { | |
| var g = this; | |
| p3.setTitle("Candidate Profile Settings"); | |
| $(f).html(g.el); | |
| g.renderData() | |
| }, | |
| renderData: function () { | |
| var f = this; | |
| p3.fT(f.template, function (g) { | |
| f.$el.html(g({})); | |
| p3.rV(new e.Vs.Main(), f.$(".col-center"), false) | |
| }) | |
| } | |
| }); | |
| e.Vs.Main = Bb.View.extend({ | |
| template: "ssatb/ssatb.main.template.html", | |
| render: function (f) { | |
| var g = this; | |
| $(f).append(g.el); | |
| g.renderData() | |
| }, | |
| renderData: function () { | |
| var g = this, | |
| f; | |
| p3.fT(g.template, function (h) { | |
| g.$el.html(h({})); | |
| f = g.$(".candidate-settings-table tbody"); | |
| p3.rV(new e.Vs.Type({ | |
| collection: new e.Cs.ProfileSettingTypes(), | |
| settingType: b.SsatbSettingTypes.ETHNICITY, | |
| dictionaryEnum: b.DictionaryData.EthnicityTypes | |
| }), f, false); | |
| p3.rV(new e.Vs.Type({ | |
| collection: new e.Cs.ProfileSettingTypes(), | |
| settingType: b.SsatbSettingTypes.GRADE, | |
| dictionaryEnum: b.DictionaryData.GradeLevel | |
| }), f, false); | |
| p3.rV(new e.Vs.Type({ | |
| collection: new e.Cs.ProfileSettingTypes(), | |
| settingType: b.SsatbSettingTypes.RELATIONSHIP, | |
| dictionaryEnum: b.DictionaryData.ADMConnectionsRelTypes | |
| }), f, false) | |
| }) | |
| } | |
| }); | |
| e.Vs.Type = Bb.View.extend({ | |
| template: "ssatb/ssatb.type.template.html", | |
| tagName: "tr", | |
| events: { | |
| "click .edit": "edit", | |
| "click .toggleLink": "toggleSection" | |
| }, | |
| render: function (f) { | |
| var g = this; | |
| g.settingOpen = false; | |
| $(f).append(g.el); | |
| c.Us.Fetch({ | |
| Mapping: { | |
| data: new c.Cs.Dictionary(), | |
| dataParams: g.options.dictionaryEnum | |
| } | |
| }, function (h, j, i) { | |
| if (i) { | |
| p3.displayError("There was an error loading data.") | |
| } | |
| g.dictionaries = h; | |
| g.renderData() | |
| }) | |
| }, | |
| renderData: function () { | |
| var f = this; | |
| p3.fT(f.template, function (g) { | |
| f.collection.fetch({ | |
| data: { | |
| settingTypeId: f.options.settingType.Value | |
| }, | |
| update: true, | |
| cache: false, | |
| success: function (h, i) { | |
| f.$el.html(g({ | |
| collection: f.collection.toJSON(), | |
| settingName: f.options.settingType.Name, | |
| dictionaries: f.dictionaries, | |
| settingOpen: f.settingOpen | |
| })) | |
| } | |
| }) | |
| }) | |
| }, | |
| edit: function (f) { | |
| var h = this, | |
| g; | |
| g = d.Vs.Modal2.extend({ | |
| template: "ssatb/ssatb.type.edit.template.html", | |
| collection: h.collection, | |
| variables: { | |
| settingName: h.options.settingType.Name | |
| }, | |
| modalRendered: function (j) { | |
| var i = this; | |
| i.collection.each(function (l) { | |
| var k = new e.Vs.EditType({ | |
| model: l, | |
| selector: i.selector, | |
| dictionaries: h.dictionaries | |
| }); | |
| p3.rV(k, i.$("#edit-types-holder tbody"), false) | |
| }) | |
| }, | |
| modalUpdate: function (i) { | |
| return false | |
| }, | |
| saveModel: function () { | |
| var j = this, | |
| i = true; | |
| i = _.every(j.collection.models, function (k) { | |
| return k.isValid(true) | |
| }); | |
| if (i) { | |
| j.collection.save({ | |
| dataParam: { | |
| settingTypeId: h.options.settingType.Value, | |
| returnModel: true | |
| }, | |
| success: function (k) { | |
| p3.fT(h.template, function (l) { | |
| h.$(h.el).empty(); | |
| h.collection.reset(k); | |
| h.$el.html(l({ | |
| collection: h.collection.toJSON(), | |
| settingName: h.options.settingType.Name, | |
| dictionaries: h.dictionaries, | |
| settingOpen: h.settingOpen | |
| })) | |
| }); | |
| p3.Layout.Containers.Modal.modal("hide") | |
| }, | |
| error: function (l, k) { | |
| h.$(".save").button("reset") | |
| } | |
| }) | |
| } | |
| return false | |
| } | |
| }); | |
| d.Us.renderModal(new g()) | |
| }, | |
| toggleSection: function (g) { | |
| g.preventDefault(); | |
| g.stopPropagation(); | |
| var h = this, | |
| f = $(g.currentTarget); | |
| f.siblings(".toggledetail").slideToggle("fast"); | |
| f.find("i").toggleClass("p3icon-downArrow p3icon-sideArrow"); | |
| if (f.hasClass("active")) { | |
| f.removeClass("active"); | |
| h.settingOpen = false | |
| } else { | |
| f.addClass("active"); | |
| h.settingOpen = true | |
| } | |
| } | |
| }); | |
| e.Vs.EditType = Bb.View.extend({ | |
| template: "ssatb/ssatb.type.edit.row.template.html", | |
| tagName: "tr", | |
| events: { | |
| 'change [name="MappingSettingTypeId"]': "setMapping" | |
| }, | |
| render: function (f) { | |
| var g = this; | |
| $(f).append(g.el); | |
| g.renderData() | |
| }, | |
| renderData: function () { | |
| var f = this; | |
| p3.fT(f.template, function (g) { | |
| f.$el.html(g({ | |
| model: f.model.toJSON(), | |
| dictionaries: f.options.dictionaries | |
| })); | |
| p3.setModalHeight(p3.Layout.Containers.Modal) | |
| }) | |
| }, | |
| setMapping: function (f) { | |
| var g = this; | |
| _.defer(function () { | |
| g.model.set({ | |
| MappingSettingTypeId: $(f.currentTarget).prop("value") | |
| }) | |
| }) | |
| } | |
| }); | |
| p3.router().route("settings/sao", "settings/sao", function () { | |
| e.Data.Dictionaries = {}; | |
| p3.renderMainPage(new e.Vs.Layout({})) | |
| }) | |
| }(p3.module("admissions/SSATBSettings"))); | |
| (function (d) { | |
| var b = p3.module("shared/base"), | |
| f = p3.module("shared/datepicker"), | |
| n = p3.module("shared/timepicker"), | |
| c = p3.module("admissions/managecandidates"), | |
| a = p3.module("admissions/admissionsscheduling"), | |
| e = p3.module("admissions/candidateprofile"), | |
| k = p3.module("admissions/candidate/schools"), | |
| g = p3.module("utilities/dictionary"), | |
| l = p3.module("utilities/smodal"), | |
| h = p3.Us.Enum, | |
| o = p3.Us.Tools, | |
| i = p3.Us.InfoMessageLibrary, | |
| m = p3.module("shared/task"), | |
| j = p3.module("utilities/multifetch"); | |
| d.Ms.Checklist = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| getChecklistSteps: function () { | |
| var p = this.get("ProspectChecklistStep"); | |
| if (p && p.length) { | |
| p = new d.Cs.ChecklistSteps(p) | |
| } | |
| return p | |
| }, | |
| url: function () { | |
| return aP + "admissions/ProspectCheckListADM/" | |
| } | |
| }); | |
| d.Ms.ChecklistStep = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| getChecklistItems: function () { | |
| var p = this.get("ProspectChecklistItem"); | |
| if (p && p.length) { | |
| p = new d.Cs.ChecklistItems(p) | |
| } | |
| return p | |
| }, | |
| url: function () { | |
| return aP + "admissions/ProspectCheckListADM/" | |
| } | |
| }); | |
| d.Ms.ChecklistItem = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "ChecklistItemId", | |
| validation: { | |
| Comment: [{ | |
| required: false, | |
| maxLength: 4000, | |
| msg: i.P3.MaxLengthExceeded | |
| }] | |
| }, | |
| url: function () { | |
| return aP + "admissions/ProspectCheckListItem/" + this.id | |
| } | |
| }); | |
| d.Ms.ChangeChecklist = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "CheckListId", | |
| url: function () { | |
| return aP + "admissions/ProspectCheckListADM/" + this.id | |
| } | |
| }); | |
| d.Ms.Decision = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "DecisionId", | |
| validation: { | |
| AdmDecisionDate: [{ | |
| required: true, | |
| msg: i.P3.RequiredInfoNotEntered | |
| }, { | |
| date: true | |
| }], | |
| AdmDecisionId: [{ | |
| required: true, | |
| msg: i.P3.RequiredInfoNotEntered | |
| }], | |
| PublishDate: [{ | |
| fn: function (t, r, s) { | |
| var p = $("#PublishDate"), | |
| q = $("#PublishTime"); | |
| if ((p.val() == "" && q.val() != "") || (p.val() != "" && q.val() == "")) { | |
| return i.P3.RequiredInfoNotEntered | |
| } | |
| } | |
| }, { | |
| date: true | |
| }], | |
| ExpireDate: [{ | |
| date: true | |
| }], | |
| CandDecisionDate: [{ | |
| date: true | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "admissions/prospectdecision/" + this.id + "/" : aP + "admissions/prospectdecision/" | |
| } | |
| }); | |
| d.Ms.Application = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "ProspectApplicationId", | |
| validation: { | |
| Description: [{ | |
| required: true, | |
| msg: i.P3.RequiredInfoNotEntered | |
| }], | |
| "AttachmentFile.Attachment": [{ | |
| required: true, | |
| msg: i.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "admissions/ProspectApplication/" + this.id + "/" : aP + "admissions/ProspectApplication/" | |
| } | |
| }); | |
| d.Ms.ApplicationResubmit = Bbm.extend({ | |
| idAttribute: "ApplicationId", | |
| url: function () { | |
| return this.id ? aP + "Schoolform/Unsubmit/" + this.id + "/" : aP + "Schoolform/Unsubmit/" | |
| } | |
| }); | |
| d.Ms.CommitteeProspect = Bbm.extend({ | |
| url: function () { | |
| return aP + "CommitteeReview/CommitteeProspectNameGet" | |
| } | |
| }); | |
| d.Cs.ChecklistSteps = Bbc.extend({ | |
| model: d.Ms.ChecklistStep | |
| }); | |
| d.Cs.ChecklistItems = Bbc.extend({ | |
| model: d.Ms.ChecklistItem | |
| }); | |
| d.Cs.Decisions = Bbc.extend({ | |
| model: d.Ms.Decision, | |
| url: function () { | |
| return aP + "admissions/ProspectDecisionList/" | |
| } | |
| }); | |
| d.Cs.Acknowledgements = Bbc.extend({ | |
| url: function () { | |
| return aP + "datadirect/AcknowledgementsGet/" | |
| } | |
| }); | |
| d.Cs.Applications = Bbc.extend({ | |
| model: d.Ms.Application, | |
| url: function () { | |
| return aP + "admissions/ProspectApplicationList/" | |
| } | |
| }); | |
| d.Cs.ProspectCommitteeReviews = Bbc.extend({ | |
| url: function () { | |
| return aP + "admissions/ProspectCommitteeReviewsGet/" | |
| } | |
| }); | |
| d.Cs.CommitteeProspectSubmittedReviews = Bbc.extend({ | |
| url: "CommitteeReview/CommitteeProspectSubmittedReviews" | |
| }); | |
| d.Cs.SchoolFormIds = Bbm.extend({ | |
| url: function () { | |
| return aP + "DataDirect/SchoolFormIdsGetByUser" | |
| } | |
| }); | |
| d.Us.ChangeChecklist = function (p) { | |
| d.Data.ChangeChecklist = false; | |
| _.each(p, function (q) { | |
| _.each(q.ProspectChecklistItem, function (r) { | |
| if (r.StepCompletedInd) { | |
| d.Data.ChangeChecklist = true | |
| } | |
| }) | |
| }) | |
| }; | |
| d.Us.CommentIcon = function (p, q) { | |
| if (q) { | |
| p.removeClass("text-muted") | |
| } else { | |
| p.addClass("text-muted") | |
| } | |
| }; | |
| d.Functions = { | |
| openCommitteeReviewDetailsModal: function (s) { | |
| s.preventDefault(); | |
| var r = $(s.currentTarget).data("id"), | |
| p, q; | |
| if (!o.isEmpty(r)) { | |
| j.Us.Fetch({ | |
| SubmittedReviews: { | |
| data: new d.Cs.CommitteeProspectSubmittedReviews(), | |
| dataParams: { | |
| committeeProspectId: r | |
| } | |
| }, | |
| CommitteeProspect: { | |
| data: new d.Ms.CommitteeProspect(), | |
| dataParams: { | |
| committeeProspectId: r | |
| } | |
| } | |
| }, function (t, v, u) { | |
| if (v) { | |
| if (t.SubmittedReviews.models === undefined || t.SubmittedReviews.models.length === 0) { | |
| p = true | |
| } | |
| if (t.CommitteeProspect !== undefined && t.CommitteeProspect.attributes !== undefined && t.CommitteeProspect.attributes.ProspectUser !== undefined) { | |
| q = t.CommitteeProspect.attributes.ProspectUser.FirstName + " " + t.CommitteeProspect.attributes.ProspectUser.LastName | |
| } | |
| l.Us.renderModal(new d.Vs.CommitteeReviewDetailsModal({ | |
| variables: { | |
| areThereZeroReviews: p, | |
| candidateName: q | |
| }, | |
| collection: t.SubmittedReviews | |
| })) | |
| } | |
| }) | |
| } | |
| } | |
| }; | |
| d.Vs.Layout = Bb.View.extend({ | |
| template: "admissions/candidate.detail.profile.template.html", | |
| events: { | |
| renderdata: "renderData" | |
| }, | |
| initialize: function () { | |
| var p = this; | |
| if (p.options) { | |
| p.userId = p.options.userId | |
| } | |
| d.Data.Filter = ["All"]; | |
| d.Data.prospectInstanceId = this.options.instanceId; | |
| d.Data.userId = this.options.userId; | |
| d.Data.ChangeChecklist = false; | |
| d.Data.enteringYear = p.options.enteringYear; | |
| d.Data.enteringGrade = p.options.enteringGrade | |
| }, | |
| render: function (p) { | |
| var q = this; | |
| p3.setTitle("Candidate Checklist"); | |
| $(p).html(q.el); | |
| g.Us.FetchAll({ | |
| ADMCandidateDataCollectionStatuses: h.DictionaryData.ADMCandidateDataCollectionStatuses | |
| }, function (r) { | |
| d.Data.dictionaries = r; | |
| q.renderData() | |
| }) | |
| }, | |
| renderData: function () { | |
| var p = this; | |
| p3.fT(p.template, function (r) { | |
| p.$el.html(r({})); | |
| var q = new d.Vs.Checklist({ | |
| instanceId: p.options.instanceId, | |
| userId: p.options.userId, | |
| layoutView: p | |
| }); | |
| q.on("filterItems", function () { | |
| p.renderData() | |
| }); | |
| p3.rV(q, $("#content"), false) | |
| }) | |
| } | |
| }); | |
| d.Vs.Checklist = Bb.View.extend({ | |
| template: "candidatechecklist/candidate.detail.checklist.template.html", | |
| initialize: function () { | |
| var p = this; | |
| p.model = new d.Ms.Checklist() | |
| }, | |
| events: { | |
| "click .changechecklistbtn": "changeChecklist", | |
| "click .toggleMilestones": "toggleMilestones", | |
| "click .status-filter": "statusFilterClicked" | |
| }, | |
| render: function (p) { | |
| var r = this, | |
| q = 0; | |
| $(p).append(r.el); | |
| r.dictionaries = { | |
| dictionary_112: { | |
| id: 112, | |
| keyName: "dd_id", | |
| valueName: "dd_description", | |
| inputParam: "@active_only=1[i]", | |
| dictionary: {} | |
| } | |
| }; | |
| _.each(r.dictionaries, function (s) { | |
| var t = new e.Cs.Dictionary(); | |
| t.fetch({ | |
| data: { | |
| dictionaryId: s.id, | |
| key: "pk", | |
| value: "short_description", | |
| inputParam: s.inputParam | |
| }, | |
| success: function (u) { | |
| s.dictionary = u.toJSON(); | |
| q++; | |
| if (q === _.size(r.dictionaries)) { | |
| r.renderData() | |
| } | |
| } | |
| }) | |
| }) | |
| }, | |
| renderData: function () { | |
| var s = this, | |
| p = true, | |
| q = m.Us.getUrlById(53703) !== "#" ? true : false, | |
| r = true; | |
| s.model.off("sync"); | |
| p3.fT(s.template, function (t) { | |
| s.model.fetch({ | |
| cache: false, | |
| data: { | |
| prospectInstanceId: d.Data.prospectInstanceId | |
| }, | |
| success: function (v, w) { | |
| d.Us.ChangeChecklist(v.get("ProspectChecklistStep")); | |
| s.$el.html(t({ | |
| model: v.toJSON(), | |
| changeChecklistDisabled: d.Data.ChangeChecklist, | |
| statusList: d.Data.Filter.join(",") | |
| })); | |
| var u = v.getChecklistSteps(); | |
| p3.rV(new d.Vs.ChecklistSteps({ | |
| collection: u | |
| }), s.$("#checkliststeps"), false); | |
| if (p) { | |
| p3.rV(new d.Vs.Applications({ | |
| layoutView: s.options.layoutView | |
| }), $("#checklistApplication"), true) | |
| } | |
| if (q) { | |
| p3.rV(new d.Vs.CommitteeReviewSummary(), $("#checklistCommitteeReviewSummary"), true) | |
| } | |
| if (r) { | |
| p3.rV(new d.Vs.Decisions({ | |
| instanceId: d.Data.prospectInstanceId, | |
| userId: d.Data.userId | |
| }), $("#checklistDecision"), true) | |
| } | |
| }, | |
| complete: function () { | |
| s.model.on("sync", s.renderData, s) | |
| } | |
| }) | |
| }) | |
| }, | |
| changeChecklist: function (p) { | |
| p.stopPropagation(); | |
| p.preventDefault(); | |
| var q = this; | |
| if (d.Data.ChangeChecklist) { | |
| q.modal2Extend = l.Vs.Modal2.extend({ | |
| template: "utilities/utilities.smodal.message.html", | |
| variables: { | |
| title: "Change Checklist", | |
| infoText: "The current checklist cannot be changed because checklist items have been completed or waived." | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new q.modal2Extend(), p3.Layout.Containers.Modal, true) | |
| } else { | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new c.Vs.Modal({ | |
| template: "candidatechecklist/candidate.detail.checklist.edit.template.html", | |
| model: new d.Ms.ChangeChecklist(q.model.get("CheckList")), | |
| dictionaries: q.dictionaries, | |
| dataParam: { | |
| prospectInstanceId: d.Data.prospectInstanceId | |
| } | |
| }), p3.Layout.Containers.Modal, true) | |
| } | |
| }, | |
| toggleMilestones: function (q) { | |
| var p = $(q.currentTarget); | |
| q.preventDefault(); | |
| if (p.hasClass("active")) { | |
| p.removeClass("active"); | |
| $("thead").addClass("hide"); | |
| d.Data.showMilestones = false; | |
| p.addClass("fa-chevron-down").removeClass("fa-chevron-up") | |
| } else { | |
| p.addClass("active"); | |
| $("thead").removeClass("hide"); | |
| d.Data.showMilestones = true; | |
| p.addClass("fa-chevron-up").removeClass("fa-chevron-down") | |
| } | |
| }, | |
| filterItems: function (p) { | |
| p.preventDefault(); | |
| var q = this; | |
| q.trigger("filterItems") | |
| }, | |
| statusFilterClicked: function (p) { | |
| if ($(p.currentTarget).data("status-id") === "All") { | |
| if ($.inArray("All", d.Data.Filter) === -1) { | |
| d.Data.Filter = ["All"] | |
| } | |
| } else { | |
| if ($.inArray($(p.currentTarget).data("status-id"), d.Data.Filter) > -1) { | |
| d.Data.Filter.splice($.inArray($(p.currentTarget).data("status-id"), d.Data.Filter), 1); | |
| if (d.Data.Filter.length === 0) { | |
| d.Data.Filter.push("All") | |
| } | |
| } else { | |
| if ($.inArray("All", d.Data.Filter) > -1) { | |
| d.Data.Filter.splice($.inArray("All", d.Data.Filter), 1) | |
| } | |
| d.Data.Filter.push($(p.currentTarget).data("status-id")) | |
| } | |
| } | |
| this.filterItems(p) | |
| } | |
| }); | |
| d.Vs.ChecklistSteps = Bb.View.extend({ | |
| render: function (p) { | |
| var q = this; | |
| $(p).append(q.el); | |
| q.renderData() | |
| }, | |
| renderData: function () { | |
| var p = this; | |
| p.$el.html(); | |
| _.each(p.collection.models, function (q) { | |
| p3.rV(new d.Vs.ChecklistStep({ | |
| model: q | |
| }), p.$el, false) | |
| }) | |
| } | |
| }); | |
| d.Vs.ChecklistStep = Bb.View.extend({ | |
| template: "candidatechecklist/candidate.detail.checkliststep.template.html", | |
| render: function (p) { | |
| var q = this; | |
| $(p).append(q.el); | |
| q.renderData() | |
| }, | |
| renderData: function () { | |
| var p = this; | |
| p3.fT(p.template, function (r) { | |
| p.$el.html(r({ | |
| model: p.model.toJSON() | |
| })); | |
| var q = new d.Cs.ChecklistItems(p.model.get("ProspectChecklistItem")); | |
| p3.rV(new d.Vs.ChecklistItems({ | |
| collection: q | |
| }), p.$(".checklistitems"), false) | |
| }) | |
| } | |
| }); | |
| d.Vs.ChecklistItems = Bb.View.extend({ | |
| tagName: "tbody", | |
| render: function (p) { | |
| var q = this; | |
| $(p).append(q.el); | |
| q.renderData() | |
| }, | |
| renderData: function () { | |
| var s = this, | |
| r, q, p; | |
| s.$el.html(); | |
| _.each(s.collection.models, function (t) { | |
| if (d.Data.Filter[0] === "All") { | |
| p3.rV(new d.Vs.ChecklistItem({ | |
| model: t | |
| }), s.$el, false) | |
| } else { | |
| for (r = 0; r < d.Data.Filter.length; r++) { | |
| if (t.attributes.StepInd == d.Data.Filter[r]) { | |
| p3.rV(new d.Vs.ChecklistItem({ | |
| model: t | |
| }), s.$el, false) | |
| } | |
| } | |
| } | |
| }); | |
| q = $(".toggleMilestones"); | |
| p = q.find(".fa"); | |
| if (d.Data.showMilestones) { | |
| q.addClass("active"); | |
| $("thead").removeClass("hide"); | |
| p.addClass("fa-chevron-up").removeClass("fa-chevron-down") | |
| } else { | |
| p.addClass("fa-chevron-down").removeClass("fa-chevron-up") | |
| } | |
| } | |
| }); | |
| d.Vs.ChecklistItem = Bb.View.extend({ | |
| template: "candidatechecklist/candidate.detail.checklistitem.template.html", | |
| tagName: "tr", | |
| initialize: function () { | |
| var p = this; | |
| Bb.Validation.bind(p, { | |
| forceUpdate: true, | |
| selector: "name" | |
| }) | |
| }, | |
| events: { | |
| "click .dataCollection": "updateDataCollection", | |
| "click .checklistStatus": "updateStatus", | |
| "change textarea": "updateModel", | |
| "click a.togglebutton": "toggleInfo", | |
| "blur textarea": "closeInfo", | |
| "keyup .checklistComment": "updateCharacterCounter", | |
| "click .inline-edit": "openInlineEdit", | |
| "blur .inline-edit .inline-update input": "closeInlineEdit", | |
| "blur .inline-edit .inline-update select": "closeInlineEdit", | |
| "change .inline-update select": "updateModel", | |
| "change .inline-update input": "updateModel", | |
| "mouseover .inline-edit": "inlineEditOver", | |
| "mouseout .inline-edit": "inlineEditOut", | |
| "click #printSchoolFormBtn": "printSchoolForm" | |
| }, | |
| render: function (p) { | |
| var q = this; | |
| $(p).append(q.el); | |
| q.renderData() | |
| }, | |
| renderData: function () { | |
| var r = this, | |
| p = r.model.get("DataCollectionTypeId"), | |
| q = [2, 4, 6, 7, 11, 12, 17, 18]; | |
| if (q.indexOf(p) != -1) { | |
| if (r.model.get("DataCollectionPk")) { | |
| r.model.set({ | |
| DataCollectionAction: "Edit" | |
| }) | |
| } else { | |
| r.model.set({ | |
| DataCollectionAction: "Add" | |
| }) | |
| } | |
| } | |
| p3.fT(r.template, function (s) { | |
| r.$el.html(s({ | |
| model: r.model.toJSON(), | |
| cid: r.model.cid, | |
| statusDictionary: p3.Data.SchoolContext.hasAppCategory(p3.Us.Enum.AppCategories.ADMISSIONSSCHEDULING) ? _.reject(d.Data.dictionaries.ADMCandidateDataCollectionStatuses.dictionary, function (t) { | |
| return ((t.dd_data === 7 || t.dd_data === 12) && (t.dd_id < 4)) | |
| }) : d.Data.dictionaries.ADMCandidateDataCollectionStatuses.dictionary | |
| })); | |
| r.$(".checklistComment").trigger(jQuery.Event("keyup")); | |
| f.Us.initialize(".date-input", { | |
| yearRange: "-30:+20" | |
| }); | |
| $(".dropdown-toggle").dropdown() | |
| }) | |
| }, | |
| updateDataCollection: function (v) { | |
| v.stopPropagation(); | |
| v.preventDefault(); | |
| var w = this, | |
| r = w.model.get("DataCollectionTypeId"), | |
| q = w.model.get("DataCollectionPk"), | |
| p = w.model.get("ChecklistItemId"), | |
| s, u, t; | |
| switch (r) { | |
| case 2: | |
| if (q) { | |
| u = new e.Ms.TestScore({ | |
| disabled: true | |
| }) | |
| } else { | |
| u = new e.Ms.TestScore({ | |
| disabled: true, | |
| ChecklistItemId: p, | |
| userId: d.Data.userId, | |
| prospectInstanceId: d.Data.prospectInstanceId, | |
| Test: { | |
| "$type": "clBLL.nAdmissions.Test, clBLL" | |
| }, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }) | |
| } | |
| s = "admissions/candidate.detail.profile.testscore.edit.template.html"; | |
| t = { | |
| dictionary_105: h.DictionaryData.ADMTestTypes, | |
| dictionary_102: h.DictionaryData.ADMStaff | |
| }; | |
| break; | |
| case 4: | |
| if (q) { | |
| u = new e.Ms.Recommendation({ | |
| disabled: true | |
| }) | |
| } else { | |
| u = new e.Ms.Recommendation({ | |
| disabled: true, | |
| ChecklistItemId: p, | |
| ProspectInstanceId: d.Data.prospectInstanceId, | |
| ReferenceType: { | |
| "$type": "clBLL.nAdmissions.ReferenceType, clBLL" | |
| }, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }) | |
| } | |
| s = "candidate/candidate.record.recommendation.edit.template.html"; | |
| t = { | |
| dictionary_20: h.DictionaryData.Country, | |
| ADMReferenceTypes: h.DictionaryData.ADMReferenceTypes, | |
| dictionary_123: h.DictionaryData.StatesPlusArmyPO | |
| }; | |
| break; | |
| case 6: | |
| if (q) { | |
| u = new d.Ms.Decision({ | |
| disabled: true | |
| }) | |
| } else { | |
| u = new d.Ms.Decision({ | |
| disabled: true, | |
| ChecklistItemId: p, | |
| prospectInstanceId: d.Data.prospectInstanceId, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }) | |
| } | |
| s = "candidatechecklist/candidate.detail.checklist.decision.edit.template.html"; | |
| t = { | |
| ADMReasonsDeclinedAll: h.DictionaryData.ADMReasonsDeclinedAll, | |
| ADMDecisionTypeNoAll: h.DictionaryData.ADMDecisionTypeNoAll, | |
| TransferSchool: { | |
| id: 94, | |
| inputParam: "@chosen_inq=1[i]" | |
| } | |
| }; | |
| break; | |
| case 7: | |
| if (q) { | |
| u = new e.Ms.Interview({ | |
| disabled: true | |
| }) | |
| } else { | |
| u = new e.Ms.Interview({ | |
| disabled: true, | |
| ChecklistItemId: p, | |
| ProspectInstanceId: d.Data.prospectInstanceId, | |
| InterviewType: { | |
| "$type": "clBLL.nAdmissions.InterviewType, clBLL" | |
| }, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }) | |
| } | |
| s = "candidate/candidate.record.interview.edit.template.html"; | |
| t = { | |
| ADMInterviewTypes: h.DictionaryData.ADMInterviewTypes, | |
| dictionary_102: h.DictionaryData.ADMStaff | |
| }; | |
| break; | |
| case 11: | |
| if (q) { | |
| u = new k.Ms.ProspectSendingSchools({ | |
| disabled: true | |
| }) | |
| } else { | |
| u = new k.Ms.ProspectSendingSchools({ | |
| disabled: true, | |
| ChecklistItemId: p, | |
| userId: d.Data.userId, | |
| prospectInstanceId: d.Data.prospectInstanceId, | |
| TransferSchool: { | |
| "$type": "clBLL.nSchoolInfo.TransferSchool, clBLL" | |
| }, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| }, | |
| SendingSchoolType: { | |
| "$type": "clBLL.nAdmissions.SendingSchoolType, clBLL" | |
| }, | |
| SendingGrade: { | |
| "$type": "clBLL.nAdmissions.SendingGrade, clBLL" | |
| } | |
| }) | |
| } | |
| s = "candidate/candidate.schools.school.edit.template.html"; | |
| t = { | |
| dictionary_20: h.DictionaryData.Country, | |
| dictionary_56: h.DictionaryData.StatesAndProvinces, | |
| dictionary_83: h.DictionaryData.SchoolYearCurrent, | |
| dictionary_106: h.DictionaryData.ApplicationCurrentGrade, | |
| ADMSchoolTypes: h.DictionaryData.ADMSchoolTypes | |
| }; | |
| break; | |
| case 12: | |
| if (q) { | |
| u = new e.Ms.Visit({ | |
| disabled: true | |
| }) | |
| } else { | |
| u = new e.Ms.Visit({ | |
| disabled: true, | |
| ChecklistItemId: p, | |
| prospectInstanceId: d.Data.prospectInstanceId, | |
| VisitType: { | |
| "$type": "clBLL.nAdmissions.VisitType, clBLL" | |
| }, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }) | |
| } | |
| s = "candidate/candidate.record.visit.edit.template.html"; | |
| t = { | |
| ADMVisitTypes: h.DictionaryData.ADMVisitTypes, | |
| dictionary_102: h.DictionaryData.ADMStaff | |
| }; | |
| break; | |
| case 17: | |
| if (q) { | |
| u = new e.Ms.Event({ | |
| disabled: true | |
| }) | |
| } else { | |
| u = new e.Ms.Event({ | |
| disabled: true, | |
| ChecklistItemId: p, | |
| prospectInstanceId: d.Data.prospectInstanceId, | |
| EventType: { | |
| "$type": "clBLL.nAdmissions.EventType, clBLL" | |
| } | |
| }) | |
| } | |
| s = "candidate/candidate.record.event.edit.template.html"; | |
| t = { | |
| ADMEventTypes: h.DictionaryData.ADMEventTypes | |
| }; | |
| break; | |
| case 18: | |
| if (q) { | |
| u = new e.Ms.MiscellaneousFile({ | |
| disabled: true | |
| }) | |
| } else { | |
| u = new e.Ms.MiscellaneousFile({ | |
| disabled: true, | |
| ChecklistItemId: p, | |
| userId: d.Data.userId, | |
| prospectInstanceId: d.Data.prospectInstanceId, | |
| AttachmentFile: {} | |
| }) | |
| } | |
| s = "candidate/candidate.record.miscellaneous.file.edit.template.html"; | |
| t = { | |
| dictionary_152: h.DictionaryData.ProspectFileType | |
| }; | |
| break | |
| } | |
| g.Us.FetchAll(t, function (x) { | |
| if (r === 17) { | |
| x.ADMEventTypes = x.ADMEventTypes.dictionary | |
| } | |
| d.Data.dictionaries = x; | |
| if (q) { | |
| u.fetch({ | |
| data: { | |
| prospectInstanceId: d.Data.prospectInstanceId, | |
| id: q, | |
| userId: d.Data.userId | |
| }, | |
| success: function (y) { | |
| e.Us.ChecklistDictionaryGet(d.Data.prospectInstanceId, r, q, function (z) { | |
| d.Data.dictionaries.dictionary_127 = z.dictionary_127; | |
| d.Data.dictionaries.dictionary_128 = z.dictionary_128; | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| if (r === 6) { | |
| w.showDecisionEdit(u, s) | |
| } else { | |
| if (r === 7) { | |
| if (p3.Data.Context.findByTaskId(53624)) { | |
| a.Us.EditInterview(q, d.Data.prospectInstanceId) | |
| } else { | |
| p3.rV(new c.Vs.Modal({ | |
| template: s, | |
| model: u, | |
| dictionaries: d.Data.dictionaries | |
| }), p3.Layout.Containers.Modal, true) | |
| } | |
| } else { | |
| if (r === 11) { | |
| w.showSchoolEdit(u) | |
| } else { | |
| if (r === 12) { | |
| if (p3.Data.Context.findByTaskId(53624)) { | |
| a.Us.EditVisit(q, d.Data.prospectInstanceId) | |
| } else { | |
| p3.rV(new c.Vs.Modal({ | |
| template: s, | |
| model: u, | |
| dictionaries: d.Data.dictionaries | |
| }), p3.Layout.Containers.Modal, true) | |
| } | |
| } else { | |
| if (r === 17) { | |
| w.showEventEdit(u) | |
| } else { | |
| if (r === 18) { | |
| w.showMiscFileEdit(u) | |
| } else { | |
| p3.rV(new c.Vs.Modal({ | |
| template: s, | |
| model: u, | |
| dictionaries: d.Data.dictionaries | |
| }), p3.Layout.Containers.Modal, true) | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }) | |
| } | |
| }) | |
| } else { | |
| e.Us.ChecklistDictionaryGet(d.Data.prospectInstanceId, r, q, function (y) { | |
| d.Data.dictionaries.dictionary_127 = y.dictionary_127; | |
| d.Data.dictionaries.dictionary_128 = y.dictionary_128; | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| if (r === 6) { | |
| w.showDecisionEdit(u, s) | |
| } else { | |
| if (r === 7) { | |
| if (p3.Data.Context.findByTaskId(53624)) { | |
| a.Us.AddInterview(null, d.Data.prospectInstanceId) | |
| } else { | |
| p3.rV(new c.Vs.Modal({ | |
| template: s, | |
| model: u, | |
| dictionaries: d.Data.dictionaries | |
| }), p3.Layout.Containers.Modal, true) | |
| } | |
| } else { | |
| if (r === 11) { | |
| w.showSchoolEdit(u) | |
| } else { | |
| if (r === 12) { | |
| if (p3.Data.Context.findByTaskId(53624)) { | |
| a.Us.AddVisit(null, d.Data.prospectInstanceId) | |
| } else { | |
| p3.rV(new c.Vs.Modal({ | |
| template: s, | |
| model: u, | |
| dictionaries: d.Data.dictionaries | |
| }), p3.Layout.Containers.Modal, true) | |
| } | |
| } else { | |
| if (r === 17) { | |
| w.showEventEdit(u) | |
| } else { | |
| if (r === 18) { | |
| w.showMiscFileEdit(u) | |
| } else { | |
| p3.rV(new c.Vs.Modal({ | |
| template: s, | |
| model: u, | |
| dictionaries: d.Data.dictionaries | |
| }), p3.Layout.Containers.Modal, true) | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }) | |
| } | |
| }) | |
| }, | |
| showSchoolEdit: function (p) { | |
| var r = this, | |
| q = new k.Cs.TransferSchools(); | |
| q.fetch({ | |
| success: function (s, t) { | |
| d.Data.dictionaries.TransferSchools = {}; | |
| d.Data.dictionaries.TransferSchools.dictionary = t; | |
| k.Us.getDefaultCountry(d.Data.dictionaries.dictionary_20, function (u) { | |
| if (p.isNew()) { | |
| p.set("Country", u) | |
| } | |
| var v = new k.Vs.SchoolEdit({ | |
| model: p, | |
| dictionaries: d.Data.dictionaries | |
| }); | |
| v.on("modelSaved", function () { | |
| $(".candidate-header").parent().parent().trigger("renderdata") | |
| }, r); | |
| p3.rV(v, p3.Layout.Containers.Modal, true) | |
| }) | |
| } | |
| }) | |
| }, | |
| showEventEdit: function (p) { | |
| var r = this, | |
| q = new e.Vs.EventEditModal({ | |
| model: p, | |
| dictionaries: d.Data.dictionaries | |
| }); | |
| q.on("modelSaved", function () { | |
| $(".candidate-header").parent().parent().trigger("renderdata") | |
| }, r); | |
| p3.rV(q, p3.Layout.Containers.Modal, true) | |
| }, | |
| showDecisionEdit: function (r, p) { | |
| var q = new d.Vs.DecisionModal({ | |
| model: r, | |
| dictionaries: d.Data.dictionaries, | |
| template: p, | |
| variables: { | |
| enteringYear: d.Data.enteringYear, | |
| enteringGrade: d.Data.enteringGrade, | |
| profilePage: true | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(q, p3.Layout.Containers.Modal, true) | |
| }, | |
| showMiscFileEdit: function (p) { | |
| var r = this, | |
| q = new e.Vs.MiscellaneousFileModal({ | |
| model: p, | |
| dictionaries: d.Data.dictionaries | |
| }); | |
| d.Data.dictionaries.FileTypes = d.Data.dictionaries.dictionary_152.dictionary; | |
| q.on("modelSaved", function () { | |
| $(".candidate-header").parent().parent().trigger("renderdata") | |
| }, r); | |
| p3.rV(q, p3.Layout.Containers.Modal, true) | |
| }, | |
| updateCharacterCounter: function (p) { | |
| var q = this; | |
| p.stopPropagation(); | |
| p.preventDefault(); | |
| q.$(p.currentTarget).siblings("p").find(".characterCounter").html($(p.currentTarget).val().length); | |
| if ($(p.currentTarget).val().length > 4000) { | |
| q.$(p.currentTarget).siblings("p").find(".characterCounter").addClass("badge-important") | |
| } else { | |
| q.$(p.currentTarget).siblings("p").find(".characterCounter").removeClass("badge-important") | |
| } | |
| }, | |
| toggleInfo: function (q) { | |
| var r = this, | |
| p = r.$(".toggleinfo"); | |
| q.stopPropagation(); | |
| q.preventDefault(); | |
| if (p.filter(":visible").length) { | |
| if (r.model.isValid(true)) { | |
| r.$el.find("textarea").blur(); | |
| p.hide() | |
| } | |
| } else { | |
| p.show(500); | |
| r.$el.find("textarea").focus() | |
| } | |
| }, | |
| closeInfo: function (p) { | |
| var q = this; | |
| p.stopPropagation(); | |
| p.preventDefault(); | |
| if (q.model.isValid(true)) { | |
| q.$(".toggleinfo").hide(500) | |
| } | |
| }, | |
| updateStatus: function (q) { | |
| q.stopPropagation(); | |
| q.preventDefault(); | |
| var u = this, | |
| s = $(q.currentTarget), | |
| r = s.parents("ul").attr("name"), | |
| t = s.data("value"), | |
| p = {}; | |
| u.model.defaults = $.extend(true, {}, u.model.attributes); | |
| p[r] = t; | |
| u.model.set(p); | |
| if (u.model.isValid(true)) { | |
| u.model.set({ | |
| FieldsToNull: [] | |
| }); | |
| _.each(u.model.attributes, function (x, v, w) { | |
| l.Us.setFieldsToNull(u.model, x, v, w, "") | |
| }); | |
| u.model.save({}, { | |
| dataParam: {}, | |
| success: function (v, w) { | |
| u.renderData(); | |
| u.changeChecklistButton(); | |
| c.Data.pidCollection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| userId: d.Data.userId, | |
| alwaysReturn: true | |
| }, | |
| success: function (x, y) { | |
| $(".candidate-header").parent().trigger("renderheader") | |
| } | |
| }) | |
| }, | |
| error: function (w, v) { | |
| p3.displayError("Error saving") | |
| } | |
| }) | |
| } | |
| }, | |
| inlineEditOver: function (p) { | |
| p.stopPropagation(); | |
| p.preventDefault(); | |
| $(p.currentTarget).find("i").show() | |
| }, | |
| inlineEditOut: function (p) { | |
| p.stopPropagation(); | |
| p.preventDefault(); | |
| $(p.currentTarget).find("i").hide() | |
| }, | |
| openInlineEdit: function (p) { | |
| p.stopPropagation(); | |
| p.preventDefault(); | |
| var r = this, | |
| q; | |
| if (r.model.isValid(true)) { | |
| q = $(p.currentTarget); | |
| q.find(".inline-display").hide(); | |
| q.find(".inline-update").show(); | |
| if (q.find(".inline-update input").length > 0) { | |
| q.find(".inline-update input").focus() | |
| } else { | |
| if (q.find(".inline-update select").length > 0) { | |
| q.find(".inline-update select").focus() | |
| } | |
| } | |
| } else { | |
| p3.displayError("This form's settings must be updated before changing") | |
| } | |
| }, | |
| closeInlineEdit: function (p) { | |
| p.stopPropagation(); | |
| p.preventDefault(); | |
| var q = this; | |
| if (q.model.isValid(true)) { | |
| q.$(".inline-display").show(); | |
| q.$(".inline-update").hide() | |
| } | |
| }, | |
| changeChecklistButton: function () { | |
| var p = this; | |
| p.checklist = new d.Ms.Checklist(); | |
| p.checklist.fetch({ | |
| cache: false, | |
| data: { | |
| userId: d.Data.userId, | |
| prospectInstanceId: d.Data.prospectInstanceId | |
| }, | |
| success: function () { | |
| d.Us.ChangeChecklist(p.checklist.get("ProspectChecklistStep")) | |
| } | |
| }) | |
| }, | |
| updateModel: function (q) { | |
| q.stopPropagation(); | |
| q.preventDefault(); | |
| var u = this, | |
| s = $(q.currentTarget), | |
| r = s.attr("name"), | |
| t, p = {}; | |
| u.model.defaults = $.extend(true, {}, u.model.attributes); | |
| if (r === "DateDue") { | |
| t = s.prop("value"); | |
| if (t === "") { | |
| t = null | |
| } | |
| } else { | |
| if (r === "DateWaived") { | |
| t = s.prop("value"); | |
| if (t === "") { | |
| t = null; | |
| u.model.set({ | |
| StepInd: "Awaiting" | |
| }, { | |
| silent: true | |
| }) | |
| } else { | |
| u.model.set({ | |
| StepInd: "Waived" | |
| }, { | |
| silent: true | |
| }) | |
| } | |
| } else { | |
| if (r === "DateCompleted") { | |
| t = s.prop("value"); | |
| if (t === "") { | |
| t = null; | |
| u.model.set({ | |
| StepInd: "Awaiting" | |
| }, { | |
| silent: true | |
| }) | |
| } else { | |
| u.model.set({ | |
| StepInd: "Completed" | |
| }, { | |
| silent: true | |
| }) | |
| } | |
| } else { | |
| t = s.prop("value") | |
| } | |
| } | |
| } | |
| if (!_.contains(r, ".")) { | |
| p[r] = t; | |
| u.model.set(p) | |
| } else { | |
| l.Us.setPropByString(u.model.toJSON(), r, t); | |
| if (u.model.isValid(r)) { | |
| Bb.Validation.callbacks.valid(u, r, "name") | |
| } else { | |
| Bb.Validation.callbacks.invalid(u, r, "Entered value contains an error.", "name") | |
| } | |
| } | |
| if (u.model.isValid(true)) { | |
| u.model.set({ | |
| FieldsToNull: [] | |
| }); | |
| _.each(u.model.attributes, function (x, v, w) { | |
| l.Us.setFieldsToNull(u.model, x, v, w, "") | |
| }); | |
| u.model.save({}, { | |
| dataParam: {}, | |
| success: function (w, x) { | |
| var v = u.$("a.togglebutton i"); | |
| d.Us.CommentIcon(v, u.model.get("Comment")); | |
| if (r === "DateDue") { | |
| u.renderData() | |
| } else { | |
| if (r === "DateCompleted") { | |
| u.renderData(); | |
| u.changeChecklistButton(); | |
| c.Data.pidCollection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| userId: d.Data.userId, | |
| alwaysReturn: true | |
| }, | |
| success: function (y, z) { | |
| $(".candidate-header").parent().trigger("renderheader") | |
| } | |
| }) | |
| } else { | |
| if (r === "DateWaived") { | |
| u.renderData() | |
| } | |
| } | |
| } | |
| }, | |
| error: function (w, v) { | |
| p3.displayError("Error saving field") | |
| } | |
| }) | |
| } | |
| }, | |
| printSchoolForm: function (r) { | |
| r.preventDefault(); | |
| r.stopPropagation(); | |
| var t = this, | |
| p = r.target.getAttribute("data-application-form-id"), | |
| q, s; | |
| if (!t.schoolFormIds) { | |
| t.schoolFormIds = new d.Cs.SchoolFormIds(); | |
| t.schoolFormIds.fetch({ | |
| data: { | |
| id: d.Data.userId | |
| }, | |
| success: function (u) { | |
| q = _.findWhere(u.toJSON(), { | |
| oa_application_form_id: o.stringToInt(p) | |
| }).oa_application_id; | |
| s = "/podium/default.aspx?t=1691&wapp=1&ch=1&pk=502&ext=pdf&fid=" + p + "&appid=" + q; | |
| window.open(s, "_blank") | |
| }, | |
| error: function () { | |
| p3.displayError("An unexpected error occurred loading your school form. Please try again.") | |
| } | |
| }) | |
| } else { | |
| q = _.findWhere(t.schoolFormIds.toJSON(), { | |
| oa_application_form_id: o.stringToInt(p) | |
| }).oa_application_id; | |
| s = "/podium/default.aspx?t=1691&wapp=1&ch=1&pk=502&ext=pdf&fid=" + p + "&appid=" + q; | |
| window.open(s, "_blank") | |
| } | |
| } | |
| }); | |
| d.Vs.Applications = Bb.View.extend({ | |
| template: "candidatechecklist/candidate.detail.checklist.applications.template.html", | |
| initialize: function () { | |
| var p = this; | |
| p.collection = new d.Cs.Applications(); | |
| this.collection.bind("add", function (r) { | |
| var q = new d.Vs.Application({ | |
| model: r, | |
| prospectInstanceId: d.Data.prospectInstanceId | |
| }); | |
| r.bind("sync", p.renderData, p); | |
| p3.rV(q, this.$("#applications"), false) | |
| }, this) | |
| }, | |
| events: { | |
| "click button.create": "createApplication", | |
| "click a.toggleLink": "toggleSection" | |
| }, | |
| render: function (p) { | |
| var q = this; | |
| $(p).append(q.el); | |
| q.renderData() | |
| }, | |
| renderData: function () { | |
| var p = this; | |
| p.collection.reset(); | |
| p3.fT(p.template, function (q) { | |
| p.$el.html(q({})); | |
| p.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| id: d.Data.prospectInstanceId | |
| } | |
| }) | |
| }) | |
| }, | |
| createApplication: function () { | |
| var r = this, | |
| q, p; | |
| p = new d.Ms.Application({ | |
| ProspectInstanceId: d.Data.prospectInstanceId, | |
| UploadSource: 1, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }); | |
| q = l.Vs.Modal2.extend({ | |
| template: "candidatechecklist/candidate.detail.checklist.application.edit.template.html", | |
| model: p, | |
| dictionaries: r.options.dictionaries, | |
| modalRendered: function () { | |
| var s = this; | |
| s.initializeFileUpload_File() | |
| } | |
| }); | |
| p.bind("sync", r.renderData, r); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new q({}), p3.Layout.Containers.Modal, true) | |
| }, | |
| toggleSection: function (p) { | |
| p.stopPropagation(); | |
| p.preventDefault(); | |
| $(p.currentTarget).siblings(".toggledetail").slideToggle("fast"); | |
| if ($(p.currentTarget).hasClass("active")) { | |
| $(p.currentTarget).removeClass("active") | |
| } else { | |
| $(p.currentTarget).addClass("active") | |
| } | |
| } | |
| }); | |
| d.Vs.Application = Bb.View.extend({ | |
| template: "candidatechecklist/candidate.detail.checklist.application.template.html", | |
| tagName: "tr", | |
| initialize: function () { | |
| this.model.bind("destroy", this.deleteElement, this); | |
| this.model.bind("remove", this.deleteElement, this); | |
| this.model.bind("sync", this.renderTemplate, this) | |
| }, | |
| events: { | |
| "click .editapplication": "editApplication", | |
| "click .deleteapplication:not(.disabled)": "deleteApplication", | |
| "click .resubmit:not(.disabled)": "resubmitApplication" | |
| }, | |
| render: function (p) { | |
| var q = this; | |
| $(p).append(q.el); | |
| q.renderData() | |
| }, | |
| renderData: function () { | |
| var t = this, | |
| s = t.model.get("UploadSource"), | |
| p = t.model.get("Deleted"), | |
| q = (s === 0 || (s === 3 && p)) ? false : true, | |
| r = (s === 0 && t.model.get("ApplicationStatus") === 2) ? false : true; | |
| p3.fT(t.template, function (u) { | |
| t.$el.html(u({ | |
| model: t.model.toJSON(), | |
| oaDeleteDisabled: q, | |
| oaResubmitDisabled: r | |
| })); | |
| if (q) { | |
| t.$(".deleteapplication").tooltip() | |
| } | |
| if (r) { | |
| t.$(".resubmit").tooltip() | |
| } | |
| }) | |
| }, | |
| editApplication: function (p) { | |
| var r = this, | |
| q; | |
| q = l.Vs.Modal2.extend({ | |
| template: "candidatechecklist/candidate.detail.checklist.application.edit.template.html", | |
| model: r.model, | |
| dictionaries: r.options.dictionaries, | |
| modalRendered: function () { | |
| var s = this; | |
| s.initializeFileUpload_File() | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new q({}), p3.Layout.Containers.Modal, true) | |
| }, | |
| deleteApplication: function (p) { | |
| var q = this; | |
| p3.showConfirm("Delete Application", "Wait a minute. Are you really sure you want to delete this application information? This cannot be undone.", null, function () { | |
| var r = { | |
| formId: q.model.get("FormId") | |
| }; | |
| q.model.destroy({ | |
| dataParam: r | |
| }); | |
| $(".candidate-header").parent().trigger("renderdata") | |
| }) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| }, | |
| resubmitApplication: function (q) { | |
| var r = this, | |
| p = new d.Ms.ApplicationResubmit({ | |
| ApplicationId: r.model.id | |
| }); | |
| p3.showConfirm("Resubmit Application", "Resubmit will remove the signature from the application and allow the applicant to continue working on the application.<p><b>This cannot be undone.</b></p>", null, function () { | |
| p.save({}, { | |
| success: function () { | |
| $(".candidate-header").parent().trigger("renderdata") | |
| }, | |
| error: function (t, s) { | |
| p3.displayError("Error unsubmitting") | |
| } | |
| }) | |
| }) | |
| } | |
| }); | |
| d.Vs.CommitteeReviewSummary = Bb.View.extend({ | |
| template: "Candidate/candidate.checklist.committeereview.summary.template.html", | |
| initialize: function () { | |
| var p = this; | |
| p.collection = new d.Cs.ProspectCommitteeReviews() | |
| }, | |
| events: { | |
| "click a.seeCommitteeReviewDetails": "openCommitteeReviewDetailsModal" | |
| }, | |
| render: function (p) { | |
| var q = this; | |
| $(p).append(q.el); | |
| q.renderData() | |
| }, | |
| renderData: function () { | |
| var q = this, | |
| p; | |
| q.collection.fetch({ | |
| data: { | |
| prospectInstanceId: d.Data.prospectInstanceId | |
| }, | |
| success: function (r, s) { | |
| if (r.length === 0) { | |
| p = true | |
| } | |
| p3.fT(q.template, function (t) { | |
| q.$el.html(t({ | |
| collection: r.toJSON(), | |
| noSubmittedReviews: p | |
| })) | |
| }) | |
| } | |
| }) | |
| }, | |
| openCommitteeReviewDetailsModal: function (p) { | |
| p.stopPropagation(); | |
| p.preventDefault(); | |
| d.Functions.openCommitteeReviewDetailsModal(p) | |
| } | |
| }); | |
| d.Vs.Decisions = Bb.View.extend({ | |
| template: "candidatechecklist/candidate.detail.checklist.decisions.template.html", | |
| initialize: function () { | |
| var p = this; | |
| p.collection = new d.Cs.Decisions(); | |
| this.collection.bind("add", function (r) { | |
| var q = new d.Vs.Decision({ | |
| model: r, | |
| dictionaries: p.dictionaries, | |
| prospectInstanceId: d.Data.prospectInstanceId | |
| }); | |
| r.bind("sync", p.renderData, p); | |
| p3.rV(q, this.$("#decisions"), false) | |
| }, this) | |
| }, | |
| events: { | |
| "click a.toggleLink": "toggleSection", | |
| "click button.create": "createDecision" | |
| }, | |
| render: function (p) { | |
| var q = this; | |
| $(p).append(q.el); | |
| g.Us.FetchAll({ | |
| ADMReasonsDeclinedAll: h.DictionaryData.ADMReasonsDeclinedAll, | |
| ADMDecisionTypeNoAll: h.DictionaryData.ADMDecisionTypeNoAll, | |
| TransferSchool: { | |
| id: 94, | |
| inputParam: "@chosen_inq=1[i]" | |
| } | |
| }, function (r) { | |
| q.dictionaries = r; | |
| q.renderData() | |
| }) | |
| }, | |
| renderData: function () { | |
| var p = this; | |
| p.collection.reset(); | |
| p3.fT(p.template, function (q) { | |
| p.$el.html(q({})); | |
| p.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| prospectInstanceId: d.Data.prospectInstanceId | |
| } | |
| }) | |
| }) | |
| }, | |
| toggleSection: function (p) { | |
| $(p.currentTarget).siblings(".toggledetail").slideToggle("fast"); | |
| if ($(p.currentTarget).hasClass("active")) { | |
| $(p.currentTarget).removeClass("active") | |
| } else { | |
| $(p.currentTarget).addClass("active") | |
| } | |
| return false | |
| }, | |
| createDecision: function () { | |
| var p = this; | |
| e.Us.ChecklistDictionaryGet(d.Data.prospectInstanceId, 6, null, function (s) { | |
| p.dictionaries.dictionary_127 = s.dictionary_127; | |
| p.dictionaries.dictionary_128 = s.dictionary_128; | |
| var q = new d.Ms.Decision({ | |
| prospectInstanceId: d.Data.prospectInstanceId, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| } | |
| }), | |
| r = new d.Vs.DecisionModal({ | |
| template: "candidatechecklist/candidate.detail.checklist.decision.edit.template.html", | |
| model: q, | |
| dictionaries: p.dictionaries, | |
| variables: { | |
| enteringYear: d.Data.enteringYear, | |
| enteringGrade: d.Data.enteringGrade, | |
| profilePage: true | |
| } | |
| }); | |
| q.bind("sync", p.renderData, p); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(r, p3.Layout.Containers.Modal, true) | |
| }) | |
| } | |
| }); | |
| d.Vs.Decision = Bb.View.extend({ | |
| template: "candidatechecklist/candidate.detail.checklist.decision.template.html", | |
| tagName: "tr", | |
| initialize: function () { | |
| this.model.bind("destroy", this.deleteElement, this); | |
| this.model.bind("remove", this.deleteElement, this); | |
| this.model.bind("sync", this.renderTemplate, this) | |
| }, | |
| events: { | |
| "click .editdecision": "editDecision", | |
| "click .delete": "deleteDecision", | |
| "click .togglebutton": "toggleInfo" | |
| }, | |
| render: function (p) { | |
| var q = this; | |
| $(p).append(q.el); | |
| q.renderData() | |
| }, | |
| renderData: function () { | |
| var r = this, | |
| p = r.model.get("AttachmentFile"), | |
| q = r.model.get("DecisionComment") || (p && p.hasOwnProperty("Attachment") && p.Attachment.length > 0); | |
| p3.fT(r.template, function (s) { | |
| r.$el.html(s({ | |
| model: r.model.toJSON(), | |
| hasSlider: q, | |
| dictionaries: r.options.dictionaries | |
| })) | |
| }) | |
| }, | |
| toggleInfo: function (q) { | |
| var r = this, | |
| p = $(q.currentTarget); | |
| r.$(".toggleinfo").slideToggle("fast"); | |
| if ($(q.currentTarget).hasClass("active")) { | |
| $(q.currentTarget).removeClass("active") | |
| } else { | |
| $(q.currentTarget).addClass("active") | |
| } | |
| if (p.hasClass("fa-chevron-up")) { | |
| p.removeClass("fa-chevron-up").addClass("fa-chevron-down") | |
| } else { | |
| if (p.hasClass("fa-chevron-down")) { | |
| p.removeClass("fa-chevron-down").addClass("fa-chevron-up") | |
| } | |
| } | |
| return false | |
| }, | |
| editDecision: function (p) { | |
| var q = this; | |
| e.Us.ChecklistDictionaryGet(d.Data.prospectInstanceId, 6, q.model.get("DecisionId"), function (s) { | |
| q.options.dictionaries.dictionary_127 = s.dictionary_127; | |
| q.options.dictionaries.dictionary_128 = s.dictionary_128; | |
| var r = new d.Vs.DecisionModal({ | |
| template: "candidatechecklist/candidate.detail.checklist.decision.edit.template.html", | |
| model: q.model, | |
| dictionaries: q.options.dictionaries, | |
| variables: { | |
| enteringYear: d.Data.enteringYear, | |
| enteringGrade: d.Data.enteringGrade, | |
| profilePage: true | |
| } | |
| }); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(r, p3.Layout.Containers.Modal, true) | |
| }) | |
| }, | |
| deleteDecision: function (p) { | |
| var q = this; | |
| p3.showConfirm("Delete Decision", "Wait a minute. Are you really sure you want to delete this decision information?", null, function () { | |
| var r = { | |
| prospectInstanceId: d.Data.prospectInstanceId | |
| }; | |
| q.model.destroy({ | |
| dataParam: r, | |
| success: function () { | |
| c.Us.RenderMainPage() | |
| } | |
| }) | |
| }) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }); | |
| d.Vs.CandidateDecisions = Bb.View.extend({ | |
| template: "candidatechecklist/candidate.detail.candidate.decisions.template.html", | |
| render: function (p) { | |
| var q = this; | |
| $(p).append(q.el); | |
| q.renderData() | |
| }, | |
| renderData: function () { | |
| var p = this; | |
| p3.fT(p.template, function (q) { | |
| p.$el.html(q({ | |
| model: p.model.toJSON(), | |
| collection: p.options.collection | |
| })); | |
| $(".modal-body").parent("div").trigger("changecanddecision"); | |
| p.candDecision = $(".candDecision option:selected").attr("data"); | |
| if (o.stringToInt(p.candDecision) === 2) { | |
| $("#candDeclineReasonHolder").show() | |
| } | |
| }) | |
| } | |
| }); | |
| d.Vs.CommitteeReviewDetailsModal = l.Vs.Modal2.extend({ | |
| template: "Candidate/candidate.checklist.committeereview.details.template.html", | |
| size: "lg" | |
| }); | |
| d.Vs.DecisionModal = l.Vs.Modal2.extend({ | |
| template: "candidatechecklist/candidate.detail.checklist.decision.edit.template.html", | |
| events: { | |
| "change select.admDecision": "changeAdmDecision", | |
| "change select.candDecision": "changeCandDecision", | |
| changecanddecision: "changeCandDecision", | |
| changeadmdecision: "changeAdmDecision", | |
| 'change select[name="ChecklistItemId"]': "toggleChecklistStatus" | |
| }, | |
| modalInitialized: function () { | |
| var p = this; | |
| p.profilePage = p.options.variables.profilePage | |
| }, | |
| modalDispose: function () { | |
| var p = this; | |
| $.each(p.$(".tinyeditor"), function () { | |
| var q = tinyMCE.get(this.id); | |
| if (q) { | |
| q.remove() | |
| } | |
| }) | |
| }, | |
| modalRendered: function (q) { | |
| var p = this; | |
| p.changeAdmDecision(); | |
| f.Us.initialize(".date-input", { | |
| yearRange: "-30:+20" | |
| }); | |
| n.Us.initialize(".time-input"); | |
| l.Us.showHtmlEditor(p, "tinyeditor"); | |
| $(".required-indicator").tooltip(); | |
| p.initializeFileUpload_File(); | |
| if (p.$('[name="ChecklistItemId"] option:selected').val() != "") { | |
| p.$(".checklist-status").removeClass("hide") | |
| } | |
| }, | |
| modalSave: function () { | |
| var p = this; | |
| $.each(p.$(".tinyeditor"), function () { | |
| var q = {}; | |
| q[this.name] = tinyMCE.get(this.id).save(); | |
| p.model.set(q) | |
| }) | |
| }, | |
| modalSavedSuccess: function () { | |
| var p = this; | |
| if (p.profilePage) { | |
| c.Us.RenderMainPage() | |
| } | |
| }, | |
| changeAdmDecision: function (q) { | |
| var r = this, | |
| p; | |
| if ($(".admDecision").val()) { | |
| p = $(".admDecision").val(); | |
| r.collection = new d.Cs.Acknowledgements(); | |
| r.collection.reset(); | |
| r.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| decisionId: p | |
| }, | |
| success: function (s) { | |
| p3.rV(new d.Vs.CandidateDecisions({ | |
| model: r.model, | |
| collection: s.toJSON() | |
| }), $(".candDecisionHolder"), true); | |
| $("#candDeclineHolder div").html("") | |
| } | |
| }) | |
| } else { | |
| $(".candDecisionHolder").html('<p style="padding-top:5px;"><em>No Items</em></p>'); | |
| $("#candDeclineHolder div").html("") | |
| } | |
| }, | |
| changeCandDecision: function (p) { | |
| var q = this; | |
| q.candDecision = $(".candDecision option:selected").attr("data"); | |
| if (o.stringToInt(q.candDecision) === 2) { | |
| $("#candDeclineReasonHolder").show() | |
| } else { | |
| $('[name="DeclinedId"]').val(""); | |
| $('[name="ChosenSchool"]').val(""); | |
| $("#candDeclineReasonHolder").hide() | |
| } | |
| }, | |
| toggleChecklistStatus: function (p) { | |
| var q = this; | |
| if (q.$(p.target).prop("value") == "") { | |
| q.$('[name="ChecklistItemId"]').val(""); | |
| q.$(".checklist-status").addClass("hide") | |
| } else { | |
| q.$(".checklist-status").removeClass("hide") | |
| } | |
| } | |
| }); | |
| Hb.registerHelper("getChecklistStatusIcon", function (q) { | |
| var p = ""; | |
| switch (q) { | |
| case 0: | |
| p = '<i class="fa fa-circle p3Blue-Awaiting"></i>'; | |
| break; | |
| case 1: | |
| p = '<i class="fa fa-circle p3Yellow-Started"></i>'; | |
| break; | |
| case 2: | |
| p = '<i class="fa fa-calendar p3Orange"></i>'; | |
| break; | |
| case 3: | |
| p = '<i class="p3icon-requested"></i>'; | |
| break; | |
| case 4: | |
| p = '<i class="p3icon-waived"></i>'; | |
| break; | |
| case 5: | |
| p = '<i class="fa fa-check p3Green-Complete" style="visibility:visible;"></i>'; | |
| break | |
| } | |
| return new Hb.SafeString(p) | |
| }) | |
| }(p3.module("admissions/candidate/checklist"))); | |
| (function (d) { | |
| var b = p3.module("admissions/managecandidates"), | |
| c = p3.module("admissions/candidateprofile"), | |
| g = p3.module("utilities/multifetch"), | |
| a = p3.module("shared/base"), | |
| e = p3.Us.Enum, | |
| f = p3.Us.InfoMessageLibrary; | |
| d.Ms.DictionaryItem = Bbm.extend({}); | |
| d.Cs.Dictionary = Bbc.extend({ | |
| model: c.Ms.DictionaryItem, | |
| url: "datadirect/DictionaryGet/" | |
| }); | |
| d.Ms.Connections = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| idAttribute: "ConnectionsId", | |
| validation: { | |
| "ConnectionsType.ConnectionsTypeId": [{ | |
| required: true, | |
| msg: f.P3.RequiredInfoNotEntered | |
| }], | |
| Name: [{ | |
| required: true, | |
| msg: f.P3.RequiredInfoNotEntered | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "admissions/prospectconnections/" + this.id + "/" : aP + "admissions/prospectconnections/" | |
| } | |
| }); | |
| d.Ms.HistoricConnection = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| idAttribute: "special_relationship_id", | |
| url: function () { | |
| return this.id ? aP + "admissions/HistoricConnections/" + this.id + "/" : aP + "admissions/HistoricConnections/" | |
| } | |
| }); | |
| d.Ms.CommunityConnection = Bbm.extend({ | |
| sync: a.DataParamSync, | |
| idAttribute: "special_relationship_id", | |
| url: function () { | |
| return this.id ? aP + "admissions/CommunityConnections/" + this.id + "/" : aP + "admissions/CommunityConnections/" | |
| } | |
| }); | |
| d.Cs.Connections = Bbc.extend({ | |
| model: d.Ms.Connections, | |
| url: function () { | |
| return aP + "admissions/ProspectConnections/" | |
| } | |
| }); | |
| d.Cs.HistoricConnections = Bbc.extend({ | |
| model: d.Ms.HistoricConnection, | |
| url: function () { | |
| return aP + "DataDirect/HistoricConnections/" | |
| } | |
| }); | |
| d.Cs.CommunityConnections = Bbc.extend({ | |
| model: d.Ms.CommunityConnection, | |
| url: function () { | |
| return aP + "DataDirect/CommunityConnections/" | |
| } | |
| }); | |
| d.Vs.Layout = Bb.View.extend({ | |
| template: "admissions/candidate.detail.profile.template.html", | |
| events: { | |
| renderdata: "renderData" | |
| }, | |
| initialize: function () { | |
| var h = this; | |
| if (h.options) { | |
| d.Data.UserId = h.options.userId; | |
| d.Data.ProspectInstanceId = h.options.instanceId | |
| } | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| p3.setTitle("Candidate Connections"); | |
| $(h).html(i.el); | |
| g.Us.Fetch({ | |
| ADMSpecialRelationships: { | |
| data: new g.Cs.Dictionary(), | |
| dataParams: e.DictionaryData.ADMSpecialRelationships | |
| }, | |
| ADMConnectionsRelTypes: { | |
| data: new g.Cs.Dictionary(), | |
| dataParams: e.DictionaryData.ADMConnectionsRelTypes | |
| }, | |
| ADMConnectionsTypes: { | |
| data: new g.Cs.Dictionary(), | |
| dataParams: e.DictionaryData.ADMConnectionsTypes | |
| }, | |
| GraduationYear: { | |
| data: new g.Cs.Dictionary(), | |
| dataParams: e.DictionaryData.GraduationYear | |
| } | |
| }, function (j, l, k) { | |
| d.Data.Dictionaries = j; | |
| i.renderData() | |
| }) | |
| }, | |
| renderData: function () { | |
| var i = this, | |
| h; | |
| p3.fT(i.template, function (j) { | |
| i.$el.html(j({})); | |
| h = $("#content"); | |
| p3.rV(new d.Vs.Connections({ | |
| collection: new d.Cs.Connections(), | |
| type: "Connections" | |
| }), h, false); | |
| p3.rV(new d.Vs.Connections({ | |
| collection: new d.Cs.HistoricConnections(), | |
| type: "Historic Connections" | |
| }), h, false); | |
| p3.rV(new d.Vs.Connections({ | |
| collection: new d.Cs.CommunityConnections(), | |
| type: "Community Connections" | |
| }), h, false) | |
| }) | |
| } | |
| }); | |
| d.Vs.Connections = Bb.View.extend({ | |
| template: "candidate/candidate.connections.connections.template.html", | |
| initialize: function () { | |
| var i = this, | |
| h = "candidate/candidate.connections.connection.template.html"; | |
| this.collection.bind("add", function (k) { | |
| switch (i.options.type) { | |
| case "Connections": | |
| h = "candidate/candidate.connections.connection.template.html"; | |
| break; | |
| case "Historic Connections": | |
| h = "candidate/candidate.connections.connection.historic.template.html"; | |
| break; | |
| case "Community Connections": | |
| h = "candidate/candidate.connections.connection.community.template.html"; | |
| break | |
| } | |
| var j = new d.Vs.Connection({ | |
| model: k, | |
| template: h, | |
| ui3: true, | |
| dictionaries: d.Data.Dictionaries | |
| }); | |
| k.bind("sync", i.renderData, i); | |
| p3.rV(j, this.$('[name="connections"]'), false) | |
| }, this) | |
| }, | |
| events: { | |
| "click button.create": "createConnection", | |
| "click .toggleLink": "toggleSection" | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| $(h).append(i.el); | |
| i.$el.hide(); | |
| i.renderData() | |
| }, | |
| renderData: function () { | |
| var h = this; | |
| h.collection.reset(); | |
| p3.fT(h.template, function (i) { | |
| h.$el.html(i({ | |
| type: h.options.type | |
| })); | |
| h.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| prospectInstanceId: d.Data.ProspectInstanceId | |
| }, | |
| success: function (j) { | |
| if (h.options.type === "Connections" || h.collection.models.length > 0) { | |
| h.$el.show() | |
| } | |
| } | |
| }) | |
| }) | |
| }, | |
| createConnection: function () { | |
| var i = this, | |
| h = new d.Ms.Connections({ | |
| prospectInstanceId: d.Data.ProspectInstanceId, | |
| ConnectionsRelType: { | |
| "$type": "clBLL.nAdmissions.ConnectionsRelType, clBLL" | |
| }, | |
| ConnectionsType: { | |
| "$type": "clBLL.nAdmissions.ConnectionsType, clBLL" | |
| }, | |
| SpecialRelType: { | |
| "$type": "clBLL.nAdmissions.SpecialRelType, clBLL" | |
| } | |
| }); | |
| h.bind("sync", i.renderData, i); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new b.Vs.Modal({ | |
| template: "candidate/candidate.connections.connection.edit.template.html", | |
| model: h, | |
| dictionaries: d.Data.Dictionaries | |
| }), p3.Layout.Containers.Modal, true) | |
| }, | |
| toggleSection: function (k) { | |
| var i, j, h = $(k.currentTarget); | |
| k.stopPropagation(); | |
| k.preventDefault(); | |
| i = h.closest(".bb-tile").find(".toggledetail"); | |
| j = h.find(".toggleImage"); | |
| i.slideToggle("fast"); | |
| if (j.hasClass("fa-chevron-up")) { | |
| j.removeClass("fa-chevron-up"); | |
| j.addClass("fa-chevron-down") | |
| } else { | |
| if (j.hasClass("fa-chevron-down")) { | |
| j.removeClass("fa-chevron-down"); | |
| j.addClass("fa-chevron-up") | |
| } | |
| } | |
| } | |
| }); | |
| d.Vs.Connection = Bb.View.extend({ | |
| tagName: "tr", | |
| initialize: function () { | |
| var h = this; | |
| h.template = h.options.template; | |
| h.model.bind("destroy", h.deleteElement, h); | |
| h.model.bind("remove", h.deleteElement, h) | |
| }, | |
| events: { | |
| "click .edit": "editConnection", | |
| "click .delete": "deleteConnection", | |
| "click .delete-historic": "deleteHistoricConnection", | |
| "click .togglebutton": "toggleInfo" | |
| }, | |
| render: function (h) { | |
| var i = this; | |
| $(h).append(i.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var h = this; | |
| p3.fT(h.template, function (i) { | |
| h.$el.html(i({ | |
| model: h.model.toJSON(), | |
| dictionaries: h.options.dictionaries | |
| })) | |
| }) | |
| }, | |
| toggleInfo: function (i) { | |
| var j = this, | |
| h = $(i.currentTarget); | |
| i.stopPropagation(); | |
| i.preventDefault(); | |
| j.$(".toggleinfo").slideToggle("fast"); | |
| if (h.hasClass("active")) { | |
| h.removeClass("active") | |
| } else { | |
| h.addClass("active") | |
| } | |
| if (h.hasClass("fa-chevron-up")) { | |
| h.removeClass("fa-chevron-up"); | |
| h.addClass("fa-chevron-down") | |
| } else { | |
| if (h.hasClass("fa-chevron-down")) { | |
| h.removeClass("fa-chevron-down"); | |
| h.addClass("fa-chevron-up") | |
| } | |
| } | |
| }, | |
| editConnection: function () { | |
| var h = this; | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new b.Vs.Modal({ | |
| template: "candidate/candidate.connections.connection.edit.template.html", | |
| model: h.model, | |
| dictionaries: h.options.dictionaries | |
| }), p3.Layout.Containers.Modal, true) | |
| }, | |
| deleteConnection: function (h) { | |
| var i = this; | |
| p3.showConfirm("Delete Connection", "Wait a minute. Are you really sure you want to delete this connection information?", null, function () { | |
| var j = { | |
| prospectInstanceId: d.Data.ProspectInstanceId | |
| }; | |
| i.model.destroy({ | |
| dataParam: j | |
| }) | |
| }) | |
| }, | |
| deleteHistoricConnection: function (h) { | |
| var i = this; | |
| p3.showConfirm("Delete Connection", "Wait a minute. Are you really sure you want to delete this connection information?", null, function () { | |
| p3.log(i.model); | |
| var j = { | |
| userId: d.Data.UserId | |
| }; | |
| i.model.destroy({ | |
| dataParam: j | |
| }) | |
| }) | |
| }, | |
| deleteElement: function () { | |
| $(this.el).remove() | |
| } | |
| }) | |
| }(p3.module("admissions/candidate/connections"))); | |
| (function (c) { | |
| var a = p3.module("app"), | |
| e = p3.module("shared/datepicker"), | |
| l = p3.module("shared/timepicker"), | |
| d = p3.module("admissions/candidateprofile"), | |
| i = p3.module("shared/profilecontactcard"), | |
| b = p3.module("shared/base"), | |
| m = p3.module("utilities/validate"), | |
| j = p3.module("utilities/smodal"), | |
| h = p3.module("utilities/multifetch"), | |
| f = p3.Us.Enum, | |
| g = p3.Us.InfoMessageLibrary, | |
| k = p3.module("shared/task"); | |
| c.Ms.Contract = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "ContractId", | |
| validation: { | |
| SchoolYearLabel: [{ | |
| required: true, | |
| msg: g.P3.RequiredInfoNotEntered | |
| }], | |
| "ContractType.ContractTypeId": [{ | |
| required: true, | |
| msg: g.P3.RequiredInfoNotEntered | |
| }], | |
| AmountDue: [{ | |
| required: false, | |
| pattern: "number", | |
| msg: g.P3.NotNumeric | |
| }], | |
| AmountPaid: [{ | |
| required: false, | |
| pattern: "number", | |
| msg: g.P3.NotNumeric | |
| }], | |
| DepositAmtDue: [{ | |
| required: false, | |
| pattern: "number", | |
| msg: g.P3.NotNumeric | |
| }], | |
| DepositAmountReceived: [{ | |
| required: false, | |
| pattern: "number", | |
| msg: g.P3.NotNumeric | |
| }], | |
| SendDate: [{ | |
| date: true | |
| }], | |
| ReturnDate: [{ | |
| date: true | |
| }], | |
| DepositReceivedDate: [{ | |
| date: true | |
| }], | |
| Hold: [{ | |
| fn: function (p, n, o) { | |
| if ($("#Hold").prop("checked") == true && $("#HoldTypeId").val() == "") { | |
| return "Hold type must be selected." | |
| } | |
| } | |
| }], | |
| HoldTypeId: [{ | |
| fn: function (p, n, o) { | |
| if ($("#Hold").prop("checked") == true && $("#HoldTypeId").val() == "") { | |
| return "Hold type must be selected." | |
| } | |
| } | |
| }], | |
| NoReturnDate: [{ | |
| date: true | |
| }], | |
| EffectiveDate: [{ | |
| date: true | |
| }], | |
| EndDate: [{ | |
| date: true | |
| }], | |
| DueDate: [{ | |
| date: true | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "admissions/ProspectContract/" + this.id + "/" : aP + "admissions/ProspectContract/" | |
| } | |
| }); | |
| c.Ms.ContractDelete = Bbm.extend({ | |
| sync: b.DataParamSync, | |
| idAttribute: "ContractId", | |
| validation: { | |
| DeleteReason: [{ | |
| required: true, | |
| msg: g.P3.RequiredInfoNotEntered | |
| }, { | |
| maxLength: 1000, | |
| msg: g.P3.MaxLengthExceeded | |
| }] | |
| }, | |
| url: function () { | |
| return this.id ? aP + "admissions/ProspectContract/" + this.id + "/" : aP + "admissions/ProspectContract/" | |
| } | |
| }); | |
| c.Cs.Contracts = Bbc.extend({ | |
| model: c.Ms.Contract, | |
| url: function () { | |
| return aP + "admissions/ProspectContractList/" | |
| } | |
| }); | |
| c.Cs.HoldTypes = Bbc.extend({ | |
| url: "DataDirect/ContractHoldTypesGet/", | |
| comparator: "Name" | |
| }); | |
| c.Cs.PaymentPlans = Bbc.extend({ | |
| url: "EnrollmentContract/PaymentPlanList/", | |
| comparator: "Name" | |
| }); | |
| c.Cs.ContractTypes = Bbc.extend({ | |
| url: function () { | |
| return aP + "enrollmentcontract/ContractTypeList/" | |
| } | |
| }); | |
| c.Cs.OnBoardUsers = Bbc.extend({ | |
| url: function () { | |
| return aP + "DataDirect/OnBoardUsersGet/" | |
| } | |
| }); | |
| c.Vs.Layout = Bb.View.extend({ | |
| template: "admissions/candidate.detail.profile.template.html", | |
| events: { | |
| renderdata: "renderData" | |
| }, | |
| initialize: function () { | |
| if (this.options) { | |
| this.userId = this.options.userId | |
| } | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| p3.setTitle("Candidate Contracts"); | |
| $(n).html(o.el); | |
| o.renderData() | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({})); | |
| p3.rV(new c.Vs.Contracts({ | |
| instanceId: n.options.instanceId, | |
| userId: n.options.userId | |
| }), $("#content"), false) | |
| }) | |
| } | |
| }); | |
| c.Vs.Contracts = Bb.View.extend({ | |
| template: "candidate/candidate.contracts.contracts.template.html", | |
| initialize: function () { | |
| var n = this; | |
| this.collection = new c.Cs.Contracts(); | |
| this.collection.bind("add", function (p) { | |
| var o = new c.Vs.Contract({ | |
| model: p, | |
| dictionaries: n.dictionaries, | |
| userId: n.options.userId | |
| }); | |
| p.bind("sync", n.renderData, n); | |
| p3.rV(o, this.$("#candidateContracts"), false) | |
| }, this) | |
| }, | |
| events: { | |
| "click a.toggleLink": "toggleSection", | |
| "click button.create": "createContract" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| h.Us.Fetch({ | |
| ADMContracts: { | |
| data: new h.Cs.Dictionary(), | |
| dataParams: f.DictionaryData.ADMContracts | |
| }, | |
| SchoolYearCurrent: { | |
| data: new h.Cs.Dictionary(), | |
| dataParams: f.DictionaryData.SchoolYearCurrent | |
| }, | |
| HoldTypes: { | |
| data: new c.Cs.HoldTypes() | |
| }, | |
| PaymentPlans: { | |
| data: new c.Cs.PaymentPlans() | |
| }, | |
| OnBoardUsers: { | |
| data: new c.Cs.OnBoardUsers() | |
| } | |
| }, function (p, r, q) { | |
| if (q) { | |
| p3.displayError("There was an error loading data.") | |
| } | |
| p.SchoolYearCurrent = _.sortBy(p.SchoolYearCurrent, "dd_id").reverse(); | |
| p.HoldTypes = p.HoldTypes.toJSON(); | |
| p.PaymentPlans = p.PaymentPlans.toJSON(); | |
| p.OnBoardUsers = p.OnBoardUsers.toJSON(); | |
| o.dictionaries = p; | |
| o.renderData() | |
| }) | |
| }, | |
| renderData: function () { | |
| var n = this; | |
| n.collection.reset(); | |
| p3.fT(n.template, function (o) { | |
| n.$el.html(o({})); | |
| n.collection.fetch({ | |
| update: true, | |
| cache: false, | |
| data: { | |
| userId: n.options.userId | |
| } | |
| }) | |
| }) | |
| }, | |
| toggleSection: function (n) { | |
| $(n.currentTarget).siblings(".toggledetail").slideToggle("fast"); | |
| if ($(n.currentTarget).hasClass("active")) { | |
| $(n.currentTarget).removeClass("active") | |
| } else { | |
| $(n.currentTarget).addClass("active") | |
| } | |
| return false | |
| }, | |
| createContract: function () { | |
| var o = this, | |
| n = new c.Ms.Contract({ | |
| userId: o.options.userId, | |
| AttachmentFile: { | |
| "$type": "clBLL.nAdmissions.AttachmentFile, clBLL" | |
| }, | |
| ContractType: { | |
| "$type": "clBLL.nAdmissions.ContractType, clBLL" | |
| } | |
| }); | |
| n.bind("sync", o.renderData, o); | |
| p3.showModal(p3.Layout.Containers.Modal, { | |
| backOnHide: false | |
| }); | |
| p3.rV(new c.Vs.Modal({ | |
| template: "candidate/candidate.contracts.edit.template.html", | |
| model: n, | |
| userContracts: o.collection, | |
| dictionaries: o.dictionaries, | |
| layoutView: o.options.layoutView | |
| }), p3.Layout.Containers.Modal, true) | |
| } | |
| }); | |
| c.Vs.Contract = Bb.View.extend({ | |
| template: "candidate/candidate.contracts.contract.template.html", | |
| tagName: "tr", | |
| initialize: function () { | |
| this.model.bind("sync", this.renderData, this) | |
| }, | |
| events: { | |
| "click .edit": "editContract", | |
| "click .delete": "deleteContract", | |
| "click .togglebutton": "toggleInfo" | |
| }, | |
| render: function (n) { | |
| var o = this; | |
| $(n).append(o.el); | |
| this.renderData() | |
| }, | |
| renderData: function () { | |
| var p = this, | |
| n = p.model.get("AttachmentFile"), | |
| o = p.model.get("Comment") || (n && n.hasOwnProperty("Attachment") && n.Attachment.length > 0); | |
| if (p.model.get("FormTypeId") === 512 && p.model.get("ContractStatu |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment