SHARE
TWEET
Untitled
a guest
Oct 14th, 2016
74
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- import addMarkbackRequestTemplate from './add_markback_request.html';
- import waitForAll from '../utils/async';
- export default function routeConfig($stateProvider) {
- 'ngInject';
- $stateProvider
- .state('event.add_markback_request', {
- url: '/add_markback_request/seller/:sellerId',
- template: addMarkbackRequestTemplate,
- controller: 'AddMarkbackRequestController',
- controllerAs: 'addMarkbackRequest',
- resolve: {
- mappedSections: (Restangular, sourceId, eventId, priceCategories) => {
- const promises = []
- priceCategories.forEach((price, index) => {
- const promise = Restangular
- .all('events')
- .all(eventId)
- .all('allocated-sections')
- .all(sourceId)
- .get(price.category.split('P')[1]);
- promise.then((sectionArray) => {
- sectionArray.filter(section =>
- section.is_ga
- );
- // Set default blank value to display as '-- Any --'
- sectionArray.unshift({
- is_ga: true,
- name: '-- Any --',
- id: null,
- });
- return sectionArray;
- });
- promises.push(promise);
- });
- return Promise.all(promises).then((sectionArrays) => {
- const mappedSections = new Map();
- sectionArrays.forEach((sectionArray, index) => {
- mappedSections.set(priceCategories[index], sectionArray);
- });
- console.log(mappedSections)
- return mappedSections;
- });
- },
- },
- });
- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
