# 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;
}
[HOME](https://engage.utoronto.ca/site/SPageServer?pagename=donate#home)
# 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](#/pressing-needs)
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](#/pressing-needs) 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](#/pressing-needs) 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](#/pressing-needs)
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](mailto: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.
[Contact us](https://engage.utoronto.ca/site/SPageServer?pagename=contact_us)
[Read our FAQs](https://engage.utoronto.ca/site/SPageServer?pagename=faqs)
$(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 = "<span class='text-danger'>" + errorMsg + "</span>"
$(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 = "<span class='text-danger'>" + errorMsg + "</span>"
$(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 = "<span class='text-danger'>" + errorMsg + "</span>"
$(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.
[Give now](https://engage.utoronto.ca/site/SPageServer?pagename=donate#makeagift)
### Contact Us
416-978-1221 \
1-800-463-6048 \
[donations.management@utoronto.ca](mailto: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.
[Read FAQs](https://engage.utoronto.ca/site/SPageServer?pagename=faqs)
[Privacy](https://engage.utoronto.ca/site/SPageServer?pagename=privacy)
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 = "<span class='Error\_\_msg'>" + errorMsg + "</span>"
$(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 = "<span class='Error\_\_msg'>" + errorMsg + "</span>"
$(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
}
}
}
},
});