Give throughpayroll deduction
Source: https://engage.utoronto.ca/site/SPageServer?pagename=payroll Parent: https://engage.utoronto.ca/site/SPageServer?pagename=givingday&filterfunds=NURS&utm_source=NURS&utm_medium=DivisionalOutreach&utm_campaign=UOTGD26
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-KJQWN29');
input#\36 188_1804_10_1670{ height: 38px; }
Give through payroll deduction
Donating to the University of Toronto through automated Payroll deductions allows you to conveniently pay through automated monthly contributions. You decide how much you want to give each month and for how long. As a bonus, your tax benefits are reflected on your T4, which means no receipts to keep track of at tax time!
First Name (required)
Last Name (required)
Email Address (required)
Please use your utoronto.ca email address.
Personnel Number (required)
Select a Fund
Select category Campuses, Colleges and Communities Faculties and Institutes Special Projects, Initiatives and More
Selected category
{{ direct.category }}
Change
Select a Faculty or Division:
Select
{{ facultyInstitute.name }}
Selected Faculty or Division:
{{ getspecificEntity.name }}
Change
Select a College, Campus or Community:
Select
{{ collegeCampusCommunity.name }}
Selected {{ getspecificEntity.type }}
{{ getspecificEntity.name }}
Change
Select a Special Project, Initiative or more:
Select
{{ specialProjectInitiative.name }}
Selected Special Project or Initiative
{{ getspecificEntity.name }}
Change
Select an area of giving:
Select
Featured Funds
Departments and Specific Areas
Class Giving
Other Giving Opportunities
Selected area of giving
{{ direct.area }}
Change
Select a giving opportunity:
Select
{{ fund.name }}
No funds found, please try again or click here to donate to the most pressing needs of the University of Toronto
You're giving to
{{ getSpecificEntityFund.name }}
Change
Select a Department or a Specific Area
Select
{{ department.name }}
Selected Department or a Specific Area
{{ getspecificEntityForDirectDepartments.name }}
Change
Select Other Giving Opportunities
Select
{{ collection.name }}
Selected Giving Opportunities
{{ getspecificEntityForDirectCollections.name }}
Change
Select a giving opportunity
Select
{{ fund.name }}
No funds found, please try again or click here to donate to the most pressing needs of the University of Toronto
You're giving to
{{ getSpecificEntityFund.name }}
Change
Select a giving opportunity
Select
{{ fund.name }}
No funds found, please try again or click here to donate to the most pressing needs of the University of Toronto
You're giving to
{{ getSpecificEntityFund.name }}
Change
You're giving to
{{ getSpecificEntityFund.name }}
Change
Select a giving opportunity:
Select
{{ fund.name }}
No funds found, please try again or click here to donate to the most pressing needs of the University of Toronto
You're giving to
{{ getSpecificEntityFund }}
Change
{{ getDesignationName.name }} | {{ getDesignationName.luminate_code }} | {{ getDesignationName.designation_code }}
Monthly Gift Amount (required)
$
Duration of Monthly Deductions (required)
1 year (12 deductions)
2 years (24 deductions)
Indefinite (contact us to cancel or pause)
Other
Please specify number of months
Comments or questions, if any:
Spam Control Text: Please leave this field empty
Note: Payroll gifts submitted after the 13th of the month will be automatically deducted beginning the following month. \ \
Already a Monthly Payroll Donor?
Contact Donations Management at donations.management@utoronto.ca for any questions or changes to your deductions \ \ Leave of Absence: Staff taking a leave of absence are to notify Donation Management if they wish to suspend deductions. Deductions will otherwise be taken retroactively upon your return.
Have questions?
Consult our FAQs or contact us directly if you have questions about giving, including tax implications and how we recognize your generosity.
$(document).ready(function () { $("#fakeSubmit").click(function (e) { e.preventDefault(); //checking the total inputs in the current step var totalInputs = $("form" + ' [data-validate~="true"]').length; var errors = 0; //clear previous errors $("form" + ' [data-validate~="true"]').each(function (i) { $(this).removeClass("Shake Error" + i); $(this).closest(".form-group").find(".text-danger").remove(); if ($(this).attr('data-required') == "true") { if ($(this).val() == "" || $(this).val() == null) { errors++; $(this).addClass("Shake Error" + i); var errorMsg = $(this).attr('data-required') ? $(this).attr('data-error') : "This is a required field"; var errorMsgDOM = "" + errorMsg + "" $(this).closest(".form-group").find(".text-danger").remove(); $(this).closest(".form-group").append(errorMsgDOM); $(this).focus(); } if($(this).attr('data-format') == "personnel"){ if ($(this).val().length < 8 || $(this).val().length > 9 || !/^[0-9]+$/.test($(this).val())) { errors++; $(this).addClass("Shake Error" + i); var errorMsg = "Personnel numbers should be 8 digits"; var errorMsgDOM = "" + errorMsg + "" $(this).closest(".form-group").find(".text-danger").remove(); $(this).closest(".form-group").append(errorMsgDOM); $(this).focus(); } } if($(this).attr('data-format') == "donation"){ if ($(this).val() < 5) { errors++; $(this).addClass("Shake Error" + i); var errorMsg = "Minimum amount: $5 or above"; var errorMsgDOM = "" + errorMsg + "" $(this).closest(".form-group").find(".text-danger").remove(); $(this).closest(".form-group").append(errorMsgDOM); $(this).focus(); } } } }); if (errors > 0) { $(".Shake:first")[0].scrollIntoView(); } if (errors < 1) { $("#ACTION_SUBMIT_SURVEY_RESPONSE").click(); } }); });
\
Canadian Charitable Registration \
108162330-RR0001
Give Now
Help U of T address today's most pressing issues—here and around the world.
Contact Us
416-978-1221 \ 1-800-463-6048 \ donations.management@utoronto.ca
\
University of Toronto \ 21 King's College Circle \ Toronto, Ontario, Canada \ M5S 3J3
FAQ’s
Get answers to our most-asked questions about giving, including tax implications and how we recognize your generosity.
Copyright 2023 - All rights reserved
import 'promise-polyfill/src/polyfill';
var DonationForm = {}
let config = {
environmentId: 'p-G1r4USFbPEyB3IS3zG4qCQ',
paymentConfigurationId: '83b7bfb4-4e79-4861-83a7-4c764e79c83c',
pcoEnvironmentZone: 'p-can01',
zone: 'p-can01',
applicationName: 'Luminate',
workflowMode: 'modal',
paymentMethodOptions: {
card: {
enabled: true,
},
directDebit: {
enabled: false,
},
wallets: {
applePayEnabled: false,
googlePayEnabled: false,
},
payPal: {
enabled: false,
},
},
}
let checkoutService = window.BlackbaudCheckout(config);
if(document.getElementById('donation_form_id')){
var formID = parseInt(document.getElementById('donation_form_id').value);
}
function getUrlParameter(name) {
name = name.replace(/[[]/, '\[').replace(/[]]/, '\]')
var regex = new RegExp('[\?&]' + name + '=([^&#]*)')
var results = regex.exec(location.search)
return results === null ? '' : decodeURIComponent(results[1].replace(/+/g, ' '))
}
// Initiating LO
luminateExtend.init({
apiKey: 'Q2F8xD8W4qAiXuYn',
path: {
nonsecure: 'http://uot.convio.net/site/',
secure: 'https://engage.utoronto.ca/site/'
}
});
$('document').ready(function () {
var anchor = "";
// var anchored = localStorage.getItem("anchored");
var anchored = 0;
if (anchor && anchored < 1) {
// localStorage.setItem("anchored", "true");
anchored++
$('html, body').animate({
// scrollTop: $("#").offset().top
});
}
illuminate.getJSON();
checkoutService.checkoutComplete.subscribe((e) => {
console.log(Checkout complete. \n ${JSON.stringify(e)});
console.log(e);
illuminate.donate_checkout(e);
});
$.ajax({
url: "https://engage.utoronto.ca/site/CRDonationAPI",
method: "POST",
data: 'method=getDonationFormInfo&v=1.0&api_key=Q2F8xD8W4qAiXuYn&form_id=1620',
success: function (result) {
console.log(result);
}
});
$(document).keypress(
function (event) {
if (event.which == '13') {
event.preventDefault();
}
});
//handling donation levels toggle
$('[data-toggle="collapse"]').on('click', function (e) {
if ($(this).parentsUntil('.accordion').find('.collapse.show')) {
var idx = $(this).index('[data-toggle="collapse"]');
if (idx == $('.collapse.show').index('.collapse')) {
e.stopPropagation();
}
}
});
var showPage = function (newHash) {
// console.log("Showing Page for:" + newHash);
illuminate.domdom.body = newHash.replace(/[0-9]/g, '').replace(/\s/g, '').replace(/\//g, '');
$("body").attr("data-class", "");
$("body").attr("data-class", newHash);
$('section').addClass("d-none");
$('section').each(function () {
if ($(this).attr('data-route')) {
var route = $(this).attr('data-route');
newHash = newHash.replace(/[0-9]/g, '').replace(/\s/g, '').replace(/\//g, '');
if (newHash.indexOf('&') > -1) {
newHash = newHash.substring(0, newHash.indexOf('&'));
}
// console.log("Cleaned hash for showing page:" + newHash);
if (route == newHash) {
$(this).removeClass("d-none");
}
}
})
};
function godspeed(title) {
if (window.location.href.indexOf("engage") > -1) {
window.dataLayer.push({
'event': 'virtualPageview',
'pagePath': window.location.href,
'pageTitle': title
});
}
}
var vic = crossroads.addRoute("/vicaf", function () {
window.location.href = "https://my.alumni.utoronto.ca/s/731/index.aspx?sid=731&gid=3&pgid=1051&cid=1952&ecid=1952";
});
//HomePage
var home = crossroads.addRoute("/home", function () {
illuminate.search.searchFunds = '';
illuminate.show.page = 'home';
godspeed('Home');
});
// Fall Campaign
var fall = crossroads.addRoute("/fall", function () {
illuminate.show.page = 'fall';
godspeed('Fall');
});
// Hub Pages
var faculties = crossroads.addRoute("/faculties-institutes", function () {
godspeed('Faculty and Institutes');
illuminate.show.page = 'faculties-institutes';
});
var facultiesDepartments = crossroads.addRoute("/faculty-departments/{id}", function (id) {
illuminate.show.facultyDepartment = id;
illuminate.show.page = 'faculty-department';
godspeed('Faculty Department');
});
var facultiesClassGiving = crossroads.addRoute("/faculty-class-giving/{id}", function (id) {
illuminate.show.facultyClassGiving = id;
illuminate.show.page = 'faculties-class-giving';
godspeed('Faculty Class Giving');
});
var facultiesOther = crossroads.addRoute("/other-giving-opportunities/{id}", function (id) {
illuminate.show.facultyOther = id;
illuminate.show.page = 'other-giving-opportunities';
godspeed('Other Giving Opportunities');
});
var faculties = crossroads.addRoute("/colleges-campuses-communities", function () {
illuminate.show.page = 'colleges-campuses-communities';
godspeed('College Campus Communities');
});
var faculties = crossroads.addRoute("/special-projects-initiatives", function () {
illuminate.show.page = 'special-projects-initiatives';
godspeed('Special Project Initiatives');
});
var home = crossroads.addRoute("/search", function () {
// illuminate.search.searchFunds = '';
illuminate.show.page = 'search';
godspeed('Search');
});
var direct = crossroads.addRoute("/direct", function () {
illuminate.direct.category = '';
illuminate.direct.collection = '';
illuminate.direct.department = '';
illuminate.direct.faculty = '';
illuminate.direct.area = '';
illuminate.direct.entity = '';
illuminate.show.faculty = '';
illuminate.direct.fund = '';
godspeed('Direct your Gift');
illuminate.show.page = 'direct';
});
var makeagift = crossroads.addRoute("/makeagift", function () {
godspeed('Make a Gift');
illuminate.show.page = 'makeagift';
});
var pressingNeeds = crossroads.addRoute("/pressing-needs", function () {
godspeed('Pressing Needs');
illuminate.show.page = 'pressing-needs';
});
// Individual Category Pages
var viewCampus = crossroads.addRoute("/campus/{id}", function (id) {
illuminate.show.campus = id;
godspeed('Campus');
illuminate.show.page = 'campus';
});
var viewCollection = crossroads.addRoute("/collection/{id}", function (id) {
illuminate.show.collection = id;
godspeed('Collection');
illuminate.show.page = 'collection';
});
var viewCollege = crossroads.addRoute("/college/{id}", function (id) {
illuminate.show.college = id;
godspeed('College');
illuminate.show.page = 'college';
});
var viewDepartment = crossroads.addRoute("/department/{id}", function (id) {
illuminate.show.department = id;
godspeed('Department');
illuminate.show.page = 'department';
});
var viewFaculty = crossroads.addRoute("/faculty/{id}", function (id) {
illuminate.show.faculty = id;
godspeed('Faculty');
illuminate.show.page = 'faculty';
});
var viewInstitute = crossroads.addRoute("/institute/{id}", function (id) {
illuminate.show.institute = id;
//Adding a manual redirect for HART HOUSE
if(id == 3){
window.location.replace("https://engage.utoronto.ca/site/SPageServer?pagename=donate#/campus/4")
}
godspeed('Institute');
illuminate.show.page = 'institute';
});
var viewInitiative = crossroads.addRoute("/initiative/{id}", function (id) {
illuminate.show.initiative = id;
godspeed('Initiative');
illuminate.show.page = 'initiative';
});
// Individual Fund Pages
var viewFund = crossroads.addRoute("/fund/{id}", function (id) {
illuminate.show.fund = id;
illuminate.direct.fund = id;
godspeed('Fund');
illuminate.show.page = 'fund';
});
var viewCustomFundPage = crossroads.addRoute("/customfundpage/{id}", function (id) {
illuminate.show.fund = id;
illuminate.direct.fund = id;
godspeed('Custom Fund Page');
illuminate.show.page = 'customfundpage';
});
// var viewFund = crossroads.addRoute("/fund/{id}/{slug}", function (id) {
// illuminate.show.fund = id;
// illuminate.direct.fund = id;
// godspeed('Fund');
// });
// var viewFund = crossroads.addRoute("/fund/show/{slug}", function (slug) {
// illuminate.show.fund = id;
// illuminate.direct.fund = id;
// godspeed('Fund');
// });
//Form Routes
var viewFund = crossroads.addRoute("/donorInfo", function (id) {
godspeed('Donor Information');
if (illuminate.cart.items.length == 0) {
illuminate.go_to_route('home');
}
});
var viewFund = crossroads.addRoute("/giftOptions", function (id) {
godspeed('Gift Options');
if (illuminate.cart.items.length == 0) {
illuminate.go_to_route('home');
}
});
var viewFund = crossroads.addRoute("/billing", function (id) {
godspeed('Billing');
if (illuminate.cart.items.length == 0) {
illuminate.go_to_route('home');
}
});
var viewFund = crossroads.addRoute("/review", function (id) {
godspeed('Review');
if (illuminate.cart.items.length == 0) {
illuminate.go_to_route('home');
}
});
var thankYou = crossroads.addRoute("/thankyou", function (id) {
godspeed('Thank you ');
});
function getJsonFromUrl(url) {
if (!url) url = decodeURI(location.href).replace(/\s/g, '');
var question = url.indexOf("?");
var hash = url.indexOf("#");
if (hash == -1 && question == -1) return {};
if (hash == -1) hash = url.length;
var query = question == -1 || hash == question + 1 ? url.substring(hash) :
url.substring(question + 1, hash);
var result = {};
query.split("&").forEach(function (part) {
if (!part) return;
part = part.split("+").join(" ");
var eq = part.indexOf("=");
var key = eq > -1 ? part.substr(0, eq) : part;
var val = eq > -1 ? decodeURIComponent(part.substr(eq + 1)) : "";
var from = key.indexOf("[");
if (from == -1) result[decodeURIComponent(key)] = val;
else {
var to = key.indexOf("]", from);
var index = decodeURIComponent(key.substring(from + 1, to));
key = decodeURIComponent(key.substring(0, from));
if (!result[key]) result[key] = [];
if (!index) result[key].push(val);
else result[key][index] = val;
}
});
return result;
}
// setup hasher
function parseHash(newHash, oldHash) {
if (newHash) {
newHash = decodeURI(newHash.replace(/\s/g, ''));
}
if (oldHash) {
oldHash = decodeURI(oldHash.replace(/\s/g, ''));
}
var hash = decodeURI(window.location.href.split('#')[1]).replace(/\s/g, '');
hash = hash.split('&')[0];
var URLJSON = getJsonFromUrl(hash);
//Check if URL has parameters
if (Object.keys(URLJSON).length > 0) {
// console.log("Routing Case 1");
// console.log("Going to CrossRoads: " + decodeURI(hash.split('?')[0]).replace(/\s/g, ''));
crossroads.parse(decodeURI(window.location.hash.split('?')[0]).replace(/\s/g, ''));
showPage(hash.split('?')[0]);
} else {
// console.log("Routing Case 2");
showPage(newHash);
crossroads.parse(hash);
}
document.body.scrollTop = document.documentElement.scrollTop = 0;
if (newHash == "") {
// console.log("Routing Case 3");
hasher.setHash('home');
showPage("home");
illuminate.show.page = "home";
$("#app").attr("data-show", "home");
crossroads.parse(newHash);
}
}
hasher.initialized.add(parseHash);
hasher.changed.add(parseHash);
hasher.init();
});
const illuminate = new Vue({
el: '#app',
data: {
payroll:{
cons_first_name: '',
cons_last_name: '',
cons_email: '',
donor_phone: '',
frequency: '1 year (12 deductions)',
other: '',
personnelnumber: '',
giftamount: '',
designationname: '',
},
domdom: {
body: ''
},
analytics: {
affiliation: '',
affiliationType: '',
},
recaptchaKey: '',
database: {
campuses: [],
colleges: [],
contacts: [],
departments: [],
collections: [],
faculties: [],
institutes: [],
initiatives: [],
funds: [],
pages: [
{
"id": "1",
"name": "Ways to give",
"keyword": "Other ways to give",
"shortd": "From company matching to legacy giving, there are many ways to make a difference. Your gift will help U of T address today's most pressing issues—here and around the world.",
"url": "https://engage.utoronto.ca/site/SPageServer?pagename=ways_to_give",
"type": "page"
},
{
"id": "2",
"name": "Gift Planning",
"keyword": "Legacy Planning",
"shortd": "How do I plan a tax-smart or legacy gift to the University of Toronto?",
"url": "https://engage.utoronto.ca/site/SPageServer?pagename=gift_planning",
"type": "page"
},
{
"id": "3",
"name": "Contact Us",
"keyword": "General Inquiries and Donations",
"shortd": "Consult our FAQ or contact us directly if you have questions about giving, including tax implications and how we recognize your generosity",
"url": "https://engage.utoronto.ca/site/SPageServer?pagename=contact_us",
"type": "page"
},
],
},
search: {
searchFunds: '',
searchFacultyInstitute: '',
searchCollegeCampusCommunity: '',
searchSpecialProjectInitiative: '',
searchFundsByKeyword: '',
searchFacultyDepartment: '',
searchFacultyClassGiving: '',
searchFacultyOther: ''
},
show: {
campus: '',
collection: '',
college: '',
department: '',
faculty: '',
institute: '',
initiative: '',
fund: '',
facultyDepartment: '',
facultyClassGiving: '',
facultyOther: '',
page: '',
},
global: {
designation_types: [],
designees: []
},
current_step: 1,
current_donation: {
designation_type: '',
designees: [],
designee: {
id: '',
name: '',
arborID: '',
description: '',
},
donation_amount: '',
donation_amount_other: '',
donation_type: '' || 'one-time'
},
cart: {
total:0,
edit: null,
donation_type: '',
items: []
},
thankyoucart: {
donation_type: '',
items: []
},
url_params: {
finderNumber: '',
sourceCode: '',
consID: '',
donationAmount: '',
donationFrequency: '',
designationID: '',
divisionName: '',
userAffiliation: ''
},
donor_information: {
is_corporate_gift: false,
corporate_name: '',
donor_name_first: '',
donor_name_last: '',
donor_email: '',
donor_email_opt_in: true,
donor_phone: '',
uoftaffifl: '',
giftPlanning: ''
},
gift_options: {
tribute_show_honor_fields: false,
tribute_type: '',
tribute_honoree_name_full: '',
send_card_option: false,
send_card_type: 'none',
ecard_recipients: '',
ecard_id: '',
ecard_src: '',
ecard_subject: '',
ecard_message: '',
ecard_copy_sender: '',
tribute_notify_name_full: '',
tribute_notify_address_street1: '',
tribute_notify_address_street2: '',
tribute_notify_address_city: '',
tribute_notify_address_state: '',
tribute_notify_address_zip: '',
tribute_notify_address_country: '',
printed_card_message: '',
joint_donor_option: false,
joint_donor_name_first: '',
joint_donor_name_last: '',
anonymous: false,
pledge_payment: false,
pledge_id: '',
gift_options: '',
corporate_matching: false,
corporate_matching_employer: '',
special_instructions: ''
},
billing_information: {
billing_name_first: '',
billing_name_last: '',
card_number: '',
card_exp_date_month: '',
card_exp_date_year: '',
card_cvv: '',
billing_address_country: '',
billing_address_street1: '',
billing_address_street2: '',
billing_address_city: '',
billing_address_state: '',
billing_address_zip: ''
},
form_step_1: {
show_error: false
},
form_step_2: {
show_error: false
},
form_step_3: {
show_error: false
},
form_step_4: {
show_error: false
},
review_page: {
show_error: false
},
error_message: {
api_response: ''
},
processing_donation: false,
successful_donation: false,
successful_donation_response: {
amount: ''
},
direct: {
category: '',
department: '',
collection: '',
entity: '',
area: '',
faculty: '',
fund: 0,
facultyInstitute: [],
},
metaInfo: {
title: 'Donate | University of Toronto',
},
customFundPage: {
donlevels: '',
monthlydonlevels: '',
userentered: ''
//donlevels: '100,200,300,400,500'
},
},
watch: {
'gift_options.ecard_id': function (newVal, oldVal) {
imgSRC = document.getElementById("stationery_layout_id_" + newVal + "_image").src;
this.gift_options.ecard_src = imgSRC;
},
'cart.total': function(newVal, oldVal){
checkoutService.baseAmount = parseCurrency(illuminate.cart_total);
},
'current_donation.donation_type': function(newVal, oldVal){
if(newVal == "monthly"){
checkoutService.isRecurring = true;
}
else{
checkoutService.isRecurring = false;
}
},
},
methods: {
scrollToElement: function(el){
el = el.replace("#", "");
document.getElementById(el).scrollIntoView();
},
getFacultyNameByID: function (facID) {
if(facID){
return _.find(this.database.faculties, ['id', facID]);
}else{
return _.find(this.database.faculties, ['id', parseInt(this.show.faculty)]);
}
},
getDescriptionSubstring: function(description){
var html = description;
var div = document.createElement("div");
div.innerHTML = html;
if(description.length < 251){
return div.innerText.substring(0,250);
}else{
return div.innerText.substring(0,250) + '...'
}
},
copyECardImage: function (img) {
this.gift_options.ecard_src = img.srcElement.src;
},
autopopulate_donation_from_url: function () {
if (this.url_params.donationAmount !== '' && this.url_params.donationFrequency !== '' && this.url_params.desigationID !== '') {
this.cart.donation_type = this.url_params.donationFrequency
var add_donation = {
designee: {
id: this.url_params.designationID
},
donation_amount: this.url_params.donationAmount
}
for (var i = 0; i < this.global.designees.length; i++) {
if (this.global.designees[i].id == this.url_params.designationID) {
add_donation.designee.name = this.global.designees[i].name
}
}
this.cart.items.push(add_donation)
this.go_to_route('donorInfo')
}
},
continue_to_billing_info: function () {
if (this.current_donation.designee === '' || this.current_donation.donation_amount === '') {
this.form_step_1.show_error = true
// this.scroll_to_top()
return
}
if (this.current_donation.donation_amount === 'other' && parseFloat(this.current_donation.donation_amount_other) < 5) {
this.form_step_1.show_error = true
// this.scroll_to_top()
return
}
this.form_step_1.show_error = false;
this.add_to_cart();
hasher.setHash('donorInfo');
},
add_to_cart: function () {
checkIfFundAlreadyAdded = illuminate.cart.items.filter((item) => {
return (item.designee.id == this.current_donation.designee.id)
})
if (checkIfFundAlreadyAdded.length > 0) {
alert("This gift cannot be added to your cart, as a gift to the same fund is already in your cart. If you wish to change the gift amount, you may edit it in the Gift Summary section of checkout.");
} else {
var designee = this.current_donation.designee
var donation_type = this.current_donation.donation_type
var donation_amount = this.current_donation.donation_amount
if (donation_amount === 'other') {
donation_amount = this.current_donation.donation_amount_other
}
var cart_item = {
designee: designee,
donation_amount: donation_amount
}
this.cart.donation_type = donation_type
this.cart.items.push(cart_item)
this.reset_current_donation(this.current_donation.donation_type)
}
},
reset_current_donation: function (donation_type) {
this.current_donation = {
designation_type: '',
designees: [],
designee: {
id: 0,
name: '',
arborID: '',
description: '',
},
donation_amount: '',
donation_amount_other: '',
donation_type: donation_type
}
},
getJSON: function () {
console.log("adam and eve");
$.getJSON('../custom/database/luminate.json', function (data) {
// console.log(data);
illuminate.database.campuses = data.campuses;
illuminate.database.colleges = data.colleges;
illuminate.database.contacts = data.contacts;
illuminate.database.departments = data.departments;
illuminate.database.collections = data.collections;
illuminate.database.faculties = data.faculties;
illuminate.database.institutes = data.institute;
illuminate.database.initiatives = data.initiatives;
illuminate.database.funds = data.funds;
});
},
getParentName: function (fundID) {
var parent = _.find(this.database.funds, ['id', parseInt(fundID)]);
if (parent.departments.length > 0) {
return {
pname: parent.departments[0].name,
ptype: "department",
pid: parent.departments[0].id
};
}
if (parent.classgivings.length > 0) {
return {
pname: parent.classgivings[0].name.replace("Giving", ""),
ptype: "faculty-class-giving",
pid: parent.classgivings[0].faculty_id
};
}
if (parent.collections.length > 0) {
return {
pname: parent.collections[0].name,
ptype: "collection",
pid: parent.collections[0].id
};
}
if (parent.faculties.length > 0) {
return {
pname: parent.faculties[0].name,
ptype: "faculty",
pid: parent.faculties[0].id
};
}
if (parent.institutes.length > 0) {
return {
pname: parent.institutes[0].name,
ptype: "institute",
pid: parent.institutes[0].id
};
}
if (parent.initiatives.length > 0) {
return {
pname: parent.initiatives[0].name,
ptype: "initiative",
pid: parent.initiatives[0].id
};
}
if (parent.colleges.length > 0) {
return {
pname: parent.colleges[0].name,
ptype: "college",
pid: parent.colleges[0].id
};
}
if (parent.campuses.length > 0) {
return {
pname: parent.campuses[0].name,
ptype: "campus",
pid: parent.campuses[0].id
};
}
else {
return "";
}
},
getSearchParentName: function(item){
if (item.type == "page") {
return {
pname: item.name,
ptype: "page",
pid: item.id,
pshortd: item.shortd,
purl: item.url
};
}
if(item.type == "faculty"){
return {
pname: item.name,
ptype: "faculty",
pid: item.id,
pdescription: item.shortd
};
}
if(item.type == "campus"){
return {
pname: item.name,
ptype: "campus",
pid: item.id,
pdescription: item.shortd
};
}
if(item.type == "college"){
return {
pname: item.name,
ptype: "college",
pid: item.id,
pdescription: item.shortd
};
}
if(item.type == "institute"){
return {
pname: item.name,
ptype: "institute",
pid: item.id,
pdescription: item.shortd
};
}
if(item.type == "initiative"){
return {
pname: item.name,
ptype: "initiative",
pid: item.id,
pdescription: item.shortd
};
}
if(item.type == "department"){
return {
pname: item.name,
ptype: "department",
pid: item.id,
pdescription: item.shortd
};
}
if(item.type == "classgiving"){
return {
pname: item.name,
ptype: "faculty-class-giving",
pid: item.id,
pdescription: item.shortd
};
}
if(item.type == "collection"){
return {
pname: item.name,
ptype: "collection",
pid: item.id,
pdescription: item.shortd
};
}
if(item.luminate_code){
return{
pname: item.name,
ptype: "fund",
pid: item.id,
pdescription: item.description
}
}
},
clear_designation_type: function () {
this.current_donation.designation_type = ''
this.current_donation.designee = ''
this.current_donation.designees = []
this.go_to_route('division')
},
clear_designee: function () {
this.current_donation.designee = ''
this.go_to_route('designation')
},
handle_selected_designation_type: function (event) {
if (this.current_donation.designation_type === '') return
for (var i = 0; i < this.global.designees.length; i++) {
if (this.current_donation.designation_type.id === this.global.designees[i].typeId) {
this.current_donation.designees.push(this.global.designees[i])
}
}
this.go_to_route('designation')
},
handle_selected_designee: function (event) {
if (this.current_donation.designee === '') return
this.go_to_route('donationAmount')
},
handle_custom_donation_amt: function () {
this.current_donation.donation_amount = 'other'
},
handle_donation_amt: function () {
this.current_donation.donation_amount_other = ''
},
eligible_for_designation: function () {
if (this.current_donation.designation_type === '') {
return false
}
return true
},
eligible_for_donation: function () {
if (this.current_donation.designee === '') {
return false
}
return true
},
eligible_for_donorInfo: function () {
if (this.cart.items.length === 0) {
return false
}
return true
},
eligible_for_giftOptions: function () {
if (this.donor_information.donor_name_first === '' ||
this.donor_information.donor_name_last === '' ||
this.donor_information.donor_email === '' ||
this.donor_information.uoftaffifl === '') {
return false
}
return true
},
eligible_for_billing: function () {
if (this.donor_information.donor_name_first === '' ||
this.donor_information.donor_name_last === '' ||
this.donor_information.donor_email === '' ||
this.donor_information.uoftaffifl === '') {
return false
}
return true
},
eligible_for_review: function () {
if (this.billing_information.billing_name_first === '' ||
this.billing_information.billing_name_last === '' ||
this.billing_information.card_number === '' ||
this.billing_information.card_exp_date_month === '' ||
this.billing_information.card_exp_date_year === '' ||
this.billing_information.card_cvv === '' ||
this.billing_information.billing_address_country === '' ||
this.billing_information.billing_address_street1 === '' ||
this.billing_information.billing_address_city === '' ||
this.billing_information.billing_address_state === '' ||
this.billing_information.billing_address_zip === '') {
return false
}
return true
},
eligible_for_thanks: function () {
if (!this.successful_donation) {
return false
}
return true
},
autopopulate_donation_from_url: function () {
if (this.url_params.donationAmount !== '' && this.url_params.donationFrequency !== '' && this.url_params.desigationID !== '') {
this.cart.donation_type = this.url_params.donationFrequency
var add_donation = {
designee: {
id: this.url_params.designationID
},
donation_amount: this.url_params.donationAmount
}
for (var i = 0; i < this.global.designees.length; i++) {
if (this.global.designees[i].id == this.url_params.designationID) {
add_donation.designee.name = this.global.designees[i].name
}
}
this.cart.items.push(add_donation)
this.go_to_route('donorInfo')
}
},
clear_corporate_name: function () {
if (this.donor_information.is_corporate_gift === true) {
return
}
this.donor_information.corporate_name = ''
},
reset_tribute_fields: function () {
if (this.gift_options.tribute_show_honor_fields === true) {
return
}
this.gift_options.tribute_type = '',
this.gift_options.tribute_honoree_name_full = '',
this.gift_options.send_card_option = false
this.reset_card_tribute_fields()
},
reset_card_tribute_fields: function () {
if (this.gift_options.send_card_option === true) {
return
}
this.gift_options.send_card_type = 'none',
this.gift_options.ecard_recipients = '',
this.gift_options.ecard_id = '',
this.gift_options.ecard_subject = '',
this.gift_options.ecard_message = '',
this.gift_options.ecard_copy_sender = '',
this.gift_options.tribute_notify_name_full = '',
this.gift_options.tribute_notify_address_street1 = '',
this.gift_options.tribute_notify_address_street2 = '',
this.gift_options.tribute_notify_address_city = '',
this.gift_options.tribute_notify_address_state = '',
this.gift_options.tribute_notify_address_zip = '',
this.gift_options.tribute_notify_address_country = '',
this.gift_options.printed_card_message = ''
},
clear_tribute_fields: function () {
if (this.gift_options.send_card_type === 'printedcard') {
this.gift_options.ecard_recipients = '',
this.gift_options.ecard_id = '',
this.gift_options.ecard_subject = '',
this.gift_options.ecard_message = '',
this.gift_options.ecard_copy_sender = ''
}
if (this.gift_options.send_card_type === 'ecard') {
//this.gift_options.tribute_notify_name_full = '',
this.gift_options.tribute_notify_address_street1 = '',
this.gift_options.tribute_notify_address_street2 = '',
this.gift_options.tribute_notify_address_city = '',
this.gift_options.tribute_notify_address_state = '',
this.gift_options.tribute_notify_address_zip = '',
this.gift_options.tribute_notify_address_country = '',
this.gift_options.printed_card_message = ''
}
if (this.gift_options.send_card_type === 'none') {
this.gift_options.ecard_recipients = '',
this.gift_options.ecard_id = '',
this.gift_options.ecard_subject = '',
this.gift_options.ecard_message = '',
this.gift_options.ecard_copy_sender = '',
this.gift_options.tribute_notify_name_full = '',
this.gift_options.tribute_notify_address_street1 = '',
this.gift_options.tribute_notify_address_street2 = '',
this.gift_options.tribute_notify_address_city = '',
this.gift_options.tribute_notify_address_state = '',
this.gift_options.tribute_notify_address_zip = '',
this.gift_options.tribute_notify_address_country = '',
this.gift_options.printed_card_message = ''
}
},
clear_joint_donor: function () {
if (this.gift_options.joint_donor_option === true) {
return
}
this.gift_options.joint_donor_name_first = '',
this.gift_options.joint_donor_name_last = ''
},
clear_employer_name: function () {
if (this.gift_options.corporate_matching === true) {
return
}
this.gift_options.corporate_matching_employer = ''
},
scroll_to_top: function () {
window.scrollTo({
top: 0,
behavior: 'smooth'
})
},
go_to_route: function (route, step) {
if (step) {
if (step <= this.current_step) {
window.location.hash = route;
} else {
return false;
}
} else {
window.location.hash = route;
}
},
eCardValidation: function () {
console.log("ecard validations")
var errors = 0;
$("#step2" + ' [data-validateECard~="true"]').each(function (i) {
$(this).removeClass("Shake Error" + i);
$(this).closest(".form-group").find(".Error__msg").remove();
if ($(this).attr('data-validateECard') == "true") {
if ($(this).val() == "" || $(this).val() == null) {
errors++;
$(this).addClass("Shake Error" + i);
var errorMsg = $(this).attr('data-validateECard') ? $(this).attr('data-error') : "This is a required field";
var errorMsgDOM = "" + errorMsg + "stion_1789=Yes",
callback: function () {
console.log("Survey submitted successfully");
},
useHTTPS: true,
requestType: 'POST'
})
}
this.processing_donation = false;
this.thankyoucart.items = this.cart.items;
this.thankyoucart.donation_type = this.cart.donation_type;
this.go_to_route('thankyou');
this.scroll_to_top();
this.cart.items = [];
}
}
},
computed: {
cart_total: function () {
var initial_value = 0
var total_amount = this.cart.items.reduce(function (accumulator, cart_item) {
return accumulator + cart_item.donation_amount;
}, initial_value)
if (total_amount == 0) {
// this.go_to_route('home');
}
this.cart.total = total_amount;
return "$" + parseFloat(total_amount).toFixed(2);
},
getSubCategory: function () {
if (this.direct.category == "Campuses, Colleges and Communities ") {
} if (this.direct.category == "Faculties and Institutes") {
} if (this.direct.category == "Special Projects, Initiatives and More") {
}
},
hide_designation_type_dropdown: function () {
return this.current_donation.designation_type !== ''
},
hide_empty_designation_type: function () {
return this.current_donation.designation_type === ''
},
hide_designee_dropdown: function () {
return this.current_donation.designation_type !== '' &&
this.current_donation.designee !== ''
},
hide_empty_designee: function () {
return this.current_donation.designation_type !== '' &&
this.current_donation.designee === ''
},
hide_donation_amounts: function () {
return this.current_donation.designation_type === '' ||
this.current_donation.designee === ''
},
getFacultiesInstitutes: function () {
var _this = this;
if (this.search.searchFacultyInstitute == "") {
return _.orderBy(this.database.faculties.concat(this.database.institutes), 'name');
} else {
return this.database.faculties.concat(this.database.institutes).filter(function (facultyInstitute) {
return facultyInstitute.name.toLowerCase().indexOf(_this.search.searchFacultyInstitute.toLowerCase()) >"
$(this).closest(".form-group").find(".Error__msg").remove();
$(this).closest(".form-group").append(errorMsgDOM);
$(this).focus();
}
}
});
if (this.gift_options.ecard_id == 0) {
errors++;
$("#selectECardOption").removeClass("d-none");
}
if (this.gift_options.ecard_id != 0) {
$("#selectECardOption").addClass("d-none");
}
if (errors < 1) {
$("#ecardmodal").modal("show");
}
},
validateStep: function (currentStep, target) {
//checking the total inputs in the current step
//console.log(currentStep + " - " + target);
var totalInputs = $("#" + currentStep + ' [data-validate~="true"]').length;
var errors = 0;
if (totalInputs < 1) {
hasher.setHash(target);
}
//clear previous errors
$("#" + currentStep + ' [data-validate~="true"]').each(function (i) {
$(this).removeClass("Shake Error Error" + i);
$(this).closest(".form-group").find(".Error__msg").remove();
if ($(this).attr('data-required') == "true") {
if ($(this).val() == "" || $(this).val() == null) {
errors++;
$(this).addClass("Shake Error Error" + i);
var errorMsg = $(this).attr('data-required') ? $(this).attr('data-error') : "This is a required field";
var errorMsgDOM = "" + errorMsg + "s.current_donation.designation_type !== ''
},
hide_empty_designation_type: function () {
return this.current_donation.designation_type === ''
},
hide_designee_dropdown: function () {
return this.current_donation.designation_type !== '' &&
this.current_donation.designee !== ''
},
hide_empty_designee: function () {
return this.current_donation.designation_type !== '' &&
this.current_donation.designee === ''
},
hide_donation_amounts: function () {
return this.current_donation.designation_type === '' ||
this.current_donation.designee === ''
},
getFacultiesInstitutes: function () {
var _this = this;
if (this.search.searchFacultyInstitute == "") {
return _.orderBy(this.database.faculties.concat(this.database.institutes), 'name');
} else {
return this.database.faculties.concat(this.database.institutes).filter(function (facultyInstitute) {
return facultyInstitute.name.toLowerCase().indexOf(_this.search.searchFacultyInstitute.toLowerCase()) >"
$(this).closest(".form-group").find(".Error__msg").remove();
$(this).closest(".form-group").append(errorMsgDOM);
$(this).focus();
}
}
});
if (errors > 0) {
$(".Shake:first")[0].scrollIntoView();
}
if (errors < 1) {
this.current_step = parseInt(currentStep.replace(/\D/g, ''));
hasher.setHash(target);
}
},
donateCheckout_validate: function(e){
payload = illuminate.donateCheckout_payload();
luminateExtend.api.request({
api: 'donation',
data: 'method=validateDonateCheckout&form_id=' + formID + '&' + $.param(payload),
callback: illuminate.donateCheckout_validate_callback.bind(this),
useHTTPS: true,
requestType: 'POST'
});
},
donateCheckout_validate_callback: function(response){
this.review_page.show_error = false
let donationType;
if(this.cart.donation_type == "monthly"){
donationType = true;
}
else{
donationType = false;
}
if(response.validateDonateCheckoutResponse.isValid == "true"){
checkoutService.checkoutModal.open({
baseAmount: parseCurrency(this.cart_total),
isRecurring: donationType,
transactionCategory: 'donation',
billingDetails: {
name: this.billing_information.billing_name_first + " " + this.billing_information.billing_name_last,
email: this.donor_information.donor_email,
address: {
line: this.billing_information.billing_address_street1,
postalCode: this.billing_information.billing_address_zip,
city: this.billing_information.billing_address_city,
state: this.billing_information.billing_address_state,
country: this.billing_information.billing_address_country,
},
}
});
}else{
this.error_message.api_response = "Error Code: " + response.validateDonateCheckoutResponse.errors.code + " : " + response.validateDonateCheckoutResponse.errors.message;
this.review_page.show_error = true
this.processing_donation = false
this.go_to_route('billing')
this.scroll_to_top()
}
},
donateCheckout_payload: function () {
var payload = {
'billing.name.first': this.billing_information.billing_name_first,
'billing.name.last': this.billing_information.billing_name_last,
'billing.address.street1': this.billing_information.billing_address_street1,
'billing.address.street2': this.billing_information.billing_address_street2,
'billing.address.city': this.billing_information.billing_address_city,
'billing.address.state': this.billing_information.billing_address_state,
'billing.address.zip': this.billing_information.billing_address_zip,
'billing.address.country': this.billing_information.billing_address_country,
'donor.name.first': this.donor_information.donor_name_first,
'donor.name.last': this.donor_information.donor_name_last,
'donor.phone': this.donor_information.donor_phone,
'donor.email': this.donor_information.donor_email,
'donor.email_opt_in': this.donor_information.donor_email_opt_in,
'pledgepaymentv2': this.gift_options.pledge_payment,
'anonymous': this.gift_options.anonymous,
'uoftaffifl': this.donor_information.uoftaffifl,
'corporate_name': this.donor_information.corporate_name.substring(0, 250),
'sustaining.frequency': this.cart.donation_type,
'findernum': this.url_params.finderNumber,
'sourcecode': this.url_params.sourceCode,
'specialinstructions': this.gift_options.special_instructions.substring(0, 250)
}
if (this.gift_options.joint_donor_option) {
payload['joint_donor'] = this.gift_options.joint_donor_option
payload['joint_donor.name.first'] = this.gift_options.joint_donor_name_first
payload['joint_donor.name.last'] = this.gift_options.joint_donor_name_last
}
if (this.gift_options.tribute_show_honor_fields) {
payload['tribute.type'] = this.gift_options.tribute_type
payload['tribute.honoree.name.full'] = this.gift_options.tribute_honoree_name_full
}
if (this.gift_options.send_card_type === 'ecard') {
if (this.gift_options.tribute_type == 'tribute') {
}
if (this.gift_options.tribute_type == 'memorial') {
}
payload['tribute.notify.name.full'] = this.gift_options.tribute_notify_name_full
payload['ecard.copy_sender'] = this.gift_options.ecard_copy_sender
payload['ecard.id'] = this.gift_options.ecard_id
// payload['ecard.subject'] = this.gift_options.ecard_subject.substring(0, 250) //does not work
payload['ecard.subject'] = "Tribute Gift Notification from U of T"
payload['ecard.message'] = this.gift_options.ecard_message.substring(0, 250) //does not work
payload['ecard.recipients'] = this.gift_options.ecard_recipients.substring(0, 250) //does not work
payload['ecard.send'] = true,
payload['sendcardtype'] = "eCard"
}
if (this.gift_options.send_card_type === 'printedcard') {
payload['send_printed_card'] = true,
payload['sendcardtype'] = "Print Card",
payload['printed_card_message'] = this.gift_options.printed_card_message.substring(0, 250)
payload['tribute.notify.name.full'] = this.gift_options.tribute_notify_name_full //does not work
payload['tribute.notify.address.street1'] = this.gift_options.tribute_notify_address_street1
payload['tribute.notify.address.street2'] = this.gift_options.tribute_notify_address_street2 //does not work
payload['tribute.notify.address.city'] = this.gift_options.tribute_notify_address_city //does not work
payload['tribute.notify.address.state'] = this.gift_options.tribute_notify_address_state //does not work
payload['tribute.notify.address.zip'] = this.gift_options.tribute_notify_address_zip //does not work
payload['tribute.notify.address.country'] = this.gift_options.tribute_notify_address_country //does not work
}
if (this.gift_options.corporate_matching) {
payload['corporate_matching'] = this.gift_options.corporate_matching
payload['employername'] = this.gift_options.corporate_matching_employer.substring(0, 250)
payload['donor.employer'] = this.gift_options.corporate_matching_employer
}
if (this.gift_options.pledge_id) {
payload['pledgeid'] = this.gift_options.pledge_id.substring(0, 250)
}
if (this.cart.donation_type === 'monthly') {
payload['sustaining.duration'] = 0
}
//custom S120 String
var designeeInformation = [];
for (var i = 0; i < this.cart.items.length; i++) {
var cart_item = this.cart.items[i]
designeeInformation.push(cart_item.designee.name);
}
payload['designeeinformation'] = designeeInformation.toString();
// Sending some meta data related to fund affiliation
if(this.analytics.affiliation == ''){
payload['affiliation'] = 'GEN';
payload['affiliationtype'] = 'GEN';
}else{
payload['affiliation'] = this.analytics.affiliation.substring(0, 250);
payload['affiliationtype'] = this.analytics.affiliationType.substring(0, 250);
}
var splittransaction = [];
for (var i = 0; i < this.cart.items.length; i++) {
var cart_item = this.cart.items[i]
payload['designated.' + (i) + '.id'] = cart_item.designee.id
payload['designated.' + (i) + '.amount'] = cart_item.donation_amount
splittransaction.push(cart_item.designee.id + "-" + cart_item.designee.arborID + "-" + cart_item.donation_amount);
}
if (this.cart.items.length > 1) {
payload['splittransaction'] = splittransaction.toString().replace(/['"]+/g, '').replace(/[[]']+/g, '');
}
payload['level_id'] = 2101;
return payload;
},
donate_checkout: function(e){
payload = illuminate.donateCheckout_payload();
luminateExtend.api.request({
api: 'donation',
data: 'method=donateCheckout&form_id=' + formID + '&' + $.param(payload) + '&transactiontoken=' + e.transaction.id,
callback: illuminate.donation_callback.bind(this),
useHTTPS: true,
requestType: 'POST'
});
},
donation_callback: function (response) {
console.log("Donation Callback");
console.log(response)
this.review_page.show_error = false
if (response.donationResponse && response.donationResponse.errors) {
if (response.donationResponse.errors.code == 101) {
this.error_message.api_response =
response.donationResponse.errors.message + "(Error Code: " +
response.donationResponse.errors.code + " : " +
response.donationResponse.errors.reason + ")";
if (response.donationResponse.errors.fieldError) {
this.error_message.api_response = this.error_message.api_response + " : " +
response.donationResponse.errors.fieldError.toString() + ")";
}
if (response.donationResponse.errors.declineUserMessage) {
this.error_message.api_response = this.error_message.api_response + " : " +
response.donationResponse.errors.declineUserMessage + ")";
}
} else {
this.error_message.api_response = response.donationResponse.errors.message + "(Error Code: " + response.donationResponse.errors.code + " : " + response.donationResponse.errors.reason + ")"
}
this.review_page.show_error = true
this.processing_donation = false
this.go_to_route('billing')
this.scroll_to_top()
}
if (response.donationResponse && response.donationResponse.donation) {
this.successful_donation = true;
this.successful_donation_response.amount = response.donationResponse.donation.amount.formatted;
//Sending Google Analytics
for (var i = 0; i < this.cart.items.length; i++) {
var cart_item = this.cart.items[i]
//console.log(cart_item.designee.name.replace(/[^a-zA-Z ]/g, ""));
if (window.location.href.indexOf("engage") > -1 && window.location.href.indexOf("refresh") < 1 ) {
if(this.analytics.affiliation == ''){
aff = 'GEN';
affType = 'GEN';
}else{
aff = this.analytics.affiliation.substring(0, 250);
affType = this.analytics.affiliationType.substring(0, 250);
}
dataLayer.push({
'event': 'purchase',
'ecommerce': {
'currency': 'CAD',
'transaction_id': response.donationResponse.donation.transaction_id,
'affiliation': 'Luminate Online',
'value': response.donationResponse.donation.amount.decimal,
'items': [{
'item_id': cart_item.designee.id,
'item_name': cart_item.designee.name.replace(/[^a-zA-Z ]/g, ""),
'price': cart_item.donation_amount,
'item_brand': 'UofT',
'quantity': 1
}]
},
'pixelConversionTransactionID': response.donationResponse.donation.transaction_id,
'pixelConversionValue': response.donationResponse.donation.amount.decimal,
'consID': this.url_params.consID,
'consIDLO': response.donationResponse.donation.cons_id,
'sourceCode': this.url_params.sourceCode,
'finderNumber': this.url_params.finderNumber,
'aff': aff,
'affType': affType
});
}
}
if (this.donor_information.giftPlanning) {
console.log("Will attempt GPL Survey");
var authToken = document.getElementById('auth').value;
luminateExtend.api.request({
api: "survey",
data: "method=submitSurvey&survey_id=1904&auth=" + authToken +
"&cons_first_name=" + this.donor_information.donor_name_first +
"&cons_first_last=" + this.donor_information.donor_name_last +
"&cons_email=" + this.donor_information.donor_email +
"&cons_phone=" + this.donor_information.donor_phone +
"&question_1789=Yes",
callback: function () {
console.log("Survey submitted successfully");
},
useHTTPS: true,
requestType: 'POST'
})
}
this.processing_donation = false;
this.thankyoucart.items = this.cart.items;
this.thankyoucart.donation_type = this.cart.donation_type;
this.go_to_route('thankyou');
this.scroll_to_top();
this.cart.items = [];
}
}
},
computed: {
cart_total: function () {
var initial_value = 0
var total_amount = this.cart.items.reduce(function (accumulator, cart_item) {
return accumulator + cart_item.donation_amount;
}, initial_value)
if (total_amount == 0) {
// this.go_to_route('home');
}
this.cart.total = total_amount;
return "$" + parseFloat(total_amount).toFixed(2);
},
getSubCategory: function () {
if (this.direct.category == "Campuses, Colleges and Communities ") {
} if (this.direct.category == "Faculties and Institutes") {
} if (this.direct.category == "Special Projects, Initiatives and More") {
}
},
hide_designation_type_dropdown: function () {
return this.current_donation.designation_type !== ''
},
hide_empty_designation_type: function () {
return this.current_donation.designation_type === ''
},
hide_designee_dropdown: function () {
return this.current_donation.designation_type !== '' &&
this.current_donation.designee !== ''
},
hide_empty_designee: function () {
return this.current_donation.designation_type !== '' &&
this.current_donation.designee === ''
},
hide_donation_amounts: function () {
return this.current_donation.designation_type === '' ||
this.current_donation.designee === ''
},
getFacultiesInstitutes: function () {
var _this = this;
if (this.search.searchFacultyInstitute == "") {
return _.orderBy(this.database.faculties.concat(this.database.institutes), 'name');
} else {
return this.database.faculties.concat(this.database.institutes).filter(function (facultyInstitute) {
return facultyInstitute.name.toLowerCase().indexOf(_this.search.searchFacultyInstitute.toLowerCase()) > -1;
});
}
},
getCollegesCampusesCommunitites: function () {
var _this = this;
if (this.search.searchCollegeCampusCommunity == "") {
return _.orderBy(this.database.campuses, 'id').concat(this.database.colleges);
} else {
return this.database.campuses.concat(this.database.colleges).filter(function (collegeCampusCommunity) {
return collegeCampusCommunity.name.toLowerCase().indexOf(_this.search.searchCollegeCampusCommunity.toLowerCase()) > -1;
});
}
},
getSpecialProjectsInitiatives: function () {
var _this = this;
if (this.search.searchSpecialProjectInitiative == "") {
return _.orderBy(this.database.initiatives, 'name');
} else {
return this.database.initiatives.filter(function (initiative) {
return initiative.name.toLowerCase().indexOf(_this.search.searchSpecialProjectInitiative.toLowerCase()) > -1;
});
}
},
getDepartmentsByFacultyforDirect: function () {
var entityType = this.direct.faculty.replace(/[0-9]/g, '');
var entityID = parseInt(this.direct.faculty.match(/(\d+)/));
return _.chain(this.database.departments)
.filter({ faculties: [{ id: parseInt(entityID) }] })
.orderBy(['name'])
.value();
},
getCollectionsByFacultyforDirect: function () {
var entityType = this.direct.faculty.replace(/[0-9]/g, '');
var entityID = parseInt(this.direct.faculty.match(/(\d+)/));
return _.chain(this.database.collections)
.filter({ faculty_id: parseInt(entityID) })
.orderBy(['name'])
.value();
},
getDepartmentsByFaculty: function () {
var _this = this;
if (this.search.searchFacultyDepartment == "") {
return _.chain(this.database.departments).filter({
faculties: [{
id: parseInt(this.show.facultyDepartment)
}]
}).orderBy(['name']).value();
} else {
var departments = _.chain(this.database.departments).filter({
faculties: [{
id: parseInt(this.show.facultyDepartment)
}]
}).orderBy(['name']).value();
return departments.filter(function (department) {
return department.name.toLowerCase().indexOf(_this.search.searchFacultyDepartment.toLowerCase()) > -1;
});
}
return _.find(this.database.faculties, ['id', parseInt(this.show.facultyDepartment)]);
},
getCollectionsByFaculty: function () {
var _this = this;
if (this.search.searchFacultyOther == "") {
return _.chain(this.database.collections).filter({
faculty_id: parseInt(this.show.facultyOther)
}).orderBy(['name']).value();
} else {
return this.database.collections.filter(function (collection) {
return collection.name.toLowerCase().indexOf(_this.search.searchFacultyOther.toLowerCase()) > -1;
});
}
return _.find(this.database.collections, ['faculty_id', parseInt(this.show.facultyOther)]);
},
getDesignationName: function(){
var fund = _.find(this.database.funds, ['id', parseInt(this.direct.fund)]) || '';
return fund;
},
// Displaying individual Category pages
getSpecificFund: function () {
this.analytics.affiliationType = '';
this.analytics.affiliation = '';
if (this.show.fund) {
var fund = _.find(this.database.funds, ['id', parseInt(this.show.fund)]) || '';
console.log(fund);
this.current_donation.designee.id = fund.luminate_code || '';
this.current_donation.designee.arborID = fund.designation_code || '';
this.current_donation.designee.name = fund.name;
this.current_donation.designee.description = fund.description;
if(fund.departments){
if(fund.departments.length > 0){
var departmentID = fund.departments[0].id;
var department = _.find(this.database.departments, ['id', parseInt(departmentID)]) || '';
this.analytics.affiliationType = "Faculty";
this.analytics.affiliation = department.faculties[0].slug;
return fund;
}
}
if(fund.classgivings){
if(fund.classgivings.length > 0){
var facultyID = fund.classgivings[0].faculty_id;
var faculty = _.find(this.database.faculties, ['id', parseInt(facultyID)]);
this.analytics.affiliationType = "Faculty";
this.analytics.affiliation = faculty.slug;
return fund;
}
}
if(fund.collections){
if(fund.collections.length > 0){
var facultyID = fund.collections[0].faculty_id;
var faculty = _.find(this.database.faculties, ['id', parseInt(facultyID)]);
this.analytics.affiliationType = "Faculty";
this.analytics.affiliation = faculty.slug;
return fund;
}
}
if(fund.faculties){
if(fund.faculties.length > 0){
var facultySlug = fund.faculties[0].slug;
this.analytics.affiliationType = "Faculty";
this.analytics.affiliation = facultySlug;
return fund;
}
}
if(fund.campuses){
if(fund.campuses.length > 0){
var campusSlug = fund.campuses[0].slug;
this.analytics.affiliationType = "Campus";
this.analytics.affiliation = campusSlug;
return fund;
}
}
if(fund.colleges){
if(fund.colleges.length > 0){
var collegeSlug = fund.colleges[0].slug;
this.analytics.affiliationType = "College";
this.analytics.affiliation = collegeSlug;
return fund;
}
}
if(fund.institutes){
if(fund.institutes.length > 0){
var instituteSlug = fund.institutes[0].slug;
this.analytics.affiliationType = "Institute";
this.analytics.affiliation = instituteSlug;
return fund;
}
}
if(fund.initiatives){
if(fund.initiatives.length > 0){
var initiativeSlug = fund.initiatives[0].slug;
this.analytics.affiliationType = "Initiative";
this.analytics.affiliation = initiativeSlug;
return fund;
}
}
else{
this.analytics.affiliationType = "GEN";
this.analytics.affiliation = "GEN";
return fund;
}
return fund;
}
},
getSpecificFaculty: function (id) {
return _.find(this.database.faculties, ['id', parseInt(this.show.faculty)]);
},
getSpecificFacultyForDepartments: function () {
return _.find(this.database.faculties, ['id', parseInt(this.show.facultyDepartment)]);
},
getSpecificFacultyForOthers: function () {
return _.find(this.database.faculties, ['id', parseInt(this.show.facultyOther)]);
},
getSpecificFacultyForClassGiving: function () {
return _.find(this.database.faculties, ['id', parseInt(this.show.facultyClassGiving)]);
},
getSpecificCampus: function () {
return _.find(this.database.campuses, ['id', parseInt(this.show.campus)]);
},
getSpecificCollege: function () {
return _.find(this.database.colleges, ['id', parseInt(this.show.college)]);
},
getSpecificDepartment: function () {
return _.find(this.database.departments, ['id', parseInt(this.show.department)]);
},
getSpecificCollection: function () {
return _.find(this.database.collections, ['id', parseInt(this.show.collection)]);
},
getSpecificInstitute: function () {
return _.find(this.database.institutes, ['id', parseInt(this.show.institute)]);
},
getSpecificInitiative: function () {
return _.find(this.database.initiatives, ['id', parseInt(this.show.initiative)]);
},
getspecificEntityForDirectDepartments: function () {
var entityType = this.direct.department.replace(/[0-9]/g, '');
var entityID = parseInt(this.direct.department.match(/(\d+)/));
return _.find(this.database.departments, ['id', entityID]);
},
getspecificEntityForDirectCollections: function () {
var entityType = this.direct.collection.replace(/[0-9]/g, '');
var entityID = parseInt(this.direct.collection.match(/(\d+)/));
return _.find(this.database.collections, ['id', entityID]);
},
getspecificEntity: function () {
if (this.direct.entity == '') {
var entityType = this.direct.faculty.replace(/[0-9]/g, '');
var entityID = parseInt(this.direct.faculty.match(/(\d+)/));
} else {
var entityType = this.direct.entity.replace(/[0-9]/g, '');
var entityID = parseInt(this.direct.entity.match(/(\d+)/));
}
if (entityType == 'campus') {
return _.find(this.database.campuses, ['id', entityID]);
}
if (entityType == 'college') {
return _.find(this.database.colleges, ['id', entityID]);
}
if (entityType == 'faculty') {
return _.find(this.database.faculties, ['id', entityID]);
}
if (entityType == 'institute') {
return _.find(this.database.institutes, ['id', entityID]);
}
if (entityType == 'initiative') {
return _.find(this.database.initiatives, ['id', entityID]);
}
if (entityType == 'department') {
return _.find(this.database.departments, ['id', entityID]);
}
},
getspecificEntityFundsForFaculties: function () {
var entityType = this.direct.faculty.replace(/[0-9]/g, '');
var entityID = parseInt(this.direct.faculty.match(/(\d+)/));
if (this.direct.area == "Featured Funds") {
//console.log("faculty Type: featured");
return _.chain(this.database.funds)
.filter({ faculties: [{ id: entityID }] })
.orderBy(['important', 'name'], ['asc', 'asc'])
.value();
}
else if (this.direct.area == "Departments and Specific Areas") {
var entityType = this.direct.department.replace(/[0-9]/g, '');
var entityID = parseInt(this.direct.department.match(/(\d+)/));
return _.chain(this.database.funds)
.filter({ departments: [{ id: entityID }] })
.orderBy(['important', 'name'], ['asc', 'asc'])
.value();
}
else if (this.direct.area == "Class Giving") {
//console.log("faculty Type: class giving");
return _.chain(this.database.funds)
.filter({ classgivings: [{ faculty_id: entityID }] })
.orderBy(['important', 'name'], ['asc', 'asc'])
.value();
}
else if (this.direct.area == "Scholarships and Awards") {
//console.log("faculty Type: class giving");
return _.chain(this.database.funds)
.filter({ swards: [{ faculty_id: entityID }] })
.orderBy(['important', 'name'], ['asc', 'asc'])
.value();
}
else if (this.direct.area == "Other Giving Opportunities") {
var entityType = this.direct.collection.replace(/[0-9]/g, '');
var entityID = parseInt(this.direct.collection.match(/(\d+)/));
return _.chain(this.database.funds)
.filter({ collections: [{ id: entityID }] })
.orderBy(['important', 'name'], ['asc', 'asc'])
.value();
}
else {
//console.log("faculty Type: n/a");
return _.chain(this.database.funds)
.filter({ institutes: [{ id: entityID }] })
.orderBy(['important', 'name'], ['asc', 'asc'])
.value();
}
},
getspecificEntityFunds: function () {
if (this.direct.entity == '') {
var entityType = this.direct.faculty.replace(/[0-9]/g, '');
var entityID = parseInt(this.direct.faculty.match(/(\d+)/));
} else {
var entityType = this.direct.entity.replace(/[0-9]/g, '');
var entityID = parseInt(this.direct.entity.match(/(\d+)/));
}
if (entityType == 'campus') {
return _.chain(this.database.funds)
.filter({ campuses: [{ id: entityID }] })
.orderBy(['important', 'name'], ['asc', 'asc'])
.value();
}
if (entityType == 'college') {
return _.chain(this.database.funds)
.filter({ colleges: [{ id: entityID }] })
.orderBy(['important', 'name'], ['asc', 'asc'])
.value();
}
if (entityType == 'institute') {
return _.chain(this.database.funds)
.filter({ institutes: [{ id: entityID }] })
.orderBy(['important', 'name'], ['asc', 'asc'])
.value();
}
if (entityType == 'initiative') {
return _.chain(this.database.funds)
.filter({ initiatives: [{ id: entityID }] })
.orderBy(['important', 'name'], ['asc', 'asc'])
.value();
}
if (entityType == 'department') {
return _.chain(this.database.funds)
.filter({ departments: [{ id: entityID }] })
.orderBy(['important', 'name'], ['asc', 'asc'])
.value();
}
},
getSpecificEntityFund: function () {
if (this.direct.fund) {
var fund = _.find(this.database.funds, ['id', parseInt(this.direct.fund)]);
this.current_donation.designee.id = fund.luminate_code || '';
this.current_donation.designee.name = fund.name;
this.current_donation.designee.description = fund.description;
return fund;
}
},
// Fetching funds by specific categories
searchFundsByKeyword: function () {
var _this = this;
if (this.search.searchFunds.length > 2) {
var facultiesName = this.database.faculties.filter(function (faculty) {
if (faculty.name) {
return faculty.name.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
}
});
var facultiesDesc = this.database.faculties.filter(function (faculty) {
if (faculty.shortd) {
return faculty.shortd.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
}
});
var campusesName = this.database.campuses.filter(function (campus) {
if (campus.name) {
return campus.name.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
}
});
var campusesDesc = this.database.campuses.filter(function (campus) {
if (campus.shortd) {
return campus.shortd.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
}
});
var collegesName = this.database.colleges.filter(function (college) {
if (college.name) {
return college.name.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
}
});
var collegesDesc = this.database.colleges.filter(function (college) {
if (college.shortd) {
return college.shortd.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
}
});
var institutesName = this.database.institutes.filter(function (institute) {
if (institute.name) {
return institute.name.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
}
});
var institutesDesc = this.database.institutes.filter(function (institute) {
if (institute.shortd) {
return institute.shortd.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
}
});
var initiativesName = this.database.initiatives.filter(function (initiative) {
if (initiative.name) {
return initiative.name.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
}
});
var initiativesDesc = this.database.initiatives.filter(function (initiative) {
if (initiative.shortd) {
return initiative.shortd.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
}
});
var departmentsName = this.database.departments.filter(function (department) {
if (department.name) {
return department.name.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
}
});
var departmentsDesc = this.database.departments.filter(function (department) {
if (department.shortd) {
return department.shortd.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
}
});
var collectionsName = this.database.collections.filter(function (collection) {
if (collection.name) {
return collection.name.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
}
});
var collectionsDesc = this.database.collections.filter(function (collection) {
if (collection.shortd) {
return collection.shortd.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
}
});
// TODO: Make the search work with Faculties and Pages
var pagesName = this.database.pages.filter(function (pages) {
return pages.name.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
});
var pagesKeyword = this.database.pages.filter(function (pages) {
return pages.keyword.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
});
var fundsbyname = this.database.funds.filter(function (fund) {
return fund.name.toLowerCase().replace(/-/g, ' ').indexOf(_this.search.searchFunds.toLowerCase().replace(/-/g, ' ')) > -1;
});
var fundsbyDesignationID = this.database.funds.filter(function (fund) {
return fund.designation_code.toLowerCase().replace(/-/g, ' ').indexOf(_this.search.searchFunds.toLowerCase().replace(/-/g, ' ')) > -1;
});
var fundsbyLOID = this.database.funds.filter(function (fund) {
return fund.luminate_code.toLowerCase().replace(/-/g, ' ').indexOf(_this.search.searchFunds.toLowerCase().replace(/-/g, ' ')) > -1;
});
var fundsbydesc = this.database.funds.filter(function (fund) {
if (fund.description) {
return fund.description.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
}
});
// var pages = this.database.funds.filter(function (fund) {
// if (fund.description) {
// return fund.description.toLowerCase().indexOf(_this.search.searchFunds.toLowerCase()) > -1;
// }
// });
return _.union(
facultiesName, facultiesDesc,
campusesName, campusesDesc,
collegesName, collegesDesc,
institutesName, institutesDesc,
initiativesName, initiativesDesc,
departmentsName, departmentsDesc,
collectionsName, collectionsDesc,
fundsbyname, fundsbydesc,
fundsbyDesignationID, fundsbyLOID,
pagesName, pagesKeyword
);
}
},
searchFacultyDepartment: function () {
var _this = this;
return this.database.departments.filter(function (fund) {
return fund.name.toLowerCase().indexOf(_this.search.searchFacultyDepartment.toLowerCase()) > -1;
});
},
getFundsByFaculty: function () {
var _this = this;
if (this.search.searchFacultyFunds == "" || this.search.searchFacultyFunds == undefined) {
console.log("SEARCH: default listing");
return _.chain(this.database.funds).filter({
faculties: [{
id: parseInt(this.show.faculty)
}]
}).orderBy(['faculties[0].pivot.important', 'faculties[0].pivot.sort_order', 'name'], ['asc', 'asc', 'asc']).value();
} else {
console.log("SEARCH: keyword search");
var funds = _.chain(this.database.funds).filter({
faculties: [{
id: parseInt(this.show.faculty)
}]
}).orderBy(['faculties[0].pivot.important', 'faculties[0].pivot.sort_order', 'name'], ['asc', 'asc', 'asc']).value();
return funds.filter(function (fund) {
return fund.name.toLowerCase().indexOf(_this.search.searchFacultyFunds.toLowerCase()) > -1;
});
}
},
getFundsByCampus: function () {
// return _.filter(this.database.campuses, { campuses: [ { id: parseInt(this.show.campus) } ]});
var _this = this;
if (this.search.searchCampusFunds == "" || this.search.searchCampusFunds == undefined) {
return _.chain(this.database.funds).filter({
campuses: [{
id: parseInt(this.show.campus)
}]
}).orderBy(['campuses[0].pivot.important', 'campuses[0].pivot.sort_order', 'name'], ['asc', 'asc', 'asc']).value();
} else {
var funds = _.chain(this.database.funds).filter({
campuses: [{
id: parseInt(this.show.campus)
}]
}).orderBy(['campuses[0].pivot.important', 'campuses[0].pivot.sort_order', 'name'], ['asc', 'asc', 'asc']).value();
return funds.filter(function (fund) {
return fund.name.toLowerCase().indexOf(_this.search.searchCampusFunds.toLowerCase()) > -1;
});
}
},
getFundsByCollege: function () {
// return _.filter(this.database.funds, { colleges: [ { id: parseInt(this.show.college) } ]});
return _.chain(this.database.funds)
.filter({ colleges: [{ id: parseInt(this.show.college) }] })
.orderBy(['colleges[0].pivot.important', 'colleges[0].pivot.sort_order', 'name'], ['asc', 'asc', 'asc'])
.value();
},
getFundsByDepartment: function () {
// return _.filter(this.database.funds, { departments: [ { id: parseInt(this.show.department) } ]});
return _.chain(this.database.funds)
.filter({ departments: [{ id: parseInt(this.show.department) }] })
.orderBy(['departments[0].pivot.important', 'departments[0].pivot.sort_order', 'name'], ['asc', 'asc', 'asc'])
.value();
},
getFundsByCollection: function () {
// return _.filter(this.database.funds, { departments: [ { id: parseInt(this.show.department) } ]});
return _.chain(this.database.funds)
.filter({ collections: [{ id: parseInt(this.show.collection) }] })
.orderBy(['collections[0].pivot.important', 'collections[0].pivot.sort_order', 'name'], ['asc', 'asc', 'asc'])
.value();
},
getFundsByInstitute: function () {
// return _.filter(this.database.funds, { institutes: [ { id: parseInt(this.show.institute) } ]});
return _.chain(this.database.funds)
.filter({ institutes: [{ id: parseInt(this.show.institute) }] })
.orderBy(['institutes[0].pivot.important', 'institutes[0].pivot.sort_order', 'name'], ['asc', 'asc', 'asc'])
.value();
},
getFundsByInitiative: function () {
// return _.filter(this.database.funds, { initiatives: [ { id: parseInt(this.show.initiative) } ]});
return _.chain(this.database.funds)
.filter({ initiatives: [{ id: parseInt(this.show.initiative) }] })
.orderBy(['initiatives[0].pivot.important', 'initiatives[0].pivot.sort_order', 'name'], ['asc', 'asc', 'asc'])
.value();
},
getFundsByClassGiving: function () {
var _this = this;
if (this.search.searchFacultyClassGiving == "" || this.search.searchFacultyClassGiving == undefined) {
return _.chain(this.database.funds).filter({
classgivings: [{
faculty_id: parseInt(this.show.facultyClassGiving)
}]
}).orderBy(['classgivings[0].pivot.important', 'classgivings[0].pivot.sort_order', 'name'], ['asc', 'asc', 'asc']).value();
} else {
var funds = _.chain(this.database.funds).filter({
classgivings: [{
faculty_id: parseInt(this.show.facultyClassGiving)
}]
}).orderBy(['faculties[0].pivot.important', 'faculties[0].pivot.sort_order', 'name'], ['asc', 'asc', 'asc']).value();
return funds.filter(function (fund) {
return fund.name.toLowerCase().indexOf(_this.search.searchFacultyClassGiving.toLowerCase()) > -1;
});
}
},
getDonationLevels: function () {
var _this = this;
return this.customFundPage.donlevels.split(",");
},
getMonthlyDonationLevels: function () {
var _this = this;
return this.customFundPage.monthlydonlevels.split(",");
},
getUniversalContact: function () {
// var universal = "";
// var contact = "";
var fund = _.find(this.database.funds, ['id', parseInt(this.show.fund)]);
if (fund.initiatives) {
if (fund.initiatives.length > 0) {
initiative_id = fund.initiatives[0].id;
initiative = _.find(this.database.initiatives, ['id', parseInt(initiative_id)]);
return {
universal: initiative.contacts,
local: fund.contacts
};
}
}
if (fund.institutes) {
if (fund.institutes.length > 0) {
institute_id = fund.institutes[0].id;
institute = _.find(this.database.institutes, ['id', parseInt(institute_id)]);
return {
universal: institute.contacts,
local: fund.contacts
};
}
}
if (fund.colleges) {
if (fund.colleges.length > 0) {
college_id = fund.colleges[0].id;
college = _.find(this.database.colleges, ['id', parseInt(college_id)]);
return {
universal: college.contacts,
local: fund.contacts
};
}
}
if (fund.campuses) {
if (fund.campuses.length > 0) {
campus_id = fund.campuses[0].id;
campus = _.find(this.database.campuses, ['id', parseInt(campus_id)]);
return {
universal: campus.contacts,
local: fund.contacts
};
}
}
if (fund.departments) {
if (fund.departments.length > 0) {
department_id = fund.departments[0].id;
department = _.find(this.database.departments, ['id', parseInt(department_id)]);
return {
universal: department.contacts,
local: fund.contacts
};
}
}
if (fund.classgivings) {
if (fund.classgivings.length > 0) {
faculty_id = fund.classgivings[0].faculty_id;
faculty = _.find(this.database.faculties, ['id', parseInt(faculty_id)]);
return {
universal: faculty.contacts,
local: fund.contacts
};
}
}
if (fund.collections) {
if (fund.collections.length > 0) {
faculty_id = fund.collections[0].faculty_id;
faculty = _.find(this.database.faculties, ['id', parseInt(faculty_id)]);
return {
universal: faculty.contacts,
local: fund.contacts
};
}
}
if (fund.faculties) {
if (fund.faculties.length > 0) {
faculty_id = fund.faculties[0].id;
faculty = _.find(this.database.faculties, ['id', parseInt(faculty_id)]);
return {
universal: faculty.contacts,
local: fund.contacts
};
}
}
if (fund.contacts.length > 0) {
return {
universal: "",
local: fund.contacts
}
} else {
return {
universal: "",
local: ""
}
}
},
ifFacultyHasDepartments: function () {
var facultyID = this.show.faculty;
if (facultyID == "") {
if (window.location.href.indexOf("faculty-department") > -1) {
facultyID = this.show.facultyDepartment;
}
if (window.location.href.indexOf("faculty-class-giving") > -1) {
facultyID = this.show.facultyClassGiving;
}
if (window.location.href.indexOf("other-giving-opportunities") > -1) {
facultyID = this.show.facultyOther;
}
}
if (facultyID) {
var faculty = _.find(this.database.faculties, ['id', parseInt(facultyID)]);
if (faculty.departments.length) {
return faculty.departments.length
} else {
return 0
}
}
else {
var entityID = parseInt(this.direct.faculty.match(/(\d+)/));
var faculty = _.find(this.database.faculties, ['id', entityID]);
if (faculty.departments.length) {
return faculty.departments.length
} else {
return 0
}
}
},
ifFacultyHasClassGivings: function () {
var facultyID = this.show.faculty;
if (facultyID == "") {
if (window.location.href.indexOf("faculty-department") > -1) {
facultyID = this.show.facultyDepartment;
}
if (window.location.href.indexOf("faculty-class-giving") > -1) {
facultyID = this.show.facultyClassGiving;
}
if (window.location.href.indexOf("other-giving-opportunities") > -1) {
facultyID = this.show.facultyOther;
}
}
if (facultyID) {
var faculty = _.find(this.database.faculties, ['id', parseInt(facultyID)]);
if (faculty.classgivings.length) {
return faculty.classgivings.length
} else {
return 0
}
}
else {
var entityID = parseInt(this.direct.faculty.match(/(\d+)/));
var faculty = _.find(this.database.faculties, ['id', entityID]);
if (faculty.classgivings.length) {
return faculty.classgivings.length
} else {
return 0
}
}
},
ifFacultyHasCollections: function () {
var facultyID = this.show.faculty;
if (facultyID == "") {
if (window.location.href.indexOf("faculty-department") > -1) {
facultyID = this.show.facultyDepartment;
}
if (window.location.href.indexOf("faculty-class-giving") > -1) {
facultyID = this.show.facultyClassGiving;
}
if (window.location.href.indexOf("other-giving-opportunities") > -1) {
facultyID = this.show.facultyOther;
}
}
if (facultyID) {
var faculty = _.find(this.database.faculties, ['id', parseInt(facultyID)]);
if (faculty.collections.length) {
return faculty.collections.length
} else {
return 0
}
}
else {
var entityID = parseInt(this.direct.faculty.match(/(\d+)/));
var faculty = _.find(this.database.faculties, ['id', entityID]);
if (faculty.collections.length) {
return faculty.collections.length
} else {
return 0
}
}
}
},
});