angular.module('r6-configuration', []) .constant('ordercaptureWizardSteps', [ { titleUrl: 'i18n/customermanagement/ordercapture/wizard/offerselection/title', titleFallback: 'Offer Selection', stateName: 'customermanagement.ordercapture.wizard.offerselection', permission: '/UI/CRM/createCustomer', nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false; }], isSkipped: ['r6ShoppingCart', function (r6ShoppingCart) { return !!r6ShoppingCart.getSelectedShoppingCart().orderDetails.orderId; }], states: [ { name: 'customermanagement.ordercapture.wizard.offerselection', state: { url: '/offerselection?offerCategory&customerTypeKey', data: { permission: '/UI/CRM/createCustomer', disableSpinner: true }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/offerselection', controller: 'r6OrdercaptureWizardOfferselectionCtrl' } } } } ] }, { titleUrl: 'i18n/customermanagement/ordercapture/wizard/offerconfiguration/title', titleFallback: 'Offer Configuration', stateName: 'customermanagement.ordercapture.wizard.offerconfiguration', permission: '/UI/CRM/createCustomer', isSkipped: ['r6ShoppingCart', function (r6ShoppingCart) { var selectedShoppingCart = r6ShoppingCart.getSelectedShoppingCart(); if (selectedShoppingCart) { return selectedShoppingCart.selectedOfferList.length === 0; } else { return true; } }], nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false && (r6ShoppingCart.getSelectedShoppingCart().selectedOfferList.length === 0 || (r6ShoppingCart.getSelectedShoppingCart().selectedOfferList.length > 0 && r6ShoppingCart.isOrderable())); }], prevEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return !r6ShoppingCart.getSelectedShoppingCart().orderDetails.orderId; }], validate: [ '$q', 'r6ShoppingCart', function ($q, r6ShoppingCart) { var deferred = $q.defer(); r6ShoppingCart.validate().then(function (result) { if (result.isValid()) { deferred.resolve(); } else { deferred.reject("validation failed"); } }); return deferred.promise; }], states: [ { name: 'customermanagement.ordercapture.wizard.offerconfiguration', state: { url: '/offerconfiguration', data: { offerConfiguration: true, permission: '/UI/CRM/createCustomer' }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/offerconfiguration', controller: 'r6OrdercaptureWizardOfferconfigurationCtrl' } } } } ] }, { titleUrl: 'i18n/customermanagement/ordercapture/wizard/customerdetails/title', titleFallback: 'Customer Details', stateName: 'customermanagement.ordercapture.wizard.customerdetails', nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false; }], validate: [ '$q', 'r6ShoppingCart', 'r6ShoppingCartResource', 'r6AddressResource', function ($q, r6ShoppingCart, r6ShoppingCartResource, r6AddressResource) { return $q.all([r6ShoppingCartResource.ShoppingCartValidator.validatePersonalDetails(r6ShoppingCart.getSelectedShoppingCart().customer.personalDetails).$promise, r6ShoppingCartResource.ShoppingCartValidator.validateContactDetails(r6ShoppingCart.getSelectedShoppingCart().customer.contactDetails).$promise, r6AddressResource.validate(r6ShoppingCart.getSelectedShoppingCart().customer.contactAddress).$promise]); }], states: [ { name: 'customermanagement.ordercapture.wizard.customerdetails', state: { url: '/customerdetails', data: { permission: '/UI/CRM/createCustomer' }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/customerdetails', controller: 'r6OrdercaptureWizardCustomerdetailsCtrl' } } } }, { name: 'customermanagement.ordercapture.wizard.customerdetails.RESIDENTIAL', state: { url: '/private', views: { '': { templateUrl: 'view/customermanagement/ordercapture/customerdetails/private' } } } }, { name: 'customermanagement.ordercapture.wizard.customerdetails.BUSINESS', state: { url: '/business', views: { '': { templateUrl: 'view/customermanagement/ordercapture/customerdetails/business' } } } }, { name: 'customermanagement.ordercapture.wizard.customerdetails.ENTERPRISE', state: { url: '/enterprise', views: { '': { templateUrl: 'view/customermanagement/ordercapture/customerdetails/enterprise' } } } } ] }, { titleUrl: 'i18n/customermanagement/ordercapture/wizard/paymentdetails/title', titleFallback: 'Payment Details', stateName: 'customermanagement.ordercapture.wizard.paymentdetails', permission: '/UI/CRM/createCustomer', nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false; }], states: [ { name: 'customermanagement.ordercapture.wizard.paymentdetails', state: { url: '/paymentdetails', data: { permission: '/UI/CRM/createCustomer' }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/paymentdetails', controller: 'r6OrdercaptureWizardPaymentdetailsCtrl' } } } } ] }, { titleUrl: 'i18n/customermanagement/ordercapture/wizard/summary/title', titleFallback: 'Summary', stateName: 'customermanagement.ordercapture.wizard.summary', permission: '/UI/CRM/createCustomer', nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false; }], states: [ { name: 'customermanagement.ordercapture.wizard.summary', state: { url: '/summary', data: { permission: '/UI/CRM/createCustomer' }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/summary', resolve: { summary: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.getSummary(); }] }, controller: 'r6OrdercaptureWizardSummaryCtrl' }, 'sidebar@': { templateUrl: 'view/customermanagement/ordercapture/sidebar', controller: 'r6OrdercaptureWizardSummarySidebarCtrl' } } } } ] } ] ) .constant('tenantOrdercaptureWizardSteps', [ { titleUrl: 'i18n/customermanagement/tenant/ordercapture/wizard/accountdetails/title', titleFallback: 'Account Details', stateName: 'customermanagement.tenant.ordercapture.wizard.accountdetails', states: [ { name: 'customermanagement.tenant.ordercapture.wizard.accountdetails', state: { url: '/accountdetails', data: { permission: '/UI/Admin/manageAllTenants' }, views: { '': { templateUrl: 'view/customermanagement/tenant/ordercapture/wizard/accountdetails', controller: 'r6TenantOrdercaptureWizardAccountdetailsCtrl' } } } } ] }, { titleUrl: 'i18n/customermanagement/tenant/ordercapture/wizard/summary/title', titleFallback: 'Summary', stateName: 'customermanagement.tenant.ordercapture.wizard.summary', states: [ { name: 'customermanagement.tenant.ordercapture.wizard.summary', state: { url: '/summary', data: { permission: '/UI/Admin/manageAllTenants' }, views: { '': { templateUrl: 'view/customermanagement/tenant/ordercapture/wizard/summary', resolve: { summary: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.getSummary(); }] }, controller: 'r6TenantOrdercaptureWizardSummaryCtrl' }, 'sidebar@': { templateUrl: 'view/customermanagement/tenant/ordercapture/wizard/sidebar', controller: 'r6TenantOrdercaptureWizardSummarySidebarCtrl' } } } } ] } ] ) .constant('tenantcustomerOrdercaptureWizardSteps', [ { titleUrl: 'i18n/customermanagement/tenantcustomer/ordercapture/wizard/tenantselection/title', titleFallback: 'Tenant selection', stateName: 'customermanagement.tenantcustomer.ordercapture.wizard.tenantselection', nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { var selectedShoppingCart = r6ShoppingCart.getSelectedShoppingCart(); return !!(selectedShoppingCart && selectedShoppingCart.customer && selectedShoppingCart.customer.type === 'TENANT_CUSTOMER'); }], states: [ { name: 'customermanagement.tenantcustomer.ordercapture.wizard.tenantselection', state: { url: '/tenantselection', data: { permission: {key: '/UI/CRM/createCustomer', context: 'WHOLESALE'} }, views: { '': { templateUrl: 'view/customermanagement/tenantcustomer/ordercapture/wizard/tenantselection', controller: 'r6TenantcustomerTenantSelectionController' } } } } ] }, { titleUrl: 'i18n/customermanagement/tenantcustomer/ordercapture/wizard/accountdetails/title', titleFallback: 'Account Details', stateName: 'customermanagement.tenantcustomer.ordercapture.wizard.accountdetails', validate: [ '$q', 'r6ShoppingCart', 'r6ShoppingCartResource', 'r6AddressResource', function ($q, r6ShoppingCart, r6ShoppingCartResource, r6AddressResource) { return $q.all([r6ShoppingCartResource.ShoppingCartValidator.validatePersonalDetails(r6ShoppingCart.getSelectedShoppingCart().customer.personalDetails).$promise, r6ShoppingCartResource.ShoppingCartValidator.validateContactDetails(r6ShoppingCart.getSelectedShoppingCart().customer.contactDetails).$promise, r6AddressResource.validate(r6ShoppingCart.getSelectedShoppingCart().customer.contactAddress).$promise ] ); } ], states: [ { name: 'customermanagement.tenantcustomer.ordercapture.wizard.accountdetails', state: { url: '/accountdetails', data: { permission: {key: '/UI/CRM/createCustomer', context: 'WHOLESALE'} }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/customerdetails/business', controller: 'r6TenantcustomerOrdercaptureWizardAccountdetailsCtrl' } } } } ] }, { titleUrl: 'i18n/customermanagement/tenantcustomer/ordercapture/wizard/paymentdetails/title', titleFallback: 'Payment Details', stateName: 'customermanagement.tenantcustomer.ordercapture.wizard.paymentdetails', states: [ { name: 'customermanagement.tenantcustomer.ordercapture.wizard.paymentdetails', state: { url: '/paymentdetails', data: { permission: {key: '/UI/CRM/createCustomer', context: 'WHOLESALE'} }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/paymentdetails' } } } } ] }, { titleUrl: 'i18n/customermanagement/tenantcustomer/ordercapture/wizard/summary/title', titleFallback: 'Summary', stateName: 'customermanagement.tenantcustomer.ordercapture.wizard.summary', states: [ { name: 'customermanagement.tenantcustomer.ordercapture.wizard.summary', state: { url: '/summary', data: { permission: {key: '/UI/CRM/createCustomer', context: 'WHOLESALE'} }, views: { '': { templateUrl: 'view/customermanagement/tenantcustomer/ordercapture/wizard/summary', resolve: { summary: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.getSummary(); }] }, controller: 'r6TenantcustomerOrdercaptureWizardSummaryCtrl' }, 'sidebar@': { templateUrl: 'view/customermanagement/tenantcustomer/ordercapture/wizard/sidebar', controller: 'r6TenantcustomerOrdercaptureWizardSummarySidebarCtrl' } } } } ] } ] ) .constant('customerOfferTerminateWizardSteps', [ { titleUrl: 'i18n/customermanagement/offer/terminate/wizard/configure/title', titleFallback: 'Terminate offer', stateName: 'customermanagement.customer.offer.terminate.wizard.configure', permission: '/UI/CRM/terminateCustomerOffer', states: [ { name: 'customermanagement.customer.offer.terminate.wizard.configure', state: { url: '/configure', data: { permission: {key: '/UI/CRM/terminateCustomerOffer', context: 'RETAIL'} }, views: { '': { templateUrl: 'view/customermanagement/customer/offer/terminate/configure', controller: 'offerTerminateWizardConfigureCtrl' } } } } ] }, { titleUrl: 'i18n/customermanagement/offer/terminate/wizard/summary/title', titleFallback: 'Summary', stateName: 'customermanagement.customer.offer.terminate.wizard.summary', states: [ { name: 'customermanagement.customer.offer.terminate.wizard.summary', state: { url: '/summary', data: { permission: {key: '/UI/CRM/terminateCustomerOffer', context: 'RETAIL'} }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/summary', resolve: { shoppingCart: ['$stateParams', 'r6ShoppingCart', function ($stateParams, r6ShoppingCart) { var wizard = r6ShoppingCart.getWizard('customerOfferTerminateWizard'); if (!wizard) { return false; } prepareTerminationOrderDetails(r6ShoppingCart.getSelectedShoppingCart()); return r6ShoppingCart.selectOffer(null, $stateParams.customizedOfferId, 'DELETE'); function prepareTerminationOrderDetails(shoppingCart) { if (shoppingCart.metadata && shoppingCart.metadata.terminationReason) { shoppingCart.metadata.selectedOffer = {}; shoppingCart.metadata.selectedOffer.terminationReasonKey = shoppingCart.metadata.terminationReason.key; if (shoppingCart.metadata.terminationReason.waiveEarlyTerminationFee) { shoppingCart.metadata.selectedOffer.etfHandling = 'WAIVED'; } else { shoppingCart.metadata.selectedOffer.etfHandling = 'TOTAL'; } } else { shoppingCart.metadata.selectedOffer = {}; shoppingCart.metadata.selectedOffer.terminationReasonKey = ''; shoppingCart.metadata.selectedOffer.etfHandling = 'TOTAL' } return shoppingCart; } }], summary: ['$state', '$stateParams', 'r6ShoppingCart', 'shoppingCart', function ($state, $stateParams, r6ShoppingCart, shoppingCart) { if (shoppingCart) { return r6ShoppingCart.getSummary(); } else { wizard.reset(); $state.go('customermanagement.customer.tabs.offer.offers'); } }] }, controller: 'offerTerminateWizardSummaryCtrl' } } } } ] } ] ) .constant('customerOfferWholesaleTerminateWizardSteps', [ { titleUrl: 'i18n/customermanagement/offer/wholesale/terminate/wizard/configure/title', titleFallback: 'Terminate offer', stateName: 'customermanagement.customer.offer.wholesale.terminate.wizard.configure', states: [ { name: 'customermanagement.customer.offer.wholesale.terminate.wizard.configure', state: { url: '/configure', data: { permission: {key: '/UI/CRM/terminateCustomerOffer', context: 'WHOLESALE'} }, views: { '': { templateUrl: 'view/customermanagement/customer/offer/wholesale/terminate/configure', controller: 'offerWholesaleTerminateWizardConfigureCtrl' } } } } ] }, { titleUrl: 'i18n/customermanagement/offer/wholesale/terminate/wizard/summary/title', titleFallback: 'Summary', stateName: 'customermanagement.customer.offer.wholesale.terminate.wizard.summary', states: [ { name: 'customermanagement.customer.offer.wholesale.terminate.wizard.summary', state: { url: '/summary', data: { permission: {key: '/UI/CRM/terminateCustomerOffer', context: 'WHOLESALE'} }, resolve: { userAndChannel: ['r6Security', function (r6Security) { return r6Security.requestCurrentUserAndChannel(); }], shoppingCart: ['$stateParams', 'r6ShoppingCart', function ($stateParams, r6ShoppingCart) { var wizard = r6ShoppingCart.getWizard('customerOfferWholesaleTerminateWizard'); if (!wizard) { return false; } return r6ShoppingCart.selectOffer(null, $stateParams.customizedOfferId, 'DELETE'); }], summary: ['$state', '$stateParams', 'r6ShoppingCart', 'shoppingCart', function ($state, $stateParams, r6ShoppingCart, shoppingCart) { if (shoppingCart) { return r6ShoppingCart.getSummary(); } else { wizard.reset(); $state.go('customermanagement.customer.tabs.offer.offers'); } }] }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/summary', controller: 'offerWholesaleTerminateWizardSummaryCtrl' } } } } ] } ] ) .constant('customerOfferUnbundleWizardSteps', [{ titleUrl: 'i18n/customermanagement/offer/unbundle/wizard/configure/title', titleFallback: 'Unbundle offer', stateName: 'customermanagement.customer.offer.unbundle.wizard.configure', states: [{ name: 'customermanagement.customer.offer.unbundle.wizard.configure', state: { url: '/configure', data: { permission: '/UI/CRM/unbundleCustomerOffer' }, views: { '': { templateUrl: 'view/customermanagement/customer/offer/unbundle/configure', controller: ['$scope', '$state', '$stateParams', 'r6ShoppingCart', 'r6DateUtilFactory', function ($scope, $state, $stateParams, r6ShoppingCart, r6DateUtilFactory) { $scope.shoppingCart = r6ShoppingCart.getSelectedShoppingCart(); if ($scope.shoppingCart.selectedOfferList.length == 0) { $state.go('customermanagement.customer.tabs.offer.offers'); } $scope.shoppingCart = setEffectiveDateInShoppingCart($scope.shoppingCart); function setEffectiveDateInShoppingCart(shoppingCart) { var effectiveDate = r6DateUtilFactory.getEffectiveDay(new Date(shoppingCart.orderDetails.effectiveDate)); shoppingCart.orderDetails.effectiveDate = effectiveDate; shoppingCart.minSelectableDate = r6DateUtilFactory.getCurrentDay(); return shoppingCart; } }] } } } }] }, { titleUrl: 'i18n/customermanagement/offer/unbundle/wizard/summary/title', titleFallback: 'Summary', stateName: 'customermanagement.customer.offer.unbundle.wizard.summary', permission: '/UI/CRM/unbundleCustomerOffer', states: [{ name: 'customermanagement.customer.offer.unbundle.wizard.summary', state: { url: '/summary', views: { '': { templateUrl: 'view/customermanagement/ordercapture/summary', resolve: { summary: ['$stateParams', 'r6ShoppingCart', function ($stateParams, r6ShoppingCart) { var wizard = r6ShoppingCart.getWizard('customerOfferUnbundleWizard'); if (!wizard) { return false; } return r6ShoppingCart.selectOffer(null, $stateParams.customizedOfferId, 'UNBUNDLE').then(function () { return r6ShoppingCart.getSummary(); }); }] }, controller: ['$scope', '$state', 'summary', 'r6ShoppingCart', function ($scope, $state, summary, r6ShoppingCart) { var wizard = r6ShoppingCart.getWizard('customerOfferUnbundleWizard'); if (!summary) { wizard.reset(); $state.go('customermanagement.customer.offer.unbundle.wizard.configure'); } else { $scope.summary = summary; } }] } } } }] }] ) .constant('customerOfferAddWizardSteps', [ { titleUrl: 'i18n/customermanagement/ordercapture/wizard/offerselection/title', titleFallback: 'Offer Selection', stateName: 'customermanagement.customer.offer.add.wizard.offerselection', nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false && r6ShoppingCart.getSelectedShoppingCart().selectedOfferList.length > 0; }], isSkipped: ['r6ShoppingCart', function (r6ShoppingCart) { return !!r6ShoppingCart.getSelectedShoppingCart().orderDetails.orderId; }], states: [ { name: 'customermanagement.customer.offer.add.wizard.offerselection', state: { url: '/offerselection', data: { permission: '/UI/CRM/addCustomerOffer', disableSpinner: true }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/offerselection', controller: 'r6OrdercaptureWizardOfferselectionCtrl' } } } } ] }, { titleUrl: 'i18n/customermanagement/ordercapture/wizard/offerconfiguration/title', titleFallback: 'Offer Configuration', stateName: 'customermanagement.customer.offer.add.wizard.offerconfiguration', nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false && r6ShoppingCart.getSelectedShoppingCart().selectedOfferList.length > 0 && r6ShoppingCart.isOrderable(); }], prevEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return !r6ShoppingCart.getSelectedShoppingCart().orderDetails.orderId; }], states: [ { name: 'customermanagement.customer.offer.add.wizard.offerconfiguration', state: { url: '/offerconfiguration', data: { offerConfiguration: true, permission: '/UI/CRM/addCustomerOffer' }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/offerconfiguration', controller: 'r6OrdercaptureWizardOfferconfigurationCtrl' } } } } ] }, { titleUrl: 'i18n/customermanagement/ordercapture/wizard/summary/title', titleFallback: 'Summary', stateName: 'customermanagement.customer.offer.add.wizard.summary', nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false; }], states: [ { name: 'customermanagement.customer.offer.add.wizard.summary', state: { url: '/summary', data: { permission: '/UI/CRM/addCustomerOffer' }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/summary', resolve: { summary: ['r6ShoppingCart', 'shoppingCart', function (r6ShoppingCart, shoppingCart) { return r6ShoppingCart.getSummary(); }] }, controller: 'r6CustomerOfferAddWizardSummaryCtrl' }, 'sidebar@': { templateUrl: 'view/customermanagement/offer/add/sidebar', controller: 'r6CustomerOfferAddWizardSidebarCtrl' } } } } ] } ] ) .constant('customerOfferModifyWizardSteps', [ { titleUrl: 'i18n/customermanagement/customer/offer/modify/wizard/offerconfiguration/title', titleFallback: 'Offer Configuration', stateName: 'customermanagement.customer.offer.modify.wizard.offerconfiguration', validate: [ 'r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOrderable(); }], nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false && r6ShoppingCart.isOrderable(); }], isSkipped: ['r6ShoppingCart', function (r6ShoppingCart) { return !!r6ShoppingCart.getSelectedShoppingCart().orderDetails.orderId; }], states: [{ name: 'customermanagement.customer.offer.modify.wizard.offerconfiguration', state: { url: '/offerconfiguration', data: { offerConfiguration: true, permission: '/UI/CRM/editCustomerOffer' }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/offerconfiguration', resolve: { shoppingCart: ['r6CustomerOfferModifyWizardOfferconfigurationResolver', '$stateParams', function (r6CustomerOfferModifyWizardOfferconfigurationResolver, $stateParams) { return r6CustomerOfferModifyWizardOfferconfigurationResolver($stateParams); }] }, controller: 'r6OrdercaptureWizardOfferconfigurationCtrl' } } } }] }, { titleUrl: 'i18n/customermanagement/customer/offer/modify/wizard/summary/title', titleFallback: 'Summary', stateName: 'customermanagement.customer.offer.modify.wizard.summary', permission: '/UI/CRM/createCustomer', nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false; }], states: [{ name: 'customermanagement.customer.offer.modify.wizard.summary', state: { url: '/summary', data: { permission: '/UI/CRM/editCustomerOffer' }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/summary', resolve: { summary: ['r6ShoppingCart', 'shoppingCart', function (r6ShoppingCart, shoppingCart) { return r6ShoppingCart.getSummary(); }] }, controller: 'r6CustomerOfferModifyWizardSummaryCtrl' }, 'sidebar@': { templateUrl: 'view/customermanagement/offer/modify/sidebar', controller: 'r6CustomerOfferModifyWizardSidebarCtrl' } } } }] }] ) .constant('customerOfferUpdowngradeWizardSteps', [ { titleUrl: 'i18n/customermanagement/customer/offer/updowngrade/selectoffer/title', titleFallback: 'Select Offer', stateName: 'customermanagement.customer.offer.updowngrade.wizard.selectoffer', nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false; }], states: [ { name: 'customermanagement.customer.offer.updowngrade.wizard.selectoffer', state: { url: '/selectoffer', data: { permission: '/UI/CRM/updowngradeCustomerOffers' }, views: { '': { templateUrl: 'view/customermanagement/customer/offer/updowngrade/selectoffer', controller: 'r6CustomerOfferUpdowngradeSelectOfferCtrl' } } } } ] }, { titleUrl: 'i18n/customermanagement/customer/offer/updowngrade/configurationdetails/title', titleFallback: 'Up/Downgrade Details', stateName: 'customermanagement.customer.offer.updowngrade.wizard.offerconfigurationdetails', nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false; }], states: [ { name: 'customermanagement.customer.offer.updowngrade.wizard.offerconfigurationdetails', state: { url: '/configurationdetails', data: { permission: '/UI/CRM/updowngradeCustomerOffers' }, views: { '': { templateUrl: 'view/customermanagement/customer/offer/updowngrade/details', controller: 'r6CustomerOfferUpdowngradeSelectDetailsCtrl' } } } } ] }, { titleUrl: 'i18n/customermanagement/customer/offer/updowngrade/offerconfiguration/title', titleFallback: 'Offer Configuration', stateName: 'customermanagement.customer.offer.updowngrade.wizard.offerconfiguration', validate: [ 'r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOrderable(); }], nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false && r6ShoppingCart.isOrderable(); }], states: [ { name: 'customermanagement.customer.offer.updowngrade.wizard.offerconfiguration', state: { url: '/offerconfiguration', data: { offerConfiguration: true, permission: '/UI/CRM/updowngradeCustomerOffers' }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/offerconfiguration', resolve: { shoppingCart: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.getSelectedShoppingCart(); }] }, controller: 'r6OrdercaptureWizardOfferconfigurationCtrl' } } } } ] }, { titleUrl: 'i18n/customermanagement/customer/offer/updowngrade/summary/title', titleFallback: 'Summary', stateName: 'customermanagement.customer.offer.updowngrade.wizard.summary', permission: '/UI/CRM/updowngradeCustomerOffers', nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false; }], states: [ { name: 'customermanagement.customer.offer.updowngrade.wizard.summary', state: { url: '/summary', data: { permission: '/UI/CRM/updowngradeCustomerOffers' }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/summary', resolve: { summary: ['r6CustomerOfferUpdowngradeWizardSummaryResolver', function (r6CustomerOfferUpdowngradeWizardSummaryResolver) { return r6CustomerOfferUpdowngradeWizardSummaryResolver(); }] }, controller: 'r6CustomerOfferUpdowngradeWizardSummaryCtrl' } } } } ] } ] ) .constant('customerOfferUpdowngradeInflightWizardSteps', [ { titleUrl: 'i18n/customermanagement/customer/offer/updowngrade/inflight/selectoffer/title', titleFallback: 'Selection Source Offer', stateName: 'customermanagement.customer.offer.updowngrade.inflight.wizard.sourceOfferSelection', validate: [ 'r6ShoppingCart', 'r6MessageService', 'r6DialogService','$q', function (r6ShoppingCart, r6MessageService, r6DialogService, $q) { var shoppingCart = r6ShoppingCart.getSelectedShoppingCart(); var offerKey = shoppingCart.metadata.selectedUpDowngradeOfferKey; var customizedOfferId = shoppingCart.metadata.customizedOfferId; var deferred = $q.defer(); r6ShoppingCart.selectSourceOfferForInflightUpDowngrade(offerKey, customizedOfferId, 'CHANGE').then(function (result) { var isUpDowngradeable = result.configuration.offers && result.configuration.offers.list && result.configuration.offers.list.length > 0; if (!isUpDowngradeable) { r6DialogService.info('i18n.angular.operations.provisioning.orders.order.modal.sorry.title.ftl', 'i18n.angular.customermanagement.customer.offer.updowngrade.notavailable.ftl').then(function () { return false; }); } else { deferred.resolve(true); } }).catch(function (error) { r6MessageService.addError(error); deferred.resolve(false); }); return deferred.promise; }], nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return !!r6ShoppingCart.getSelectedShoppingCart().metadata && !!r6ShoppingCart.getSelectedShoppingCart().metadata.selectedUpDowngradeOfferConfigurationId && !!r6ShoppingCart.getSelectedShoppingCart().metadata.selectedUpDowngradeOfferKey; }], states: [ { name: 'customermanagement.customer.offer.updowngrade.inflight.wizard.sourceOfferSelection', state: { url: '/selectsourceoffer', data: { permission: '/UI/CRM/allowInFlightOrderChanges' }, views: { '': { templateUrl: 'view/customermanagement/customer/offer/updowngrade/sourceofferselection', controller: 'r6CustomerOfferUpdowngradeInflightSelectSourceOfferCtrl' } } } } ] }, { titleUrl: 'i18n/customermanagement/customer/offer/updowngrade/inflight/configurationdetails/title', titleFallback: 'Selection Target Offer', stateName: 'customermanagement.customer.offer.updowngrade.inflight.wizard.offerconfigurationdetails', nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false; }], previous: [ 'r6ShoppintCart', function (r6ShoppintCart) { r6ShoppintCart.loadShoppingCartByOrderId($scope.shoppingCart.orderDetails.orderId); } ], states: [ { name: 'customermanagement.customer.offer.updowngrade.inflight.wizard.offerconfigurationdetails', state: { url: '/configurationdetails', data: { permission: '/UI/CRM/updowngradeCustomerOffers' }, views: { '': { templateUrl: 'view/customermanagement/customer/offer/updowngrade/selectoffer', controller: 'r6CustomerOfferUpdowngradeInflightSelectOfferCtrl' } } } } ] }, { titleUrl: 'i18n/customermanagement/customer/offer/updowngrade/offerconfiguration/title', titleFallback: 'Offer Configuration', stateName: 'customermanagement.customer.offer.updowngrade.inflight.wizard.offerconfiguration', validate: [ 'r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOrderable(); }], nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false && r6ShoppingCart.isOrderable(); }], states: [ { name: 'customermanagement.customer.offer.updowngrade.inflight.wizard.offerconfiguration', state: { url: '/offerconfiguration', data: { offerConfiguration: true, permission: '/UI/CRM/updowngradeCustomerOffers' }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/offerconfiguration', resolve: { shoppingCart: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.getSelectedShoppingCart(); }] }, controller: 'r6OrdercaptureWizardOfferconfigurationCtrl' } } } } ] }, { titleUrl: 'i18n/customermanagement/customer/offer/updowngrade/summary/title', titleFallback: 'Summary', stateName: 'customermanagement.customer.offer.updowngrade.inflight.wizard.summary', permission: '/UI/CRM/updowngradeCustomerOffers', nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false; }], states: [ { name: 'customermanagement.customer.offer.updowngrade.inflight.wizard.summary', state: { url: '/summary', data: { permission: '/UI/CRM/updowngradeCustomerOffers' }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/summary', resolve: { summary: ['r6CustomerOfferUpdowngradeWizardSummaryResolver', function (r6CustomerOfferUpdowngradeWizardSummaryResolver) { return r6CustomerOfferUpdowngradeWizardSummaryResolver(); }] }, controller: 'r6CustomerOfferUpdowngradeWizardSummaryCtrl' } } } } ] } ] ) .constant('customerOfferBarringWizardSteps', [ { titleUrl: 'i18n/customermanagement/customer/offer/barring/wizard/configure/title', titleFallback: 'Offer Barring', stateName: 'customermanagement.customer.offer.barring.wizard.configure', states: [{ name: 'customermanagement.customer.offer.barring.wizard.configure', state: { url: '/configure', data: { permission: [ '/UI/CRM/editCustomerLevelBarring', '/UI/CRM/editCollectionsLevelBarring' ] }, views: { '': { templateUrl: 'view/customermanagement/offer/barring/configure', resolve: { barringLevels: ['r6CustomerOfferBarringWizardConfigureResolver', '$stateParams', function (r6CustomerOfferBarringWizardConfigureResolver, $stateParams) { return r6CustomerOfferBarringWizardConfigureResolver(this.data, $stateParams); }], customerPermission: ['r6CustomerOfferBarringWizardConfigurePermissionResolver', function (r6CustomerOfferBarringWizardConfigurePermissionResolver) { return r6CustomerOfferBarringWizardConfigurePermissionResolver(); }] }, controller: 'r6CustomerOfferBarringWizardConfigureCtrl' } } } }] }, { titleUrl: 'i18n/customermanagement/customer/offer/barring/wizard/summary/title', titleFallback: 'Summary', stateName: 'customermanagement.customer.offer.barring.wizard.summary', states: [{ name: 'customermanagement.customer.offer.barring.wizard.summary', state: { url: '/summary', data: { permission: [ '/UI/CRM/editCustomerLevelBarring', '/UI/CRM/editCollectionsLevelBarring' ] }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/summary', resolve: { summary: ['r6CustomerOfferBarringWizardSummaryResolver', '$stateParams', function (r6CustomerOfferBarringWizardSummaryResolver, $stateParams) { return r6CustomerOfferBarringWizardSummaryResolver($stateParams); }] }, controller: 'r6CustomerOfferBarringWizardSummaryCtrl' } , 'sidebar@': { templateUrl: 'view/customermanagement/offer/barring/sidebar', controller: 'r6CustomerOfferBarringWizardSidebarCtrl' } } } }] } ] ) .constant('customerOfferTopUpWizardSteps', [ { titleUrl: 'i18n/customermanagement/customer/offer/topup/wizard/method/title', titleFallback: 'Method', stateName: 'customermanagement.customer.offer.topup.wizard.method', nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false; }], states: [{ name: 'customermanagement.customer.offer.topup.wizard.method', state: { url: '/method', views: { '': { templateUrl: 'view/customermanagement/offer/topup/method', controller: 'r6CustomerOfferWizardMethodCtrl', resolve: { paymentTypes: ['r6ShoppingCartResource', function (r6ShoppingCartResource) { return r6ShoppingCartResource.ShoppingCart.retrieveTopUpPaymentTypes().$promise; }] } } } } }] }, { titleUrl: 'i18n/customermanagement/customer/offer/topup/wizard/recharge/title', titleFallback: 'Recharge options', stateName: 'customermanagement.customer.offer.topup.wizard.recharge', validate: [ 'r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOrderable(); }], prevEnabled: [function () { return false; }], nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false && r6ShoppingCart.isOrderable(); }], states: [{ name: 'customermanagement.customer.offer.topup.wizard.recharge', state: { url: '/recharge', views: { '': { templateUrl: 'view/customermanagement/offer/topup/recharge', controller: 'r6CustomerOfferWizardRechargeCtrl', resolve: { shoppingCart: ['$stateParams', 'r6ShoppingCart', function ($stateParams, r6ShoppingCart) { var params = angular.copy(r6ShoppingCart.getSelectedShoppingCart().metadata); return r6ShoppingCart.selectTopUpOffer($stateParams.customizedOfferId, params); }] } } } } }] }, { titleUrl: 'i18n/customermanagement/customer/offer/topup/wizard/summary/title', titleFallback: 'Summary', stateName: 'customermanagement.customer.offer.topup.wizard.summary', permission: '/UI/CRM/createCustomer', nextEnabled: ['r6ShoppingCart', function (r6ShoppingCart) { return r6ShoppingCart.isOfferActionInProgress() === false; }], states: [{ name: 'customermanagement.customer.offer.topup.wizard.summary', state: { url: '/summary', data: { permission: '/UI/CRM/editCustomerOffer' }, views: { '': { templateUrl: 'view/customermanagement/ordercapture/summary', resolve: { summary: ['r6ShoppingCart', 'shoppingCart', function (r6ShoppingCart, shoppingCart) { return r6ShoppingCart.getSummary(); }] }, controller: 'r6CustomerOfferTopUpWizardSummaryCtrl' }, 'sidebar@': { templateUrl: 'view/customermanagement/offer/topup/sidebar', controller: 'r6CustomerOfferTopUpWizardSidebarCtrl' } } } }] } ] ) .constant("r6ScrollableMinHeight", 200) .constant('uiDateConfig', { changeMonth: true, changeYear: true }) .constant('r6TagitConfig', {}) .constant('uiDateFormatConfig', '') .constant('r6ProgressDefaultOptions', {max: 100}) .constant('r6EnableTemplatePreloader', true) .constant('r6LogEnable', false) .constant('r6LogEnableLog', false) .constant('r6LogEnableInfo', false) .constant('r6LogEnableWarn', false) .constant('r6LogEnableError', false) .constant('r6LogEnableDebug', false) .constant('r6SpinnerDelay', 30) .constant('r6HttpResponseTimeout', 180000) .constant('r6MessageTimeout', 15000) .constant('r6CsmBillingAccount', 'undefined') .constant('r6ChargeMonthMaxValue', 999) .constant('r6ChargeDayMaxValue', 9999) .constant('r6UsageChargesFractionSize', 5) .constant('r6MaxPositiveNumber',9007199254740991) .constant('r6MinNegativeNumber',-9007199254740991) .constant('r6MaxCRSyncTime', 2000);