(function() { var app = angular.module("bmCore", []); app.filter('entityName', function() { return function (input) { var _input = input.replace('$' +'{applicant.value}', '') .replace('$' + '{contact.value}', '') .replace('$' + '{client.value}', '') .replace('$' + '{requirement.value}', '') .replace('$' + '{office.value}', '') .replace('$' + '{submittal.value}', '') ; return _input; } }); 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 getStatusTypes() { return { NONE : { id : -1 }, ACTIVE : { id : 1 }, INACTIVE : { id : 2 }, } } function getDropdownTypes() { return { NONE : { id : -1 }, ACTION_EMAIL : { id : 1 }, ACTION_SUBMITTAL : { id : 2 }, ACTION_MY_APPLICANT_FOLDER : { id : 3 }, ACTION_PUBLIC_APPLICANT_FOLDER : { id : 4 }, ACTION_SENDOUT : { id : 5 }, ACTION_MY_CLIENT_FOLDER : { id : 6 }, ACTION_PUBLIC_CLIENT_FOLDER : { id : 7 }, ACTION_MY_CONTACT_FOLDER : { id : 8 }, ACTION_PUBLIC_CONTACT_FOLDER : { id : 9 }, ACTION_MY_REQUIREMENT_FOLDER : { id : 10 }, ACTION_PUBLIC_REQUIREMENT_FOLDER : { id : 11 }, ACTION_DECLINE_SUBMITTAL : { id : 12 }, ACTION_SEND_TO_CART : { id : 13 }, ACTION_SUBACTIVITY_MASS : { id : 14 }, ACTION_ACTIVITY_MASS : { id : 15 }, ACTION_TAG_MASS : { id : 55 }, ACTION_DECLINE_SUBMITTAL_NOTE : { id : 16 }, ACTION_SUBMITTAL_EXTENDED : { id : 17 }, ACTION_MASS_REQUIREMENT_STATUS : { id : 18 }, ACTION_ACTIVITY_PLACEMENT_MASS : { id : 19 }, ACTION_SEND_SMS : { id : 20 }, ACTION_ACTIVITY : { id : 21 }, ACTION_EXPORT_CLIENT_OFFICE_REQUIREMENTS : { id : 22 }, ACTION_COPY_REQUIREMENTS : { id : 23 }, ACTION_COPY_REQUIREMENTS_POST_TO_WEB : { id : 24 }, ACTION_COPY_REQUIREMENTS_POST_TO_INTERNAL : { id : 25 }, ACTION_COPY_REQUIREMENTS_POST_TO_BOTH : { id : 26 }, ACTION_SOURCING_IMPORT_APPLICANT : { id : 27 }, ACTION_SOURCING_IMPORT_CONTACT : { id : 28 }, ACTION_SEND_SMS_AND_EMAIL : { id : 29 }, QUICK_SEARCH_APPLICANT : { id : 31 }, QUICK_SEARCH_CLIENT : { id : 32 }, QUICK_SEARCH_CONTACT : { id : 33 }, QUICK_SEARCH_REQUIREMENT : { id : 34 }, ACTION_APPLICATION_CAREERBUILDER : { id : 41 }, ACTION_APPLICATION_MONSTER : { id : 42 }, ACTION_APPLICATION_LINKEDIN : { id : 48 }, ACTION_APPLICATION_SOURCEJET : { id : 410 }, ACTION_MASS_REMOVE_APPLICANT_FROM_FOLDER : { id : 49 }, ACTION_MASS_REMOVE_CLIENT_FROM_FOLDER : { id : 50 }, ACTION_MASS_REMOVE_CONTACT_FROM_FOLDER : { id : 51 }, ACTION_MASS_REMOVE_REQUIREMENT_FROM_FOLDER : { id : 52 }, } } function getFieldTypes() { return { TEXT : { id : 1 }, TEXTAREA : { id : 2 }, CHECKBOX : { id : 3 }, SELECT : { id : 4 }, NUMBER : { id : 5 }, CURRENCY : { id : 6 }, DATE : { id : 7 }, SEPARATOR : { id : 8 }, READ_ONLY : { id : 9 }, TIME : { id : 10 }, } } 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') }, INTERVIEWER : { id : 17, name : getValue('Interviewer') }, COMPANY_PREFERENCE : { id : 18, name : getValue('') }, 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') }, INTERVIEWER : { id : 9, name : getValue('Interviewer') }, fromId : function(id) { var type; switch (id) { case this.EMPLOYEE.id: type = this.EMPLOYEE; break; case this.APPLICANT.id: type = this.APPLICANT; break; case this.CONTACT.id: type = this.CONTACT; break; case this.ADMIN.id: type = this.ADMIN; break; case this.REFERRER.id: type = this.REFERRER; break; case this.SOURCER.id: type = this.SOURCER; break; case this.SALES.id: type = this.SALES; break; case this.VENDOR.id: type = this.VENDOR; break; case this.INTERVIEWER.id: type = this.INTERVIEWER; 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/' }, "maxSendoutSize" : 25, "modalTimeout" : 10, "maxReqLocations" : 50, "backgroundRefreshInterval" : 5, "skin" : { "reseller" : getValue(''), "portalUrl" : getValue('') }, "types" : { "ENTITY" : getEntityTypes(), "USER" : getUserTypes(), 'FIELD' : getFieldTypes(), 'DROPDOWN' : getDropdownTypes(), 'STATUS' : getStatusTypes() }, "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' }, "phoneRegex" : /^((\+\d{1,3}(-| |.)?\(?\d\)?(-| |.)?\d{1,3})|(\(?\d{2,3}\)?))(-| |.)?(\d{3,4})(-| |.)?(\d{4})(( e?x?t?.? ?)\d{1,10}){0,1}$/ }); 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('') / 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(''), "trackGdpr" : getValue(''), "showLastActivity" : getValue(''), "enableRecruitingHelp" : getValue(''), "recruitingHelpText" : getValue(""), "recruitingHelpConfirmation" : getValue(""), "requireSubmittalActivityComment" : getValue(''), "maxSendoutRecipients" : '25' } }); app.constant('BM_USER', { "guid" : '', "displayName" : '', "userGk" : getValue(''), "companyGk" : getValue(''), "myCompanyGk" : getValue(''), "companyGuid" : '', "remoteAddr" : '34.234.76.59', "rpoAccess" : getValue(''), "parentCompanyGk" : getValue(''), "managingOtherCompany" : getValue(''), "adminUser" : false, "iesCredential" : getValue('false'), "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(''), "activityDateTime" : getValue(''), "activityDate" : getValue(''), "activityTime" : getValue(''), "activityAmPm" : getValue(''), "type" : { "id" : getValue('') } }); })();