eHealthAfrica/direct-delivery-dashboard

View on GitHub
src/app/configurations/allocations/calculations/calculations.states.js

Summary

Maintainability
A
0 mins
Test Coverage
'use strict'

angular.module('allocations')
  .config(function ($stateProvider) {
    $stateProvider
      .state('configurations.allocations.calculations', {
        parent: 'configurations.allocations',
        url: '/calculations',
        templateUrl: 'app/configurations/allocations/calculations/index.html',
        controller: 'CalculationsController',
        controllerAs: 'calculationsController',
        resolve: {
          products: function (productService) {
            return productService.getAll()
              .then(function (productList) {
                return productList.map(function (item) {
                  return item._id
                })
              })
              .catch(function () {
                return []
              })
          },
          locationStates: function (locationService, authService) {
            return authService.getUserStates()
              .catch(function () {
                return []
              })
          },
          assumptionList: function (assumptionService) {
            return assumptionService.getAssumptions()
              .catch(function () {
                return []
              })
          }
        }
      })
  })