/*
* ATTWiFiOrdering Javasscript
*/
// Setup angular to control window
(function(window, angular, undefined) {'use strict';
/**
* @ngdoc overview
* @name angulartics.webtrends
* Enables analytics support for Webtrends
*/
angular.module('angulartics.webtrends', ['angulartics'])
.config(['$analyticsProvider','$compileProvider', function ($analyticsProvider,$compileProvider) {
/* $analyticsProvider.registerPageTrack(function (path, properties) {
dcsMultiTrack('DCS.dcsuri', path);
});
$analyticsProvider.registerEventTrack(function (event, properties, options, callback) {
Webtrends.multiTrack({argsa: ["WT.fo_event", event]});
});
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|blob|chrome-extension|data):/);*/
}])
})(window, window.angular);
///////////////////////////////////
// Setup Pages with angular
angular.module('wifiOrder', ['ngRoute', 'ui.bootstrap', 'ngMessages', 'angulartics', 'angulartics.webtrends', 'checklist-model', 'signature','ngSanitize', 'ngAnimate'])
.config(function ($routeProvider, $provide) {
$provide.decorator('$log', ['$delegate', function ($delegate) {
// Keep track of the original debug method, we'll need it later.
var origError = $delegate.error;
/*
* Intercept the call to $log.wifiError() so we can add on
* our enhancement. We're going to add on a date and
* time stamp to the message that will be logged.
*/
$delegate.wifiError = function () {
var args = [].slice.call(arguments);
args[0] = [new Date().toString(), ': ', args[0]].join('');
// Send on our enhanced message to the original debug method.
origError.apply(null, args)
};
return $delegate;
}]);
$routeProvider
//product brochure page
.when('/', {
templateUrl: '/ATTWiFiUpgradeOrdering/wifiOrd_preFlight',
controller: 'preFlightController'
})
.when('/ContactValidation', {
templateUrl: '/ATTWiFiUpgradeOrdering/wifiOrd_ContactValidation_html',
controller: 'contactValidationController'
})
.when('/Error', {
templateUrl: '/ATTWiFiUpgradeOrdering/wifiOrd_error_html',
controller: 'errorController'
})
//product brochure page
.when('/ProductOverview/:brandId', {
templateUrl: '/ATTWiFiUpgradeOrdering/wifiOrd_ProductOverview_html',
controller: 'productOverviewController'
})
//operator agreement page
.when('/OperatorAgreement/:brandId', {
templateUrl: '/ATTWiFiUpgradeOrdering/wifiOrd_OperatorAgreement_html',
controller: 'operatorAgreementController'
})
//order form
.when('/OrderForm', {
templateUrl: '/ATTWiFiUpgradeOrdering/wifiOrd_OrderReview_html',
controller: 'orderFormController'
})
//order equipment
.when('/OrderEquipment/:v_id', {
templateUrl: '/ATTWiFiUpgradeOrdering/wifiOrd_OrderFormEquipment_html',
controller: 'orderEquipmentController'
})
//venue circuit
.when('/VenueCircuitOrder/:v_id', {
templateUrl: '/ATTWiFiUpgradeOrdering/wifiOrd_VenueCircuitOrder_html',
controller: 'venueCircuitController'
})
.when('/OrderSummary', {
templateUrl: '/ATTWiFiUpgradeOrdering/wifiOrd_OrderSummary_html',
controller: 'orderSummaryController'
// resolve: 'resolveOrder'
})
.when('/OrderConfirmation', {
templateUrl: '/ATTWiFiUpgradeOrdering/wifiOrd_Orderconfirmation_html',
controller: 'orderSummaryController'
// resolve: 'resolveOrder'
})
.when('/Help', {
template: '
We\'re sorry there\'s been a problem completing your request.
Please contact the distributor of this link for further assistance. If you have any additional questions, please call 855-288-9434.
'
//controller: 'orderSummaryController',
//resolve: 'resolveOrder'
})
.otherwise({
redirectTo: '/Help'
});
})
.filter('removeSpaces', [function() {
return function(string) {
if (!angular.isString(string)) {
return string;
}
return string.replace(/[\s]/g, '');
};
}])
.filter('escapeCharacters', [function() {
return function(string) {
if (!angular.isString(string)) {
return string;
}
return string.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, "'").replace(/>/g, '>').replace(/</g, '<');
};
}])
.filter('boundHtml', ['$sce', function($sce){
return function(text) {
return $sce.trustAsHtml(text);
};
}])
.filter('BringToTop', function () {
return function (item, current) {
var newList = [];
angular.forEach(item, function (u) {
if (u.sfdcID == current) {
newList.unshift(u);
}
else {
newList.push(u);
}
});
return newList;
};
})
.filter('split', function() {
return function(input, splitChar, splitIndex) {
// do some bounds checking here to ensure it has that index
return input.split(splitChar)[splitIndex];
}
})
.filter('emptyreturn0', function() {
return function(input) {
input = parseFloat(input);
if (!isNaN(input) && angular.isNumber(input) ) {
usevalue = input;
}
else {
usevalue = 0;
}
return usevalue;
}
})
.filter('ATTServiceBandwidth', function($filter) {
return function(inputdata) {
numberPattern = /\d+([\/.]\d+)?/g;
// Check for ; or ,
if (inputdata.indexOf(';') != -1) {
getBW = $filter('split')(inputdata,';',0);
}
else {
getBW = $filter('split')(inputdata,',',0);
}
// Split by '/' to get the upload and download
firstNum = $filter('split')(getBW,'/',0).match( numberPattern );
SecNum = $filter('split')(getBW,'/',1).match( numberPattern );
// Set value for upload and download
Broadband_Down = firstNum;
if(SecNum.length > 1) {
Broadband_Up = SecNum[0] + '-' + SecNum[1];
}
else if (SecNum >= 100 ) {
Broadband_Up = '0.' + SecNum;
}
else {
Broadband_Up = SecNum;
}
return {
'Broadband_Down':Broadband_Down.toString(),
'Broadband_Up':Broadband_Up.toString()
}
}
})
.filter('ATTExtDSLBandwidth', function($filter) {
return function(inputdata) {
numberPattern = /\d+([\/.]\d+)?/g;
firstNum = $filter('split')(inputdata,'x',0).match( numberPattern );
SecNum = $filter('split')(inputdata,'x',1).match( numberPattern );
if(firstNum.length > 1) {
Broadband_Down = firstNum[1];
}
else {
Broadband_Down = firstNum;
}
if (SecNum >= 100 ) {
Broadband_Up = '0.' + SecNum;
}
else {
Broadband_Up = SecNum;
}
return {
'Broadband_Down':Broadband_Down.toString(),
'Broadband_Up':Broadband_Up.toString()
}
}
})
.filter('ATTExtCableBandwidth', function($filter) {
return function(inputdata) {
numberPattern = /\d+([\/.]\d+)?/g;
firstNum = $filter('split')(inputdata,'x',0).match( numberPattern );
SecNum = $filter('split')(inputdata,'x',1).match( numberPattern );
return {
'Broadband_Down':firstNum.toString(),
'Broadband_Up':SecNum.toString()
}
}
})
.filter('CableBandwidth', function($filter) {
return function(inputdata) {
numberPattern = /\d+([\/.]\d+)?/g;
firstNum = $filter('split')(inputdata,'x',0).match( numberPattern );
SecNum = $filter('split')(inputdata,'x',1).match( numberPattern );
if(firstNum.length > 1) {
Broadband_Down = firstNum[1];
}
else {
Broadband_Down = firstNum;
}
if (SecNum >= 100 ) {
Broadband_Up = '0.' + SecNum;
}
else {
Broadband_Up = SecNum;
}
return {
'Broadband_Down':Broadband_Down.toString(),
'Broadband_Up':Broadband_Up.toString()
}
}
})
.filter('ILECBandwidth', function($filter) {
return function(inputdata) {
numberPattern = /\d+([\/.]\d+)?/g;
firstNum = $filter('split')(inputdata,'x',0).match( numberPattern );
SecNum = $filter('split')(inputdata,'x',1).match( numberPattern );
if(firstNum.length > 1) {
Broadband_Down = firstNum[1];
}
else {
Broadband_Down = firstNum;
}
if (SecNum >= 100 ) {
Broadband_Up = '0.' + SecNum;
}
else {
Broadband_Up = SecNum;
}
return {
'Broadband_Down':Broadband_Down.toString(),
'Broadband_Up':Broadband_Up.toString()
}
}
})
.filter('aContainsB', function($filter) {
return function aContainsB (a, b) {
IsBroadbandData = (a.toLowerCase().indexOf(b)== -1 ? false : true);
return IsBroadbandData;
}
})
.filter('tel', function () {
return function (tel) {
if (!tel) { return ''; }
var value = tel.toString().trim().replace(/^\+/, '');
if (value.match(/[^0-9]/)) {
return tel;
}
var country, city, number;
switch (value.length) {
case 10: // +1PPP####### -> C (PPP) ###-####
country = 1;
city = value.slice(0, 3);
number = value.slice(3);
break;
case 11: // +CPPP####### -> CCC (PP) ###-####
country = value[0];
city = value.slice(1, 4);
number = value.slice(4);
break;
case 12: // +CCCPP####### -> CCC (PP) ###-####
country = value.slice(0, 3);
city = value.slice(3, 5);
number = value.slice(5);
break;
default:
return tel;
}
if (country == 1) {
country = "";
}
number = number.slice(0, 3) + '-' + number.slice(3);
return (country + " (" + city + ") " + number).trim();
};
})
.filter('objLimitTo', [function(){
return function(obj, limit){
var keys = Object.keys(obj);
if(keys.length < 1) return [];
var start = 1;
var ret = new Object();
var count = 0;
angular.forEach(keys, function(key, arrayIndex){
if(count > limit && limit == 1) {
return false;
}
else if (start > limit && limit >= 1) {
ret[key] = obj[key];
}
count++;
start++;
});
return ret;
};
}])
.filter('sumByKey', [function(){
return function(icdata, key) {
if (typeof(icdata) === 'undefined' || typeof(key) === 'undefined') {
return 0;
}
var sum = 0;
for (var i = icdata.length - 1; i >= 0; i--) {
sum += parseInt(icdata[i][key]);
}
return sum;
};
}])
.filter('isEmpty', [function() {
return function(object) {
return !angular.equals({}, object);
}
}])
.filter('removeString', function () {
return function (text) {
var str = text.replace(/\*/g, '');
return str;
};
})
.filter('removeInvalidFileNameSymbols', function () {
return function (text) {
var str = text.replace(/\//g, "").replace(/:/g, "").replace(/\*/g, "").replace(/\?/g, "").replace(/\\/g, "").replace(//g, "").replace(/\|/g, "");
return str;
};
})
.filter('capitalize', function() {
return function(input) {
return (!!input) ? input.split(' ').map(function(wrd){return wrd.charAt(0).toUpperCase() + wrd.substr(1).toLowerCase();}).join(' ') : '';
}
})
.filter('numberFixedLen', function () {
return function (n, len) {
var num = parseInt(n, 10);
len = parseInt(len, 10);
if (isNaN(num) || isNaN(len)) {
return n;
}
num = '' + num;
while (num.length < len) {
num = '0' + num;
}
return num;
};
})
/////////////////////////////////////
.directive('loading', function () {
return {
restrict: 'E',
replace:true,
template: '
Loading
',
link: function (scope, element, attr) {
scope.$watch('loading', function (val) {
if (val)
$(element).show();
else
$(element).hide();
});
}
}
})
.directive('sectionLoading', function () {
return {
restrict: 'E',
replace:true,
template: '',
link: function (scope, element, attr) {
scope.$watch('sectionLoading', function (val) {
if (val)
$(element).show();
else
$(element).hide();
});
}
}
})
//
.directive('formAutofillFix', function() {
return function(scope, elem, attrs) {
// Fixes Chrome bug: https://groups.google.com/forum/#!topic/angular/6NlucSskQjY
elem.prop('method', 'POST');
// Fix autofill issues where Angular doesn't know about autofilled inputs
if(attrs.ngSubmit) {
setTimeout(function() {
elem.unbind('submit').submit(function(e) {
e.preventDefault();
elem.find('input, textarea, select').trigger('input').trigger('change').trigger('keydown');
scope.$apply(attrs.ngSubmit);
});
}, 0);
}
};
})
.directive('ngConfirmClick', [
function(){
return {
link: function (scope, element, attr) {
var msg = attr.ngConfirmClick || "Are you sure?";
var clickAction = attr.confirmedClick;
element.bind('click',function (event) {
if ( window.confirm(msg) ) {
scope.$eval(clickAction)
}
});
}
};
}])
///////////////////////////////////////////////
.directive('blank', function () {
return {
restrict: 'E',
replace:true,
template: '',
link: function (scope, element, attr) {
scope.$watch('blank', function (val) {
if (val)
$(element).show();
else
$(element).hide();
});
}
}
})
/*
Start controllers
productOverviewController
operatorAgreementController
orderFormController
VenuesOverviewController
orderEquipmentController
venueCircuitController
orderSummaryController
preFlightController
*/
.controller('preFlightController', function ($scope, $rootScope, $window, $location, $routeParams, $filter, webtrendsService, brandService , $uibModal , $log) {
//@TODO:Moving this code to config object . Also on this page this method is called again. need to remove it
$scope.blank = true;
$scope.loading = true;
ATTWiFiOrderingClass.getCurrentUserName(function(result, status){
$scope.$evalAsync(function () {
$scope.id = result.body[0].Id;
if($scope.id==null || $scope.id==="undefined" || result.body[0].FirstName==='ATTWiFiUpgradeOrdering' ){
$rootScope.orderRequest = '';
if($rootScope.brandId==null || $rootScope.brandId==="undefined"){
$rootScope.brandId='001600000lzkAb';
}
$location.path('/ProductOverview/'+$rootScope.brandId);
}
$scope.loading = false;
$scope.blank = false;
});
});
//Uncomment to clear salesforce storage
//ATTWiFiOrderingClass.clearOrderState(function(result, status){});
/* Pre-Flight Check List Page:
* As a McDonald's franchisee user, upon logging into the microsite
* I want to be presented with information regarding the details I will need
* to know in order to successfully place orders for my venues. */
ATTWiFiOrderingClass.getOrderState(function(result, status){
$scope.$evalAsync(function () {
if (result === null) {
$rootScope.orderRequest = '';
// console.log($rootScope.orderRequest);
}
else {
$rootScope.orderRequest = JSON.parse($filter('escapeCharacters')(result)); // result.replace(/"/g, '"').replace(/&/g, '&')
/*
console.log('$rootScope.orderRequest First pull');
console.log($rootScope.orderRequest);
console.log('JSON.parse(result) Mike');
console.log(result.toString());
console.log( JSON.parse($filter('escapeCharacters')(result)) );
*/
}
});
});
/* Disable form objects while processing backend calls */
$scope.disableContinue = true;
$scope.loading = true;
/* On load of page, getCurrentUserName gets the Id of currently logged in user */
ATTWiFiOrderingClass.getCurrentUserName(function(result, status){
$scope.id = result.body[0].Id;
$scope.contactId = result.body[0].ContactId;
//console.log($scope.id);
/* localstorage CustomerWiFI_Order values are checked
* If CustomerWiFI_Order is null, or if getCurrentUserName Id
* is different with the localstorage value,
* getCurrentUserName is triggered to pull current user data.
* If CustomerWiFI_Order has values, & Franchisee_preFlight is true,
* proceed to next page (ContactValidation) */
// $rootScope.orderRequest = JSON.parse(localStorage.getItem('CustomerWiFI_Order'));
//console.log($rootScope.orderRequest);
ATTWiFiOrderingClass.getUserInfo('001600000lzkAb', null, function(result, status) {
$scope.$evalAsync(function() {
$scope.loading = false;
/* Successful response from Cassandra JSON.parse(result.replace(/"/g, '"').replace(/&/g, '&')); */
if(result != null) {
var response = JSON.parse($filter('escapeCharacters')(result));
$rootScope.mcdInputData = response;
// console.log("mcdInputData is "+$rootScope.mcdInputData);
// console.log($rootScope.mcdInputData);
if ($rootScope.orderRequest == null || $rootScope.orderRequest == '') {
$rootScope.mcdInputData.Franchisee_signature = false;
$rootScope.mcdInputData.Franchisee_preFlight = false;
$rootScope.mcdInputData.Franchisee_contactValidation = false;
$rootScope.mcdInputData.Franchisee_BillingCity = '';
$rootScope.mcdInputData.Franchisee_BillingCountryCode = '';
$rootScope.mcdInputData.Franchisee_BillingPostalCode = '';
$rootScope.mcdInputData.Franchisee_BillingState = '';
$rootScope.mcdInputData.Franchisee_BillingStateCode = '';
$rootScope.mcdInputData.Franchisee_BillingStreet = '';
$rootScope.mcdInputData.Franchisee_Phone = '';
// console.log($rootScope.mcdInputData);
} else {
$rootScope.mcdInputData.Franchisee_signature = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_signature;
$rootScope.mcdInputData.Franchisee_preFlight = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_preFlight;
$rootScope.mcdInputData.Franchisee_contactValidation = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_contactValidation;
$rootScope.mcdInputData.Franchisee_CompanyName = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_CompanyName;
$rootScope.mcdInputData.Franchisee_Phone = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_Phone;
$rootScope.mcdInputData.Franchisee_BillingCity = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingCity;
$rootScope.mcdInputData.Franchisee_BillingCountryCode = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingCountryCode;
$rootScope.mcdInputData.Franchisee_BillingPostalCode = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingPostalCode;
$rootScope.mcdInputData.Franchisee_BillingState = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingState;
$rootScope.mcdInputData.Franchisee_BillingStateCode = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingStateCode;
$rootScope.mcdInputData.Franchisee_BillingStreet = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingStreet;
}
sessionStorage.setItem('mcdInputData', JSON.stringify($rootScope.mcdInputData));
sessionStorage.setItem('mcdInputDatavenues', JSON.stringify($rootScope.mcdInputData.venues));
} else {
/* if request error or Cassandra is Down
* 1. Remove sessionStorage, logout user
* 2. Redirect to ProductOverview page */
$rootScope.error = 2;
$location.path("/Error");
localStorage.clear();
sessionStorage.clear();
}
})
});
// if(($rootScope.orderRequest == null || $rootScope.orderRequest.currentUserId != $scope.id) {
/*if($rootScope.orderRequest == null || $rootScope.orderRequest == '') {
ATTWiFiOrderingClass.getUserInfo('001600000lzkAb',null,function(result, status){
if(result.length > 0){
var response = JSON.parse($filter('escapeCharacters')(result)); //JSON.parse(result.replace(/"/g,'"').replace(/&/g, '&'));
$rootScope.mcdInputData = response;
$rootScope.mcdInputData.Franchisee_signature = false;
$rootScope.mcdInputData.Franchisee_preFlight = false;
$rootScope.mcdInputData.Franchisee_contactValidation = false;
// console.log($rootScope.mcdInputData);
}
$scope.disableCheckbox = false;
$scope.disableCancel = false;
$scope.$apply();
});
} else {
/* handling in case currently login do not have getcontactinfo response
* remove else clause codes in the future/actual data
* $scope.id = '0036300000GqGRp' (Sanish Kasprzyk) */
//$scope.id = '0036300000GqGRp';
// $rootScope.mcdInputData.Franchisee_FirstName = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_FirstName;
// $rootScope.mcdInputData.Franchisee_LastName = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_LastName;
// Company will be set in the Contact Validation page and obtained from json object
/* $rootScope.mcdInputData.Franchisee_CompanyName = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_CompanyName;
$rootScope.mcdInputData.Franchisee_email = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_email;
$rootScope.mcdInputData.Franchisee_Phone = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_Phone;
$rootScope.mcdInputData.Franchisee_ID = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_ID;
$rootScope.mcdInputData.Franchisee_signature = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_signature;
$rootScope.mcdInputData.Franchisee_preFlight = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_preFlight;
$rootScope.mcdInputData.Franchisee_contactValidation = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_contactValidation;
$rootScope.mcdInputData.Franchisee_Role = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_role;
$rootScope.mcdInputData.Franchisee_BillingStreet = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingStreet;
$rootScope.mcdInputData.Franchisee_BillingState = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingState;
$rootScope.mcdInputData.Franchisee_BillingCity = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingCity;
$rootScope.mcdInputData.Franchisee_BillingPostalCode = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingPostalCode;
$rootScope.mcdInputData.Franchisee_BillingCountryCode = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingCountryCode;
$rootScope.mcdInputData.Franchisee_BillingStateCode = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingStateCode;
$rootScope.mcdInputData.corporateId = '0016300000Ie7GdAAJ';
// console.log($rootScope.mcdInputData);
}*/
});
/* Checking if there are changes with the page checkbox, to enable/disable Continue button */
$scope.$watch('orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_preFlight', function(value) {
$scope.disableContinue = (value) ? false : true;
});
/* Continuing to the next page, pulled user data on load is saved in the CustomerWiFI_Order SFDC & session storage
* this is even there's already an existing CustomerWiFI_Order values;
* to update the CustomerWiFI_Order values */
$scope.continue = function () {
////////// Get Partial Order from SFDC //////////
ATTWiFiOrderingClass.getOrderState(function(result, status){
$scope.$evalAsync(function () {
$scope.loading = true;
// Get incoming string and convert to Object /////////////////////
ic_OrderRequest = JSON.parse($filter('escapeCharacters')(result));
//console.log('result isObject : ' + angular.isObject(ic_OrderRequest));
//console.log(ic_OrderRequest);
// Create orderRequest JSON ///////////////////////////////
$rootScope.orderRequest = {
"currentUserContactId" : $scope.contactId,
"currentUserId": $scope.id,
"FranchiseeOrdering":{
"franchiseeContactInfo":{
"Franchisee_FirstName":$rootScope.mcdInputData.Franchisee_FirstName,
"Franchisee_LastName":$rootScope.mcdInputData.Franchisee_LastName,
"Franchisee_CompanyName":$rootScope.mcdInputData.Franchisee_CompanyName,
"Franchisee_email":$rootScope.mcdInputData.Franchisee_email,
"Franchisee_Phone":$rootScope.mcdInputData.Franchisee_Phone,
"Franchisee_role": $rootScope.mcdInputData.Franchisee_Role,
"Franchisee_signature": $rootScope.mcdInputData.Franchisee_signature,
"Franchisee_contactValidation": $rootScope.mcdInputData.Franchisee_contactValidation,
"Franchisee_preFlight": true,
"Franchisee_ID":$rootScope.mcdInputData.Franchisee_ID,
"Franchisee_BillingStreet":$rootScope.mcdInputData.Franchisee_BillingStreet,
"Franchisee_BillingState": $rootScope.mcdInputData.Franchisee_BillingState,
"Franchisee_BillingCity": $rootScope.mcdInputData.Franchisee_BillingCity,
"Franchisee_BillingPostalCode": $rootScope.mcdInputData.Franchisee_BillingPostalCode,
"Franchisee_BillingCountryCode":$rootScope.mcdInputData.Franchisee_BillingCountryCode,
"Franchisee_BillingStateCode":$rootScope.mcdInputData.Franchisee_BillingStateCode,
"Account_Invoice_ID":$rootScope.mcdInputData.SE_Invoice_Account_ID__c,
//"Franchisee_EID":$rootScope.mcdInputData.EID,
//TODO retrieve credit check id from salesforce and insert here if it exists
"Credit_Check_ID":'',
"Franchisee_InvoiceAccountID":$rootScope.mcdInputData.Franchisee_InvoiceAccountID,
//"documentsList":[]
},
'venues': []
}
}
////////// Use Partial Order from SFDC in orderRequest Object //////////
// if (result!=null && !(JSON.parse(result.replace(/"/g, '"')) === null || JSON.parse(result.replace(/"/g, '"')) === 'undefined')){
if (angular.isObject(ic_OrderRequest)) {
if (angular.isObject(ic_OrderRequest.FranchiseeOrdering) && ic_OrderRequest.FranchiseeOrdering.venues.length !== 0) {
$rootScope.orderRequest.FranchiseeOrdering.venues = ic_OrderRequest.FranchiseeOrdering.venues;
}
/*if (angular.isObject(ic_OrderRequest.FranchiseeOrdering) && angular.isObject(ic_OrderRequest.FranchiseeOrdering.OrderedVenues)) {
$rootScope.orderRequest.FranchiseeOrdering.OrderedVenues = ic_OrderRequest.FranchiseeOrdering.OrderedVenues;
}*/
}
console.log($rootScope.orderRequest);
////////////
// Update SFDC with Partial order //////////////////////
///////////////////////////////////
ATTWiFiOrderingClass.setOrderState(JSON.stringify($rootScope.orderRequest), function(result, status){});
sessionStorage.setItem('CustomerWiFI_Order',JSON.stringify($rootScope.orderRequest));
sessionStorage.setItem('mcdInputData',JSON.stringify($rootScope.mcdInputData));
sessionStorage.setItem('mcdInputDatavenues',JSON.stringify($rootScope.mcdInputData.venues));
/*
console.log(JSON.stringify($rootScope.orderRequest));
console.log('$rootScope.orderRequest After Save to server');
console.log($rootScope.orderRequest);
console.log('Stop Looking');
//ATTWiFiOrderingContractService.isDocumentExists('operatorAgreement.pdf', $rootScope.mcdInputData.Franchisee_InvoiceAccountID, function(result, status) {
//console.log('isDocumentExistsOA' + result);
//$rootScope.operatorAgreementexist = result;
*/
ATTWiFiOrderingContractService.checkSignature($rootScope.mcdInputData.Franchisee_ID, function(signature, status){
$scope.$evalAsync(function() {
//if(signature.exists && $rootScope.operatorAgreementexist) {
$scope.loading = false;
if(signature.exists) {
$rootScope.Franchisee_signature_image = signature.image;
$rootScope.mcdInputData.Franchisee_signature = true;
$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_signature = true;
if($rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_contactValidation) {
if($rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_signature) {
if ($rootScope.orderRequest.FranchiseeOrdering.venues.length !== 0) {
ATTWiFiOrderingClass.setOrderState(JSON.stringify($rootScope.orderRequest), function(result, status){});
$location.path("/OrderSummary");
}
else {
$location.path("/OrderForm");
}
}
else {
$location.path("/OperatorAgreement/"+$rootScope.brandId);
}
}
else {
$location.path("/ContactValidation");
}
}
else {
if($rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_contactValidation) {
$location.path("/OperatorAgreement/"+$rootScope.brandId);
}
else {
$location.path("/ContactValidation");
}
//$scope.$apply();
}
});
});
//});
});
});
};
/// end continue
})
// contact Validation controller //////////////////////////////
.controller('contactValidationController', function ($scope, $rootScope, $window, $location, $filter, $routeParams, webtrendsService, brandService , $uibModal , $log) {
//@TODO:Moving this code to config object
ATTWiFiOrderingClass.getCurrentUserName(function(result, status){
$scope.$evalAsync(function () {
$scope.id = result.body[0].Id;
if($scope.id==null || $scope.id==="undefined" || result.body[0].FirstName==='ATTWiFiUpgradeOrdering' ){
$rootScope.orderRequest = '';
if($rootScope.brandId==null || $rootScope.brandId==="undefined"){
$rootScope.brandId='001600000lzkAb';
}
$location.path('/ProductOverview/'+$rootScope.brandId);
}
})
});
ATTWiFiOrderingClass.getOrderState(function(result, status){
$scope.$evalAsync(function () {
$rootScope.orderRequest = JSON.parse($filter('escapeCharacters')(result)) // JSON.parse(result.replace(/"/g, '"').replace(/&/g, '&')); //
// console.log($rootScope.orderRequest);
});
});
// console.log($rootScope.orderRequest);
// console.log($rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_contactValidation);
if($rootScope.orderRequest != null && $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_contactValidation) {
$location.path("/OperatorAgreement/"+$rootScope.brandId);
}
/*$scope.$watch('orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_CompanyName', function(value) {
$scope.disableContinue = (value) ? false : true;
// console.log($scope.disableContinue);
});*/
$scope.$watch('myForm.$valid', function(value) {
$scope.disableContinue = (value) ? false : true;
});
/*$scope.$watch('myForm.PhoneNumber.$dirty', function(value) {
if(!value) {
$scope.myForm.PhoneNumber.$setValidity("pattern", true);
$scope.myForm.PhoneNumber.$setValidity("maxlength", true);
$scope.myForm.PhoneNumber.$setValidity("minlength", true);
}
});*/
$scope.cancel = function ( path ) {
//$location.path('/ProductOverview/'+$routeParams.brandId);
//if(!$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_preFlight) {
$location.path('/');
//}
};
$scope.returnToPage = function() {
$scope.loading = false;
$scope.modalInstance.dismiss('cancel');
}
$scope.verifyContactModal = function(){
$scope.modalInstance = $uibModal.open({
animation: true,
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
templateUrl: 'verifyContact.html',
windowClass: 'verifyContactModal',
scope: $scope,
keyboard: false,
backdrop: 'static',
size: 'sm',
resolve: {
}
});
$scope.modalInstance.result.then(function () {
}, function () {
$log.info('verifyContactModal, dismissed at: ' + new Date());
});
};
$scope.continue = function () {
//$scope.loading = true;
$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_contactValidation = true;
ATTWiFiOrderingClass.setOrderState(JSON.stringify($rootScope.orderRequest), function(result, status){});
//if(!$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.signature) {
//$location.path("/OperatorAgreement/"+$rootScope.brandId);
//} else {
//$location.path("/OrderForm");
//}
$scope.loading = true;
ATTWiFiOrderingContractService.checkSignature($rootScope.mcdInputData.Franchisee_ID, function(signature, status){
$scope.$evalAsync(function() {
$scope.loading = false;
if(signature.exists) {
$rootScope.Franchisee_signature_image = signature.image;
$rootScope.mcdInputData.Franchisee_signature = true;
$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_signature = true;
if($rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_signature) {
if ($rootScope.orderRequest.FranchiseeOrdering.venues.length) {
$location.path('/OrderSummary/');
} else {
$location.path("/OrderForm");
}
} else {
$location.path("/OperatorAgreement/"+$rootScope.brandId);
}
} else {
$location.path("/OperatorAgreement/"+$rootScope.brandId);
}
});
});
};
})
//errorController
.controller('errorController', function ($scope, $rootScope, $window, $location, $filter, $routeParams, webtrendsService, brandService , $uibModal , $log) {
$scope.subText = "Please contact 877-397-6900 or AWS-orders@att.com for assistance.";
if($rootScope.error == 2) { /* Cassandra is down */
$scope.headlineText = "We're sorry, there's been a problem processing your request.";
delete $rootScope.error;
} else {
$scope.headlineText = 'You are not authorized to access this site.';
}
//$scope.isErrorPage = "Yes";
})
//logoutController
.controller('logoutController', function ($scope, $rootScope, $window, $location, $routeParams, $filter, webtrendsService, brandService , $uibModal , $log) {
$rootScope.brandId='001600000lzkAb';
document.getElementById("header_logo_link").href="/ATTWiFiUpgradeOrdering#/ProductOverview/"+$rootScope.brandId;
$scope.logout = function (){
$scope.modalInstance = $uibModal.open({
animation: true,
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
templateUrl: '/ATTWiFiUpgradeOrdering/wifiOrd_LogoutModal_html',
windowClass: 'logoutModal',
scope: $scope,
keyboard: false,
backdrop: 'static',
size: 'sm',
resolve: {
}
});
ATTWiFiOrderingClass.setOrderState(JSON.stringify($rootScope.orderRequest), function(result, status){});
//console.log('Logging out...');
//alert('Functionality has not been implemented yet.');
};
$scope.cancel = function (){
$scope.modalInstance.dismiss('cancel');
};
$scope.ok = function (){
$location.path('/ProductOverview/'+$rootScope.brandId);
};
})
///// PRODUCT OVERVIEW CONTROLLER
.controller('productOverviewController', function ($scope, $rootScope, $window, $location, $routeParams, $filter, webtrendsService, brandService , $uibModal , $log) {
//@TODO:Moving this code to config object
ATTWiFiOrderingClass.getCurrentUserName(function(result, status){
$scope.$evalAsync(function () {
$scope.id = result.body[0].Id;
if($scope.id==null || $scope.id==="undefined" || result.body[0].FirstName==='ATTWiFiUpgradeOrdering' ){
$rootScope.orderRequest = '';
if($rootScope.brandId==null || $rootScope.brandId==="undefined"){
$rootScope.brandId='001600000lzkAb';
}
$location.path('/ProductOverview/'+$rootScope.brandId);
}
})
});
checkBrand($routeParams.brandId, $location, brandService);
// Default Values
$scope.brandId = $routeParams.brandId;
$rootScope.brandId = $routeParams.brandId;
$rootScope.Customer_brand = brandService.getBrandByUrlId($rootScope.brandId);
// Windows Browser Storages
sessionStorage.setItem('CustomerbrandID',JSON.stringify($rootScope.brandId));
//sessionStorage.setItem('Customerbrand',JSON.stringify($rootScope.Customer_brand));
/*
console.log($rootScope.Customer_brand);
console.log($rootScope.Customer_brand.name);
console.log($rootScope.Customer_brand.sfdcId);
console.log($scope.brandId);
console.log($rootScope.brandId);
$scope.go = function ( path ) {
$location.path( path );
};
*/
//Login to McDonalds
$scope.initialLogin = function(){
//$window.location.href = 'https://gafsstg.mcd.com/adfs/ls/idpinitiatedsignon.aspx?logintoRP=https://awsdev-attwifi.cs43.force.com/ATTWiFiUpgradeOrdering';
//$window.location.href = 'https://gafsstg.mcd.com/adfs/ls/idpinitiatedsignon.aspx?logintoRP=https://'+window.location.host+'/ATTWiFiUpgradeOrdering';
$window.location.href ='https://'+window.location.host+'/ATTWiFiUpgradeOrdering/mcd';
};
// openLoginModal
$scope.openLoginModal = function (size) {
var modalInstance = $uibModal.open({
animation: true,
templateUrl: '/ATTWiFiUpgradeOrdering/wifiOrd_LoginModal_html',
controller: 'VenuesOverviewController',
size: size,
keyboard: false,
resolve: {}
});
modalInstance.result.then(function () {
//Go to the front so that the user can see the venue that they just added
$scope.currentPage = 1;
}, function () {
$scope.loading = false;
$log.info('Modal dismissed at: ' + new Date());
});
};
})
///// END PRODUCT OVERVIEW CONTROLLER
///// OPERATOR AGREEMENT Controller
.controller('operatorAgreementController', function ($rootScope, $scope, $location, $uibModal, $log, $http, $routeParams, $analytics, webtrendsService, brandService, $timeout, $filter) {
//@TODO:Moving this code to config object
$scope.blank = true;
$scope.loading = true;
ATTWiFiOrderingClass.getCurrentUserName(function(result, status){
$scope.$evalAsync(function () {
$scope.id = result.body[0].Id;
if($scope.id==null || $scope.id==="undefined" || result.body[0].FirstName==='ATTWiFiUpgradeOrdering' ){
$rootScope.orderRequest = '';
if($rootScope.brandId==null || $rootScope.brandId==="undefined"){
$rootScope.brandId='001600000lzkAb';
}
$location.path('/ProductOverview/'+$rootScope.brandId);
}
$scope.loading = false;
$scope.blank = false;
});
});
// console.log($rootScope.mcdInputData);
$scope.disableFormObjects = true;
//$scope.CurrentFranchisee = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo;
$scope.CurrentFranchisee = $rootScope.mcdInputData;
sessionStorage.setItem('CustomerWiFI_Order',JSON.stringify($rootScope.orderRequest));
ATTWiFiOrderingClass.setOrderState(JSON.stringify($rootScope.orderRequest), function(result, status){});
var today = new Date();
var dd = (today.getDate() < 10) ? '0' + today.getDate() : today.getDate();
var mm = ((today.getMonth() + 1) < 10) ? '0' + (today.getMonth() + 1) : (today.getMonth() + 1); // January is 0!
var yyyy = today.getFullYear();
$scope.agreementDate = mm + '/' + dd + '/' + yyyy;
var oldattachmentBody = "
Operator's Participation Agreement
" + " " +
"
This Operator’s Participant Agreement (“Operator’s Agreement”) is entered into by and between AT&T Corp. (“AT&T”) and " + $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_FirstName + " " + $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_LastName + " (“Operator”), as an operator of one or more McDonald’s restaurants (“Restaurants”). This Operator’s Agreement is effective on the date of the last party’s signature (the “Effective Date”).
" + " " +
"
By executing this Operator’s Agreement, Operator is a Participant within the meaning of the Participation Agreement (“PA”), as amended, between McDonald’s Corporation (“McDonald’s”) and AT&T. Operator is also entitled to all rights and privileges, and agrees to be bound by the terms and conditions of Master Agreement No. 143894UA, as amended (“MA”), by and between McDonald’s and AT&T, and the ability to order any AT&T services available to Participants listed on the PA. In the event of an inconsistency, conflict or ambiguity between this Operator’s Agreement and the PA and any applicable AT&T Pricing Schedule (“PS”), the PA and PS shall control.
" + " " +
"
1. Master Agreement and Pricing Schedule. The Operator and AT&T agree that the terms and conditions of this Operator’s Agreement and the MA, PA and PS shall govern and control the provision of the Services received by the Operator from AT&T. All of the terms and conditions of the MA, PA and PS are hereby incorporated into this Operator’s Agreement to the same extent as if such terms and conditions were fully reproduced in this Operator’s Agreement. For purposes of all rights and remedies in the MA, references in the MA to “Customer” shall mean “Operator”.
" + " " +
"
2. Restaurant List. Attachment A is the initial Restaurant list that details the Operator’s Restaurants in which the Services are being ordered by Operator and that will be covered by the MA, PA, PS, and Operator’s Agreement (“Restaurant List”). The Restaurant List will be updated and revised from time to time as Restaurants are opened or closed by the Operator. Any Restaurant eligible to be added to the Restaurant List during the term of this Operator’s Agreement may be provided Services by AT&T at the then prevailing terms, conditions, and prices pursuant to the PS.
" + " " +
"
3. Services. During the term of this Operator’s Agreement, the Operator shall purchase from AT&T, and AT&T shall provide the Services to Operator in accordance with and subject to the terms and conditions set forth in this Operator’s Agreement and the MA, PA and PS. The standard terms for payment of invoices for Services purchased by the Operator are set forth in the MA, PA and PS. By entering into this Operator’s Agreement, all of Operator’s Restaurants subject to this Operator’s Agreement shall receive the benefit of the negotiated pricing set forth in the PS. Operator must provide AT&T with accurate and timely information as AT&T reasonably requires in order to provision, move, add or change Services. Attachment B (“Order Form”) lists the Services that Operator may purchase from AT&T. Upon AT&T’s acceptance and implementation of the Order Form, Operator shall receive the Services in accordance with the applicable PS. AT&T reserves the right to accept such Order Forms in an electronic or paper format.
" + " " +
"
4. Eligibility. Operator must meet the following eligibility requirements at all time during this Operator’s Agreement: (a) Operator must meet AT&T’s creditworthiness standards and cooperate with any credit assessment required by AT&T and (b) Operator must be a Restaurant which is branded and managed or operated pursuant to a management or operations agreement. Operator represents and warrants that, as of the Effective Date of this Operator’s Agreement, it is a Restaurant. If at any time Operator ceases to be a Restaurant, Operator shall notify AT&T.
" + " " +
"
5. Term and Termination. (a) Termination for Disassociation. If AT&T is notified by Customer that an Operator has ceased to be a Restaurant, AT&T will notify Operator in writing of the date on which Services under the Operator’s Agreement will be terminated (the “Notice”). Following the date set forth in the Notice, Services will be terminated.
" + " " +
"
6. Entire Agreement. This Operator’s Agreement, its Attachments, and the MA, PA and PS constitute the entire understanding and agreement between AT&T and Operator and supersede all prior and contemporaneous understandings and agreements, whether oral or written.
" + " " +
"
7. Assignment. This Operator’s Agreement shall not be assigned, sublicensed, delegated or otherwise transferred by Operator without notice to AT&T and AT&T retains the right to conduct creditworthiness check of any assignee, and any such assignment shall be null and void.
" + " " +
"
AT&T, Customer, and Operator have caused this Operator’s Agreement to be executed by their duly authorized representatives as of the date written below.
" + " " +
"
SIGNER’S HANDWRITTEN OR ELECTRONIC SIGNATURE BELOW ACKNOWLEDGES THAT SIGNER HAS READ AND UNDERSTANDS EACH OF THE PROVISIONS OF THIS AGREEMENT AND AGREES TO BE BOUND BY THEM.
" + " " +
'
Customer (by its authorized representative)
AT&T (by its authorized representative)
By:
By:
Name:
Name:
Title:
Title:
Date:
Date:
';
var attachmentBody = "
Operator's Participation Agreement
" + " " +
"
WHEREAS AT&T Corp. (“AT&T”) and McDonald’s Corporation (“Customer”) are parties to that certain Unified Agreement Ref. No 143894UA (the “Master Agreement”), and certain Pricing Schedules (collectively, the “Customer Agreement”).
" + " " +
"
WHEREAS,"+ $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_CompanyName + " wishes to purchase certain AT&T services under the same terms and conditions;
" + " " +
"
WHEREAS, purposes of this Participation Agreement , , the term “Participant” may include: (i) Customer (ii) Customer’s Affiliates; (iii) a Joint Venture, and (iv) each Franchisee and Developmental Licensee, that agrees to comply with, and be bound by, the terms and conditions of the Agreement by executing this Participation Agreement with AT&T (or agreeing to comply with, and be bound by, the terms and conditions of the Agreement in such other manner as is mutually agreed upon in writing by Customer and AT&T).
" + " " +
"
(a) Customer Affiliates/Joint Ventures. Customer Affiliates and Joint Ventures shall be permitted to purchase certain Services under the same terms, conditions and pricing as are contained in the Agreement by executing a Participation Agreement with AT&T; provided, however, there is no obligation on the part of any Customer Affiliate or Joint Venture to purchase any Service. “Joint Venture” means any entity in which Customer has an ownership interest in and which is authorized to operate under Customer’s “McDonald’s” brand.
" + " " +
"
(b) Franchisees. Franchisees shall be permitted to purchase certain Services under the same terms, conditions and pricing as are contained in the Agreement by executing a Participation Agreement with AT&T (or agreeing to comply with, and be bound by, the terms and conditions of the Agreement in such other manner as is mutually agreed upon in writing by Customer and AT&T). “Franchisee” means, for purposes of the Agreement, an entity with which Customer or a Customer Affiliate has an agreement pursuant to which: (a) such entity has a license to use a brand owned by Customer or a Customer Affiliate; and (b) the entity undertakes to conduct its primary business in accordance with methods and procedures prescribed by Customer or a Customer Affiliate.
" + " " +
"
(c) Development Licensees. Developmental Licensees shall be permitted to purchase certain Services under the same terms, conditions and pricing as are contained in the Agreement by executing a Participation Agreement with AT&T (or agreeing to comply with, and be bound by, the terms and conditions of the Agreement in such other manner as is mutually agreed upon in writing by Customer and Licensor). “Developmental Licensees” means a Franchisee to which Customer or a Customer Affiliate has granted a geographic territory in which such Franchisee may develop additional restaurants under the Customer's “McDonald’s” brand
" + " " +
"
AT&T and Customer or Participant, as applicable, hereby agree as follows:
" + " " +
"
1 Participant may purchase certain Services pursuant to this Participation Agreement. Capitalized terms used but not defined in this Participation Agreement shall have the same meaning as in the Customer Agreement.
" + " " +
"
2 Participant hereby represents and warrants that it is “Participant” as defined herein. If at any time Participant ceases to be a defined Participant of Customer, AT&T may notify Participant and Customer that this Participation Agreement is terminated pursuant to Section 12, below. AT&T shall have the right, prior to accepting an order from Participant, to confirm Participant’s creditworthiness.
" + " " +
"
3 Participant may purchase the following Services under the relevant terms of the Customer Agreement:
4 Participant also may execute its own Pricing Schedule under this Participation Agreement for and purchase any of the following types of Services:
" + " " +
"
• AT&T VPN Service Pricing Schedule
" + " " +
"
5 (a) The Customer Agreement and the Pricing Schedules described in Section 3 are incorporated herein by reference. Participant shall be bound by the terms and conditions of the Customer Agreement and by all current or future amendments as they relate to Participant’s purchase of Services under this Participation Agreement without the necessity of further action or notice by AT&T. The Customer Agreement has been pre-negotiated by and between AT&T and Customer, and only Customer may enter into amendments or modifications to the Customer Agreement.
" + " " +
"
(b) Customer shall provide Participant a copy of the relevant portions of the Customer Agreement prior to Participant’s execution of this Participation Agreement.
" + " " +
"
6 AT&T shall have no obligation to provide Participant a copy of the Customer Agreement.
" + " " +
"
7 This Participation Agreement may not be assigned by Participant or Customer. Any such assignment shall be null and void.
" + " " +
"
8 Notices relating to Participant’s performance of its obligations under this Participation Agreement shall be delivered pursuant to the terms of the Customer Agreement to Participant at the following address:
" + " " +
"
9 Customer shall not be responsible for Participant’s performance under this Participation Agreement. The parties acknowledge and agree that Participant is individually entering into this Agreement on its own behalf and therefore: (a) neither Customer nor any other Customer Affiliate will be liable for the obligations of Participant hereunder, and (b) Participant will be independently liable and responsible for all obligations of Participant arising from this Agreement.
" + " " +
"
10 AT&T may disclose Participant’s Information to Customer. Such disclosures may include Participant’s name, services purchased, monthly or annual usage, total billings and payment status. This Participation Agreement shall be deemed AT&T, Customer and Participant’s Information pursuant to the terms of the Customer Agreement.
" + " " +
"
11 If Participant and Customer, or any collection of Participants or Customer and Participants, bring separate actions against AT&T for substantially similar claims, Customer and such If Participant and Customer, or any collection of Participants or Customer and Participants, bring separate actions against AT&T for substantially similar claims, Customer and such Participant(s) shall use reasonable efforts to cause such actions to be heard in a single proceeding.
" + " " +
"
12 AT&T has and may exercise all rights with respect to each Participant as AT&T has and may exercise with respect to Customer, including without limitation, the right to suspend or terminate Service for breach. In addition, if Participant fails to abide by its obligations under this Participation Agreement or ceases to be a defined Participant of Customer, AT&T may notify Customer in writing that Participant is no longer an eligible Participant (the “Notice”). With regard to the Services provided to the former Participant up to the date of the Notice, the former Participant shall remain the responsible party. Following the date of the Notice:
" + " " +
"
(a) With regard to the Services that the former Participant had been purchasing pursuant to Section 3, above, the former Participant shall be deemed a User under the Customer Agreement;
" + " " +
"
(b) Any Pricing Schedule executed pursuant to Section 4, above, shall be deemed a separate contract between the former Participant and AT&T governed by the attached AT&T Master Agreement Terms and not the Customer Agreement; and,
" + " " +
"
(c) AT&T retains its rights under the Customer Agreement to suspend or terminate Services or Service Components for any of the former Participant’s breaches that took place prior to the termination of this Participation Agreement.
" + " " +
"
13 THIS PARTICIPATION AGREEMENT AND THE CUSTOMER AGREEMENT CONSTITUTE THE ENTIRE AGREEMENT BETWEEN THE PARTIES. THIS AGREEMENT SUPERSEDES ALL PRIOR AGREEMENTS, PROPOSALS, REPRESENTATIONS, STATEMENTS OR UNDERSTANDINGS, WHETHER WRITTEN OR ORAL CONCERNING THE SERVICES. THIS AGREEMENT SHALL NOT BE MODIFIED OR SUPPLEMENTED BY ANY WRITTEN OR ORAL STATEMENTS, PROPOSALS, REPRESENTATIONS, ADVERTISEMENTS, SERVICE DESCRIPTIONS OR YOUR PURCHASE ORDER FORMS NOT EXPRESSLY SET FORTH IN THIS AGREEMENT.
" + " " +
"
IN WITNESS WHEREOF, AT&T and Customer or Participant (as applicable) have caused this Participation Agreement to be executed by their duly authorized representatives as of the date written below. This Participation Agreement is effective on the date of the last party’s signature hereon.
" + " " +
'
Customer (by its authorized representative)
AT&T (by its authorized representative)
By:
By:
Name:
Name:
Title:
Title:
Date:
Date:
';
$scope.$watch('orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_signature', function(value) {
$scope.disableContinue1 = (value) ? false : true;
});
$scope.downloadPDF = function () {
ATTWiFiOrderingContractService.getOperatorAgreementPdf(attachmentBody,function(result,status){
//console.log(result);
var dlink = document.getElementById('downloadlink');
dlink.href = 'data:application/pdf;base64,' + result;
dlink.click();
})
};
$scope.go = function (path) {
// console.log($scope.operatorEsign);
$scope.loading = true; //Loading Layover. Please DO NOT remove this
/* Adding encoded image string in the franchiseeContactInfo */
var imageString = ($scope.operatorEsign).split(',')[1];
$rootScope.Franchisee_signature_image = imageString;
$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_signature = true;
var order = $rootScope.orderRequest.FranchiseeOrdering;
order.franchiseeContactInfo.Franchisee_signature_image = imageString;
// console.log('Franchisee_signature_image.length: ' + $rootScope.Franchisee_signature_image.length);
// console.log(order);
Visualforce.remoting.timeout = 120000;
//var fileName ='operatorAgreement';
var checkFileName = $filter('removeInvalidFileNameSymbols')('Participation Agreement ' + $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_CompanyName);
ATTWiFiOrderingContractService.isDocumentExists(checkFileName, $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_ID, function(result, status) {
if (result == false) {
var fileName = encodeURI(checkFileName + ' ' + $scope.agreementDate.split('/').join('_'));
ATTWiFiOrderingContractService.processAgreementAttachment(fileName, attachmentBody, JSON.stringify(order),function(result,status){
// console.log(result);
if(result.status == 'success'){
var inquireContractEsignDetailsstatus=result.inquireContractEsignDetailsstatus;
ATTWiFiOrderingContractService.processAgreementAttachment2(result.inquireContractEsignDetailsstatus,fileName, attachmentBody, JSON.stringify(order),function(result,status){
// console.log('processAgreementAttachment2' + result);
ATTWiFiOrderingContractService.submitDocument(result.fileName, $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_ID, inquireContractEsignDetailsstatus, function(result, status) {
// console.log('Operator Agreement saved to SFDC '+result);
ATTWiFiOrderingContractService.storeSignature(imageString, $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_ID, function(result, status){
// console.log('ATTWiFiOrderingClass.signatureMethod: ' + JSON.stringify(result));
});
$scope.disableFormObjects = false;
$scope.download = true;
$scope.loading = false; //Loading Layover. Please DO NOT remove this
$location.path(path);
$scope.$apply();
});
});
}
else{
$scope.download = true;
$scope.loading = false; //Loading Layover. Please DO NOT remove this
$location.path(path);
$scope.$apply();
}
})
}else{
$scope.download = true;
$scope.loading = false; //Loading Layover. Please DO NOT remove this
$location.path(path);
$scope.$apply();
}
});
};
$scope.cancel = function ( path ) {
// console.log($rootScope.orderRequest);
/*if ($rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_signature == false) {
$location.path('/ContactValidation');
} else {
$location.path('/');
}*/
//$location.path( "/ATTWiFiUpgradeOrdering#/ProductOverview/"+$routeParams.brandId);
if(!$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_contactValidation) {
$location.path('/ContactValidation');
} else {
$location.path('/');
}
};
/* Adjust signature pad/canvas with window size */
$scope.adjustSignaturePad = function() {
var c = $(".signature canvas")[0];
if(c != undefined) {
var ctx = c.getContext('2d');
var imgData = ctx.getImageData(0, 0, c.width, c.height);
var responsiveContainerWidth = $('.signature')[0].offsetWidth;
var signatureContainer = $('.signature.ng-isolate-scope')[0];
$(signatureContainer).attr('width', responsiveContainerWidth);
$(signatureContainer).css({
'width' : responsiveContainerWidth,
'max-width' : responsiveContainerWidth
});
c.style.width = '100%';
c.width = responsiveContainerWidth;
/*var ratio = Math.max(window.devicePixelRatio || 1, 1);
ctx.scale(ratio, ratio);*/
ctx.putImageData(imgData, 0, 0);
}
};
$(window).resize(function(){
$scope.adjustSignaturePad();
});
})
///// END OPERATOR AGREEMENT CONTROLLER
///// ORDER FORM CONTROLLER
.controller('orderFormController', function ($rootScope, $scope, $location, $uibModal, $log, $http, $routeParams, $analytics, $filter, webtrendsService, brandService) {
//@TODO:Moving this code to config object
$scope.loading = true;
ATTWiFiOrderingClass.getCurrentUserName(function(result, status){
$scope.$evalAsync(function () {
$scope.id = result.body[0].Id;
if($scope.id==null || $scope.id==="undefined" || result.body[0].FirstName==='ATTWiFiUpgradeOrdering' ){
$rootScope.orderRequest = '';
if($rootScope.brandId==null || $rootScope.brandId==="undefined"){
$rootScope.brandId='001600000lzkAb';
}
$location.path('/ProductOverview/'+$rootScope.brandId);
}
})
ATTWiFiOrderingClass.getUserInfo('001600000lzkAb', null, function(result, status) {
$scope.$evalAsync(function() {
$scope.loading = false;
// console.log("getting a new update from cassandra");
var response = JSON.parse($filter('escapeCharacters')(result)); //JSON.parse(result.replace(/"/g, '"').replace(/&/g, '&'));
$rootScope.mcdInputData.venues = response.venues;
sessionStorage.setItem('mcdInputDatavenues', JSON.stringify($rootScope.mcdInputData.venues));
})
})
});
// $rootScope.brandId $rootScope.Customer_brand $rootScope.orderRequest
//console.log($rootScope.orderRequest);
$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.documentsList=[];
Visualforce.remoting.timeout = 120000;
$scope.$evalAsync(function () {
ATTWiFiOrderingContractService.fetchAgreementAttachmentByFranchisee($rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_ID , function(result, status){
$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.documentsList=result;
});
});
$scope.go = function ( path ) {
$location.path( path );
};
$scope.getStaticAgreement = function ( filename ) {
Object.freeze(filename);
ATTWiFiOrderingContractService.fetchAgreementAttachmentByFileName(filename, function(result, status){
if (window.navigator && window.navigator.msSaveOrOpenBlob ) {
var byteCharacters = atob(result.content);
var byteNumbers = new Array(byteCharacters.length);
for (var i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
var blob = new Blob([byteArray], {type: 'application/pdf'});
window.navigator.msSaveOrOpenBlob(blob, filename);
}else if (window.navigator.userAgent.indexOf('iPad')!= -1 || window.navigator.userAgent.indexOf('iPhone')!= -1) { //Safari & Opera iOS
var byteCharacters = atob(result.content);
var byteNumbers = new Array(byteCharacters.length);
for (var i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
var blob = new Blob([byteArray], {type: 'application/pdf'});
var url = window.URL.createObjectURL(blob);
window.location.href = url;
}
else {
var pdfAsDataUri = "data:application/pdf;base64," + result.content;
var win = window.open();
win.document.write('');
}
});
};
$scope.getDynamicAgreement = function ( filename , contractId ) {
var fname =filename;
filename=filename.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, "'").replace(/>/g, '>').replace(/</g, '<');
$scope.filename = filename;
var fetchObj = {
fname : fname,
filename :encodeURI(filename),
contractId : contractId,
franchiseeId :$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_ID
}
Object.freeze(fetchObj);
ATTWiFiOrderingContractService.fetchAgreementAttachment(fetchObj.filename, fetchObj.contractId, fetchObj.franchiseeId, fetchObj.fname,$rootScope.orderRequest.currentUserContactId , function(result, status){
if (window.navigator && window.navigator.msSaveOrOpenBlob ) {
var byteCharacters = atob(result.content);
var byteNumbers = new Array(byteCharacters.length);
for (var i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
var blob = new Blob([byteArray], {type: 'application/pdf'});
window.navigator.msSaveOrOpenBlob(blob, filename);
}else if (window.navigator.userAgent.indexOf('iPad')!= -1 || window.navigator.userAgent.indexOf('iPhone')!= -1) { //Safari & Opera iOS
var byteCharacters = atob(result.content);
var byteNumbers = new Array(byteCharacters.length);
for (var i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
var blob = new Blob([byteArray], {type: 'application/pdf'});
var url = window.URL.createObjectURL(blob);
window.location.href = url;
}
else if(status.result.status =="Invalid Input Parameters"){
alert(status.result.status);
}else if(status.result.status =="File Not Found"){
alert(status.result.status);
}else{
var pdfAsDataUri = "data:application/pdf;base64," + result.content;
var win = window.open();
win.document.write('');
}
});
};
$scope.goHome = function () {
$rootScope.orderRequest = '';
$location.path('/ProductOverview/'+$routeParams.brandId);
};
$scope.openVenueSummaryModal = function (size) {
$scope.loading = true;
var modalInstance = $uibModal.open({
animation: true,
templateUrl: '/ATTWiFiUpgradeOrdering/wifiOrd_VenuesOverview_html',
controller: 'VenuesOverviewController',
size: size,
keyboard: false,
backdrop: 'static',
scope: $scope,
//windowClass: 'venueListModal',
resolve: {}
});
modalInstance.result.then(function (selectedVenue) {
//Go to the front so that the user can see the venue that they just added
$scope.currentPage = 1;
}, function () {
$scope.loading = false;
$log.info('Modal dismissed at: ' + new Date());
});
}
//x - button / close button
$scope.close = function (){
$scope.loading = false;
$scope.modalInstance.dismiss('cancel');
};
})
// Venues Overview Controller ///////////////////////////////
/* Venues List page will display with a complete List of the Franchisee venues, for user can select to order */
.controller('VenuesOverviewController', function ($rootScope, $scope, $location, $uibModal, $uibModalInstance,
$log, $http, $routeParams, $analytics, webtrendsService,
brandService, $filter, filteredListService,VFRemotingFactory) {
//@TODO:Moving this code to config object
ATTWiFiOrderingClass.getCurrentUserName(function(result, status){
$scope.$evalAsync(function () {
$scope.id = result.body[0].Id;
if($scope.id==null || $scope.id==="undefined" || result.body[0].FirstName==='ATTWiFiUpgradeOrdering' ){
$rootScope.orderRequest = '';
if($rootScope.brandId==null || $rootScope.brandId==="undefined"){
$rootScope.brandId='001600000lzkAb';
}
$location.path('/ProductOverview/'+$rootScope.brandId);
}
})
});
$scope.tel = "^\\(*\\+*[1-9]{0,3}\\)*-*[1-9]{0,3}[-. /]*\\(*[2-9]\\d{2}\\)*[-. /]*\\d{3}[-. /]*\\d{4} *e*x*t*\\.* *\\d{0,5}$"
if (typeof $rootScope.franchiseeData === "undefined" || $rootScope.franchiseeData === null) {
$rootScope.franchiseeData = {};
}
$scope.hidePlacedOrder = false;
// Venue Data to New Array from JSON file for testing
var VenueArray = [];
// $scope.storeNumber =[];
if($rootScope.mcdInputData==null || $rootScope.mcdInputData=='undefined'){
$rootScope.mcdInputData = sessionStorage.getItem("mcdInputData");
$rootScope.mcdInputData.venues = sessionStorage.getItem("mcdInputDatavenues");
$rootScope.mcdInputData = JSON.parse($rootScope.mcdInputData.replace(/"/g,'"')).replace(/&/g, '&');
}
// console.log($rootScope.mcdInputData);
if($rootScope.mcdInputData.venues) {
for(var i=0; i < $rootScope.mcdInputData.venues.length; i++) {
var venue = angular.copy($rootScope.mcdInputData.venues[i]);
//
if (venue.STORE_NUMBER != null) {
VenueArray.push({
// 'STORE_NUMBER' : parseInt(venue.STORE_NUMBER),
'STORE_NUMBER' : venue.STORE_NUMBER,
//'STORE_NUMBER' : $filter('numberFixedLen')(parseInt(venue.STORE_NUMBER),5),
'STORE_SERVICE_PHONE' : venue.STORE_SERVICE_PHONE,
'STORE_ADDRESS' : venue.STORE_ADDRESS,
'STORE_CITY' : venue.STORE_CITY,
'STORE_STATE' : venue.STORE_STATE,
'STORE_ZIP' : venue.STORE_ZIP,
'hasCradlepoint' : (venue.has_cradlepoint) ? 'Yes' : 'No',
'NONPUBLICWIFI' : (venue.non_public_wifi) ? 'Yes' : 'No',
'HASAWEVENUE' : venue.HASAWEVENUE,
'AWEORDERPLACEDATE' : $filter('date')(venue.AWEORDERPLACEDATE, "MM/dd/yyyy")
});
// $scope.storeNumber.push(angular.copy(VenueArray[i].STORE_NUMBER));
}
}
$rootScope.mcdInputData.Venues = VenueArray;
} else {
VenueArray.push.apply(VenueArray, $rootScope.mcdInputData.Venues);
}
$rootScope.franchiseeData.venues = VenueArray;
//console.log($rootScope.franchiseeData.venues);
/* ATTWiFiOrderingClass.getDSRDataAsJson($scope.storeNumber,$rootScope.brandId, function(result, status){
$scope.DSRData = JSON.parse($filter('escapeCharacters')(result)); //JSON.parse(result.replace(/"/g,'"').replace(/&/g, '&'));
// console.log($scope.DSRData.venues);
$rootScope.franchiseeData.venues = $scope.DSRData.venues;
// console.log($rootScope.franchiseeData)
})*/
// console.log('FranchiseeOrdering.venues');
// console.log($rootScope.orderRequest.FranchiseeOrdering.venues);
////// Start Check for Staus of Venue : Ordered,Order and In Current Order /////////
var InCurrentOrder = [];
if ($rootScope.orderRequest.FranchiseeOrdering.venues.length) {
angular.forEach($rootScope.orderRequest.FranchiseeOrdering.venues, function(or_venue){
lp_venueID = or_venue.venueId;
InCurrentOrder.push(lp_venueID);
});
}
angular.forEach($rootScope.franchiseeData.venues, function(venue){
var inSFDC = '';
venueID = venue.STORE_NUMBER;
// check for not SFDC order
/*
if (venue.HASAWEVENUE.toLowerCase() === 'no') {
// check Partial Order
if (angular.isObject($rootScope.orderRequest.FranchiseeOrdering.OrderedVenues)) {
angular.forEach($rootScope.orderRequest.FranchiseeOrdering.OrderedVenues, function(O_venue){
if (O_venue.StoreNumber === venueID) {
if (O_venue.OrderType.toLowerCase() === 'package') {
venue.HASAWEVENUE = 'yes';
newCDate = O_venue.DateOrdered.replace(/\?/g, '');
venue.AWEORDERPLACEDATE = new Date(newCDate);
}
else if (O_venue.OrderType.toLowerCase() === 'sitesurvey') {
venue.HASAWEVENUE = 'sitesurvey';
newCDate = O_venue.DateOrdered.replace(/\?/g, '');
venue.AWEORDERPLACEDATE = new Date(newCDate);
}
}
});
}
// End check Partial Order
}
*/
// End check for not SFDC order
CheckOrder = false;
angular.forEach(InCurrentOrder, function(curvenueID){
if (parseInt(curvenueID) == parseInt(venueID) ) {
inSFDC = 'InOrder';
CheckOrder = true;
}
});
if (!CheckOrder) {
switch (venue.HASAWEVENUE.toLowerCase()) {
case 'yes':
inSFDC = 'InSFDC';
break;
case 'no':
inSFDC = 'Order';
break;
case 'sitesurvey':
inSFDC = 'sitesurveyorder';
break;
case 'sitesurveycomplete':
inSFDC = 'sitesurveycomplete';
break;
}
}
venue.Current_Status = inSFDC;
});
////// End Check for Staus of Venue : Ordered,Order and In Current Order /////////
$scope.venueTotal = VenueArray.length;
$scope.pageSize = 20;
// console.log($scope.pageSize);
$scope.allItems = VenueArray; //$rootScope.franchiseeData.venues;
$scope.reverse = true;
$scope.resetAll = function () {
$scope.filteredList = $scope.allItems;
$scope.venue_id = '';
$scope.details = '';
$scope.street = '';
$scope.city = '';
$scope.state = '';
$scope.zip = '';
$scope.searchText = '';
$scope.currentPage = 1;
$scope.Header = ['', '', '', '', '', ''];
}
//console.log($routeParams);
/*$scope.login = function () {
ATTWiFiOrderingClass.getContactInfo($scope.id, function(result, status){
if(result.body.length > 0) {
var response = result.body[0];
$rootScope.mcdInputData.Franchisee_FirstName = response.FirstName;
$rootScope.mcdInputData.Franchisee_LastName = response.LastName;
$rootScope.mcdInputData.Franchisee_CompanyName = response.Corporate_Account__c;
$rootScope.mcdInputData.Franchisee_email = response.Email;
$rootScope.mcdInputData.Franchisee_Phone = response.Phone;
$rootScope.mcdInputData.Franchisee_ID = response.Id;
$rootScope.mcdInputData.Franchisee_Role = (response.Role__r == undefined) ? '' : response.Role__r.Role_Name__c;
$rootScope.mcdInputData._corporateId = response.AccountId;
ATTWiFiOrderingClass.getVenueIds($rootScope.mcdInputData._corporateId, function(result, status) {
$rootScope.mcdInputData._venueIds = result.body;
$scope.loading = false;
$uibModalInstance.dismiss('cancel');
$location.path('/OperatorAgreement/'+$rootScope.brandId);
VFRemotingFactory.getData($scope.username , $scope.password).then(function(result){
$scope.authorizedstoreids = result;
});
//$scope.authorizedstoreids = getAuthorizedStores($scope.username , $scope.password);
});
}
});
}*/
$scope.close = function () {
$scope.loading = false;
$uibModalInstance.dismiss('cancel');
};
$scope.hidePlacedOrderFilter = function(item) {
return ! (item.Current_Status==='InSFDC' && item.HASAWEVENUE.toLowerCase()==='yes');
};
// Search
$scope.search = function () {
$scope.currentPage = 1;
$scope.filteredList = filteredListService.searched($scope.allItems, $scope.searchText);
if ($scope.searchText == '') {
$scope.filteredList = $scope.allItems;
}
$scope.venueTotal = $scope.filteredList.length;
$scope.pagination();
}
// Search filter 27032017
/*$scope.searchFilter = function (query) {
$scope.filteredList = $filter('filter')($scope.allItems, query);
if ($scope.searchText == '') {
$scope.filteredList = $scope.allItems;
}
$scope.venueTotal = $scope.filteredList.length;
$scope.pagination();
}*/
// Calculate Total Number of Pages based on Search Result
$scope.pagination = function () {
$scope.ItemsByPage = filteredListService.paged($scope.filteredList, $scope.pageSize);
$scope.totalItems = $scope.venueTotal;
};
$scope.setItemsPerPage = function(num) {
$scope.pageSize = num;
// console.log($scope.pageSize);
$scope.currentPage = 1;
$scope.itemsPerPage = $scope.pageSize;
$scope.pagination();
};
$scope.itemsPerPage = $scope.pageSize;
$scope.pageChanged = function() {
// console.log('Page changed to: ' + $scope.currentPage);
};
/////////////// Edit Venue Link /////////////////
$scope.editVenue = function (ic_value) {
$location.path("OrderEquipment/"+ic_value);
}
////////////////////
$scope.sort = function (sortBy) {
$scope.resetAll();
$scope.columnToOrder = sortBy;
// console.log(sortBy);
// console.log($scope.filteredList);
//$Filter - Standard Service
$scope.filteredList = $filter('orderBy')($scope.filteredList, $scope.columnToOrder, $scope.reverse);
if ($scope.reverse) iconName = 'glyphicon glyphicon-chevron-up';
else iconName = 'glyphicon glyphicon-chevron-down';
if (sortBy === 'STORE_NUMBER') {
$scope.Header[0] = iconName;
}
else if (sortBy === 'STORE_ADDRESS') {
$scope.Header[1] = iconName;
}
else if (sortBy === 'STORE_CITY') {
$scope.Header[2] = iconName;
}
else if (sortBy === 'STORE_STATE') {
$scope.Header[3] = iconName;
}
else if (sortBy === 'STORE_ZIP') {
$scope.Header[4] = iconName;
}
else if (sortBy === 'details') {
$scope.Header[5] = iconName;
}
//else {
// $scope.Header[1] = iconName;
//}
//
$scope.reverse = !$scope.reverse;
$scope.pagination();
};
//By Default sort by venue_name
$scope.sort('STORE_NUMBER');
//////////////////////////////
// open Venue Service Modal to add for the selected venue
$scope.openVenueServiceModal = function (v_id) {
$scope.selectedVenue = v_id;
scopeVenue = $scope;
$uibModalInstance.close('ok');
$location.path("OrderEquipment/"+$scope.selectedVenue);
};
$scope.venueClick = function(item) {
if (item.Current_Status == 'Order' || item.Current_Status == 'sitesurveycomplete') {
$scope.openVenueServiceModal(item.STORE_NUMBER);
} else if (item.Current_Status == 'InOrder' ) {
$scope.editVenue(item.STORE_NUMBER);
}
}
})
// END Venues Overview Controller ///////////////////////////////
// $uibModalInstance, $analytics,icVenue,
.controller('orderEquipmentController', function ($rootScope, $scope, $filter, $location, $routeParams, $log, $http, $uibModal) {
//@TODO:Moving this code to config object
ATTWiFiOrderingClass.getCurrentUserName(function(result, status){
$scope.$evalAsync(function () {
$scope.id = result.body[0].Id;
if($scope.id==null || $scope.id==="undefined" || result.body[0].FirstName==='ATTWiFiUpgradeOrdering' ){
$rootScope.orderRequest = '';
if($rootScope.brandId==null || $rootScope.brandId==="undefined"){
$rootScope.brandId='001600000lzkAb';
}
$location.path('/ProductOverview/'+$rootScope.brandId);
}
})
});
if($rootScope.mcdInputData==null || $rootScope.mcdInputData=='undefined'){
$rootScope.mcdInputData = sessionStorage.getItem("mcdInputData");
$rootScope.mcdInputData.venues = sessionStorage.getItem("mcdInputDatavenues");
$rootScope.mcdInputData = JSON.parse($filter('escapeCharacters')($rootScope.mcdInputData));// JSON.parse($rootScope.mcdInputData.replace(/"/g,'"'));
}
$scope.IncomingVenueID = $routeParams.v_id;
$scope.ServiceOptions = order_Services.serviceOptions;
$scope.OptionalEquipment = order_Services.OptionalEquipment;
$scope.SpareEquipment = order_Services.SpareEquipment;
$scope.InstallationCodes = order_Services.InstallationCodes;
$scope.VenueQuestionnaire = order_Services.VenueQuestionnaire;
$scope.showQuestionsWarning = false;
$scope.UseHHOT = false;
$scope.NoRecommendation = false;
$scope.DriveThruQuestion = false;
$scope.MaintainQuestion = false;
$scope.GuestWiFiQuestion = false;
$scope.UsePackage = {};
$scope.checkForm = false;
$scope.SiteSurveyYes = false;
$scope.SiteSurveyMessage = false;
$scope.ProccessThruSummary = false;
/*
console.log($scope.UsePackage.length);
console.log('Packages and Hardware');
console.log($scope.ServiceOptions);
console.log($scope.OptionalEquipment);
console.log($scope.SpareEquipment);
*/
////////////////////////////////
$scope.VenueArray = [];
angular.forEach($rootScope.mcdInputData.venues, function(venue){
ar_VenueID = venue.STORE_NUMBER;
// STORE_NUMBER
if(parseInt(ar_VenueID) === parseInt($scope.IncomingVenueID)){
$scope.VenueArray = venue;
}
});
//console.log('$scope.VenueArray');
//console.log($scope.VenueArray);
////////////////////////////////
$scope.VenueInOrder = false;
$scope.VenueOrdered = '';
if ($rootScope.orderRequest.FranchiseeOrdering.venues.length) {
angular.forEach($rootScope.orderRequest.FranchiseeOrdering.venues, function(or_venue){
lp_venueID = or_venue.venueId;
if (parseInt($scope.IncomingVenueID) === parseInt(lp_venueID)) {
$scope.VenueInOrder = true;
$scope.VenueOrdered = or_venue;
}
});
}
////////////////////////////////
//$scope.ComcastProvider = ($scope.VenueArray.COMCAST_PROVIDER == 'true');
$scope.ComcastProvider = ($scope.VenueArray.COMCAST_PROVIDER.toLowerCase() == 'yes' ? true : false);
$scope.AdditionalIndoorAP = Number($scope.VenueArray.ADDITIONAL_INDOORAP || 0);
$scope.AdditionalOutdoorAP = Number($scope.VenueArray.ADDITIONAL_OUTDOORAP || 0);
//$scope.AdditionalOutdoorAP = 0;
$scope.PackagereCommendation = $scope.VenueArray.AWEPACKAGERECOMMENDATION;
$scope.APP_Package_ID = Number($scope.VenueArray.APP_PACKAGE_ID || 0);
$scope.Cradlepoint = $scope.VenueArray.HAS_CRADLEPOINT;
var isCradlepoint = ($scope.Cradlepoint == 'true');
// No Recommendation - New Venue
if ($scope.APP_Package_ID == 0) {
$scope.NoRecommendation = true;
}
////////////////////////////////
/*
console.log('ComcastProvider ' +$scope.ComcastProvider);
console.log($scope.AdditionalIndoorAP);
console.log($scope.VenueArray);
console.log('ComcastProvider ' +$scope.ComcastProvider);
console.log($scope.AdditionalIndoorAP);
console.log($scope.AdditionalIndoorAP.length);
console.log($scope.PackagereCommendation);
console.log('$scope.APP_Package_ID ' +$scope.APP_Package_ID);
console.log('isCradlepoint '+isCradlepoint);
console.log('$scope.VenueArray.STORE_ADDRESS '+$scope.VenueArray.STORE_ADDRESS.length);
*/
//////////////////////////////
$scope.YesNoBlank_Options = [
{value: -1, label: 'Yes/No'},
{value: true, label: 'Yes'},
{value: false, label: 'No'}
];
$scope.YesNo_Options = [
{value: true, label: 'Yes'},
{value: false, label: 'No'}
];
///////////
Equ_Amount = [0,1,2,3,4,5];
// AdditionalIndoorAP
if (parseInt($scope.AdditionalIndoorAP) > 0) {
IP_Amount = Equ_Amount.slice($scope.AdditionalIndoorAP);
}
else {
IP_Amount = Equ_Amount;
}
// AdditionalOutdoorAP
if (parseInt($scope.AdditionalOutdoorAP) > 0) {
Out_IP_Amount = Equ_Amount.slice($scope.AdditionalOutdoorAP);
}
else {
Out_IP_Amount = Equ_Amount;
}
angular.forEach($scope.OptionalEquipment, function(oreq){
switch(parseInt(oreq.AppID)) {
case 120:
oreq.qy_amount = IP_Amount;
break;
case 130:
oreq.qy_amount = Out_IP_Amount;
break;
default:
oreq.qy_amount = Equ_Amount;
break;
}
});
// console.log('$scope.OptionalEquipment : ' + $scope.AdditionalIndoorAP);
// console.log('$scope.OptionalEquipment');
// console.log($scope.OptionalEquipment);
//////////////////////////////
//////////////////////////////
//// Set Default Vars //////////////////////////////
if ($scope.VenueInOrder){
$scope.cur_Venue = {
"StoreNumber":$scope.VenueOrdered.venueId,
"StorePhone":$scope.VenueOrdered.storephoneNumber,
"StoreAddress":$scope.VenueOrdered.street,
"StoreSuite":'',
"StoreCity":$scope.VenueOrdered.city,
"StoreState":$scope.VenueOrdered.state,
"StoreZip":$scope.VenueOrdered.zip,
"ContactFirstName":$scope.VenueOrdered.contactFirstName,
"ContactLastName":$scope.VenueOrdered.contactLastName,
"ContactphoneNumber":$scope.VenueOrdered.contactphoneNumber,
"ContactEmail":$scope.VenueOrdered.Contact_Email,
"ContactFirstName2nd":$scope.VenueOrdered.Additional_contactFirstName,
"ContactLastName2nd":$scope.VenueOrdered.Additional_contactLastName,
"ContactphoneNumber2nd":$scope.VenueOrdered.Additional_phoneNumber,
"ContactEmail2nd":$scope.VenueOrdered.Additional_Contact_Email,
"AdditionalInformation":$scope.VenueOrdered.Additional_Information
}
$scope.ContactToggle = $scope.VenueOrdered.Additional_contactFirstName.length ? false : true;
//
$scope.VenueOrdered.VenueQuestionnaire.Questions = $filter('orderBy')($scope.VenueOrdered.VenueQuestionnaire.Questions, 'quID', false);
var newQuestion = $scope.VenueOrdered.VenueQuestionnaire.Questions;
if( newQuestion != undefined){
$scope.questionRenovated = $scope.VenueOrdered.VenueQuestionnaire.Questions[0].option.toLowerCase() === 'no equipment' ? true : false;
}
if (angular.isObject($scope.VenueOrdered.VenueQuestionnaire)) {
$scope.selectedItem = {
'Question1':$scope.VenueOrdered.VenueQuestionnaire.Questions[0],
'Question2':$scope.VenueOrdered.VenueQuestionnaire.Questions[1],
'Question3':$scope.VenueOrdered.VenueQuestionnaire.Questions[2],
'Question4':$scope.VenueOrdered.VenueQuestionnaire.Questions[3],
'Question5':$scope.VenueOrdered.VenueQuestionnaire.Questions[4],
'Question6':$scope.VenueOrdered.VenueQuestionnaire.Questions[5]
}
}
else {
$scope.selectedItem = {
'Question1':$scope.VenueQuestionnaire[0].options[0],
'Question2':$scope.VenueQuestionnaire[1].options[0],
'Question3':$scope.VenueQuestionnaire[2].options[0],
'Question4':$scope.VenueQuestionnaire[3].options[0],
'Question5':$scope.VenueQuestionnaire[4].options[0],
'Question6':$scope.VenueQuestionnaire[5].options[0]
}
}
// = $scope.VenueOrdered.PackageOption.Configuration
//
// console.log('$scope.VenueOrdered');
// console.log($scope.VenueOrdered);
// console.log('NoRecommendation : '+$scope.VenueOrdered.PackageOption.NoRecommendation);
$scope.NoRecommendation = $scope.VenueOrdered.PackageOption.NoRecommendation;
Package_use = $scope.VenueOrdered.PackageOption.Configuration;
sfdcID_use = $scope.VenueOrdered.PackageOption.sfdcID;
//.Configuration
/*
"Configuration": "SSTR-Standard",
"Configuration": "SSTR-Standard-WBU", Need the Wireless Card
"Configuration": "SSTR-HHOT",
"Configuration": "SSTR-HHOT-WBU", Need the Wireless Card
Question 1 Yes
Question 2 Yes
Question 3 Yes
• Non-Traditional Restaurant with Business Wi-Fi and Guest Wi-Fi "NTR-Standard-WBU","NTR-Standard" 40
Question 3 No
• Non-Traditional Restaurant with Business Wi-Fi Only "NTR-BusnWifi-WBU", "NTR-BusnWifi" 30
----------
Question 1 Yes
Question 2 No
Question 3 Yes
• Standard Service for Traditional Restaurants with HHOT Support "SSTR-HHOT-WBU","SSTR-HHOT", 10
Question 3 No
• Standard Service for Traditional Restaurants "SSTR-Standard-WBU","SSTR-Standard", 10
----------
Question 1 No
Question 2 Yes
Question 3 Yes
• Non-Traditional Restaurant with Business Wi-Fi and Guest Wi-Fi "NTR-Standard-WBU","NTR-Standard" 40
Question 3 No
• Non-Traditional Restaurant with Business Wi-Fi Only "NTR-BusnWifi-WBU", "NTR-BusnWifi" 30
----------
Question 1 No
Question 2 No
Standard Service for Traditional Restaurants No Drive Thru "SSTRND-Standard-WBU","SSTRND-Standard" 20
$scope.select_DriveThru = {
value: true
};
$scope.select_DiningRoom = {
value: true
};
$scope.select_GuestWiFi = {
value: false
};
$scope.select_HHOT = {
value: false
};
// console.log('Package_use : ' + Package_use);
// console.log('$scope.NoRecommendation : ' + $scope.NoRecommendation);
*/
if ($scope.NoRecommendation){
if (!$scope.VenueOrdered.SiteSurveyRequest) {
$scope.select_SiteSurvey = {
value: false
};
$scope.SiteSurvey = {
value: false
};
}
else if ($scope.VenueOrdered.SiteSurveyRequest) {
$scope.SiteSurveyYes = true;
$scope.SiteSurveyMessage = true;
$scope.select_SiteSurvey = {
value: true
};
$scope.SiteSurvey = {
value: true
};
$scope.selectedItem = {
'Question1':$scope.VenueQuestionnaire[0].options[0],
'Question2':$scope.VenueQuestionnaire[1].options[0],
'Question3':$scope.VenueQuestionnaire[2].options[0],
'Question4':$scope.VenueQuestionnaire[3].options[0],
'Question5':$scope.VenueQuestionnaire[4].options[0],
'Question6':$scope.VenueQuestionnaire[5].options[0]
}
$scope.select_DriveThru = {
value: false
};
$scope.select_DiningRoom = {
value: false
};
$scope.select_GuestWiFi = {
value: false
};
$scope.select_HHOT = {
value: false
};
}
if ($filter('aContainsB')(Package_use,'ntr-busnwifi-wbu') || $filter('aContainsB')(Package_use,'ntr-busnwifi')) {
$scope.DriveThruQuestion = true;
$scope.MaintainQuestion = true;
$scope.GuestWiFiQuestion = true;
$scope.UseHHOT = false;
$scope.select_DriveThru = {
value: $scope.VenueOrdered.PackageOption.DriveThru
};
$scope.select_DiningRoom = {
value: $scope.VenueOrdered.PackageOption.DiningRoom
};
$scope.select_GuestWiFi = {
value: $scope.VenueOrdered.PackageOption.GuestWiFi
};
$scope.select_HHOT = {
value: $scope.VenueOrdered.PackageOption.HHOT
};
}
else if ($filter('aContainsB')(Package_use,'ntr-standard-wbu') || $filter('aContainsB')(Package_use,'ntr-standard')) {
$scope.DriveThruQuestion = true;
$scope.MaintainQuestion = true;
$scope.GuestWiFiQuestion = true;
$scope.UseHHOT = false;
$scope.select_DriveThru = {
value: $scope.VenueOrdered.PackageOption.DriveThru
};
$scope.select_DiningRoom = {
value: $scope.VenueOrdered.PackageOption.DiningRoom
};
$scope.select_GuestWiFi = {
value: $scope.VenueOrdered.PackageOption.GuestWiFi
};
$scope.select_HHOT = {
value: $scope.VenueOrdered.PackageOption.HHOT
};
}
else if ($filter('aContainsB')(Package_use,'sstr-hhot-wbu') || $filter('aContainsB')(Package_use,'sstr-hhot')) {
$scope.DriveThruQuestion = true;
$scope.MaintainQuestion = true;
$scope.GuestWiFiQuestion = false;
$scope.UseHHOT = true;
$scope.select_DriveThru = {
value: $scope.VenueOrdered.PackageOption.DriveThru
};
$scope.select_DiningRoom = {
value: $scope.VenueOrdered.PackageOption.DiningRoom
};
$scope.select_GuestWiFi = {
value: $scope.VenueOrdered.PackageOption.GuestWiFi
};
$scope.select_HHOT = {
value: $scope.VenueOrdered.PackageOption.HHOT
};
}
else if ($filter('aContainsB')(Package_use,'sstr-standard-wbu') || $filter('aContainsB')(Package_use,'sstr-standard')) {
$scope.DriveThruQuestion = true;
$scope.MaintainQuestion = true;
$scope.GuestWiFiQuestion = false;
$scope.UseHHOT = true;
$scope.select_DriveThru = {
value: $scope.VenueOrdered.PackageOption.DriveThru
};
$scope.select_DiningRoom = {
value: $scope.VenueOrdered.PackageOption.DiningRoom
};
$scope.select_GuestWiFi = {
value: $scope.VenueOrdered.PackageOption.GuestWiFi
};
$scope.select_HHOT = {
value: $scope.VenueOrdered.PackageOption.HHOT
};
}
else if ($filter('aContainsB')(Package_use,'sstrnd-standard-wbu') || $filter('aContainsB')(Package_use,'sstrnd-standard')) {
$scope.DriveThruQuestion = true;
$scope.MaintainQuestion = true;
$scope.GuestWiFiQuestion = false;
$scope.UseHHOT = false;
$scope.select_DriveThru = {
value: $scope.VenueOrdered.PackageOption.DriveThru
};
$scope.select_DiningRoom = {
value: $scope.VenueOrdered.PackageOption.DiningRoom
};
$scope.select_GuestWiFi = {
value: $scope.VenueOrdered.PackageOption.GuestWiFi
};
$scope.select_HHOT = {
value: $scope.VenueOrdered.PackageOption.HHOT
};
}
}
else {
$scope.NoRecommendation = false;
if ($scope.VenueOrdered.SiteSurveyRequest) {
$scope.SiteSurveyYes = true;
$scope.SiteSurveyMessage = true;
$scope.select_SiteSurvey = {
value: true
};
$scope.SiteSurvey = {
value: true
};
$scope.selectedItem = {
'Question1':$scope.VenueQuestionnaire[0].options[0],
'Question2':$scope.VenueQuestionnaire[1].options[0],
'Question3':$scope.VenueQuestionnaire[2].options[0],
'Question4':$scope.VenueQuestionnaire[3].options[0],
'Question5':$scope.VenueQuestionnaire[4].options[0],
'Question6':$scope.VenueQuestionnaire[5].options[0]
}
}
else {
$scope.select_SiteSurvey = {
value: false
};
$scope.SiteSurvey = {
value: false
};
}
if (!$scope.VenueOrdered.SiteSurveyRequest && $filter('aContainsB')(Package_use,'sstr-')) {
$scope.UseHHOT = true;
IsHHOT = $filter('aContainsB')(Package_use,'hhot');
//console.log('HHOT : ' + IsHHOT);
$scope.select_HHOT = {
value: IsHHOT
};
}
else{
$scope.select_HHOT = {
value: false
};
}
$scope.select_DriveThru = {
value: false
};
$scope.select_DiningRoom = {
value: false
};
$scope.select_GuestWiFi = {
value: false
};
}
/// Get Packages
if (!$scope.VenueOrdered.SiteSurveyRequest ) {
getPackage(Package_use,sfdcID_use);
}
else {
$scope.UsePackage = {};
}
// Optional Equipment /////////
$scope.OptionalEqu = {};
tmp_appID = [];
angular.forEach($scope.VenueOrdered.OptionalEquipment, function(order_eq){
order_AppID = order_eq.AppID;
order_equ = order_eq.EquipmentType.toLowerCase(); //&& order_equ == "equipment"
if (order_equ == "equipment"){
angular.forEach([100,110,120,130], function(org_eq){
if (org_eq == order_AppID) {
$scope.OptionalEqu['Count'+org_eq] = order_eq.Quantity;
tmp_appID.push(org_eq);
}
});
}
});
angular.forEach([100,110,120,130], function(appID){
if (tmp_appID.indexOf(appID)== -1) {
$scope.OptionalEqu['Count'+appID] = 0;
}
});
///////////
// Spare Equipment /////////
$scope.SpareEqu = {};
Spare_appID = [];
angular.forEach($scope.VenueOrdered.SpareEquipment, function(order_spare){
order_AppID = order_spare.AppID;
order_equ = order_spare.EquipmentType.toLowerCase(); //&& order_equ == "equipment"
if (order_equ == "equipment"){
angular.forEach([200,210,220,230,240], function(app_ID){
if (app_ID == order_AppID) {
$scope.SpareEqu['Count'+app_ID] = order_spare.Quantity;
Spare_appID.push(app_ID);
}
});
}
});
angular.forEach([200,210,220,230,240], function(app_ID){
if (Spare_appID.indexOf(app_ID)== -1) {
$scope.SpareEqu['Count'+app_ID] = 0;
}
});
///////////
}
// New Venue
else {
////////////////////////////////
// Default Values
$scope.cur_Venue = {
"StoreNumber":$scope.VenueArray.STORE_NUMBER,
"StorePhone":$scope.VenueArray.STORE_SERVICE_PHONE,
//"StoreAddress":$filter('capitalize')($scope.VenueArray.STORE_ADDRESS),
"StoreAddress":$scope.VenueArray.STORE_ADDRESS,
"StoreSuite":$scope.VenueArray.STORE_SUITE,
"StoreCity":$filter('capitalize')($scope.VenueArray.STORE_CITY),
//"StoreCity":$scope.VenueArray.STORE_CITY,
"StoreState":$scope.VenueArray.STORE_STATE,
"StoreZip":$scope.VenueArray.STORE_ZIP,
"hhotEnabled":$scope.VenueArray.hhotEnabled,
"hasCradlepoint":$scope.VenueArray.hasCradlepoint,
"apCount":$scope.VenueArray.apCount,
"nonPublicWiFi":$scope.VenueArray.nonPublicWiFi,
"hasAWEVenue":$scope.VenueArray.hasAWEVenue,
"ContactFirstName":"",
"ContactLastName":"",
"ContactphoneNumber":"",
"ContactEmail":"",
"ContactFirstName2nd":"",
"ContactLastName2nd":"",
"ContactphoneNumber2nd":"",
"ContactEmail2nd":"",
"AdditionalInformation":""
}
$scope.selectedItem = {
'Question1':$scope.VenueQuestionnaire[0].options[0],
'Question2':$scope.VenueQuestionnaire[1].options[0],
'Question3':$scope.VenueQuestionnaire[2].options[0],
'Question4':$scope.VenueQuestionnaire[3].options[0],
'Question5':$scope.VenueQuestionnaire[4].options[0],
'Question6':$scope.VenueQuestionnaire[5].options[0]
}
$scope.ContactToggle = true;
$scope.select_SiteSurvey = {
value: false
};
$scope.SiteSurvey = {
value: false
};
$scope.select_DriveThru = {
value: false
};
$scope.select_DiningRoom = {
value: false
};
$scope.select_GuestWiFi = {
value: false
};
$scope.select_HHOT = {
value: false
};
$scope.OptionalEqu = {};
angular.forEach([100,110,120,130], function(orequ){
if (orequ == 120 && $scope.AdditionalIndoorAP > 0) {
$scope.OptionalEqu['Count'+orequ] = $scope.AdditionalIndoorAP;
}
else if (orequ == 130 && $scope.AdditionalOutdoorAP > 0) {
$scope.OptionalEqu['Count'+orequ] = $scope.AdditionalOutdoorAP;
}
else {
$scope.OptionalEqu['Count'+orequ] = 0;
}
});
$scope.SpareEqu = {};
angular.forEach([200,210,220,230,240], function(equ){
$scope.SpareEqu['Count'+equ] = 0;
});
////////////////////////////////
switch(parseInt($scope.APP_Package_ID)) {
case 10: // Standard Service for Traditional Restaurant
$scope.UseHHOT = true;
if (isCradlepoint){
c_package = "sstr-standard";
}
else {
c_package = "sstr-standard-wbu";
}
getPackage(c_package,10);
break;
case 20: // Standard Service for Traditional Restaurants No Drive-Thru
if (isCradlepoint){
c_package = "sstrnd-standard";
}
else {
c_package = "sstrnd-standard-wbu";
}
getPackage(c_package,20);
break;
case 30: // Non-Traditional Restaurant with Business Wi-Fi
if (isCradlepoint){
c_package = 'ntr-busnwifi';
}
else {
c_package = 'ntr-busnwifi-wbu';
}
getPackage(c_package,30);
break;
case 40: // Non-Traditional Restaurant with Business Wi-Fi and Guest Wi-Fi
if (isCradlepoint){
c_package = 'ntr-standard';
}
else {
c_package = 'ntr-standard-wbu';
}
getPackage(c_package,40);
break;
}
}
//////////////////////////////////////////
// .venues["0"].PackageOption.Configuration
/* $scope.PackageArray = [];
"Configuration": "SSTR-Standard",
"Configuration": "SSTR-Standard-WBU", Need the Wireless Card
"Configuration": "SSTR-HHOT",
"Configuration": "SSTR-HHOT-WBU", Need the Wireless Card
"Configuration": "SSTRND-Standard",
"Configuration": "SSTRND-Standard-WBU", Need the Wireless Card
"Configuration": "NTR-BusnWifi",
"Configuration": "NTR-BusnWifi-WBU", Need the Wireless Card
"Configuration": "NTR-Standard",
"Configuration": "NTR-Standard-WBU", Need the Wireless Card
console.log('$scope.NoRecommendation ' +$scope.NoRecommendation)
console.log('$scope.UseHHOT ' +$scope.UseHHOT)
*/
/////////////
if ($scope.NoRecommendation) {
$scope.DriveThruQuestion = true;
$scope.MaintainQuestion = true;
$scope.UseHHOT = true;
$scope.GuestWiFiQuestion = false;
$scope.select_DriveThru = {
value: true
};
$scope.select_DiningRoom = {
value: false
};
$scope.select_HHOT = {
value: false
};
$scope.select_GuestWiFi = {
value: false
};
if (isCradlepoint){
c_package = "SSTR-Standard"; // Standard Service for Traditional Restaurants - update WBU
}
else {
c_package = "SSTR-Standard-WBU"; // Standard Service for Traditional Restaurants - New WBU
}
getPackage(c_package,10);
// DriveThru YesNo ///////////////////////////////////////
$scope.DriveThruYesNo = function (ic){
$scope.UsePackage = {};
if (ic) { // true
$scope.MaintainQuestion = true;
$scope.UseHHOT = true;
$scope.GuestWiFiQuestion = false;
$scope.select_DriveThru = {
value: true
};
$scope.select_DiningRoom = {
value: false
};
$scope.select_HHOT = {
value: false
};
$scope.select_GuestWiFi = {
value: false
};
if (isCradlepoint){
c_package = "SSTR-Standard"; // Standard Service for Traditional Restaurants - update WBU
}
else {
c_package = "SSTR-Standard-WBU"; // Standard Service for Traditional Restaurants - New WBU
}
getPackage(c_package,10);
}
else {
$scope.MaintainQuestion = true;
$scope.GuestWiFiQuestion = false;
$scope.UseHHOT = false;
$scope.select_DiningRoom = {
value: false
};
if (isCradlepoint){
c_package = "SSTRND-Standard"; // Standard Service for Traditional Restaurants No Drive Thru - update WBU
}
else {
c_package = "SSTRND-Standard-WBU"; // Standard Service for Traditional Restaurants No Drive Thru - New WBU
}
getPackage(c_package,20);
}
/*
$scope.select_DiningRoom = {
value: true
};
$scope.select_GuestWiFi = {
value: false
};
$scope.select_HHOT = {
value: false
};
$scope.MaintainQuestion = true;
$scope.GuestWiFiQuestion = false;
$scope.UseHHOT = false;
if (ic == -1) {
$scope.MaintainQuestion = false;
$scope.UseHHOT = false;
$scope.GuestWiFiQuestion = false;
}*/
}
////////////////////////////
// Dining Room YesNo ///////////////////////////////////////
$scope.DiningRoomYesNo = function (ic){
$scope.UsePackage = {};
if ($scope.select_DriveThru.value) { // Yes Drive Thru
if (ic == true){ // false
$scope.GuestWiFiQuestion = true;
$scope.UseHHOT = false;
$scope.select_GuestWiFi = {
value: false
};
if (isCradlepoint){
c_package = "NTR-BusnWifi"; // Non-Traditional Restaurant with Business Wi-Fi Only - update WBU
}
else {
c_package = "NTR-BusnWifi-WBU"; // Non-Traditional Restaurant with Business Wi-Fi Only- New WBU
}
getPackage(c_package,30);
}
else if (ic == false) { // false
$scope.UseHHOT = true;
$scope.GuestWiFiQuestion = false;
if (isCradlepoint){
c_package = "SSTRND-Standard"; // Standard Service for Traditional Restaurants No Drive Thru - update WBU
}
else {
c_package = "SSTRND-Standard-WBU"; // Standard Service for Traditional Restaurants No Drive Thru - New WBU
}
getPackage(c_package,20);
}
}
else { // No Drive Thru
if (ic == true){ // True
$scope.GuestWiFiQuestion = true;
$scope.UseHHOT = false;
$scope.select_GuestWiFi = {
value: false
};
if (isCradlepoint){
c_package = "NTR-BusnWifi"; // Non-Traditional Restaurant with Business Wi-Fi Only - update WBU
}
else {
c_package = "NTR-BusnWifi-WBU"; // Non-Traditional Restaurant with Business Wi-Fi Only - New WBU
}
getPackage(c_package,30);
}
else if (ic == false) { // false
$scope.UseHHOT = false;
$scope.GuestWiFiQuestion = false;
if (isCradlepoint){
c_package = "SSTRND-Standard"; // Standard Service for Traditional Restaurants No Drive Thru - update WBU
}
else {
c_package = "SSTRND-Standard-WBU"; // Standard Service for Traditional Restaurants No Drive Thru - New WBU
}
getPackage(c_package,20);
}
}
}
////////////////////////////
// Guest WiFi YesNo ///////////////////////////////////////
$scope.GuestWiFiYesNo = function (ic){
$scope.UsePackage = {};
if (ic){
if (isCradlepoint){
u_package = "NTR-Standard"; // Non-Traditional Restaurant with Business Wi-Fi and Guest Wi-Fi - update WBU
}
else {
u_package = "NTR-Standard-WBU"; // Non-Traditional Restaurant with Business Wi-Fi and Guest Wi-Fi - New WBU
}
getPackage(u_package,40);
}
else {
if (isCradlepoint){
c_package = "NTR-BusnWifi"; // Non-Traditional Restaurant with Business Wi-Fi Only - update WBU
}
else {
c_package = "NTR-BusnWifi-WBU"; // Non-Traditional Restaurant with Business Wi-Fi Only- New WBU
}
getPackage(c_package,30);
}
}
// HHOT True ///////////////////////////////////////
$scope.wantsHHOT = function (ic){
if (ic){
if (isCradlepoint){
c_package = "SSTR-HHOT";
}
else {
c_package = "SSTR-HHOT-WBU";
}
getPackage(c_package,10)
}
else {
if (isCradlepoint){
c_package = "SSTR-Standard"; // Standard Service for Traditional Restaurants - update WBU
}
else {
c_package = "SSTR-Standard-WBU"; // Standard Service for Traditional Restaurants - New WBU
}
getPackage(c_package,10);
}
}
}
///////////////////////////////////////
else {
// HHOT True ///////////////////////
$scope.wantsHHOT = function (ic){
if (parseInt($scope.APP_Package_ID) == 10 ) {
if (ic){
if (isCradlepoint){
c_package = "SSTR-HHOT";
}
else {
c_package = "SSTR-HHOT-WBU";
}
getPackage(c_package,10)
}
else {
if (isCradlepoint){
c_package = "SSTR-Standard"; // Standard Service for Traditional Restaurants - update WBU
}
else {
c_package = "SSTR-Standard-WBU"; // Standard Service for Traditional Restaurants - New WBU
}
getPackage(c_package,10);
}
}
}
}
//////////////////////////////////////////////////////////////////
// Starts Actions
////////////////////////////////////////////////////////////////
// functions
$scope.$watch('ContactToggle', function(){
$scope.ContactToggleText = $scope.ContactToggle ? '+Add an optional second contact' : '-Remove optional second contact';
if ($scope.ContactToggle) {
$scope.cur_Venue.ContactFirstName2nd = "";
$scope.cur_Venue.ContactLastName2nd = "";
$scope.cur_Venue.ContactphoneNumber2nd = "";
$scope.cur_Venue.ContactEmail2nd = "";
}
})
// SiteSurveyYesNo(select_SiteSurvey.value) ///////////////////////////////////////
$scope.dsMessage = 'By selecting Site Survey, you will not be placing a service or equipment order until the Site Survey is complete.';
$scope.animationsEnabled = true;
$scope.SiteSurveyYesNo = function (ic){
var isTrueSet = ic;
if (isTrueSet){
$scope.SiteSurveyMessage = true;
}
else {
$scope.SiteSurveyMessage = false;
$scope.SiteSurvey = {
value: false
};
$scope.SiteSurveyYes = false;
}
}
$scope.SiteSurveyOn = function (ic){
// console.log(ic);
if (ic){
$scope.SiteSurveyYes = true;
$scope.select_SiteSurvey = {
value: true
};
/////////////////
$scope.modalInstance = $uibModal.open({
animation: $scope.animationsEnabled,
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
templateUrl: 'confirmation.html',
scope: $scope,
keyboard: false,
backdrop: 'static',
size: 'sm'
});
$scope.modalInstance.result.then(function () {
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
/////////////////////////
}
else {
$scope.select_SiteSurvey = {
value: false
};
$scope.SiteSurveyYes = false;
}
}
$scope.SiteSurvey_continue = function (ic){
this.$dismiss();
}
/*
$scope.SiteSurvey = {
value: false
};
$scope.SiteSurveyYes = false;
*/
$scope.SiteSurvey_cancel = function (ic){
// SiteSurvey.value
$scope.select_SiteSurvey = {
value: false
};
$scope.SiteSurvey = {
value: false
};
$scope.SiteSurveyYes = false;
this.$dismiss();
}
//////////////////////////////////////////////////////////////////
// Get Installation Codes ////////////////////////
function getInstallationCodes(icNu) {
InstallCode = '';
angular.forEach($scope.InstallationCodes, function(in_nu){
Code_Nu = in_nu.ItemCount;
if(parseInt(Code_Nu) === parseInt(icNu)){
InstallCode = {
"ItemCount": in_nu.ItemCount,
"InstallationDescription": in_nu.InstallationDescription,
"sfdcID": in_nu.sfdcID
}
}
});
return InstallCode;
}
// Get Package ////////////////////////
function getPackage(icPackage,AppPackageID) {
ic_package = icPackage.toLowerCase();
Package_Array = [];
angular.forEach($scope.ServiceOptions, function(seropt){
APP_ID = seropt.sfdcID;
if(parseInt(APP_ID) === parseInt(AppPackageID)){
Package_Array = seropt;
}
});
Package_level = [];
angular.forEach(Package_Array.Packages, function(Package){
if (Package.Configuration.toLowerCase() == ic_package) {
Package_level = Package;
//console.log('Configuration ' + Package.Configuration);
}
});
/* Add up all charges */
var NRC_Charge = 0;
var NRC_Install = 0;
var NRC_Day_Install = 0;
var MRC_Charge = 0;
angular.forEach(Package_level.Equipment, function(equ){
var eq_qty = Number(equ.qty || 0);
angular.forEach(equ.Charges, function(Charge){
switch(Charge.ChargeType) {
case "NRC":
NRCCost = Number(Charge.charge || 0);
// NRC_Charge = NRC_Charge + NRCCost;
if (eq_qty > 1) {
NRC_Charge = (NRC_Charge + (NRCCost * eq_qty));
}
else {
NRC_Charge = (NRC_Charge + NRCCost);
}
break;
//
case "Install":
AfterHours = Number(Charge.AfterBusinessHours || 0);
DayHours = Number(Charge.MultiDeviceInstallation || 0);
if (eq_qty > 1) {
NRC_Install = (NRC_Install + (AfterHours * eq_qty));
NRC_Day_Install = (NRC_Day_Install + (DayHours * eq_qty));
}
else {
NRC_Install = (NRC_Install + AfterHours);
NRC_Day_Install = (NRC_Day_Install + DayHours);
}
break;
//
case "MRC":
MRCCost = Number(Charge.charge || 0) * eq_qty;
MRC_Charge = MRC_Charge + MRCCost;
break;
}
});
});
brandID = '';
if ($filter('aContainsB')(ic_package,'standard')) {
brandID = 'B-00051';
}
else if ($filter('aContainsB')(ic_package,'hhot')) {
brandID = 'B-00008';
}
else if ($filter('aContainsB')(ic_package,'busnwifi')) {
brandID = 'B-00035';
}
Package_level.Brand_ID = brandID;
Package_level.sfdcID = AppPackageID;
Package_level.EquipmentPrice = NRC_Charge;
Package_level.NRC_Install = NRC_Install;
Package_level.NRC_Day_Install = NRC_Day_Install;
Package_level.MRC_Charge = MRC_Charge;
/*
console.log('Package_level');
console.log(Package_level);
*/
$scope.UsePackage = Package_level;
$scope.checkForm = true;
}
///////////////////////////////////////////////////////////////
////// question List
/*
Question 1: "Tallest Ceiling Height: Between 10 and 15 feet"
Question 2: "POS Patch Panel: No"
Question 3: "Rack with POS Patch Panel: Free Standing"
console.log(ic);
console.log('isObject UsePackage : ' + $filter('isEmpty')($scope.UsePackage));
console.log($scope.VenueQuestionnaire[3].options[0]);
console.log($scope.VenueQuestionnaire[4].options[0]); //
console.log($scope.questionList);
console.log($scope.VenueQuestionnaire[0].options[1]);
*/
$scope.questionRenovated = false;
$scope.questionChanged = false;
$scope.questionList = [];
$scope.questionList.push($scope.VenueQuestionnaire[0].options[0]);
// console.log($scope.VenueQuestionnaire[0].options[0]);
$scope.updateQuestions = function(ic) {
// Update Questions in Venue
if ($scope.VenueInOrder && !$scope.questionChanged){
if (angular.isObject($scope.VenueOrdered.VenueQuestionnaire)) {
Ve_qu = [];
angular.forEach($scope.VenueQuestionnaire, function(mainQU){
main_question = mainQU.quID;
angular.forEach($scope.VenueOrdered.VenueQuestionnaire.Questions, function(veQU){
veQU_question = veQU.quID;
veQU_option = veQU.option;
if (main_question === veQU_question) {
//console.log($filter('aContainsB')(veQU_option,'select options:'));
angular.forEach(mainQU.options, function(mainOP){
mainOPT = mainOP.option;
if (!$filter('aContainsB')(veQU_option,'select options:') && veQU_option.toLowerCase() == mainOPT.toLowerCase()) {
Ve_qu.push(mainOP);
}
});
}
});
});
$scope.questionList = Ve_qu;
}
}
//////// Add info to venue
if ( angular.isObject(ic)) {
$scope.showQuestionsWarning = false;
$scope.questionChanged = true;
var item = ic;
answer = item.option;
//in_question = item.questionNu;
lp_quID = item.quID;
// Renovated Yes or No ////////
if (lp_quID === 1){
if (answer.toLowerCase() === 'no equipment') {
$scope.questionRenovated = true;
}
else {
$scope.questionRenovated = false;
}
}
if (answer.toLowerCase() != 'select options:') {
switch (lp_quID) {
case 1:
tempCase = '';
break;
case 2:
SS_Case = 'POS Patch Panel: ';
answer = item.option;
tempCase = SS_Case + answer;
break;
case 3:
SS_Case = 'Rack with POS Patch Panel: ';
answer = item.option;
tempCase = SS_Case + answer;
break;
case 4:
//SS_Case = 'Rack with POS Patch Panel: ';
//answer = item.option;
if (answer.toLowerCase() == 'floor') {
answer = 'McDonalds Custom 82 Inch Floor Rack';
}
else {
answer = 'McDonalds Custom 77 Inch Rolling Rack';
}
tempCase = answer;
break;
case 5:
SS_Case = 'Tallest Ceiling Height: ';
answer = item.option;
tempCase = SS_Case + answer;
break;
case 6:
SS_Case = 'Permits Required: ';
if (answer.toLowerCase() == 'yes') {
answer = 'Yes permits are needed';
}
else {
answer = 'No permits needed';
}
tempCase = SS_Case + answer;
break;
}
item.SiteSurveyCase = tempCase;
// Delete question if already in array ////
if ($scope.questionList.length) {
angular.forEach($scope.questionList, function(question,key){
lp_question = question.quID;
if (lp_question == lp_quID) {
$scope.questionList.splice(key, 1);
}
});
}
// add to array
$scope.questionList.push(item);
// /// Renovated = Yes
if ($scope.questionRenovated) {
$scope.selectedItem.Question2 = $scope.VenueQuestionnaire[1].options[0];
$scope.selectedItem.Question3 = $scope.VenueQuestionnaire[2].options[0];
angular.forEach($scope.questionList, function(question,key){
// 4 = Question 4 Wall Mount/Rack Mount
if (question.quID === 2 || question.quID === 3) {
$scope.questionList.splice(key, 1);
}
});
}
// Renovated = No
else {
$scope.selectedItem.Question4 = $scope.VenueQuestionnaire[3].options[0];
angular.forEach($scope.questionList, function(question,key){
if (question.quID === 4) { // 5 = Question 5 Floor/Rolling Rack
$scope.questionList.splice(key, 1);
}
});
}
}
$scope.questionList = $filter('orderBy')($scope.questionList, 'questionNu', false);
//console.log('$scope.questionList');
// console.log($scope.questionList);
}
}
// End question List
////////////////////////////////////////////////////////////////
if ($scope.VenueInOrder && $scope.VenueOrdered.VenueQuestionnaire.Questions != undefined){
//console.log($scope.VenueOrdered.VenueQuestionnaire.Questions[0]);
$scope.updateQuestions($scope.VenueOrdered.VenueQuestionnaire.Questions[0]);
}
else {
$scope.updateQuestions($scope.VenueQuestionnaire[0].options[0]);
}
//// Check Form to Submit ////////////////////////////////////////////////////////////
$scope.FormCheck = function() {
// /// Renovated = Yes
if ($scope.questionRenovated) {
//console.log($scope.questionList.length);
question_List = ($scope.questionList.length === 4) ? true : false;
angular.forEach( $scope.selectedItem, function(qu){
// console.log('qu.option : ' + qu.quID + ' - ' + qu.option);
if (qu.quID != 2 && qu.quID != 3) {
if ( $filter('aContainsB')(qu.option,'select options:') ){
question_List = false;
}
}
});
}
/// Renovated = No
else {
question_List = ($scope.questionList.length === 5) ? true : false;
angular.forEach( $scope.selectedItem, function(qu){
if (qu.quID != 4 && qu.quID != 5) {
if ( $filter('aContainsB')(qu.option,'select options:') ){
question_List = false;
}
}
});
}
// console.log('question_List ' + question_List +' $scope.questionRenovated : '+$scope.questionRenovated);
// console.log('CHanged ' +$scope.questionChanged);
// console.log('form invalid : ' +$scope.serviceForm.$invalid);
// console.log('UsePackage emply : ' +$filter('isEmpty')($scope.UsePackage));
// console.log('SiteSurveyYes : '+ $scope.SiteSurveyYes);
// console.log('quid ' +qu.quID + ' - ' +$filter('aContainsB')(qu.option,'select options:'));
if ( $filter('isEmpty')($scope.UsePackage) && question_List && !$scope.serviceForm.$invalid) {
return false;
}
else if ($scope.SiteSurveyYes && !$scope.serviceForm.$invalid) {
return false;
}
else {
return true;
}
};
////////////////////////////////////////////////////////////////////////////////
// Continue Button
$scope.openVenueCircuit = function (v_id,$event) {
$scope.selectedVenue = v_id;
var submitForm = true;
if ($rootScope.orderRequest.FranchiseeOrdering.venues.length) {
angular.forEach($rootScope.orderRequest.FranchiseeOrdering.venues, function(or_venue){
lp_venueID = or_venue.venueId;
if (parseInt($scope.selectedVenue) === parseInt(lp_venueID)) {
if (or_venue.DSR.length){
$scope.VenueInOrder = true;
}
}
});
}
/*
console.log('$scope.VenueInOrder : ' +$scope.VenueInOrder);
console.log('checkForm ' + $scope.checkForm);
console.log($scope.selectedItem);
console.log('questionRenovated ' +$scope.questionRenovated);
*/
if (!$scope.SiteSurveyYes) {
// /// Renovated = Yes
if ($scope.questionRenovated) {
angular.forEach( $scope.selectedItem, function(qu){
if (qu.quID != 2 && qu.quID != 3) {
if ( $filter('aContainsB')(qu.option,'select options:') ){
submitForm = false;
}
}
});
}
/// Renovated = No
else {
angular.forEach( $scope.selectedItem, function(qu){
if (qu.quID != 4) {
if ( $filter('aContainsB')(qu.option,'select options:') ){
submitForm = false;
}
}
});
}
}
//
if ( !submitForm ) {
$scope.showQuestionsWarning = true;
}
/*
console.log('submitForm :' +submitForm);
console.log('SiteSurveyYes :' +$scope.SiteSurveyYes);
console.log('SiteSurvey Value :' +$scope.SiteSurvey.value);
submitForm = false;
*/
if (submitForm) {
////////////////////
if ($scope.SiteSurveyYes) {
var OptEquipmentArray = [];
var PackageOption = '';
var SpareEquipmentArray = [];
var Mobility_MRC = '';
var Venue_Questionnaire = '';
$scope.ProccessThruSummary = true;
/* Initial Order Services
Site Survey N/A $207.50 N/A N/A N/A
152155-Custom-NRC-x N/A
Existing
*/
PackageOption = {
"sfdcID":'152155-Custom-NRC-x',
"PackageName":'Site Survey',
"Configuration":'',
"NoRecommendation":$scope.NoRecommendation,
"Equipment_Total":'207.50',
"DriveThru": $scope.select_DriveThru.value,
"DiningRoom": $scope.select_DiningRoom.value,
"GuestWiFi": $scope.select_GuestWiFi.value,
"HHOT": $scope.select_HHOT.value
};
EquipmentArray = [];
tmp_data = {
"sfdcID": '152155-Custom-NRC-x',
"EquipmentType": "Equipment",
"Description": 'Site Survey',
"Quantity": 1,
"Charge": '207.50'
};
EquipmentArray.push(tmp_data);
PackageOption.Equipment = EquipmentArray;
}
else {
//console.log($scope.questionList);
// Venue Questionnaire ////////////
if ($scope.questionList.length) {
theQuestions = [];
theEquipment = [];
angular.forEach($scope.questionList, function(ls){
tmp_data = {
"SiteSurveyCase": ls.SiteSurveyCase,
"questionNu": ls.questionNu,
"Question": ls.question,
"quID": ls.quID,
"option": ls.option,
"moreInfo": ls.moreInfo
};
theQuestions.push(tmp_data);
if (typeof(ls.Equipment) != 'undefined' && ls.Equipment.length > 0) {
//theEquipment.push(ls.Equipment);
angular.forEach(ls.Equipment, function(ee){
tmpEQ = {
"ChargeType": ee.ChargeType,
"EquipmentName": ee.EquipmentName,
"DisplayName": ee.DisplayName,
"sfdcID": ee.sfdcID,
"Quantity": ee.Quantity,
"Charge": ee.charge,
"questionNu": ee.questionNu
}
theEquipment.push(tmpEQ);
});
}
});
// console.log($scope.questionRenovated);
renovated_data = '';
// /// Renovated = Yes
if ($scope.questionRenovated) {
qu_2 = {
"SiteSurveyCase": "",
"question": "Is the restaurant wiring patch panel located in the same room OR a room immediately adjacent to the AWS 24 port switch where the blue digital menu boards (DMB) cables are connected?",
"option": "Select Options:",
"questionNu": "Question 2",
"quID":2,
"moreInfo":"",
}
theQuestions.push(qu_2);
renovated_data = {
"SiteSurveyCase": "",
"questionNu": "",
"quID": 3,
"Question": "Is the rack containing the restaurant wiring patch panel wall or rack mounted?",
"option": "Select Options:",
"moreInfo": ""
};
}
/// Renovated = No
else {
renovated_data = {
"SiteSurveyCase": "",
"questionNu": "",
"quID": 4,
"Question": "What rack should be installed in the restaurant? An 82 inch Floor Rack or a 77 inch Rolling Rack.",
"option": "Select Options:",
"moreInfo": ""
};
}
theQuestions.push(renovated_data);
theQuestions = $filter('orderBy')(theQuestions, 'questionNu', false);
/*
"question": "Is the rack containing the restaurant wiring patch panel wall or rack mounted?",
"option": "Select Options:",
"questionNu": "Question 4",
"quID":4,
"moreInfo":"",
'Question1':$scope.VenueOrdered.VenueQuestionnaire.Questions[0],
'Question2':$scope.VenueOrdered.VenueQuestionnaire.Questions[1],
'Question3':$scope.VenueOrdered.VenueQuestionnaire.Questions[2],
'Question4':$scope.VenueOrdered.VenueQuestionnaire.Questions[3]
*/
var Venue_Questionnaire = {};
Venue_Questionnaire.Questions = theQuestions;
Venue_Questionnaire.Equipment = theEquipment;
}
else {
var Venue_Questionnaire = $scope.VenueOrdered.VenueQuestionnaire;
}
// PackageOption.Equipment = EquipmentArray;
////////////////////
// Get Optional Equipment ////////////////////////////////////////////
var Total_Items = 0;
var Running_InstallCost = 0;
var OptEquipmentArray = [];
angular.forEach($scope.OptionalEquipment, function(hw){
getCount = parseInt($scope.OptionalEqu['Count'+hw.AppID]);
if (getCount > 0) {
Total_Items = Total_Items + getCount;
angular.forEach(hw.Charges, function(Charge) {
switch(Charge.ChargeType) {
case "Install":
InstallCost = Number(Charge.AfterBusinessHours || 0);
Running_InstallCost = Running_InstallCost + (InstallCost * getCount);
break;
//
case "NRC":
NRCCost = Number(Charge.charge || 0);
tmp_data = {
"sfdcID": Charge.sfdcID,
"AppID": hw.AppID,
"EquipmentType": "Equipment",
"Description": hw.Description,
"DisplayName": hw.DisplayName,
"Quantity": getCount,
"Charge": NRCCost
};
OptEquipmentArray.push(tmp_data);
break;
//
case "MRC":
MRCCost = Number(Charge.charge || 0);
tmp_data = {
"sfdcID": Charge.sfdcID,
"AppID": hw.AppID,
"EquipmentType": "MRC",
"DisplayName": hw.DisplayName,
"Description": hw.Description,
"Quantity": getCount,
"Charge": MRCCost
};
OptEquipmentArray.push(tmp_data);
break;
}
});
}
});
/*
console.log(OptEquipmentArray);
console.log('OptEquipment');
console.log('Total_Items : ' + Total_Items);
console.log('Running_InstallCost : ' + Running_InstallCost);
*/
// END Optional Equipment ////////////////////////////////////////////
// Get Package ////////////////////////////////////////////
var PackageOption = '';
PackageOption = {
"Brand_ID":$scope.UsePackage.Brand_ID,
"sfdcID":$scope.UsePackage.sfdcID,
"PackageName":$scope.UsePackage.ConfName,
"Configuration":$scope.UsePackage.Configuration,
"NoRecommendation":$scope.NoRecommendation,
"Equipment_Total":$scope.UsePackage.EquipmentPrice,
"NRC_Total":$scope.UsePackage.NRC_Install,
"NRC_Day_Install":$scope.UsePackage.NRC_Day_Install,
"MRC_Total":$scope.UsePackage.MRC_Charge,
"DriveThru": $scope.select_DriveThru.value,
"DiningRoom": $scope.select_DiningRoom.value,
"GuestWiFi": $scope.select_GuestWiFi.value,
"HHOT": $scope.select_HHOT.value
};
var EquipmentArray = [];
angular.forEach($scope.UsePackage.Equipment, function(Package){
var eq_qty = Number(Package.qty || 0);
if (Package.Charges.length > 0) {
Total_Items = Total_Items + eq_qty;
angular.forEach(Package.Charges, function(Charge) {
switch(Charge.ChargeType) {
//
case "Install":
InstallCost = Number(Charge.AfterBusinessHours || 0);
Running_InstallCost = Running_InstallCost + (InstallCost * eq_qty);
break;
//
case "NRC":
NRCCost = Number(Charge.charge || 0);
tmp_data = {
"sfdcID": Charge.sfdcID,
"EquipmentType": "Equipment",
"DisplayName": Package.DisplayName,
"Description": Package.Description,
"Quantity": eq_qty,
"Charge": NRCCost
};
EquipmentArray.push(tmp_data);
break;
//
case "MRC":
MRCCost = Number(Charge.charge || 0);
tmp_data = {
"sfdcID": Charge.sfdcID,
"EquipmentType": "MRC",
"DisplayName": Package.DisplayName,
"Description": Package.Description,
"Quantity": eq_qty,
"Charge": MRCCost
};
EquipmentArray.push(tmp_data);
break;
}
});
}
else if (Package.Charges.length == 0) {
//"Description": "Installation Charge - #X Equipment"
if (!$filter('aContainsB')(Package.Description,'installation')) {
tmp_data = {
"sfdcID": Package.sfdcID,
"EquipmentType": Package.EquipmentType,
"DisplayName": Package.DisplayName,
"Description": Package.Description,
"Quantity": eq_qty,
"Charge": Package.Equipment_Price
};
EquipmentArray.push(tmp_data);
}
}
});
PackageOption.Equipment = EquipmentArray;
//console.log('PackageOption');
//console.log(PackageOption);
TotalItems_obj = getInstallationCodes(Total_Items);
PackageOption.Equipment = PackageOption.Equipment.concat([{
sfdcID: TotalItems_obj.sfdcID,
EquipmentType: "Installation",
Description: TotalItems_obj.InstallationDescription,
Quantity: 1,
Charge: Running_InstallCost
}]);
// END Get Package ////////////////////////////////////////////
/*
console.log('Total_Items : ' + Total_Items);
console.log('Running_InstallCost : ' + Running_InstallCost);
console.log('TotalItems_obj : ');
console.log(TotalItems_obj);
*/
// Get Spare Equipment ////////////////////////////////////////////
// "SpareEquipment": [],
var SpareEquipmentArray = [];
angular.forEach($scope.SpareEquipment, function(spare){
checkCount = $scope.SpareEqu['Count'+spare.AppID];
//console.log(checkCount);
if (checkCount > 0) {
angular.forEach(spare.Charges, function(Charge) {
switch(Charge.ChargeType) {
case "NRC":
NRCCost = Number(Charge.charge || 0);
tmp_data = {
"sfdcID": Charge.sfdcID,
"AppID": spare.AppID,
"EquipmentType": "Equipment",
"DisplayName": spare.DisplayName,
"Description": spare.Description,
"Quantity": checkCount,
"Charge": NRCCost
};
SpareEquipmentArray.push(tmp_data);
break;
//
case "MRC":
MRCCost = Number(Charge.charge || 0);
tmp_data = {
"sfdcID": Charge.sfdcID,
"AppID": spare.AppID,
"EquipmentType": "MRC",
"DisplayName": spare.DisplayName,
"Description": spare.Description,
"Quantity": checkCount,
"Charge": MRCCost
};
SpareEquipmentArray.push(tmp_data);
break;
}
});
}
});
// END Spare Equipment ////////////////////////////////////////////
// //////////////////////////////////////////
/*
Include a $10 Mobility MRC per venue (Data plan charge) in the order summary and order confirmation page.
Do not charge. Customer is getting charged through CCIP
*/
Mobility_MRC = {
"sfdcID": '',
"EquipmentType": "MRC",
"Description": 'Mobility Data Plan',
"Quantity": 1,
"Charge": '10.00'
};
// //////////////////////////////////////////
}
////////////////////////////////////////////
if ($scope.VenueInOrder){
angular.forEach($rootScope.orderRequest.FranchiseeOrdering.venues, function(ch_venue){
lp_venueID = ch_venue.venueId;
if (parseInt($scope.IncomingVenueID) === parseInt(lp_venueID)) {
ch_venue.street = $scope.cur_Venue.StoreAddress;
ch_venue.city = $scope.cur_Venue.StoreCity;
ch_venue.state = $scope.cur_Venue.StoreState;
ch_venue.zip = $scope.cur_Venue.StoreZip;
ch_venue.storephoneNumber = $scope.cur_Venue.StorePhone;
ch_venue.contactFirstName = $scope.cur_Venue.ContactFirstName;
ch_venue.contactLastName = $scope.cur_Venue.ContactLastName;
ch_venue.contactphoneNumber = $scope.cur_Venue.ContactphoneNumber;
ch_venue.Contact_Email = $scope.cur_Venue.ContactEmail;
ch_venue.Additional_contactFirstName = $scope.cur_Venue.ContactFirstName2nd;
ch_venue.Additional_contactLastName = $scope.cur_Venue.ContactLastName2nd;
ch_venue.Additional_phoneNumber = $scope.cur_Venue.ContactphoneNumber2nd;
ch_venue.Additional_Contact_Email = $scope.cur_Venue.ContactEmail2nd;
ch_venue.Additional_Information = $scope.cur_Venue.AdditionalInformation;
ch_venue.SiteSurveyRequest = $scope.SiteSurveyYes;
ch_venue.ComcastProvider = $scope.ComcastProvider;
ch_venue.HasCradlepoint = $scope.isCradlepoint;
ch_venue.PackageRecommendation = $scope.NoRecommendation;
ch_venue.PackageOption = PackageOption;
ch_venue.OptionalEquipment = OptEquipmentArray;
ch_venue.SpareEquipment = SpareEquipmentArray;
ch_venue.VenueQuestionnaire = Venue_Questionnaire;
ch_venue.MobilityMRC = Mobility_MRC;
}
});
}
else {
venue_ordered = {
"venueId":$scope.selectedVenue,
"street":$scope.cur_Venue.StoreAddress,
"city":$scope.cur_Venue.StoreCity,
"state":$scope.cur_Venue.StoreState,
"zip":$scope.cur_Venue.StoreZip,
"storephoneNumber":$scope.cur_Venue.StorePhone,
"contactFirstName":$scope.cur_Venue.ContactFirstName,
"contactLastName":$scope.cur_Venue.ContactLastName,
"contactphoneNumber":$scope.cur_Venue.ContactphoneNumber,
"Contact_Email":$scope.cur_Venue.ContactEmail,
"Additional_contactFirstName":$scope.cur_Venue.ContactFirstName2nd,
"Additional_contactLastName":$scope.cur_Venue.ContactLastName2nd,
"Additional_phoneNumber":$scope.cur_Venue.ContactphoneNumber2nd,
"Additional_Contact_Email":$scope.cur_Venue.ContactEmail2nd,
"Additional_Information": $scope.cur_Venue.AdditionalInformation,
"SiteSurveyRequest":$scope.SiteSurveyYes,
"ComcastProvider":$scope.ComcastProvider,
"HasCradlepoint":isCradlepoint,
"PackageRecommendation":($scope.NoRecommendation ? false : true),
"PackageOption": PackageOption,
"OptionalEquipment":OptEquipmentArray,
"SpareEquipment":SpareEquipmentArray,
"VenueQuestionnaire": Venue_Questionnaire,
"MobilityMRC": Mobility_MRC,
"DSR":[]
};
// Add Venue Server to Order
$rootScope.orderRequest.FranchiseeOrdering.venues.push(venue_ordered);
}
/**/
//console.log(JSON.stringify(venue_ordered));
// Update Windows SessionStorage with current order
sessionStorage.setItem('CustomerWiFI_Order',JSON.stringify($rootScope.orderRequest));
//Update SFDC storage with venues
ATTWiFiOrderingClass.setOrderState(JSON.stringify($rootScope.orderRequest), function(result, status){});
////
if ($scope.ProccessThruSummary) {
$scope.locationPath = "OrderSummary/";
//$location.path("OrderSummary/");
}
else {
$scope.locationPath = "VenueCircuitOrder/"+$scope.selectedVenue;
//$location.path("VenueCircuitOrder/"+$scope.selectedVenue);
}
$scope.openAddressValidation($scope.locationPath,$scope.selectedVenue);
// $scope.openAddressValidation($scope.locationPath);
} // end submitForm
};
/*
////
if ($scope.ProccessThruSummary) {
$scope.locationPath = "OrderSummary/";
//$location.path("OrderSummary/");
}
else {
$scope.locationPath = "VenueCircuitOrder/"+$scope.selectedVenue;
//$location.path("VenueCircuitOrder/"+$scope.selectedVenue);
}
$scope.openAddressValidation($scope.locationPath,$scope.selectedVenue);
*/
//////////////////////////////////////////
// Venue address validation
$scope.openAddressValidation = function(locatePath,ic_venue){
$scope.locate_Path = locatePath;
$scope.rtVenue = ic_venue;
$scope.loading = true;
ATTWiFiOrderingClass.valiateVenueAddress($scope.cur_Venue.StoreAddress,$scope.cur_Venue.StoreCity,$scope.cur_Venue.StoreState,$scope.cur_Venue.StoreZip, function(result, status){
$scope.$evalAsync(function () {
if (angular.isObject(result)) {
$scope.loading = false;
$scope.uspsAddress = result.body;
if(result.body.result =='incorrect' || result.body.result =='invalid') {
//console.log(result.body.result);
$scope.loading = false;
$scope.modalInstance = $uibModal.open({
animation: true,
templateUrl: '/ATTWiFiUpgradeOrdering/wifiOrd_AddressValidationModal_html',
controller: 'addressValidationController',
//size: size,
keyboard: false,
backdrop: 'static',
scope: $scope,
resolve: {
locate_Path : function() {
return $scope.locate_Path;
},
rtVenue : function() {
return $scope.rtVenue;
}
}
});
}
if(result.body.result =='valid'){
$location.path(locatePath);
// $location.path("VenueCircuitOrder/"+$scope.selectedVenue);
}
}
else {
$location.path(locatePath);
}
// console.log('result ' + result);
});
});
};
//x - button / close button
$scope.close = function (){
$scope.loading = false;
$scope.modalInstance.dismiss('cancel');
$('.ordFormEq.continue_button').prop("disabled", false);
};
//Cancel button
$scope.cancel = function () {
angular.forEach($rootScope.orderRequest.FranchiseeOrdering.venues, function(venue, key){
lp_venueID = venue.venueId;
if (parseInt(lp_venueID) === parseInt($scope.IncomingVenueID)) {
if (!venue.DSR.length) {
$rootScope.orderRequest.FranchiseeOrdering.venues.splice(key, 1);
}
}
});
$location.path("OrderSummary/");
//$location.path('/OrderForm');
};
////////////////////////////////////////////////////////////////////////////////
})
.controller('addressValidationController', function ($rootScope, $scope, $location, $routeParams, $http, $filter, $uibModalInstance) {
//@TODO:Moving this code to config object
ATTWiFiOrderingClass.getCurrentUserName(function(result, status){
$scope.$evalAsync(function () {
$scope.id = result.body[0].Id;
if($scope.id==null || $scope.id==="undefined" || result.body[0].FirstName==='ATTWiFiUpgradeOrdering' ){
$rootScope.orderRequest = '';
if($rootScope.brandId==null || $rootScope.brandId==="undefined"){
$rootScope.brandId='001600000lzkAb';
}
$location.path('/ProductOverview/'+$rootScope.brandId);
}
})
});
/////////////////////////////
$scope.EditButton = true;
$scope.showReset = true;
$scope.resetVenue = angular.copy($scope.cur_Venue);
$scope.StoreAddress_state = false;
$scope.StoreCity_state = false;
$scope.StoreState_state = false;
$scope.StoreZip_state = false;
$scope.plus4_state = false;
if ($scope.uspsAddress.result == 'invalid') {
$scope.Venue_Address = {
'StoreAddress':$scope.cur_Venue.StoreAddress,
'StoreCity':$scope.cur_Venue.StoreCity,
'StoreState':$scope.cur_Venue.StoreState,
'StoreZip':$scope.cur_Venue.StoreZip.split('-')[0],
'plus4':$scope.cur_Venue.StoreZip.split('-')[1]
}
}
else if ($scope.uspsAddress.result == 'incorrect') {
$scope.Venue_Address = {
'StoreAddress':$scope.uspsAddress.street,
'StoreCity':$scope.uspsAddress.city,
'StoreState':$scope.uspsAddress.state,
'StoreZip':$scope.uspsAddress.zip.split('-')[0],
'plus4':$scope.uspsAddress.zip.split('-')[1]
}
if (angular.equals($scope.cur_Venue.StoreAddress, $scope.uspsAddress.street)) {
$scope.StoreAddress_state = true;
}
if (angular.equals($scope.cur_Venue.StoreCity, $scope.uspsAddress.city)) {
$scope.StoreCity_state = true;
}
if (angular.equals($scope.cur_Venue.StoreState, $scope.uspsAddress.state)) {
$scope.StoreState_state = true;
}
if (angular.equals($scope.cur_Venue.StoreZip.split('-')[0], $scope.uspsAddress.zip.split('-')[0])) {
$scope.StoreZip_state = true;
}
if (angular.equals($scope.cur_Venue.StoreZip.split('-')[1], $scope.uspsAddress.zip.split('-')[1])) {
$scope.plus4_plus4_statestate = true;
}
}
///////////////////// Button updateAddress useOriginal
$scope.continue = function(locate_Path){
$location.path(locate_Path);
}
$scope.useOriginal = function (locate_Path,rtVenue) {
$location.path(locate_Path);
}
////
$scope.updateAddress = function (locate_Path,rtVenue) {
//$scope.loading = true;
if (typeof $scope.Venue_Address.plus4 != 'undefined' && $scope.Venue_Address.plus4.length) {
Zip_Plus4 = $scope.Venue_Address.StoreZip + '-' + $scope.Venue_Address.plus4;
}
else {
Zip_Plus4 = $scope.Venue_Address.StoreZip;
}
angular.forEach($rootScope.orderRequest.FranchiseeOrdering.venues, function(or_venue){
lp_venueID = or_venue.venueId;
if (parseInt(rtVenue) === parseInt(lp_venueID)) {
or_venue.street = $scope.Venue_Address.StoreAddress;
or_venue.city = $scope.Venue_Address.StoreCity;
or_venue.state = $scope.Venue_Address.StoreState;
or_venue.zip = Zip_Plus4;
}
});
$location.path(locate_Path);
/*
Commed out by Mike Hughes mh4053@att.com, because this code is not doing anything, if it is I need to know what it does. I see it doing nothing but updating an old scope vars
//Invalid changed
if($scope.uspsAddress.result == 'invalid'){
if($scope.Venue_Address.StoreAddress!=$scope.cur_Venue.StoreAddress ||$scope.cur_Venue.StoreCity!=$scope.cur_Venue.StoreCity||$scope.Venue_Address.StoreState!=$scope.cur_Venue.StoreState||$scope.Venue_Address.StoreZip!=$scope.cur_Venue.StoreZip){
// console.log("Invalid address changed");
$scope.cur_Venue.StoreAddress=$scope.Venue_Address.StoreAddress;
$scope.cur_Venue.StoreCity=$scope.Venue_Address.StoreCity;
$scope.cur_Venue.StoreState=$scope.Venue_Address.StoreState;
$scope.cur_Venue.StoreZip=$scope.Venue_Address.StoreZip;
$scope.openAddressValidation($scope.locationPath,$scope.Venue_Address);
}
else {
// console.log("Invalid address unchanged");
$scope.cur_Venue.StoreAddress=$scope.Venue_Address.StoreAddress;
$scope.cur_Venue.StoreCity=$scope.Venue_Address.StoreCity;
$scope.cur_Venue.StoreState=$scope.Venue_Address.StoreState;
//$scope.cur_Venue.StoreState=$scope.Venue_Address.plus4;
$location.path(locate_Path);
}
}
//Incorrect changed
if($scope.uspsAddress.result == 'incorrect'){
if($scope.Venue_Address.StoreAddress!=$scope.uspsAddress.street ||$scope.Venue_Address.StoreCity!=$scope.uspsAddress.city||$scope.Venue_Address.StoreState!=$scope.uspsAddress.state){
// console.log("Incorrect address changed");
$scope.cur_Venue.StoreAddress=$scope.Venue_Address.StoreAddress;
$scope.cur_Venue.StoreCity=$scope.Venue_Address.StoreCity;
$scope.cur_Venue.StoreState=$scope.Venue_Address.StoreState;
//$scope.cur_Venue.StoreZip=$scope.resetVenue.StoreState;
$scope.openAddressValidation($scope.locationPath,$scope.Venue_Address);
}
else {
// console.log("Incorrect address unchanged");
$scope.cur_Venue.StoreAddress=$scope.Venue_Address.StoreAddress;
$scope.cur_Venue.StoreCity=$scope.Venue_Address.StoreCity;
$scope.cur_Venue.StoreState=$scope.Venue_Address.StoreState;
//$scope.cur_Venue.StoreState=$scope.Venue_Address.plus4;
$location.path(locate_Path);
}
}
*/
}
//x - button / close button
$scope.close = function (locate_Path,rtVenue){
$scope.loading = false;
$scope.modalInstance.dismiss('cancel');
$location.path(locate_Path);
};
})
// Start venueCircuitController ///////////////////////////////
/* Display List of Venues for user can select to orderBy
Venue service modal box will display so the user can add the venue's contact information, service,
circuit, additional hardware and additional installation service needed for the venue successful install.
*/
.controller('venueCircuitController', function ($rootScope, $scope, $filter, $location, $analytics, $routeParams, $http, $log, $exceptionHandler) {
//@TODO:Moving this code to config object
ATTWiFiOrderingClass.getCurrentUserName(function(result, status){
$scope.$evalAsync(function () {
$scope.id = result.body[0].Id;
if($scope.id==null || $scope.id==="undefined" || result.body[0].FirstName==='ATTWiFiUpgradeOrdering'){
$rootScope.orderRequest = '';
if($rootScope.brandId==null || $rootScope.brandId==="undefined"){
$rootScope.brandId='001600000lzkAb';
}
$location.path('/ProductOverview/'+$rootScope.brandId);
}
})
});
//Back button
$scope.goback = function (v_id) {
$scope.selectedVenue = $routeParams.v_id;
$location.path('OrderEquipment/'+$scope.selectedVenue);
};
////////////////////////////////
$scope.IncomingVenueID = $routeParams.v_id;
/////////////////////
$scope.ShowPreQual = false;
// accordion //////////////////
$scope.Div_1 = {
1:false,
2:false,
1:false
}
$scope.Div_2 = {
1:false,
2:false,
1:false
}
// accordion END ///////
/////////////////////
$scope.VenueInOrder = false;
$scope.dsrOrdered = '';
if ($rootScope.orderRequest.FranchiseeOrdering.venues.length) {
angular.forEach($rootScope.orderRequest.FranchiseeOrdering.venues, function(or_venue){
lp_venueID = or_venue.venueId;
if (parseInt($scope.IncomingVenueID) === parseInt(lp_venueID)) {
if (or_venue.DSR.length){
$scope.VenueInOrder = true;
$scope.dsrOrdered = or_venue.DSR;
}
}
});
//console.log($scope.dsrOrdered);
}
$scope.buttontext = $scope.VenueInOrder ? 'Update' : 'Continue';
////////////////////////////////
$scope.VenueArray = [];
if($rootScope.mcdInputData==null || $rootScope.mcdInputData=='undefined'){
$rootScope.mcdInputData = sessionStorage.getItem("mcdInputData");
$rootScope.mcdInputData.venues = sessionStorage.getItem("mcdInputDatavenues");
$rootScope.mcdInputData = JSON.parse($filter('escapeCharacters')($rootScope.mcdInputData)); //JSON.parse($rootScope.mcdInputData.replace(/"/g,'"'));
}
angular.forEach($rootScope.mcdInputData.venues, function(venue){
ar_VenueID = venue.STORE_NUMBER;
// STORE_NUMBER
if(parseInt(ar_VenueID) === parseInt($scope.IncomingVenueID)){
$scope.VenueArray = venue;
}
});
/////////
$scope.ComcastProvider = ($scope.VenueArray.COMCAST_PROVIDER.toLowerCase() == 'yes' ? true : false);
$scope.cur_Venue = {
"StoreNumber":$scope.VenueArray.STORE_NUMBER
}
////////////////////////////////
//console.log($scope.VenueArray);
////////////////////////////////
$scope.ComcastVisible = false;
$scope.ComcastProvider = ($scope.VenueArray.COMCAST_PROVIDER.toLowerCase() == 'yes' ? true : false);
/////////
if ($scope.ComcastProvider){
$scope.ComcastVisible = true;
$scope.HasPreQual = false;
}
else {
$scope.HasPreQual = (($scope.VenueArray.dsr_data.length) ? true : false);
}
// ////////////////////////
if (!$scope.HasPreQual) {
//$scope.ShowPreQual = true;
}
/////////
//////////////////
if ($scope.HasPreQual) {
$scope.CircuitTier1 = $scope.VenueArray.dsr_data[0].TIER1;
$scope.CircuitTier2 = $scope.VenueArray.dsr_data[1].TIER2;
$scope.CircuitTier3 = $scope.VenueArray.dsr_data[2].TIER3;
/////////
$scope.DSR_Circuit = {"DSRCircuits":[]};
///// Recommendation
$scope.dsr_Recommendation = {
"DSR_Provider":$scope.VenueArray.MATCHED_SERV_DETAILS,
"DSR_BW_Up":$scope.VenueArray.MATCHED_SERV_BW_MBPS_UP,
"DSR_BW_Down":$scope.VenueArray.MATCHED_SERV_BW_MBPS_DOWN,
"DSR_MonthlyCost":$scope.VenueArray.MATCHED_SERV_EST_MONTHLY_BASE_COST,
"DSR_OneTimeCost":$scope.VenueArray.MATCHED_SERV_EST_ONE_TIME_INSTALL_ACT_COST
}
var Recommendation_Provider = $scope.dsr_Recommendation.DSR_Provider;
var Recommendation_Up = $scope.dsr_Recommendation.DSR_BW_Up;
var Recommendation_Down = $scope.dsr_Recommendation.DSR_BW_Down;
var Recommendation_MonthlyCost = $scope.dsr_Recommendation.DSR_MonthlyCost;
var Recommendation_OneTimeCost = $scope.dsr_Recommendation.DSR_OneTimeCost;
// Get Recommendation Tier
/*
Tier 1 Digital Ready: 15 Mbps down / 3 Mbps up
Tier 2 Digital Plus: 20 Mbps down / 5 Mbps up
Tier 3 Digital Platinum: 75 Mbps down / 15 Mbps up
*/
$scope.Recom_Tier = 0;
if ( parseInt(Recommendation_Down) <= 19 ) {
$scope.Recom_Tier = 1;
}
else if ( parseInt(Recommendation_Down) >= 20 && parseInt(Recommendation_Down) <= 74 ){
$scope.Recom_Tier = 2;
}
else if ( parseInt(Recommendation_Down) >= 75 ){
$scope.Recom_Tier = 3;
}
var Is_Recommendation = false;
///// End Recommendation
///////////////////////////////////
///////////////////////////////////
angular.forEach([1,2,3], function(value){
$scope.cur_Tier = $scope['CircuitTier' + value ];
//console.log( $scope.cur_Tier );
$scope.limit = 1;
// Default Var
var Is_Recommendation = false;
var Tier_Display = false;
var SubTier_Display = false;
var Circuit_Display = false;
var tmp_Recom_Service_Provider = '';
var Recom_RecommendationProvider = false;
var Recom_Service_Display = false;
var Recom_Service_Provider = '';
var Recom_Service_BW_Up = '';
var Recom_Service_BW_Down = '';
var Recom_Service_MonthlyCost = '';
var Recom_Service_OneTimeCost = '';
var Recom_Service_Contract_Term_Month = '';
var Recom_Service_Early_Termination_Charge = '';
var ATT_RecommendationProvider = false;
var ATT_Service_Display = false;
var ATT_Service_Provider = '';
var ATT_Service_BW_Up = '';
var ATT_Service_BW_Down = '';
var ATT_Service_MonthlyCost = '';
var ATT_Service_OneTimeCost = '';
var ATT_Service_Contract_Term_Month = '';
var ATT_Service_Early_Termination_Charge = '';
//
var ATT_ExtDSL_Display = false;
var ExtDSL_RecommendationProvider = false;
var ATT_ExtDSL_Provider = '';
var ATT_ExtDSL_BW_Up = '';
var ATT_ExtDSL_BW_Down = '';
var ATT_ExtDSL_MonthlyCost = '';
var ATT_ExtDSL_OneTimeCost = '';
var ATT_ExtDSL_Contract_Term_Month = '';
var ATT_ExtDSL_Early_Termination_Charge = '';
//
var ATT_ExtCable_Display = false;
var ExtCable_RecommendationProvider = false;
var ATT_ExtCable_Provider = '';
var ATT_ExtCable_BW_Up = '';
var ATT_ExtCable_BW_Down = '';
var ATT_ExtCable_MonthlyCost = '';
var ATT_ExtCable_OneTimeCost = '';
var ATT_ExtCable_Contract_Term_Month = '';
var ATT_ExtCable_Early_Termination_Charge = '';
//
var Cable_Display = false;
var Cable_RecommendationProvider = false;
var Cable_Provider = '';
var Cable_BW_Up = '';
var Cable_BW_Down = '';
var Cable_MonthlyCost = '';
var Cable_OneTimeCost = '';
var Cable_Contract_Term_Month = '';
var Cable_Early_Termination_Charge = '';
//
var ILEC_Display = false;
var ILEC_RecommendationProvider = false;
var ILEC_SERVICE_TYPE = '';
var ILEC_DSL_Provider = '';
var ILEC_BW_Up = '';
var ILEC_BW_Down = '';
var ILEC_MonthlyCost = '';
var ILEC_OneTimeCost = '';
var ILEC_Contract_Term_Month = '';
var ILEC_Early_Termination_Charge = '';
try {
////// DSR ATT_Service
ATT_Service_Provider = $scope.cur_Tier.ATT_SERVICE_TYPE;
if (ATT_Service_Provider.length) {
Recom_Service_Display = false;
// 1st check Recommendation Provider and set RecommendationProvider for values && value == $scope.Recom_Tier
if (value == $scope.Recom_Tier ) {
Is_Recommendation = true;
}
if (ATT_Service_Provider.indexOf(Recommendation_Provider) != -1 && value == $scope.Recom_Tier) {
Recom_Service_Display = true;
Tier_Display = true;
tmp_Recom_Service_Provider = ATT_Service_Provider;
Recom_Service_Contract_Term_Month = '12';
Recom_Service_Early_Termination_Charge = '400.00';
}
// 2nd Use DSR Fields for Values
if (!Recom_Service_Display && $filter('aContainsB')($scope.cur_Tier.ATT_DSL_OPTION_PRICED,';') ) { //
if (Is_Recommendation ) {
SubTier_Display = true;
}
if (Tier_Display ) {
SubTier_Display = true;
}
Tier_Display = true;
ATT_Service_Display = true;
var ATTSerUpDownload = $filter('ATTServiceBandwidth')($scope.cur_Tier.ATT_DSL_OPTION_PRICED);
ATT_Service_BW_Up = ATTSerUpDownload.Broadband_Up;
ATT_Service_BW_Down = ATTSerUpDownload.Broadband_Down;
ATT_Service_MonthlyCost = '39.95';
ATT_Service_OneTimeCost = '418';
ATT_Service_Contract_Term_Month = '12';
ATT_Service_Early_Termination_Charge = '400.00';
}
}
////// DSR AT&T EXTENDED DSL SERVICE
ATT_ExtDSL_Provider = $scope.cur_Tier.ATT_XDSL_SERVICE_TYPE;
if (ATT_ExtDSL_Provider.length) {
Recom_Service_Display = false;
// 1st check Recommendation Provider and set RecommendationProvider for values
if (value == $scope.Recom_Tier ) {
Is_Recommendation = true;
}
if (ATT_ExtDSL_Provider.indexOf(Recommendation_Provider) != -1 && value == $scope.Recom_Tier) {
Recom_Service_Display = true;
Tier_Display = true;
tmp_Recom_Service_Provider = ATT_ExtDSL_Provider;
Recom_Service_Contract_Term_Month = $scope.cur_Tier.ATT_XDSL_MIN_CONTRACT_TERM;
Recom_Service_Early_Termination_Charge = $scope.cur_Tier.ATT_XDSL_EARLY_TERMINATION_CHARGE;
}
// 2nd Use DSR Fields for Values
//if (!Recom_Service_Display && $filter('aContainsB')($scope.cur_Tier.ATT_XDSL_DSL_OPTION_PRICED,'x')) { //
if (!Recom_Service_Display && $filter('aContainsB')($scope.cur_Tier.ATT_XDSL_BANDWIDTH_PRICED,'x')) { //
if (Is_Recommendation ) {
SubTier_Display = true;
}
if (Tier_Display ) {
SubTier_Display = true;
}
Tier_Display = true;
ATT_ExtDSL_Display = true;
ATT_ExtDSL_Provider = $scope.cur_Tier.ATT_XDSL_SERVICE_TYPE;
var ATTExtDSLUpDownload = $filter('ATTExtDSLBandwidth')($scope.cur_Tier.ATT_XDSL_BANDWIDTH_PRICED);
ATT_ExtDSL_BW_Up = ATTExtDSLUpDownload.Broadband_Up;
ATT_ExtDSL_BW_Down = ATTExtDSLUpDownload.Broadband_Down;
//
var ExtraInstallCost = ($filter('emptyreturn0')($scope.cur_Tier.ATT_DSR_LEVEL_TWO_TECH_SUP)
+ $filter('emptyreturn0')($scope.cur_Tier.ATT_CONSOLIDATED_BILLING)
+ $filter('emptyreturn0')($scope.cur_Tier.ATT_DSR_BROADBAND_SER_PROV) );
//
var OneTimeCost = $filter('emptyreturn0')($scope.cur_Tier.ATT_XDSL_ACTIVATION_INSTALL_CHARGE)
+ $filter('emptyreturn0')($scope.cur_Tier.ATT_XDSL_OPT_PROF_INSTALL_CHARGE) + ExtraInstallCost;
ATT_ExtDSL_MonthlyCost = $filter('emptyreturn0')($scope.cur_Tier.ATT_XDSL_MONTHLY_CHARGE);
ATT_ExtDSL_OneTimeCost = OneTimeCost;
ATT_ExtDSL_Contract_Term_Month = $scope.cur_Tier.ATT_XDSL_MIN_CONTRACT_TERM;
ATT_ExtDSL_Early_Termination_Charge = $scope.cur_Tier.ATT_XDSL_EARLY_TERMINATION_CHARGE;
}
}
////// DSR AT&T EXTENDED CABLE SERVICE $scope.cur_Tier.ATT_XCABLE_SERVICE_TYPE + ' - ' + ATT_XCABLE_PROVIDER
ATT_ExtCable_Provider = $scope.cur_Tier.ATT_XCABLE_PROVIDER;
ATT_ExtCable_ServiceType = $scope.cur_Tier.ATT_XCABLE_SERVICE_TYPE;
if (ATT_ExtCable_Provider.length || ATT_ExtCable_ServiceType.length) {
Recom_Service_Display = false;
// 1st check Recommendation Provider and set RecommendationProvider for values
if (value == $scope.Recom_Tier) {
Is_Recommendation = true;
}
if (ATT_ExtCable_Provider.indexOf(Recommendation_Provider) != -1 && value == $scope.Recom_Tier) {
Recom_Service_Display = true;
Tier_Display = true;
tmp_Recom_Service_Provider = ATT_ExtCable_Provider;
Recom_Service_Contract_Term_Month = $scope.cur_Tier.ATT_XCABLE_MIN_CONTRACT_TERM;
Recom_Service_Early_Termination_Charge = $scope.cur_Tier.ATT_XCABLE_EARLY_TERMINATION_CHARGE;
}
// 2nd Use DSR Fields for Values
if (!Recom_Service_Display && $filter('aContainsB')($scope.cur_Tier.ATT_XCABLE_BW_PRICED,'x')) { //
if (Is_Recommendation ) {
SubTier_Display = true;
}
if (Tier_Display ) {
SubTier_Display = true;
}
Tier_Display = true;
ATT_ExtCable_Display = true;
ATT_ExtCable_Provider = $scope.cur_Tier.ATT_XCABLE_PROVIDER;
ATTExtCableUpDownload = $filter('ATTExtCableBandwidth')($scope.cur_Tier.ATT_XCABLE_BW_PRICED);
ATT_ExtCable_BW_Up = ATTExtCableUpDownload.Broadband_Up;
ATT_ExtCable_BW_Down = ATTExtCableUpDownload.Broadband_Down;
var ExtraInstallCost = ($filter('emptyreturn0')($scope.cur_Tier.ATT_DSR_LEVEL_TWO_TECH_SUP)
+ $filter('emptyreturn0')($scope.cur_Tier.ATT_CONSOLIDATED_BILLING)
+ $filter('emptyreturn0')($scope.cur_Tier.ATT_DSR_BROADBAND_SER_PROV) );
ATT_ExtCable_MonthlyCost = $filter('emptyreturn0')($scope.cur_Tier.ATT_XCABLE_MONTHLY_CHARGE);
ATT_ExtCable_OneTimeCost = $filter('emptyreturn0')($scope.cur_Tier.ATT_XCABLE_ACTIVATION_INSTALL_CHARGE) + ExtraInstallCost;
ATT_ExtCable_Contract_Term_Month = $scope.cur_Tier.ATT_XCABLE_MIN_CONTRACT_TERM;
ATT_ExtCable_Early_Termination_Charge = $scope.cur_Tier.ATT_XCABLE_EARLY_TERMINATION_CHARGE;
}
}
////// DSR CABLE SERVICE
Cable_Provider = $scope.cur_Tier.CABLE_PROVIDER;
if (Cable_Provider.length) {
Recom_Service_Display = false;
// 1st check Recommendation Provider and set RecommendationProvider for values
if (value == $scope.Recom_Tier) {
Is_Recommendation = true;
}
if (Cable_Provider.indexOf(Recommendation_Provider) != -1 && value == $scope.Recom_Tier) {
Recom_Service_Display = true;
Tier_Display = true;
tmp_Recom_Service_Provider = Cable_Provider;
Recom_Service_Contract_Term_Month = $scope.cur_Tier.CABLE_MIN_CONTRACT_TERM;
Recom_Service_Early_Termination_Charge = $scope.cur_Tier.CABLE_EARLY_TERMINATION_CHARGE;
}
// 2nd Use DSR Fields for Values
/*
!$filter('aContainsB')(CableBW,'no valid service found') && !$filter('aContainsB')(CableBW,'invalid') &&
!$filter('aContainsB')(CableBW,'cable pending') && !$filter('aContainsB')(CableBW,'international') &&
!$filter('aContainsB')(CableBW,'survey required') && !$filter('aContainsB')(CableBW,'no') && !$filter('aContainsB')(CableBW,'vyve')
*/
if (!Recom_Service_Display && $filter('aContainsB')($scope.cur_Tier.CABLE_BW_PRICED,'x') ) { //
if (Is_Recommendation ) {
SubTier_Display = true;
}
if (Tier_Display ) {
SubTier_Display = true;
}
Tier_Display = true;
Cable_Display = true;
var CableUpDownload = $filter('CableBandwidth')($scope.cur_Tier.CABLE_BW_PRICED);
Cable_BW_Up = CableUpDownload.Broadband_Up;
Cable_BW_Down = CableUpDownload.Broadband_Down;
//
var ExtraInstallCost = ($filter('emptyreturn0')($scope.cur_Tier.ATT_DSR_LEVEL_TWO_TECH_SUP)
+ $filter('emptyreturn0')($scope.cur_Tier.ATT_CONSOLIDATED_BILLING)
+ $filter('emptyreturn0')($scope.cur_Tier.ATT_DSR_BROADBAND_SER_PROV) );
Cable_MonthlyCost = ($scope.cur_Tier.CABLE_MONTHLY_CHARGE + $filter('emptyreturn0')($scope.cur_Tier.CABLE_CPE_MONTHLY_RENTAL_CHARGE));
Cable_OneTimeCost = ($filter('emptyreturn0')($scope.cur_Tier.CABLE_ACTIVATION_INSTALL_CHARGE)
+ $filter('emptyreturn0')($scope.cur_Tier.CABLE_CPE_ONE_TIME_PURCHASE_CHARGE) + ExtraInstallCost);
Cable_Contract_Term_Month = $scope.cur_Tier.CABLE_MIN_CONTRACT_TERM;
Cable_Early_Termination_Charge = $scope.cur_Tier.CABLE_EARLY_TERMINATION_CHARGE;
}
}
////// DSR ILEC SERVICE
ILEC_SERVICE_TYPE = $scope.cur_Tier.ILEC_SERVICE_TYPE;
if (ILEC_SERVICE_TYPE.length ) { // && $scope.ILEC_SERVICE_TYPE
Recom_Service_Display = false;
// 1st check Recommendation Provider and set RecommendationProvider for values
//
if ( value == $scope.Recom_Tier ) {
Is_Recommendation = true;
}
if ( $scope.cur_Tier.ILEC_PROVIDER.indexOf(Recommendation_Provider) != -1 && value == $scope.Recom_Tier) {
Recom_Service_Display = true;
Tier_Display = true;
tmp_Recom_Service_Provider = $scope.cur_Tier.ILEC_PROVIDER + ' - ' + $scope.cur_Tier.ILEC_SERVICE_TYPE;
Recom_Service_Contract_Term_Month = $scope.cur_Tier.ILEC_MIN_CONTRACT_TERM;
Recom_Service_Early_Termination_Charge = $scope.cur_Tier.ILEC_EARLY_TERMINATION_CHARGE;
}
/*!$filter('aContainsB')(ILECBW,'no valid service found') && !$filter('aContainsB')(ILECBW,'invalid address or phone') &&
!$filter('aContainsB')(ILECBW,'lec pending') && !$filter('aContainsB')(ILECBW,'international')*/
// 2nd Use DSR Fields for Values
if (!Recom_Service_Display && $filter('aContainsB')($scope.cur_Tier.ILEC_BW_PRICED,'x')) {
if (Is_Recommendation ) {
SubTier_Display = true;
}
if (Tier_Display ) {
SubTier_Display = true;
}
Tier_Display = true;
ILEC_Display = true;
ILEC_DSL_Provider = $scope.cur_Tier.ILEC_PROVIDER + ' - ' + $scope.cur_Tier.ILEC_SERVICE_TYPE;
ILECUpDownload = $filter('ILECBandwidth')($scope.cur_Tier.ILEC_BW_PRICED);
ILEC_BW_Up = ILECUpDownload.Broadband_Up;
ILEC_BW_Down = ILECUpDownload.Broadband_Down;
var ExtraInstallCost = ($filter('emptyreturn0')($scope.cur_Tier.ATT_DSR_LEVEL_TWO_TECH_SUP)
+ $filter('emptyreturn0')($scope.cur_Tier.ATT_CONSOLIDATED_BILLING)
+ $filter('emptyreturn0')($scope.cur_Tier.ATT_DSR_BROADBAND_SER_PROV) );
ILEC_MonthlyCost = ($filter('emptyreturn0')($scope.cur_Tier.ILEC_MONTHLY_CHARGE)
+ $filter('emptyreturn0')($scope.cur_Tier.ILEC_CPE_MONTHLY_RENTAL_CHARGE));
ILEC_OneTimeCost = ($filter('emptyreturn0')($scope.cur_Tier.ILEC_ACTIVATION_INSTALL_CHARGE)
+ $filter('emptyreturn0')($scope.cur_Tier.ILEC_CPE_ONE_TIME_PURCHASE_CHARGE)
+ $filter('emptyreturn0')($scope.cur_Tier.ILEC_OPT_PROF_INSTALL_CHARGE)
+ ExtraInstallCost);
ILEC_Contract_Term_Month = $scope.cur_Tier.ILEC_MIN_CONTRACT_TERM;
ILEC_Early_Termination_Charge = $scope.cur_Tier.ILEC_EARLY_TERMINATION_CHARGE;
}
}
// Recom_Service_Display tmp_Recom_Service_Provider
///////// Is_Recommendation
if ((angular.isObject($scope.dsr_Recommendation) && value == $scope.Recom_Tier )) {
Tier_Display = true;
Recom_RecommendationProvider = true;
Recom_Service_Display = true;
Recom_Service_Provider = Recommendation_Provider;
Recom_Service_BW_Up = Recommendation_Up;
Recom_Service_BW_Down = Recommendation_Down;
Recom_Service_MonthlyCost = Recommendation_MonthlyCost;
Recom_Service_OneTimeCost = Recommendation_OneTimeCost;
Recom_Service_Contract_Term_Month = Recom_Service_Contract_Term_Month;
Recom_Service_Early_Termination_Charge = Recom_Service_Early_Termination_Charge;
}
if (!Recom_RecommendationProvider && Recom_Service_Display) {
Recom_RecommendationProvider = true;
}
else if (!Recom_RecommendationProvider && ATT_Service_Display ) {
ATT_RecommendationProvider = true;
}
else if (!Recom_RecommendationProvider && ATT_ExtDSL_Display) {
ExtDSL_RecommendationProvider = true;
}
else if (!Recom_RecommendationProvider && ATT_ExtCable_Display) {
ExtCable_RecommendationProvider = true;
}
else if (!Recom_RecommendationProvider && Cable_Display) {
Cable_RecommendationProvider = true;
}
else if (!Recom_RecommendationProvider && ILEC_Display) {
ILEC_RecommendationProvider = true;
}
} catch(e) {
$log.wifiError($exceptionHandler(e));
}
/////////////////////////////////////
var TierData = {
"TierDisplay":Tier_Display,
"SubTierDisplay":SubTier_Display,
"RecommendationProvider": {
"Tier":value,
"Circuit_Display":Recom_Service_Display,
"RecommendationProvider":Recom_RecommendationProvider,
"Service_Type":"AT&T Recommendation Provider",
"Service_Provider":Recom_Service_Provider,
"Service_BW_Up":Recom_Service_BW_Up,
"Service_BW_Down":Recom_Service_BW_Down,
"Service_MonthlyCost":Recom_Service_MonthlyCost,
"Service_OneTimeCost":Recom_Service_OneTimeCost,
"Service_Contract_Term_Month":Recom_Service_Contract_Term_Month,
"Service_Early_Termination_Charge":Recom_Service_Early_Termination_Charge,
"Tier_Option":""
},
"ATT_Service": {
"Tier":value,
"Circuit_Display":ATT_Service_Display,
"RecommendationProvider":ATT_RecommendationProvider,
"Service_Type":"AT&T Service",
"Service_Provider":ATT_Service_Provider,
"Service_BW_Up":ATT_Service_BW_Up,
"Service_BW_Down":ATT_Service_BW_Down,
"Service_MonthlyCost":ATT_Service_MonthlyCost,
"Service_OneTimeCost":ATT_Service_OneTimeCost,
"Service_Contract_Term_Month":ATT_Service_Contract_Term_Month,
"Service_Early_Termination_Charge":ATT_Service_Early_Termination_Charge,
"Tier_Option":""
},
"ATT_Extended_DSL_Service":{
"Tier":value,
"Circuit_Display":ATT_ExtDSL_Display,
"RecommendationProvider":ExtDSL_RecommendationProvider,
"Service_Type":"AT&T Extended DSL Service",
"Service_Provider":ATT_ExtDSL_Provider,
"Service_BW_Up":ATT_ExtDSL_BW_Up,
"Service_BW_Down":ATT_ExtDSL_BW_Down,
"Service_MonthlyCost":ATT_ExtDSL_MonthlyCost,
"Service_OneTimeCost":ATT_ExtDSL_OneTimeCost,
"Service_Contract_Term_Month":ATT_ExtDSL_Contract_Term_Month,
"Service_Early_Termination_Charge":ATT_ExtDSL_Early_Termination_Charge,
"Tier_Option":""
},
"ATT_Extended_Cable_Service": {
"Tier":value,
"Circuit_Display":ATT_ExtCable_Display,
"RecommendationProvider":ExtCable_RecommendationProvider,
"Service_Type":"AT&T Extended Cable Service",
"Service_Provider":ATT_ExtCable_Provider,
"Service_BW_Up":ATT_ExtCable_BW_Up,
"Service_BW_Down":ATT_ExtCable_BW_Down,
"Service_MonthlyCost":ATT_ExtCable_MonthlyCost,
"Service_OneTimeCost":ATT_ExtCable_OneTimeCost,
"Service_Contract_Term_Month":ATT_ExtCable_Contract_Term_Month,
"Service_Early_Termination_Charge":ATT_ExtCable_Early_Termination_Charge,
"Tier_Option":""
},
"Cable_Service":{
"Tier":value,
"Circuit_Display":Cable_Display,
"RecommendationProvider":Cable_RecommendationProvider,
"Service_Type":"Cable Service",
"Service_Provider":Cable_Provider,
"Service_BW_Up":Cable_BW_Up,
"Service_BW_Down":Cable_BW_Down,
"Service_MonthlyCost":Cable_MonthlyCost,
"Service_OneTimeCost":Cable_OneTimeCost,
"Service_Contract_Term_Month":Cable_Contract_Term_Month,
"Service_Early_Termination_Charge":Cable_Early_Termination_Charge,
"Tier_Option":""
},
"ILEC_DSL_Service":{
"Tier":value,
"Circuit_Display":ILEC_Display,
"RecommendationProvider":ILEC_RecommendationProvider,
"Service_Type":"ILEC DSL Service",
"Service_Provider":ILEC_DSL_Provider,
"Service_BW_Up":ILEC_BW_Up,
"Service_BW_Down":ILEC_BW_Down,
"Service_MonthlyCost":ILEC_MonthlyCost,
"Service_OneTimeCost":ILEC_OneTimeCost,
"Service_Contract_Term_Month":ILEC_Contract_Term_Month,
"Service_Early_Termination_Charge":ILEC_Early_Termination_Charge,
"Tier_Option":""
}
};
/////////////////
switch (value) {
case 1:
var DSR_tier = {
"Tier1" : TierData
};
break;
case 2:
var DSR_tier = {
"Tier2" : TierData
};
break;
case 3:
var DSR_tier = {
"Tier3" : TierData
};
break;
}
$scope.DSR_Circuit.DSRCircuits.push(DSR_tier);
});
// console.log($scope.DSR_Circuit.DSRCircuits);
/// empty DSR object ///////////////
$scope.IsDSR_data = true;
angular.forEach($scope.DSR_Circuit.DSRCircuits, function(dsr){
angular.forEach(dsr, function(tier){
$scope.IsDSR_data = tier.TierDisplay;
});
});
if (!$scope.IsDSR_data) {
$scope.HasPreQual = false;
}
if (!$scope.HasPreQual) {
$scope.ShowPreQual = true;
}
//
$scope.ones = ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"]
angular.forEach($scope.DSR_Circuit.DSRCircuits, function(dsr){
var tmp_ct = 0;
angular.forEach(dsr, function(tier, key){
if (tier.SubTierDisplay) {
if (!tier.ATT_Service.RecommendationProvider && tier.ATT_Service.Circuit_Display) {
tmp_ct = tmp_ct + 1;
tier.ATT_Service.Tier_Option = $scope.ones[tmp_ct];
}
if (!tier.ATT_Extended_DSL_Service.RecommendationProvider && tier.ATT_Extended_DSL_Service.Circuit_Display) {
tmp_ct = tmp_ct + 1;
tier.ATT_Extended_DSL_Service.Tier_Option = $scope.ones[tmp_ct];
}
if (!tier.ATT_Extended_Cable_Service.RecommendationProvider && tier.ATT_Extended_Cable_Service.Circuit_Display) {
tmp_ct = tmp_ct + 1;
tier.ATT_Extended_Cable_Service.Tier_Option = $scope.ones[tmp_ct];
}
if (!tier.Cable_Service.RecommendationProvider && tier.Cable_Service.Circuit_Display) {
tmp_ct = tmp_ct + 1;
tier.Cable_Service.Tier_Option = $scope.ones[tmp_ct];
}
if (!tier.ILEC_DSL_Service.RecommendationProvider && tier.ILEC_DSL_Service.Circuit_Display) {
tmp_ct = tmp_ct + 1;
tier.ILEC_DSL_Service.Tier_Option = $scope.ones[tmp_ct];
}
};
});
});
}
/// End HasPreQual
/// Set Default for Form values and warning //
$scope.showCircuitWarning = false;
$scope.showMultCirWarning = false;
$scope.showOwCirProvWarning = false;
$scope.showOwSecCirProvWarning = false;
$scope.showSelCirWarning = false;
$scope.ShowCircuit2Option = false;
$scope.ShowSecondProvider = false;
$scope.Circuit1Option = false;
$scope.Circuit1_data = '';
$scope.Circuit2_data = '';
///////////////////////////////////
// Toggle Add Circuit
$scope.CircuitVisible = false;
$scope.OwnerCircuitVisible = false;
$scope.ShowCircuit = function (value) {
if ($scope.HasPreQual) {
$scope.CircuitVisible = value == true;
$scope.showCircuitWarning = false;
}
else {
// $scope.ShowPreQual = value == true;
}
$scope.OwnerCircuitVisible = value == false;
}
// Default Values
$scope.provideCircuit = 1;
$scope.ShowCircuit(true);
// Toggle Add Additional Circuit
$scope.Circuit2Toggle = true;
$scope.$watch('Circuit2Toggle', function(){
$scope.Circuit2ToggleText = 'Add an Optional Second broadband'; //$scope.Circuit2Toggle ? '+Add an Optional Second broadband' : '-Add an Optional Second broadband';
})
$scope.showMultCircuit = function(ic) {
$scope.showMultCirWarning = false;
//console.log(ic);
if (ic) {
$scope.ShowSecondProvider = true;
}
else {
$scope.ShowSecondProvider = false;
}
}
$scope.showOwnerProvider = function() {
$scope.showOwCirProvWarning = false;
}
//showOwnerSecondProvider
$scope.showOwnerSecondProvider = function() {
$scope.showOwSecCirProvWarning = false;
}
///////////////////////////////////
///////////////////////////////////
$scope.loadCircuit = function (ic){
incoming_Data = ic.tier;
$scope.showSelCirWarning = false;
$scope.ShowCircuit2Option = true;
$scope.Circuit1Option = true;
$scope.Circuit1_data = {
"CircuitOrdered":1,
"PreQual":$scope.HasPreQual,
"OwnerProvideCircuit": "No",
"CircuitTier":incoming_Data.Tier,
"CircuitType":incoming_Data.Service_Type,
"CircuitProvider":incoming_Data.Service_Provider,
"UploadSpeed":incoming_Data.Service_BW_Up,
"DownloadSpeed":incoming_Data.Service_BW_Down,
"CircuitMonthlyCost":incoming_Data.Service_MonthlyCost,
"CircuitOneTimeCost":incoming_Data.Service_OneTimeCost,
"CommitmentPeriod":incoming_Data.Service_Contract_Term_Month,
"Termination_Charge":incoming_Data.Service_Early_Termination_Charge,
"IPPreference":"dynamic",
"RecommendationProvider":incoming_Data.RecommendationProvider
}
//
$scope.Circuit1.ServiceType = incoming_Data.Service_Type;
$scope.Circuit1.CircuitTier = incoming_Data.Tier;
//console.log($scope.Circuit1_data);
}
/////// Circuit 2
$scope.loadCircuit2 = function (ic){
incoming_Data = ic.tier;
$scope.Circuit2_data = {
"CircuitOrdered":2,
"PreQual":$scope.HasPreQual,
"OwnerProvideCircuit": "No",
"CircuitTier":incoming_Data.Tier,
"CircuitType":incoming_Data.Service_Type,
"CircuitProvider":incoming_Data.Service_Provider,
"UploadSpeed":incoming_Data.Service_BW_Up,
"DownloadSpeed":incoming_Data.Service_BW_Down,
"CircuitMonthlyCost":incoming_Data.Service_MonthlyCost,
"CircuitOneTimeCost":incoming_Data.Service_OneTimeCost,
"CommitmentPeriod":incoming_Data.Service_Contract_Term_Month,
"Termination_Charge":incoming_Data.Service_Early_Termination_Charge,
"IPPreference":"dynamic",
"RecommendationProvider":incoming_Data.RecommendationProvider
}
//console.log($scope.Circuit2_data);
}
///////////////////////////////////
if ($scope.VenueInOrder){
var checkCC = $scope.dsrOrdered[0].OwnerProvideCircuit == 'Yes' ? 0 : 1;
var checkTrue = $scope.dsrOrdered[0].OwnerProvideCircuit == 'Yes' ? false : true;
$scope.provideCircuit = checkCC;
$scope.ShowCircuit(checkTrue);
$scope.Circuit2Toggle = true;
$scope.ShowCircuit2Option = true;
$scope.Circuit1Option = true;
if (checkTrue){
$scope.Circuit1 = {
ServiceType:$scope.dsrOrdered[0].CircuitType,
ServiceTier:$scope.dsrOrdered[0].CircuitTier
}
if (!$scope.dsrOrdered[0].RecommendationProvider) {
$scope.Div_1[$scope.dsrOrdered[0].CircuitTier] = true;
}
if ($scope.dsrOrdered.length > 1) {
$scope.Circuit2Toggle = false;
$scope.Circuit2 = {
ServiceType:$scope.dsrOrdered[1].CircuitType,
ServiceTier:$scope.dsrOrdered[1].CircuitTier
}
if (!$scope.dsrOrdered[1].RecommendationProvider) {
$scope.Div_2[$scope.dsrOrdered[1].CircuitTier] = true;
}
$scope.ToggleCircuit = {
show_Circuit2:true
}
}
}
else {
$scope.multipleCircuit = $scope.dsrOrdered[0].MultipleCircuits;
$scope.OwnerCircuit_provider = $scope.dsrOrdered[0].OwnerCircuitProvider;
if (parseInt($scope.multipleCircuit) === 1){
$scope.ShowSecondProvider = true;
$scope.OwnerSecondCircuit_provider = $scope.dsrOrdered[0].OwnerSecondCircuitProvider;
}
}
}
else {
$scope.OwnerCircuit_provider = '';
$scope.OwnerSecondCircuit_provider = '';
$scope.Circuit1 = {
ServiceType:'',
ServiceTier:''
}
$scope.Circuit2 = {
ServiceType:'',
ServiceTier:''
}
$scope.ToggleCircuit = {
show_Circuit2:''
}
}
//// Check Form to Submit ////////////////////////////////////////////////////////////
$scope.CheckForm = function() {
processform = true;
if ($scope.ComcastVisible) {
processform = false;
}
else {
// provide own Circuit parseInt(curcuit_provider) === 0 == 'Yes' ? false : true;
if (parseInt($scope.provideCircuit) === 0) {
multiple_Circuit = $scope.circuitForm.multipleCircuit.$viewValue;
OwnerCircuit_provider = $scope.circuitForm.OwnerCircuit_provider.$viewValue;
OwnerSecondCircuit_provider = $scope.circuitForm.OwnerSecondCircuit_provider.$viewValue;
// No
if ( parseInt(multiple_Circuit) === 0 ) {
if (OwnerCircuit_provider.length >= 2 ) {
processform = false;
}
}
// Yes
else if ( parseInt(multiple_Circuit) === 1 ) {
if (OwnerCircuit_provider.length >= 2 && typeof OwnerSecondCircuit_provider != "undefined") {
if (OwnerSecondCircuit_provider.length >= 2){
processform = false;
}
}
}
}
// order a new Curcuitparse Int(curcuit_provider) === 1
else if ( parseInt($scope.provideCircuit) === 1 ) {
if ($scope.HasPreQual) {
if ($scope.Circuit1Option) {
processform = false;
}
}
else {
processform = false;
}
}
}
return processform;
};
////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////
// Save Button $scope.circuitForm.provideCircuit.$modelValue
$scope.openOrderSummary = function (v_id) {
$scope.selectedVenue = parseInt(v_id);
curcuit_provider = $scope.provideCircuit;
submit_form = false;
if ($scope.ComcastVisible) {
submit_form = true;
}
else {
if (typeof curcuit_provider === "undefined") {
$scope.showCircuitWarning = true;
}
// provide own Circuit parseInt(curcuit_provider) === 0 == 'Yes' ? false : true;
else if (parseInt(curcuit_provider) === 0) {
multiple_Circuit_q = $scope.circuitForm.multipleCircuit.$viewValue;
OwnerCircuit_provider_q = $scope.circuitForm.OwnerCircuit_provider.$viewValue;
OwnerSecondCircuit_provider_q = $scope.circuitForm.OwnerSecondCircuit_provider.$viewValue;
if (typeof multiple_Circuit_q === "undefined") {
$scope.showMultCirWarning = true;
}
else if (typeof OwnerCircuit_provider_q === "undefined" || OwnerCircuit_provider_q.length === 0 ) {
$scope.showOwCirProvWarning = true;
}
else if ( parseInt(multiple_Circuit_q) === 1 ) {
if (typeof OwnerSecondCircuit_provider_q === "undefined" || OwnerSecondCircuit_provider_q.length === 0 ) {
$scope.showOwSecCirProvWarning = true;
}
else {
submit_form = true;
}
}
else {
submit_form = true;
}
}
// order a new Curcuitparse Int(curcuit_provider) === 1
else if ( parseInt(curcuit_provider) === 1 ) {
if ($scope.HasPreQual) {
if (!$scope.Circuit1Option) {
$scope.showSelCirWarning = true;
}
else {
submit_form = true;
}
}
else {
submit_form = true;
}
}
}
////////////////////
if (submit_form) {
$scope.loading = true;
angular.forEach($rootScope.orderRequest.FranchiseeOrdering.venues, function(venue){
if ( $scope.selectedVenue === parseInt(venue.venueId) ) {
if ($scope.VenueInOrder){
venue.DSR = [];
}
// Add Circuit to Order parseInt(curcuit_provider) === 1
if ($scope.ComcastVisible) {
$scope.ComcastVisible_data = {
"CircuitOrdered":1,
"ComcastPreQual":$scope.ComcastVisible,
"PreQual":$scope.HasPreQual,
"OwnerProvideCircuit": "No",
"MultipleCircuits": "",
"OwnerCircuitProvider": "",
"UploadSpeed":"",
"DownloadSpeed":"",
"CircuitProvider":"Comcast",
"CircuitTier":"",
"CircuitType":"",
"CircuitMonthlyCost":"8.00",
"CircuitOneTimeCost":"55.00",
"CommitmentPeriod":"",
"Termination_Charge":"",
"IPPreference":""
}
venue.DSR.push($scope.ComcastVisible_data);
}
else {
// typeof curcuit_provider != "undefined" &&
if (parseInt(curcuit_provider) === 1 ) {
if ($scope.HasPreQual) {
if ($scope.VenueInOrder){
if ( angular.isObject($scope.Circuit1_data) ) {
venue.DSR.push($scope.Circuit1_data);
}
else {
venue.DSR.push($scope.dsrOrdered[0]);
}
// //
if (!$scope.Circuit2Toggle) {
if ( angular.isObject($scope.Circuit2_data) ) {
venue.DSR.push($scope.Circuit2_data);
}
else {
if ($scope.dsrOrdered.length > 1) {
venue.DSR.push($scope.dsrOrdered[1]);
}
}
}
}
else {
if ( angular.isObject($scope.Circuit1_data) ) {
venue.DSR.push($scope.Circuit1_data);
}
// //
if ( angular.isObject($scope.Circuit2_data) ) {
venue.DSR.push($scope.Circuit2_data);
}
}
}
else {
$scope.NoHasPreQual_data = {
"CircuitOrdered":1,
"PreQual":$scope.HasPreQual,
"OwnerProvideCircuit": "No",
"MultipleCircuits": "",
"OwnerCircuitProvider": "",
"UploadSpeed":"",
"DownloadSpeed":"",
"CircuitProvider":"",
"CircuitTier":"",
"CircuitType":"",
"CircuitMonthlyCost":"",
"CircuitOneTimeCost":"",
"CommitmentPeriod":"",
"Termination_Charge":"",
"IPPreference":""
}
venue.DSR.push($scope.NoHasPreQual_data);
}
}
// Add Onwer Provided Circuit OwnerCircuit_provider_q multiple_Circuit_q parseInt(curcuit_provider) === 0
else if ( parseInt(curcuit_provider) === 0 ) {
if (OwnerSecondCircuit_provider_q === "undefined") {
OwnerSecondCircuit_provider = "";
}
else {
OwnerSecondCircuit_provider = OwnerSecondCircuit_provider_q;
}
$scope.OwnerCircuit_data = {
"CircuitOrdered":1,
"PreQual":$scope.HasPreQual,
"OwnerProvideCircuit": "Yes",
"MultipleCircuits": multiple_Circuit_q,
"OwnerCircuitProvider": OwnerCircuit_provider_q,
"OwnerSecondCircuitProvider": OwnerSecondCircuit_provider,
"CircuitMonthlyCost":"8.00",
"CircuitOneTimeCost":"55.00",
"UploadSpeed":"",
"DownloadSpeed":"",
"CircuitProvider":"",
"CircuitTier":"",
"CircuitType":"",
"CommitmentPeriod":"",
"Termination_Charge":"",
"IPPreference":""
}
venue.DSR.push($scope.OwnerCircuit_data);
}
}
}
});
// Update Windows SessionStorage with current order
sessionStorage.setItem('CustomerWiFI_Order',JSON.stringify($rootScope.orderRequest));
//Update SFDC
ATTWiFiOrderingClass.setOrderState(JSON.stringify($rootScope.orderRequest), function(result, status){});
$location.path("OrderSummary/");
}
};
})
// End venueCircuitController ///////////////////////////////
/////////////////////////////////
// orderSummaryController
.controller('orderSummaryController', function ($rootScope, $scope, $location, $routeParams, $uibModal, $log, $filter, $analytics) {
//@TODO:Moving this code to config object
$scope.loading = true;
ATTWiFiOrderingClass.getCurrentUserName(function(result, status){
$scope.$evalAsync(function () {
$scope.id = result.body[0].Id;
if($scope.id==null || $scope.id==="undefined" || result.body[0].FirstName==='ATTWiFiUpgradeOrdering' ){
$rootScope.orderRequest = '';
if($rootScope.brandId==null || $rootScope.brandId==="undefined"){
$rootScope.brandId='001600000lzkAb';
}
$location.path('/ProductOverview/'+$rootScope.brandId);
}
})
ATTWiFiOrderingClass.getUserInfo('001600000lzkAb', null, function(result, status) {
$scope.$evalAsync(function() {
$scope.loading = false;
var response = JSON.parse($filter('escapeCharacters')(result)); //JSON.parse(result.replace(/"/g, '"').replace(/&/g, '&'));
$rootScope.mcdInputData.venues = response.venues;
sessionStorage.setItem('mcdInputDatavenues', JSON.stringify($rootScope.mcdInputData.venues));
})
})
});
////
$scope.wait = function () {
$scope.loading = true;
setTimeout(function() {
$scope.loading = false;
}, 1000);
};
$scope.Service_Grandtotal_Month = 0;
$scope.getStaticAgreement = function ( filename ) {
Object.freeze(filename);
ATTWiFiOrderingContractService.fetchAgreementAttachmentByFileName(filename, function(result, status){
if (window.navigator && window.navigator.msSaveOrOpenBlob ) {
var byteCharacters = atob(result.content);
var byteNumbers = new Array(byteCharacters.length);
for (var i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
var blob = new Blob([byteArray], {type: 'application/pdf'});
window.navigator.msSaveOrOpenBlob(blob, filename);
}else if (window.navigator.userAgent.indexOf('iPad')!= -1 || window.navigator.userAgent.indexOf('iPhone')!= -1) { //Safari & Opera iOS
var byteCharacters = atob(result.content);
var byteNumbers = new Array(byteCharacters.length);
for (var i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
var blob = new Blob([byteArray], {type: 'application/pdf'});
var url = window.URL.createObjectURL(blob);
window.location.href = url;
}
else {
var pdfAsDataUri = "data:application/pdf;base64," + result.content;
var win = window.open();
win.document.write('');
}
});
};
$scope.getDynamicAgreement = function ( filename , contractId ) {
var fname = filename;
filename=filename.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, "'").replace(/>/g, '>').replace(/</g, '<');
$scope.filename = filename;
var fetchObj = {
fname: fname,
filename :encodeURI(filename),
contractId : contractId,
franchiseeId :$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_ID
}
Object.freeze(fetchObj);
ATTWiFiOrderingContractService.fetchAgreementAttachment(fetchObj.filename, fetchObj.contractId, fetchObj.franchiseeId, fetchObj.fname,$rootScope.orderRequest.currentUserContactId, function(result, status){
//Display PDF
if (window.navigator && window.navigator.msSaveOrOpenBlob ) {
var byteCharacters = atob(result.content);
var byteNumbers = new Array(byteCharacters.length);
for (var i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
var blob = new Blob([byteArray], {type: 'application/pdf'});
window.navigator.msSaveOrOpenBlob(blob, filename);
}else if (window.navigator.userAgent.indexOf('iPad')!= -1 || window.navigator.userAgent.indexOf('iPhone')!= -1) { //Safari & Opera iOS
var byteCharacters = atob(result.content);
var byteNumbers = new Array(byteCharacters.length);
for (var i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
var blob = new Blob([byteArray], {type: 'application/pdf'});
var url = window.URL.createObjectURL(blob);
window.location.href = url;
}
else if(status.result.status =="Invalid Input Parameters"){
alert(status.result.status);
}else if(status.result.status =="File Not Found"){
alert(status.result.status);
}
else {
var pdfAsDataUri = "data:application/pdf;base64," + result.content;
var win = window.open();
win.document.write('');
}
});
};
/////////////////////////////////////
$scope.openVenueSummaryModal = function (size) {
//$scope.loading = true;
var modalInstance = $uibModal.open({
animation: true,
templateUrl: '/ATTWiFiUpgradeOrdering/wifiOrd_VenuesOverview_html',
controller: 'VenuesOverviewController',
size: size,
scope: $scope,
keyboard: false,
backdrop: 'static',
//windowClass: 'venueListModal',
resolve: {}
});
modalInstance.result.then(function (selectedVenue) {
//Go to the front so that the user can see the venue that they just added
$scope.currentPage = 1;
}, function () {
$scope.loading = false;
$log.info('Modal dismissed at: ' + new Date());
});
};
//x - button / close button
$scope.close = function (){
$scope.loading = false;
$scope.modalInstance.dismiss('cancel');
};
/*print function */
$scope.printForm = function () {
var innerContents = document.getElementById('page_container').outerHTML;
var popupWinindow = window.open('', '_blank', 'width=900,height=1000,scrollbars=no,menubar=no,toolbar=no,location=no,status=no,titlebar=no');
popupWinindow.document.open();
popupWinindow.document.write('' + innerContents + '');
popupWinindow.document.close();
};
/* END print function */
/* function */
$scope.initOrderConfirmation = function ( path ) {
document.getElementById("header_logo_link").href="/ATTWiFiUpgradeOrdering#/ProductOverview/"+$rootScope.brandId;
ATTWiFiOrderingClass.getOrderState(function(result, status){
$scope.$evalAsync(function () {
$rootScope.orderRequest = JSON.parse($filter('escapeCharacters')(result)); //JSON.parse(result.replace(/"/g, '"').replace(/&/g, '&'));
console.log($rootScope.orderRequest);
});
});
};
$scope.placeAnotherOrder = function () {
$location.path('/ProductOverview/'+$rootScope.brandId);
};
//Back button
$scope.goback = function () {
$location.path('/OrderForm');
};
/* End function */
$scope.CurrentOrder = $rootScope.orderRequest.FranchiseeOrdering;
// console.log(JSON.stringify($rootScope.orderRequest.FranchiseeOrdering));
$scope.CurrentOrder = $rootScope.orderRequest.FranchiseeOrdering;
$scope.ServiceOptions = order_Services.serviceOptions;
$scope.OptionalEquipment = order_Services.OptionalEquipment;
// If no Venue in Order redirect user back to OrderForm
if (!$scope.CurrentOrder.venues.length) {
$location.path('/OrderForm/');
}
//
// console.log(JSON.stringify($scope.CurrentOrder));
// console.log($rootScope.orderRequest.FranchiseeOrdering);
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
Equipment_Total_NRC = 0;
Equipment_Total_MRC = 0;
Circuit_Total_NRC = 0;
Circuit_Total_MRC = 0;
$scope.Venues_Ordered = [];
angular.forEach($scope.CurrentOrder.venues, function(venue){
v_OptionalEquipment_Total_Equipment = 0;
v_OptionalEquipment_Total_NHr_NRC = 0;
v_OptionalEquipment_Total_AHr_NRC = 0;
v_OptionalEquipment_Total_MRC = 0;
v_SpareEquipment_Total_Equipment = 0;
v_SpareEquipment_Total_MRC = 0;
v_VenueQuestionnaire_Total_AHr_NRC = 0;
v_MobilityMRC_Total_MRC = 0;
v_Circuit_Total_Equipment = 0;
v_Circuit_Total_MRC = 0;
service_Package = '';
// Packages
if (venue.PackageOption.PackageName == 'Site Survey') {
service_Package = {
"DisplayName":venue.PackageOption.PackageName,
"NRC_After_Total":$filter('emptyreturn0')(venue.PackageOption.Equipment_Total),
"MRC_Total":0
};
Equipment_Total_NRC = Equipment_Total_NRC + $filter('emptyreturn0')(venue.PackageOption.Equipment_Total);
}
else {
service_Package = {
"DisplayName":venue.PackageOption.PackageName,
"Brand_ID":venue.PackageOption.Brand_ID,
"Equipment_Total":$filter('emptyreturn0')(venue.PackageOption.Equipment_Total),
"NRC_Day_Total":$filter('emptyreturn0')(venue.PackageOption.NRC_Day_Install),
"NRC_After_Total":$filter('emptyreturn0')(venue.PackageOption.NRC_Total),
"MRC_Total":$filter('emptyreturn0')(venue.PackageOption.MRC_Total)
}
Equipment_Total_NRC = Equipment_Total_NRC +
($filter('emptyreturn0')(venue.PackageOption.NRC_Total) + $filter('emptyreturn0')(venue.PackageOption.Equipment_Total));
Equipment_Total_MRC = Equipment_Total_MRC + $filter('emptyreturn0')(venue.PackageOption.MRC_Total);
tmp_array = [];
tmpObj = '';
angular.forEach(venue.PackageOption.Equipment, function(package_opt){
if (package_opt.EquipmentType == "Equipment") {
cur_equ = {
"EquipmentType":package_opt.EquipmentType,
"DisplayName":package_opt.DisplayName,
"Description":package_opt.Description,
"Quantity":package_opt.Quantity,
"Charge":$filter('emptyreturn0')(package_opt.Charge)
}
tmp_array.push(cur_equ);
}
});
service_Package.Equipment = tmp_array;
}
// End Packages
Optional_Equipment = [];
if (venue.OptionalEquipment.length) {
// Optional Equipment
tmpObj = '';
angular.forEach(venue.OptionalEquipment, function(opteq){
if (opteq.EquipmentType == "Equipment") {
Order_AppID = parseInt(opteq.AppID);
angular.forEach($scope.OptionalEquipment, function(Orig_eq){
Orig_AppID = parseInt(Orig_eq.AppID);
if (Order_AppID == Orig_AppID) {
tmpObj = Orig_eq;
}
});
tmpcharges = '';
angular.forEach(tmpObj.Charges, function(g_charges){
if (g_charges.ChargeType == "Install") {
tmpcharges = g_charges;
}
});
//
EquipmentCharge = $filter('emptyreturn0')(opteq.Charge) * opteq.Quantity;
NRC_DayCharge = $filter('emptyreturn0')(tmpcharges.MultiDeviceInstallation) * opteq.Quantity;
NRC_AfterCharge = $filter('emptyreturn0')(tmpcharges.AfterBusinessHours) * opteq.Quantity;
MRC_Charge = 0;
angular.forEach(venue.OptionalEquipment, function(mrc_eq){
if (mrc_eq.AppID == opteq.AppID) {
if (mrc_eq.EquipmentType == "MRC") {
MRC_Charge = $filter('emptyreturn0')(mrc_eq.Charge) * opteq.Quantity;
}
}
});
Item_OE = {
"DisplayName":opteq.DisplayName,
"Quantity":opteq.Quantity,
"Equipment_Total":EquipmentCharge,
"NRC_Day_Total":NRC_DayCharge,
"NRC_After_Total":NRC_AfterCharge,
"MRC_Total":MRC_Charge
}
Optional_Equipment.push(Item_OE);
v_OptionalEquipment_Total_Equipment = v_OptionalEquipment_Total_Equipment + EquipmentCharge;
v_OptionalEquipment_Total_NHr_NRC = v_OptionalEquipment_Total_NHr_NRC + NRC_DayCharge;
v_OptionalEquipment_Total_AHr_NRC = v_OptionalEquipment_Total_AHr_NRC + NRC_AfterCharge;
v_OptionalEquipment_Total_MRC = v_OptionalEquipment_Total_MRC + MRC_Charge;
Equipment_Total_NRC = Equipment_Total_NRC + (EquipmentCharge + NRC_AfterCharge);
Equipment_Total_MRC = Equipment_Total_MRC + MRC_Charge;
}
});
Optional_Equipment.Equipment_Total = parseFloat(v_OptionalEquipment_Total_Equipment);
Optional_Equipment.NHr_NRC_Total = parseFloat(v_OptionalEquipment_Total_NHr_NRC);
Optional_Equipment.AHr_NRC_Total = parseFloat(v_OptionalEquipment_Total_AHr_NRC);
Optional_Equipment.MRC_Total = parseFloat(v_OptionalEquipment_Total_MRC);
// Optional Equipment
}
// Spare Equipment
Spare_Equipment = [];
if (venue.SpareEquipment.length) {
angular.forEach(venue.SpareEquipment, function(sp_eq){
if (sp_eq.EquipmentType == 'Equipment') {
top_appID = sp_eq.AppID;
angular.forEach(venue.SpareEquipment, function(ch_eq){
if (ch_eq.AppID == top_appID) {
switch (ch_eq.EquipmentType){
case "MRC":
mrc_charge = $filter('emptyreturn0')(ch_eq.Charge) * ch_eq.Quantity;
break;
case "Equipment":
Equipment_charge = ($filter('emptyreturn0')(ch_eq.Charge) * ch_eq.Quantity);
break;
}
}
});
Item_Sp = {
"DisplayName":sp_eq.DisplayName,
"Quantity":sp_eq.Quantity,
"Equipment_Total":Equipment_charge,
"MRC_Total":mrc_charge
}
Spare_Equipment.push(Item_Sp);
Equipment_Total_NRC = Equipment_Total_NRC + Equipment_charge;
//Equipment_Total_MRC = Equipment_Total_MRC + mrc_charge;
v_SpareEquipment_Total_Equipment = v_SpareEquipment_Total_Equipment + Equipment_charge;
v_SpareEquipment_Total_MRC = v_SpareEquipment_Total_MRC + mrc_charge;
}
});
Spare_Equipment.Equipment_Total = parseFloat(v_SpareEquipment_Total_Equipment);
Spare_Equipment.MRC_Total = parseFloat(v_SpareEquipment_Total_MRC);
}
Venue_Questionnaire = [];
if (angular.isObject(venue.VenueQuestionnaire) && venue.VenueQuestionnaire.Equipment.length) { //
QuestionnaireArray = [];
QuestionnaireEquipment_NRC = 0;
angular.forEach(venue.VenueQuestionnaire.Equipment, function(vq_eq){
qu_nu = vq_eq.questionNu;
Display_Name = vq_eq.DisplayName;
angular.forEach(venue.VenueQuestionnaire.Questions, function(vq_qu){
if (qu_nu == vq_qu.questionNu) {
Equipment_NRC = $filter('emptyreturn0')(vq_eq.Charge) * $filter('emptyreturn0')(vq_eq.Quantity);
Item_Sp = {
"DisplayName":Display_Name,
"NRC_After_Total":Equipment_NRC,
}
Venue_Questionnaire.push(Item_Sp);
Equipment_Total_NRC = Equipment_Total_NRC + Equipment_NRC;
v_VenueQuestionnaire_Total_AHr_NRC = v_VenueQuestionnaire_Total_AHr_NRC + Equipment_NRC;
}
});
});
Venue_Questionnaire.AHr_NRC_Total = parseFloat(v_VenueQuestionnaire_Total_AHr_NRC);
}
////////////////////
Mobility = [];
if (angular.isObject(venue.MobilityMRC)) {
Item_MMRC = {
"DisplayName":venue.MobilityMRC.Description,
"MRC_Total":$filter('emptyreturn0')(venue.MobilityMRC.Charge)
}
Mobility.push(Item_MMRC);
Equipment_Total_MRC = Equipment_Total_MRC + $filter('emptyreturn0')(venue.MobilityMRC.Charge);
Mobility.MRC_Total = parseFloat(venue.MobilityMRC.Charge);
}
////////////////////
////////////////////
service_Circuit = [];
if (venue.DSR.length) {
Circuit_OneTime = 0;
Circuit_Month = 0;
angular.forEach(venue.DSR, function(circuit){
Circuit_Month = $filter('emptyreturn0')(circuit.CircuitMonthlyCost);
Circuit_OneTime = $filter('emptyreturn0')(circuit.CircuitOneTimeCost);
if (circuit.OwnerProvideCircuit == 'Yes' && (typeof circuit.OwnerSecondCircuitProvider != "undefined" && circuit.OwnerSecondCircuitProvider.length > 0)) {
Circuit_Month = Circuit_Month * 2;
}
Circuit_Total_NRC = Circuit_Total_NRC + Circuit_OneTime;
Circuit_Total_MRC = Circuit_Total_MRC + Circuit_Month;
v_Circuit_Total_Equipment = v_Circuit_Total_Equipment + Circuit_OneTime;
v_Circuit_Total_MRC = v_Circuit_Total_MRC + Circuit_Month;
Item_B = {
"ComcastProvider":circuit.ComcastPreQual,
"CircuitOrdered":circuit.CircuitOrdered,
"PreQual":circuit.PreQual,
"OwnerProvideCircuit": circuit.OwnerProvideCircuit,
"MultipleCircuits": circuit.MultipleCircuits,
"OwnerCircuitProvider": circuit.OwnerCircuitProvider,
"OwnerSecondCircuitProvider": circuit.OwnerSecondCircuitProvider,
"circuit_MRC":Circuit_Month,
"circuit_NRC":Circuit_OneTime,
"UploadSpeed":circuit.UploadSpeed,
"DownloadSpeed":circuit.DownloadSpeed,
"CircuitProvider":circuit.CircuitProvider,
"CircuitTier":circuit.CircuitTier,
"CircuitType":circuit.CircuitType
}
service_Circuit.push(Item_B);
});
service_Circuit.Equipment_Total = parseFloat(v_Circuit_Total_Equipment);
service_Circuit.MRC_Total = parseFloat(v_Circuit_Total_MRC);
}
cur_Venue = {
"venueId":venue.venueId,
"street":venue.street,
"city":venue.city,
"state":venue.state,
"zip":venue.zip,
"plus4":"",
"storephoneNumber":venue.storephoneNumber,
"contactFirstName":venue.contactFirstName,
"contactLastName":venue.contactLastName,
"contactphoneNumber":venue.contactphoneNumber,
"Contact_Email":venue.Contact_Email,
"ComcastProvider":venue.ComcastProvider,
"ServicePackage":service_Package,
"OptionalEquipment":Optional_Equipment,
"SpareEquipment":Spare_Equipment,
"VenueQuestionnaire":Venue_Questionnaire,
"Mobility":Mobility,
"Circuit":service_Circuit
}
$scope.Venues_Ordered.push(cur_Venue);
});
//console.log($scope.Venues_Ordered);
//console.log($scope.Venues_Ordered);
$scope.Totals = {
"Total_NRC": parseFloat(Equipment_Total_NRC),
"Total_MRC": parseFloat(Equipment_Total_MRC),
"Circuit_MRC_Total": parseFloat(Circuit_Total_MRC),
"Circuit_NRC_Total": parseFloat(Circuit_Total_NRC)
}
////////////////////////////////////////////////////////////////////////////
/////////////// Edit Venue Link /////////////////
$scope.editVenue = function (ic_value) {
$location.path("OrderEquipment/"+ic_value);
}
/////////////// Start Delete Modal /////////////////
$scope.dsMessage = 'Are you sure you want to delete this restaurant from your proposal?';
$scope.animationsEnabled = true;
$scope.selVenue = 0;
$scope.openConfirmModal = function (ic_value) {
$scope.selVenue = ic_value;
$scope.modalInstance = $uibModal.open({
animation: $scope.animationsEnabled,
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
templateUrl: 'confirmModal.html',
scope: $scope,
keyboard: false,
backdrop: 'static',
size: 'sm',
resolve: {
selVenue : function() {
return $scope.selVenue;
}
}
});
$scope.modalInstance.result.then(function () {
}, function () {
$scope.loading = false;
$log.info('Modal dismissed at: ' + new Date());
});
};
//
$scope.deleteItem = function () {
angular.forEach($rootScope.orderRequest.FranchiseeOrdering.venues, function(venue, key){
lp_venueID = venue.venueId;
if (parseInt(lp_venueID) === parseInt($scope.selVenue)) {
$rootScope.orderRequest.FranchiseeOrdering.venues.splice(key, 1);
}
});
// Update Windows SessionStorage with current order
sessionStorage.setItem('CustomerWiFI_Order',JSON.stringify($rootScope.orderRequest));
// Update SFDC
ATTWiFiOrderingClass.setOrderState(JSON.stringify($rootScope.orderRequest), function(result, status){});
$location.path("OrderSummary/");
this.$dismiss($scope.selVenue);
};
//
$scope.cancel = function(){
console.log('close');
$scope.loading = false;
this.$dismiss('cancel');
};
/////////////// End Delete Modal /////////////////
// console.log('$scope.Venues_Ordered');
// console.log($scope.Venues_Ordered);
// Add to Order Button
//$scope.AddRestaurant = function () {
//$scope.loading = true;
// $location.path('/OrderForm/'); //+$rootScope.brandId
//};
// requestAnotherOrder Button
$scope.requestFinishOrder = function (size) {
//$scope.loading = true;
setTimeout(function() {
$scope.loading = false;
}, 500);
// /////////////////
sessionStorage.setItem('CustomerWiFI_Order',JSON.stringify($rootScope.orderRequest));
ATTWiFiOrderingClass.setOrderState(JSON.stringify($rootScope.orderRequest), function(result, status){});
// //////////////// sessionStorage.clear();
//$location.path('/OrderForm/'); //+$rootScope.brandId
var modalInstance = $uibModal.open({
backdrop : 'static',
keyboard : false,
animation: true,
templateUrl: '/ATTWiFiUpgradeOrdering/wifiOrd_CreditResults_html',
controller: 'creditCheckController',
//windowClass: 'creditCheckModal',
scope: $scope,
size: size,
resolve: {}
});
};
//x - button / close button ////////////////
$scope.close = function (){
$scope.loading = false;
$scope.modalInstance.dismiss('cancel');
};
// goHome Button ////////////////
$scope.goHome = function () {
// requestAnotherOrder
$rootScope.orderRequest = '';
$location.path('/ProductOverview/'+$rootScope.brandId);
};
////////// Check to see if in OrderConfirmation Page to clear venue Array ////////////////
if ($location.path() === '/OrderConfirmation') {
//////////////////////////////////////////
//VenuesOrder_Ary = [];
angular.forEach($rootScope.orderRequest.FranchiseeOrdering.venues, function(o_venue){
var g_date = new Date();
var OrderDate = g_date.toLocaleString("en-US");
if (o_venue.SiteSurveyRequest) {
brand_ID = '';
Order_Type = 'SiteSurvey';
PackageConfiguration = 'SiteSurvey';
}
else {
brand_ID = o_venue.PackageOption.Brand_ID;
Order_Type = 'Package';
PackageConfiguration = o_venue.PackageOption.Configuration;
}
/////////////
cur_Venue = {
"DateOrdered": OrderDate,
"StoreNumber": o_venue.venueId,
"brandID":brand_ID,
"OrderType": Order_Type,
"PackageConfiguration":PackageConfiguration
}
// if OrderedVenues Node exist
/* if (angular.isObject($rootScope.orderRequest.FranchiseeOrdering.OrderedVenues)) {
$rootScope.orderRequest.FranchiseeOrdering.OrderedVenues.push(cur_Venue);
}
// If no OrderedVenues Node
else {
VenuesOrder_Ary.push(cur_Venue);
}
*/
});
// If no OrderedVenues Node
/*if (!angular.isObject($rootScope.orderRequest.FranchiseeOrdering.OrderedVenues)) {
$rootScope.orderRequest.FranchiseeOrdering.OrderedVenues = VenuesOrder_Ary;
}*/
// clear venues array
$rootScope.orderRequest.FranchiseeOrdering.venues = [];
// console.log('$rootScope.orderRequest.FranchiseeOrdering');
// console.log($rootScope.orderRequest.FranchiseeOrdering);
ATTWiFiOrderingClass.setOrderState(JSON.stringify($rootScope.orderRequest), function(result, status){});
sessionStorage.setItem('CustomerWiFI_Order',JSON.stringify($rootScope.orderRequest));
}
////////// ENd Check to see if in OrderConfirmation Page to clear venue Array ////////////////
})
.controller('creditCheckController', function ($rootScope, $scope, $window, $location, $uibModal,$uibModalInstance, $log, $filter, $analytics ,$timeout) {
//@TODO:Moving this code to config object
ATTWiFiOrderingClass.getCurrentUserName(function(result, status){
$scope.$evalAsync(function () {
$scope.id = result.body[0].Id;
if($scope.id==null || $scope.id==="undefined" || result.body[0].FirstName==='ATTWiFiUpgradeOrdering' ){
$rootScope.orderRequest = '';
if($rootScope.brandId==null || $rootScope.brandId==="undefined"){
$rootScope.brandId='001600000lzkAb';
}
$location.path('/ProductOverview/'+$rootScope.brandId);
}
})
});
if ((typeof $rootScope.orderRequest === "undefined" && typeof sessionStorage.CustomerWiFI_Order != "undefined" ) ) {
$rootScope.orderRequest = $.parseJSON(sessionStorage.CustomerWiFI_Order);
}
if ((typeof $rootScope.mcdInputData === "undefined" && typeof sessionStorage.CustomerWiFI_Order != "undefined" ) ) {
$rootScope.mcdInputData = $.parseJSON(sessionStorage.mcdInputData);
}
//$scope.creditCheckCompany = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_CompanyName;
$scope.creditCheckCompany = '';
$scope.creditCheckStreet = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingStreet;
$scope.creditCheckCity = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingCity;
$scope.creditCheckState = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingStateCode;
$scope.creditCheckZip = $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingPostalCode.substring(0,5);
$scope.continue = function(size) {
$scope.loading = true;
$scope.creditCheckProcessing = $uibModal.open({
animation: true,
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
templateUrl: 'creditCheckProcessing.html',
windowClass: 'creditCheckProcessing',
scope: $scope,
size: 'sm',
keyboard: false,
backdrop: 'static',
resolve: {
}
});
$scope.creditCheckProcessing.result.then(function () {
}, function () {
$log.info('creditCheckProcessing, dismissed at: ' + new Date());
});
$scope.creditCheckRequest = {
"creditCheckControl": {
"creditCheckId": "LS",
"opportunityId": "N",
"representativeId": "AWSS",
"submitterOrganization": "AWSS"
},
"products": [{
"name": "Wi-Fi-Enterprise",
"key": "1-5ULCP-1",
"monthlyRecurringCharges": $scope.Totals.Total_MRC + $scope.Totals.Circuit_MRC_Total,
"nonRecurringCharges": $scope.Totals.Total_NRC + $scope.Totals.Circuit_NRC_Total,
"units": "1",
"currencyType": "USD"
}],
"businessEntity": {
"businessName": $scope.creditCheckCompany,
"identifications": [{
"stateId": $scope.creditCheckState
}],
"addresses": [{
"usAddress": {
"addressLine1": $scope.creditCheckStreet,
"city": $scope.creditCheckCity,
"state": $scope.creditCheckState,
"zipCode": $scope.creditCheckZip
}
}]
},
"opportunityType": "ATT",
"offerType": "ATT"
}
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var today = new Date();
var dateText = monthNames[today.getMonth()] + ' ' + today.getDate() + ', ' + today.getFullYear();
var dd = (today.getDate() < 10) ? '0' + today.getDate() : today.getDate();
var mm = ((today.getMonth() + 1) < 10) ? '0' + (today.getMonth() + 1) : (today.getMonth() + 1); // January is 0!
var yyyy = today.getFullYear();
var shortDate = mm + '/' + dd + '/' + yyyy;
Visualforce.remoting.timeout = 120000;
var commaSeperatedStores ='';
angular.forEach($scope.Venues_Ordered, function(or_venue) {
commaSeperatedStores = commaSeperatedStores + or_venue.venueId + ',' ;
});
ATTWiFiOrderingClass.getCreditCheckResult(JSON.stringify($scope.creditCheckRequest), $scope.creditCheckCompany ,$scope.creditCheckStreet, $scope.creditCheckCity,$scope.creditCheckState,$scope.creditCheckZip,
$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_ID, $rootScope.orderRequest.currentUserContactId ,
$scope.Totals.Total_MRC + $scope.Totals.Circuit_MRC_Total , $scope.Totals.Total_NRC + $scope.Totals.Circuit_NRC_Total ,
commaSeperatedStores.substr(0 ,commaSeperatedStores.length-1) , function(result, status) {
$scope.$evalAsync(function() {
$scope.loading = true;
$scope.creditCheckProcessing.dismiss('cancel');
try {
result = JSON.parse($filter('escapeCharacters')(result)); //JSON.parse(result.replace(/"/g, '"').replace(/&/g, '&'));
}
catch(err) {
result=null;
}
$scope.loading = false;
$scope.creditApprovalStatus = true;
$scope.orderresult = "Order is being processed.";
$scope.ordermessage = 'Your order is being processed. If we require further information, an AT&T representative will be in contact with you. Please click "continue" to see a summary of your order.';
//Store response ID in the rootscope orderobject
if (result.interconnectTransactionId != null) {
$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Credit_Check_ID = result.interconnectTransactionId;
}
if($scope.creditApprovalStatus == true){
AWSOrderRequest.submitOrder(JSON.stringify($rootScope.orderRequest.FranchiseeOrdering), function(result, status) {
console.log(result);
var franchiseeId=$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_ID;
var order = JSON.stringify($rootScope.orderRequest.FranchiseeOrdering);
var checkFilenameA = $filter('removeInvalidFileNameSymbols')("Attachment A to the Participation Agreement " + $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_CompanyName);
ATTWiFiOrderingContractService.isDocumentExists(checkFilenameA, franchiseeId, function(result, status) {
console.log('Attachment A exist '+result);
$rootScope.attachmentAExist = result;
if ($rootScope.attachmentAExist == false) {
var attachmentBody = "
This Change Order is made and effective as of the date Customer signs this Change Order (the “Effective Date”). This Change Order is incorporated into and made a part of the Participation Agreement dated " + dateText + ".
" + ' ' +
"
NOW, THEREFORE, AT&T and Customer agree to amend the Participation Agreement as follows:
" + ' ' +
"
1. Change Requested. Purchase of additional Service Components for new sites, at the rates and charges set forth in the Participation Agreement.
" + ' ' +
"
2. Site Term. The Term for any Site added after the Participation Agreement Effective Date is 60 months from the date of execution of this Change Order.
" + ' ' +
"
3. General. Terms and conditions of the Participation Agreement that are not modified by this Change Order remain in full force and effect. In the event of a conflict between the terms and conditions contained in this Change Order and the referenced Participation Agreement, the terms and conditions of this Change Order control.
" + ' ' +
"
SITE LIST
" + ' ' +
'
ADDRESS/CITY/STATE/ZIP
Owner/Operator Name
Owner/Operator Number
Site Number
' + rows + '
' + ' ' +
'Any edits to this Change Order render it null and void. ' + ' ' +
'
Customer (by its authorized representative)
AT&T (by its authorized representative)
By:
By:
Name:
Name:
Title:
Title:
Date:
Date:
';
var checkFilenameB = $filter('removeInvalidFileNameSymbols')("Attachment B to the Participation Agreement " + $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_CompanyName);
var fileNameB = encodeURI(checkFilenameB + ' ' + (shortDate).split('/').join('_'));
ATTWiFiOrderingContractService.processAgreementAttachment(fileNameB, attachmentBody, order, function(result, status) {
console.log('processAgreementAttachment, AttachmentB: ' + result);
var inquireContractEsignDetailsstatus = result.inquireContractEsignDetailsstatus;
console.log('AttachmentB contractId' + inquireContractEsignDetailsstatus)
if(result.status == 'success'){
ATTWiFiOrderingContractService.processAgreementAttachment2(inquireContractEsignDetailsstatus, fileNameB, attachmentBody, order, function(result, status) {
console.log('processAgreementAttachment2, result: ' + result);
ATTWiFiOrderingContractService.submitDocument(result.fileName, franchiseeId, inquireContractEsignDetailsstatus, function(result, status) {
console.log('submitDocument'+result);
})
});
}
});
console.log('processAgreementAttachment, AttachmentB: ' + result);
return;
}
});
})
}
//$scope.checkCreditStatus = true;
// Clear Venues Array
//$rootScope.orderRequest.FranchiseeOrdering.venues = [];
//$uibModalInstance.dismiss('continue');
$scope.modalInstance = $uibModal.open({
backdrop: 'static',
keyboard: false,
animation: $scope.animationsEnabled,
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
templateUrl: 'creditcheckresultModal.html',
scope: $scope,
size: 'sm',
resolve: {
}
});
});
});
}
$scope.continue1 = function() {
this.$dismiss('continue');
$scope.CurrentOrder = $rootScope.orderRequest.FranchiseeOrdering;
//$location.path('/OrderConfirmation/');
//////////
$location.path('/OrderConfirmation/');
/* Comment Out - moved to confirmation page mh4053@att.com //Remove venues from orderRequest
$timeout(function () {
$rootScope.orderRequest = {
"currentUserContactId" : $scope.contactId,
"currentUserId": $scope.id,
"FranchiseeOrdering":{
"franchiseeContactInfo":{
"Franchisee_FirstName":$rootScope.mcdInputData.Franchisee_FirstName,
"Franchisee_LastName":$rootScope.mcdInputData.Franchisee_LastName,
"Franchisee_CompanyName":$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_CompanyName,
"Franchisee_email":$rootScope.mcdInputData.Franchisee_email,
"Franchisee_Phone":$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_Phone,
"Franchisee_role": $rootScope.mcdInputData.Franchisee_Role,
"Franchisee_signature": true,
"Franchisee_contactValidation": true,
"Franchisee_preFlight": true,
"Franchisee_ID":$rootScope.mcdInputData.Franchisee_ID,
"Franchisee_BillingStreet":$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingStreet,
"Franchisee_BillingState": $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingState,
"Franchisee_BillingCity": $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingCity,
"Franchisee_BillingPostalCode": $rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingPostalCode,
"Franchisee_BillingCountryCode":$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingCountryCode,
"Franchisee_BillingStateCode":$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_BillingStateCode,
"Account_Invoice_ID":$rootScope.mcdInputData.SE_Invoice_Account_ID__c,
"Franchisee_signature_image":$rootScope.orderRequest.FranchiseeOrdering.franchiseeContactInfo.Franchisee_signature_image,
//"Credit_Check_ID":$rootScope.mcdInputData.Credit_Check_ID,
"Franchisee_InvoiceAccountID":$rootScope.mcdInputData.Franchisee_InvoiceAccountID
//"documentsmap":$rootScope.orderRequest.documentsmap,
//"documentsList": $rootScope.orderRequest.documentsList
},
'venues': []
}
};
}, 100);
*/
};
////////////////////// Comment out - no need mh4053@att.com
/*
$scope.cancel = function() {
$scope.loading = false;
$uibModalInstance.dismiss('cancel');
};
$scope.ok = function() {
$location.path('/OrderConfirmation/');
}
$scope.cancel = function() {
$scope.loading = false;
this.$dismiss('continue');
$uibModalInstance.dismiss('cancel');
}
*/
})
/*
End controllers
*/
///////////////////////////////////////////////
.factory('webtrendsService', function() {
var service = {};
/*service.init = function() {
var DEV_DCSID = "dcsojkdbx000000kbumlqq52s_4k5x";
// var HYDRA_DCSID = "dcs4tkksg10000kz0gvydutlo_6g5y";
var QA_DCSID = "dcs0uhxwr10000kbilo2xx52s_3u9l";
var PROD_DCSID = "dcs51ynsj10000s53w4th062s_9u3o";
var DEV_DOM = "awsdev-attwifismallbizdev.cs4.force.com";
// var HYDRA_DOM = "hydratest-attwifi.cs2.force.com";
var QA_DOM = "qa-attwifi.cs20.force.com";
var PROD_DOM = "my-wifi.attwifi.com";
var sitedomain = document.location.hostname;
switch (sitedomain) {
// case HYDRA_DOM:
// dcs_id = HYDRA_DCSID;
// fpc_dom = "." + HYDRA_DOM;
// break;
case DEV_DOM:
dcs_id = DEV_DCSID;
fpc_dom = "." + DEV_DOM;
break;
case QA_DOM:
dcs_id = QA_DCSID;
fpc_dom = "." + QA_DOM;
break;
case PROD_DOM:
dcs_id = PROD_DCSID;
fpc_dom = "." + PROD_DOM;
break;
default:
dcs_id = DEV_DCSID;
fpc_dom = "." + DEV_DOM;
};
var dcs = new Webtrends.dcs().init({
dcsid: dcs_id,
domain: "wta.attwifi.com",
timezone: -6,
i18n: true,
fpcdom: fpc_dom,
plugins: {
//hm:{src:"//s.webtrends.com/js/webtrends.hm.js"}
}
}).track();
};
service.pageTrack = function(path){
dcsMultiTrack('DCS.dcsuri', path);
};*/
return service;
})
// Start Factories ///////////////////////////////
// Start Brand Services ///////////////////////////////
/* Notes: JSON objects for each CLient to map Saleforece ID, Brand Name and Brand Logo */
.factory('brandService', function() {
var _urlIdToBrandMap= {
"001600000lzkAb": {"sfdcId": "001600000lzkAb", "name": "McDonald's", "img_logo": "!$Resource.FRA_IMG_logo_mcdonald"}
};
var service = {};
// Parse Saleforece ID to local var
service.getBrandByUrlId = function(urlId){
var brand = {};
return _urlIdToBrandMap[urlId];
};
return service;
})
.factory('VFRemotingFactory',function($q,$rootScope){
var factory = {};
factory.getData = function(username,password){
var deferred = $q.defer();
getAuthorizedStores(function(result){
$rootScope.$apply(function(){
deferred.resolve(result);
});
}, username,password);
return deferred.promise;
}
return factory;
})
// END Brand Services ///////////////////////////////
/////////////////////////////////
.service('filteredListService', function () {
this.searched = function (valLists,toSearch) {
return _.filter(valLists,
function (i) {
/* Search Text in all 3 fields */
return searchUtil(i, toSearch);
});
};
this.paged = function (valLists,pageSize)
{
retVal = [];
for (var i = 0; i < valLists.length; i++) {
if (i % pageSize === 0) {
retVal[Math.floor(i / pageSize)] = [valLists[i]];
} else {
retVal[Math.floor(i / pageSize)].push(valLists[i]);
}
}
return retVal;
};
})
/////////////////////////////////
/*.run(['webtrendsService', function(webtrendsService) {
webtrendsService.init();
}])*/
.run(function($rootScope, $uibModalStack) {
$rootScope.$on('$routeChangeSuccess', function () {
$uibModalStack.dismissAll();
});
})
.run(function($rootScope, $filter, $window) {
// sessionStorage.clear();
if ( (typeof $rootScope.brandId === "undefined" && typeof sessionStorage.CustomerbrandID != "undefined" ) ) {
$rootScope.brandId = $.parseJSON(sessionStorage.CustomerbrandID);
}
//
if ((typeof $rootScope.orderRequest === "undefined" && typeof sessionStorage.CustomerWiFI_Order != "undefined" ) ) {
$rootScope.orderRequest = $.parseJSON(sessionStorage.CustomerWiFI_Order);
}
//$rootScope.mcdInputData = mcd_input_data;
if(typeof $rootScope.mcdInputData === "undefined" && typeof sessionStorage.mcdInputData != "undefined" ) {
$rootScope.mcdInputData = sessionStorage.getItem("mcdInputData");
$rootScope.mcdInputData.venues = sessionStorage.getItem("mcdInputDatavenues");
$rootScope.mcdInputData = JSON.parse($filter('escapeCharacters')($rootScope.mcdInputData)); // JSON.parse($rootScope.mcdInputData.replace(/"/g,'"'));
}
$rootScope.abbreStates = abbreStates;
});
/////////////////////////////////////////////////////////
function GetAllContactsByFilter(callback, username,password){
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.ATTWiFiOrderingClass.getAuthorizedStores}', username,password,
callback,
{escape: false}
);
}
function searchUtil(item, toSearch) {
//console.log(item);
// console.log(toSearch);
/* Search Text in all fields */
return (
// item.STORE_NUMBER.toLowerCase().indexOf(toSearch.toLowerCase()) > -1
item.STORE_NUMBER.toString().toLowerCase().indexOf(toSearch.toLowerCase()) > -1
|| parseInt(item.STORE_NUMBER) == parseInt(toSearch)
|| item.STORE_ADDRESS.toLowerCase().indexOf(toSearch.toLowerCase()) > -1
|| item.STORE_CITY.toLowerCase().indexOf(toSearch.toLowerCase()) > -1
|| item.STORE_STATE.toLowerCase().indexOf(toSearch.toLowerCase()) > -1
|| item.STORE_ZIP.toLowerCase().indexOf(toSearch.toLowerCase()) > -1
// || item.zip.toLowerCase().indexOf(toSearch.toLowerCase()) > -1
//|| item.zip.indexOf(parseInt(toSearch, 10)) > -1
|| item.venue_id == toSearch ) ? true : false;
}
var checkBrand = function (brandId, $location, brandService) {
var brand = brandService.getBrandByUrlId(brandId);
if (!brand) {
$location.path("/Help");
}
};
/////////////////////////////////////////////////////////
var getCurrentDate = function() {
var today = new Date();
var dd = (today.getDate() < 10) ? '0' + today.getDate() : today.getDate();
var mm = ((today.getMonth() + 1) < 10) ? '0' + (today.getMonth() + 1) : (today.getMonth() + 1); // January is 0!
var yyyy = today.getFullYear();
return mm + '/' + dd + '/' + yyyy;
}
/////////////////////////////////////////////////////////
// escape json strings
function escapeSpecialCharacters(string) {
return string
.replace(/[']/g, "\'")
.replace(/["]/g, '\"')
.replace(/[&]/g, "\&")
.replace(/[\n]/g, "\n")
.replace(/[\r]/g, "\r")
.replace(/[\t]/g, "\t")
.replace(/[\b]/g, "\b")
.replace(/[\v]/g, "\v")
.replace(/[\f]/g, "\f");
}
// replacer handler for JSON stringify
function stringifyReplacer(key, value) {
if (typeof value === 'string') {
return escapeSpecialCharacters(value);
}
return value;
}
/////////////////////////////////////////////////////////