(function() { var app = angular.module("bmCore", []); app.filter('utc', function() { return function(val) { var date = new Date(val); return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0); }; }); app.filter('https', function() { return function(val) { return val.replace('http://', 'https://'); }; }); function getEntityTypes() { return { APPLICANT : { id : 1, name : getValue('Applicant') }, CONTACT : { id : 2, name : getValue('Contact') }, OFFICE : { id : 3, name : getValue('Office') }, CLIENT : { id : 4, name : getValue('Client') }, REQUIREMENT : { id : 5, name : getValue('Requirement') }, PLACEMENT : { id : 6, name : getValue('') }, COMPANY_INVOICE : { id : 8, name : getValue('') }, COMPANY_GL : { id : 9, name : getValue('') }, COMPANY_BILLING : { id : 10, name : getValue('') }, REFERENCE : { id : 11, name : getValue('') }, OPPORTUNITY : { id : 12, name : getValue('') }, COMPANY : { id : 13, name : getValue('Company') }, BASIC_QUALIFICATION : { id : 14, name : getValue('') }, CALENDAR : { id : 15, name : getValue('') }, CORPORATE : { id : 16, name : getValue('Corporate') }, fromId : function(id) { var type; switch (id) { case this.APPLICANT.id: type = this.APPLICANT; break; case this.CONTACT.id: type = this.CONTACT; break; default: break; } return type; } } } function getUserTypes() { return { NONE : { id : -1, name : getValue('None') }, EMPLOYEE : { id : 1, name : getValue('Employee') }, APPLICANT : { id : 2, name : getValue('Applicant') }, CONTACT : { id : 3, name : getValue('Contact') }, ADMIN : { id : 4, name : getValue('Admin') }, REFERRER : { id : 5, name : getValue('Referrer') }, SOURCER : { id : 6, name : getValue('Sourcer') }, SALES : { id : 7, name : getValue('Sales') }, VENDOR : { id : 8, name : getValue('Vendor') }, fromId : function(id) { var type; switch (id) { case this.APPLICANT.id: type = this.APPLICANT; break; case this.CONTACT.id: type = this.CONTACT; break; case this.EMPLOYEE.id: type = this.EMPLOYEE; break; default: break; } return type; } } } function getValue(p) { if (p === 'true') { return true; } else if (p === 'false') { return false; } else if (isNumeric(p)) { return parseInt(p); } else if (isJson(p)) { return JSON.parse(p) } else { p = p.replace(/([\"\'])/g, '\\' + '$&'); return p.toString(); } } app.constant('BM_PARAMS', { }); app.constant('BM_CONSTANTS', { "brightSync" : { "endpoint" : 'https://brightsync.brightmove.com/' }, "modalTimeout" : 10, "maxReqLocations" : 50, "backgroundRefreshInterval" : 5, "skin" : { "reseller" : getValue(''), "portalUrl" : getValue('') }, "types" : { "ENTITY" : getEntityTypes(), "USER" : getUserTypes() }, "xero": { "url": { "contact": 'https://go.xero.com/Contacts/View/xxx', "invoice": 'https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=', "payment": 'https://go.xero.com/Bank/ViewTransaction.aspx?bankTransactionID=' } }, "brightReports" : { "url" : 'https://brightreports-prod.brightmove.com' } }); app.constant('BM_PREFERENCES', { "formats" : { "date" : '', "dateTime" : '', "activityDateTime" : '', "activityDate" : '', "activityTime" : '', "dateNoTZ" : '', "amPm" : '', "dstOffset" : getValue(''), "rawOffset" : getValue(''), "serverTimezone" : ((getValue('') / 1000 / 60 / 60) * 100).toString(), "timeZoneName" : '', "timeZoneOffset" : ((((getValue('') + getValue('')) / 1000 / 60 / 60) * 100) >= 0) ? "+" + (((getValue('') + getValue('')) / 1000 / 60 / 60) * 100).toString() : (((getValue('') + getValue('')) / 1000 / 60 / 60) * 100).toString() }, "replacements" : { "APPLICANT" : '', "APPLICANTS" : '', "CLIENT" : '', "CLIENTS" : '', "CONTACT" : '', "CONTACTS" : '', "OFFICE" : '', "OFFICES" : '', "PLACEMENT" : '', "PLACEMENTS" : '', "PLACEMENT_PERMANENT" : '', "PLACEMENT_CONTRACT" : '', "PLACEMENT_INTERNAL" : '', "REQUIREMENT" : '', "REQUIREMENTS" : '', "SUBMITTAL" : '', "SUBMITTALS" : '', "VENDOR" : '', "VENDORS" : '', "WORKGROUP" : '', "WORKGROUPS" : '', "DO_NOT_HIRE" : '', "CLIENT_CONTRACT" : '', "PRODUCT" : { "VALUE" : '', "PLURAL" : '', "OFFERING" : '', "OFFERINGS" : '', "SERVICE" : '', "SERVICES" : '' } }, "settings" : { "enableSms" : getValue(''), "disableActivityHover" : getValue(''), "showMapQuestLink" : getValue(''), "showGoogleMapsLink" : getValue(''), "tieredSales" : getValue(''), "tabbedApplicant" : getValue(''), "tabbedRequirement" : getValue(''), "tabbedClient" : getValue(''), "tabbedContact" : getValue(''), "tabbedUdfs" : getValue(''), "enableBrightForms" : getValue('') } }); app.constant('BM_USER', { "guid" : '', "displayName" : '', "userGk" : getValue(''), "companyGk" : getValue(''), "companyGuid" : '', "type" : { "id" : getValue('') }, "licensedForms" : getValue(0) }); app.constant('PORTAL', { "overrideKoQuestion": getValue(''), "createDeclineSubmit": getValue(''), "createApplicantImmediately": getValue('') }); app.constant('PORTAL_USER', { "guid" : '', "sourceId" : getValue(''), "userGk" : '', "companyGk" : getValue(''), "type" : { "id" : getValue('') } }); })();