2018-10-25 16:51:20 +02:00
|
|
|
/* eslint-disable
|
|
|
|
no-return-assign,
|
|
|
|
no-undef,
|
|
|
|
*/
|
|
|
|
// TODO: This file was created by bulk-decaffeinate.
|
|
|
|
// Fix any style issues and re-enable lint.
|
2018-10-25 16:50:16 +02:00
|
|
|
/*
|
|
|
|
* decaffeinate suggestions:
|
|
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
|
*/
|
2018-10-25 16:51:20 +02:00
|
|
|
angular.module('application.router', ['ui.router'])
|
|
|
|
.config(['$stateProvider', '$urlRouterProvider', '$locationProvider', function ($stateProvider, $urlRouterProvider, $locationProvider) {
|
2018-11-21 11:08:53 +01:00
|
|
|
$locationProvider.hashPrefix('!');
|
|
|
|
$urlRouterProvider.otherwise('/');
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// abstract root parents states
|
|
|
|
// these states controls the access rights to the various routes inherited from them
|
|
|
|
return $stateProvider
|
|
|
|
.state('app', {
|
|
|
|
abstract: true,
|
|
|
|
views: {
|
|
|
|
'header': {
|
2016-03-23 18:39:41 +01:00
|
|
|
templateUrl: '<%= asset_path "shared/header.html" %>'
|
2018-10-25 16:50:16 +02:00
|
|
|
},
|
|
|
|
'leftnav': {
|
|
|
|
templateUrl: '<%= asset_path "shared/leftnav.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'MainNavController'
|
2018-10-25 16:50:16 +02:00
|
|
|
},
|
2019-06-13 11:28:55 +02:00
|
|
|
'cookies': {
|
|
|
|
templateUrl: '<%= asset_path "shared/cookies.html" %>',
|
|
|
|
controller: 'CookiesController'
|
|
|
|
},
|
2016-03-23 18:39:41 +01:00
|
|
|
'main': {}
|
2018-10-25 16:50:16 +02:00
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
logoFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'logo-file' }).$promise; }],
|
|
|
|
logoBlackFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'logo-black-file' }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
commonTranslations: ['Translations', function (Translations) { return Translations.query(['app.public.common', 'app.shared.buttons', 'app.shared.elements']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
},
|
2019-10-01 17:14:16 +02:00
|
|
|
onEnter: ['$rootScope', 'logoFile', 'logoBlackFile', 'CSRF', function ($rootScope, logoFile, logoBlackFile, CSRF) {
|
|
|
|
// Retrieve Anti-CSRF tokens from cookies
|
|
|
|
CSRF.setMetaTags();
|
2018-11-19 16:17:49 +01:00
|
|
|
// Application logo
|
2018-11-21 11:08:53 +01:00
|
|
|
$rootScope.logo = logoFile.custom_asset;
|
|
|
|
return $rootScope.logoBlack = logoBlackFile.custom_asset;
|
2018-11-20 12:57:10 +01:00
|
|
|
}]
|
|
|
|
})
|
|
|
|
.state('app.public', {
|
|
|
|
abstract: true
|
2018-10-25 16:50:16 +02:00
|
|
|
})
|
|
|
|
.state('app.logged', {
|
|
|
|
abstract: true,
|
|
|
|
data: {
|
2016-03-23 18:39:41 +01:00
|
|
|
authorizedRoles: ['member', 'admin']
|
2018-10-25 16:50:16 +02:00
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
currentUser: ['Auth', function (Auth) { return Auth.currentUser(); }]
|
2018-10-25 16:50:16 +02:00
|
|
|
},
|
2018-11-20 12:57:10 +01:00
|
|
|
onEnter: ['$state', '$timeout', 'currentUser', '$rootScope', function ($state, $timeout, currentUser, $rootScope) {
|
2018-11-21 11:08:53 +01:00
|
|
|
$rootScope.currentUser = currentUser;
|
2018-11-20 12:57:10 +01:00
|
|
|
}]
|
2018-10-25 16:50:16 +02:00
|
|
|
})
|
|
|
|
.state('app.admin', {
|
|
|
|
abstract: true,
|
|
|
|
data: {
|
2016-03-23 18:39:41 +01:00
|
|
|
authorizedRoles: ['admin']
|
2018-10-25 16:50:16 +02:00
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
currentUser: ['Auth', function (Auth) { return Auth.currentUser(); }]
|
2018-10-25 16:50:16 +02:00
|
|
|
},
|
2018-11-20 12:57:10 +01:00
|
|
|
onEnter: ['$state', '$timeout', 'currentUser', '$rootScope', function ($state, $timeout, currentUser, $rootScope) {
|
2018-11-21 11:08:53 +01:00
|
|
|
$rootScope.currentUser = currentUser;
|
2018-11-20 12:57:10 +01:00
|
|
|
}]
|
2018-10-25 16:50:16 +02:00
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// main pages
|
|
|
|
.state('app.public.about', {
|
|
|
|
url: '/about',
|
|
|
|
views: {
|
|
|
|
'content@': {
|
|
|
|
templateUrl: '<%= asset_path "shared/about.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'AboutController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.public.about').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.public.home', {
|
|
|
|
url: '/?reset_password_token',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "home.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'HomeController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
lastMembersPromise: ['Member', function (Member) { return Member.lastSubscribed({ limit: 4 }).$promise; }],
|
|
|
|
lastProjectsPromise: ['Project', function (Project) { return Project.lastPublished().$promise; }],
|
|
|
|
upcomingEventsPromise: ['Event', function (Event) { return Event.upcoming({ limit: 3 }).$promise; }],
|
|
|
|
homeBlogpostPromise: ['Setting', function (Setting) { return Setting.get({ name: 'home_blogpost' }).$promise; }],
|
|
|
|
twitterNamePromise: ['Setting', function (Setting) { return Setting.get({ name: 'twitter_name' }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.public.home').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2019-04-18 12:00:57 +02:00
|
|
|
.state('app.public.privacy', {
|
|
|
|
url: '/privacy-policy',
|
|
|
|
views: {
|
|
|
|
'content@': {
|
|
|
|
templateUrl: '<%= asset_path "shared/privacy.html" %>',
|
|
|
|
controller: 'PrivacyController'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.public.privacy').$promise; }]
|
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// profile completion (SSO import passage point)
|
|
|
|
.state('app.logged.profileCompletion', {
|
|
|
|
url: '/profile_completion',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "profile/complete.html"%>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'CompleteProfileController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['fablab_name', 'name_genre']" }).$promise; }],
|
|
|
|
activeProviderPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.active().$promise; }],
|
|
|
|
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
|
|
|
|
cguFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'cgu-file' }).$promise; }],
|
|
|
|
memberPromise: ['Member', 'currentUser', function (Member, currentUser) { return Member.get({ id: currentUser.id }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.logged.profileCompletion', 'app.shared.user']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// dashboard
|
|
|
|
.state('app.logged.dashboard', {
|
|
|
|
abstract: true,
|
|
|
|
url: '/dashboard',
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
memberPromise: ['Member', 'currentUser', function (Member, currentUser) { return Member.get({ id: currentUser.id }).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.logged.dashboard.profile', {
|
|
|
|
url: '/profile',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "dashboard/profile.html" %>',
|
2016-05-12 13:53:59 +02:00
|
|
|
controller: 'DashboardController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.logged.dashboard.profile', 'app.shared.public_profile']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.logged.dashboard.settings', {
|
|
|
|
url: '/settings',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "dashboard/settings.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'EditProfileController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
groups: ['Group', function (Group) { return Group.query().$promise; }],
|
|
|
|
activeProviderPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.active().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.logged.dashboard.settings', 'app.shared.user']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.logged.dashboard.projects', {
|
|
|
|
url: '/projects',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "dashboard/projects.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'DashboardController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.logged.dashboard.projects').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.logged.dashboard.trainings', {
|
|
|
|
url: '/trainings',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "dashboard/trainings.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'DashboardController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.logged.dashboard.trainings').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.logged.dashboard.events', {
|
|
|
|
url: '/events',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "dashboard/events.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'DashboardController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.logged.dashboard.events').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.logged.dashboard.invoices', {
|
|
|
|
url: '/invoices',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "dashboard/invoices.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'DashboardController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.logged.dashboard.invoices').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.logged.dashboard.wallet', {
|
|
|
|
url: '/wallet',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "dashboard/wallet.html" %>',
|
2016-07-18 18:16:54 +02:00
|
|
|
controller: 'WalletController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
walletPromise: ['Wallet', 'currentUser', function (Wallet, currentUser) { return Wallet.getWalletByUser({ user_id: currentUser.id }).$promise; }],
|
|
|
|
transactionsPromise: ['Wallet', 'walletPromise', function (Wallet, walletPromise) { return Wallet.transactions({ id: walletPromise.id }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.shared.wallet']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// members
|
|
|
|
.state('app.logged.members_show', {
|
|
|
|
url: '/members/:id',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "members/show.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'ShowProfileController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
memberPromise: ['$stateParams', 'Member', function ($stateParams, Member) { return Member.get({ id: $stateParams.id }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.logged.members_show', 'app.shared.public_profile']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.logged.members', {
|
|
|
|
url: '/members',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "members/index.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'MembersController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
membersPromise: ['Member', function (Member) { return Member.query({ requested_attributes: '[profile]', page: 1, size: 10 }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.logged.members').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// projects
|
|
|
|
.state('app.public.projects_list', {
|
|
|
|
url: '/projects?q&page&theme_id&component_id&machine_id&from&whole_network',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "projects/index.html.erb" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'ProjectsController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
themesPromise: ['Theme', function (Theme) { return Theme.query().$promise; }],
|
|
|
|
componentsPromise: ['Component', function (Component) { return Component.query().$promise; }],
|
|
|
|
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.public.projects_list').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.logged.projects_new', {
|
|
|
|
url: '/projects/new',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "projects/new.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'NewProjectController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
allowedExtensions: ['Project', function (Project) { return Project.allowedExtensions().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.logged.projects_new', 'app.shared.project']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.public.projects_show', {
|
|
|
|
url: '/projects/:id',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "projects/show.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'ShowProjectController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
projectPromise: ['$stateParams', 'Project', function ($stateParams, Project) { return Project.get({ id: $stateParams.id }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.public.projects_show').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.logged.projects_edit', {
|
|
|
|
url: '/projects/:id/edit',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "projects/edit.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'EditProjectController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
projectPromise: ['$stateParams', 'Project', function ($stateParams, Project) { return Project.get({ id: $stateParams.id }).$promise; }],
|
|
|
|
allowedExtensions: ['Project', function (Project) { return Project.allowedExtensions().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.logged.projects_edit', 'app.shared.project']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// machines
|
|
|
|
.state('app.public.machines_list', {
|
|
|
|
url: '/machines',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "machines/index.html.erb" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'MachinesController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.public.machines_list', 'app.shared.training_reservation_modal', 'app.shared.request_training_modal']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.admin.machines_new', {
|
|
|
|
url: '/machines/new',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "machines/new.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'NewMachineController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.machines_new', 'app.shared.machine']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.public.machines_show', {
|
|
|
|
url: '/machines/:id',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "machines/show.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'ShowMachineController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
machinePromise: ['Machine', '$stateParams', function (Machine, $stateParams) { return Machine.get({ id: $stateParams.id }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.public.machines_show', 'app.shared.training_reservation_modal', 'app.shared.request_training_modal']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.logged.machines_reserve', {
|
|
|
|
url: '/machines/:id/reserve',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "machines/reserve.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'ReserveMachineController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
plansPromise: ['Plan', function (Plan) { return Plan.query().$promise; }],
|
|
|
|
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
|
|
|
|
machinePromise: ['Machine', '$stateParams', function (Machine, $stateParams) { return Machine.get({ id: $stateParams.id }).$promise; }],
|
2018-11-20 12:57:10 +01:00
|
|
|
settingsPromise: ['Setting', function (Setting) {
|
|
|
|
return Setting.query({
|
|
|
|
names: `['machine_explications_alert', \
|
|
|
|
'booking_window_start', \
|
|
|
|
'booking_window_end', \
|
|
|
|
'booking_move_enable', \
|
|
|
|
'booking_move_delay', \
|
|
|
|
'booking_cancel_enable', \
|
|
|
|
'booking_cancel_delay', \
|
|
|
|
'subscription_explications_alert']`
|
2018-11-21 11:08:53 +01:00
|
|
|
}).$promise;
|
2018-11-20 12:57:10 +01:00
|
|
|
}],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) {
|
2018-11-20 12:57:10 +01:00
|
|
|
return Translations.query(['app.logged.machines_reserve', 'app.shared.plan_subscribe', 'app.shared.member_select',
|
2016-08-09 10:22:01 +02:00
|
|
|
'app.shared.stripe', 'app.shared.valid_reservation_modal', 'app.shared.confirm_modify_slot_modal',
|
2018-11-21 11:08:53 +01:00
|
|
|
'app.shared.wallet', 'app.shared.coupon_input', 'app.shared.cart']).$promise;
|
2018-11-20 12:57:10 +01:00
|
|
|
}]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.admin.machines_edit', {
|
|
|
|
url: '/machines/:id/edit',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "machines/edit.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'EditMachineController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
machinePromise: ['Machine', '$stateParams', function (Machine, $stateParams) { return Machine.get({ id: $stateParams.id }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.machines_edit', 'app.shared.machine']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2017-02-13 17:00:27 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// spaces
|
|
|
|
.state('app.public.spaces_list', {
|
|
|
|
url: '/spaces',
|
|
|
|
abstract: Fablab.withoutSpaces,
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "spaces/index.html" %>',
|
2017-02-13 17:00:27 +01:00
|
|
|
controller: 'SpacesController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
spacesPromise: ['Space', function (Space) { return Space.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.public.spaces_list']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.admin.space_new', {
|
|
|
|
url: '/spaces/new',
|
|
|
|
abstract: Fablab.withoutSpaces,
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "spaces/new.html" %>',
|
2017-02-14 12:51:30 +01:00
|
|
|
controller: 'NewSpaceController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.space_new', 'app.shared.space']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.public.space_show', {
|
|
|
|
url: '/spaces/:id',
|
|
|
|
abstract: Fablab.withoutSpaces,
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "spaces/show.html" %>',
|
2017-02-14 12:41:51 +01:00
|
|
|
controller: 'ShowSpaceController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
spacePromise: ['Space', '$stateParams', function (Space, $stateParams) { return Space.get({ id: $stateParams.id }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.public.space_show']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.admin.space_edit', {
|
|
|
|
url: '/spaces/:id/edit',
|
|
|
|
abstract: Fablab.withoutSpaces,
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "spaces/edit.html" %>',
|
2017-02-14 13:36:10 +01:00
|
|
|
controller: 'EditSpaceController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
spacePromise: ['Space', '$stateParams', function (Space, $stateParams) { return Space.get({ id: $stateParams.id }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.space_edit', 'app.shared.space']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.logged.space_reserve', {
|
|
|
|
url: '/spaces/:id/reserve',
|
|
|
|
abstract: Fablab.withoutSpaces,
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "spaces/reserve.html" %>',
|
2017-02-23 17:45:55 +01:00
|
|
|
controller: 'ReserveSpaceController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
spacePromise: ['Space', '$stateParams', function (Space, $stateParams) { return Space.get({ id: $stateParams.id }).$promise; }],
|
|
|
|
availabilitySpacesPromise: ['Availability', '$stateParams', function (Availability, $stateParams) { return Availability.spaces({ spaceId: $stateParams.id }).$promise; }],
|
|
|
|
plansPromise: ['Plan', function (Plan) { return Plan.query().$promise; }],
|
|
|
|
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
|
2018-11-20 12:57:10 +01:00
|
|
|
settingsPromise: ['Setting', function (Setting) {
|
|
|
|
return Setting.query({
|
|
|
|
names: `['booking_window_start', \
|
|
|
|
'booking_window_end', \
|
|
|
|
'booking_move_enable', \
|
|
|
|
'booking_move_delay', \
|
|
|
|
'booking_cancel_enable', \
|
|
|
|
'booking_cancel_delay', \
|
|
|
|
'subscription_explications_alert', \
|
2018-11-21 11:08:53 +01:00
|
|
|
'space_explications_alert']` }).$promise;
|
2018-11-20 12:57:10 +01:00
|
|
|
}],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) {
|
2018-11-20 12:57:10 +01:00
|
|
|
return Translations.query(['app.logged.space_reserve', 'app.shared.plan_subscribe', 'app.shared.member_select',
|
2017-02-23 17:45:55 +01:00
|
|
|
'app.shared.stripe', 'app.shared.valid_reservation_modal', 'app.shared.confirm_modify_slot_modal',
|
2018-11-21 11:08:53 +01:00
|
|
|
'app.shared.wallet', 'app.shared.coupon_input', 'app.shared.cart']).$promise;
|
2018-11-20 12:57:10 +01:00
|
|
|
}]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2017-02-13 17:00:27 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// trainings
|
|
|
|
.state('app.public.trainings_list', {
|
|
|
|
url: '/trainings',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "trainings/index.html.erb" %>',
|
2016-07-13 18:15:14 +02:00
|
|
|
controller: 'TrainingsController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
trainingsPromise: ['Training', function (Training) { return Training.query({ public_page: true }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.public.trainings_list']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.public.training_show', {
|
|
|
|
url: '/trainings/:id',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "trainings/show.html" %>',
|
2016-07-13 18:15:14 +02:00
|
|
|
controller: 'ShowTrainingController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
trainingPromise: ['Training', '$stateParams', function (Training, $stateParams) { return Training.get({ id: $stateParams.id }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.public.training_show']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.logged.trainings_reserve', {
|
|
|
|
url: '/trainings/:id/reserve',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "trainings/reserve.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'ReserveTrainingController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
explicationAlertPromise: ['Setting', function (Setting) { return Setting.get({ name: 'training_explications_alert' }).$promise; }],
|
|
|
|
plansPromise: ['Plan', function (Plan) { return Plan.query().$promise; }],
|
|
|
|
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
|
|
|
|
availabilityTrainingsPromise: ['Availability', '$stateParams', function (Availability, $stateParams) { return Availability.trainings({ trainingId: $stateParams.id }).$promise; }],
|
2018-10-25 16:51:20 +02:00
|
|
|
trainingPromise: ['Training', '$stateParams', function (Training, $stateParams) {
|
2018-11-21 11:08:53 +01:00
|
|
|
if ($stateParams.id !== 'all') { return Training.get({ id: $stateParams.id }).$promise; }
|
2018-11-20 12:57:10 +01:00
|
|
|
}],
|
|
|
|
settingsPromise: ['Setting', function (Setting) {
|
2018-11-21 10:59:07 +01:00
|
|
|
return Setting.query({
|
2018-11-20 12:57:10 +01:00
|
|
|
names: `['booking_window_start', \
|
|
|
|
'booking_window_end', \
|
|
|
|
'booking_move_enable', \
|
|
|
|
'booking_move_delay', \
|
|
|
|
'booking_cancel_enable', \
|
|
|
|
'booking_cancel_delay', \
|
|
|
|
'subscription_explications_alert', \
|
|
|
|
'training_explications_alert', \
|
2018-11-21 11:08:53 +01:00
|
|
|
'training_information_message']` }).$promise;
|
2018-11-20 12:57:10 +01:00
|
|
|
}],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) {
|
2018-11-20 12:57:10 +01:00
|
|
|
return Translations.query(['app.logged.trainings_reserve', 'app.shared.plan_subscribe', 'app.shared.member_select',
|
2016-08-10 16:53:40 +02:00
|
|
|
'app.shared.stripe', 'app.shared.valid_reservation_modal', 'app.shared.confirm_modify_slot_modal',
|
2018-11-21 11:08:53 +01:00
|
|
|
'app.shared.wallet', 'app.shared.coupon_input', 'app.shared.cart']).$promise;
|
2018-11-20 12:57:10 +01:00
|
|
|
}]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
// notifications
|
|
|
|
.state('app.logged.notifications', {
|
|
|
|
url: '/notifications',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "notifications/index.html.erb" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'NotificationsController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.logged.notifications').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// pricing
|
|
|
|
.state('app.public.plans', {
|
|
|
|
url: '/plans',
|
|
|
|
abstract: Fablab.withoutPlans,
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "plans/index.html.erb" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'PlansIndexController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
subscriptionExplicationsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'subscription_explications_alert' }).$promise; }],
|
|
|
|
plansPromise: ['Plan', function (Plan) { return Plan.query().$promise; }],
|
|
|
|
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) {
|
2018-11-20 12:57:10 +01:00
|
|
|
return Translations.query(['app.public.plans', 'app.shared.member_select', 'app.shared.stripe', 'app.shared.wallet',
|
2018-11-21 11:08:53 +01:00
|
|
|
'app.shared.coupon_input']).$promise;
|
2018-11-20 12:57:10 +01:00
|
|
|
}]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// events
|
|
|
|
.state('app.public.events_list', {
|
|
|
|
url: '/events',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "events/index.html.erb" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'EventsController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
categoriesPromise: ['Category', function (Category) { return Category.query().$promise; }],
|
|
|
|
themesPromise: ['EventTheme', function (EventTheme) { return EventTheme.query().$promise; }],
|
|
|
|
ageRangesPromise: ['AgeRange', function (AgeRange) { return AgeRange.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.public.events_list').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.public.events_show', {
|
|
|
|
url: '/events/:id',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "events/show.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'ShowEventController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
eventPromise: ['Event', '$stateParams', function (Event, $stateParams) { return Event.get({ id: $stateParams.id }).$promise; }],
|
|
|
|
priceCategoriesPromise: ['PriceCategory', function (PriceCategory) { return PriceCategory.query().$promise; }],
|
2019-11-20 10:27:56 +01:00
|
|
|
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['booking_move_enable', 'booking_move_delay', 'booking_cancel_enable', 'booking_cancel_delay', 'event_explications_alert']" }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) {
|
2018-11-20 12:57:10 +01:00
|
|
|
return Translations.query(['app.public.events_show', 'app.shared.member_select', 'app.shared.stripe',
|
2018-11-21 11:08:53 +01:00
|
|
|
'app.shared.valid_reservation_modal', 'app.shared.wallet', 'app.shared.coupon_input']).$promise;
|
2018-11-20 12:57:10 +01:00
|
|
|
}]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// global calendar (trainings, machines and events)
|
|
|
|
.state('app.public.calendar', {
|
|
|
|
url: '/calendar',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "calendar/calendar.html" %>',
|
2016-07-13 19:12:16 +02:00
|
|
|
controller: 'CalendarController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
bookingWindowStart: ['Setting', function (Setting) { return Setting.get({ name: 'booking_window_start' }).$promise; }],
|
|
|
|
bookingWindowEnd: ['Setting', function (Setting) { return Setting.get({ name: 'booking_window_end' }).$promise; }],
|
|
|
|
trainingsPromise: ['Training', function (Training) { return Training.query().$promise; }],
|
|
|
|
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
|
|
|
|
spacesPromise: ['Space', function (Space) { return Space.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.public.calendar']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-07-13 19:12:16 +02:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// --- namespace /admin/... ---
|
|
|
|
// calendar
|
|
|
|
.state('app.admin.calendar', {
|
|
|
|
url: '/admin/calendar',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/calendar/calendar.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'AdminCalendarController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
bookingWindowStart: ['Setting', function (Setting) { return Setting.get({ name: 'booking_window_start' }).$promise; }],
|
|
|
|
bookingWindowEnd: ['Setting', function (Setting) { return Setting.get({ name: 'booking_window_end' }).$promise; }],
|
|
|
|
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.admin.calendar').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// project's elements
|
|
|
|
.state('app.admin.project_elements', {
|
|
|
|
url: '/admin/project_elements',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/project_elements/index.html.erb" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'ProjectElementsController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
componentsPromise: ['Component', function (Component) { return Component.query().$promise; }],
|
|
|
|
licencesPromise: ['Licence', function (Licence) { return Licence.query().$promise; }],
|
|
|
|
themesPromise: ['Theme', function (Theme) { return Theme.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.admin.project_elements').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2019-05-21 11:16:12 +02:00
|
|
|
.state('app.admin.manage_abuses', {
|
|
|
|
url: '/admin/abuses',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/abuses/index.html" %>',
|
|
|
|
controller: 'AbusesController'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
abusesPromise: ['Abuse', function(Abuse) { return Abuse.query().$promise; }],
|
|
|
|
translations: ['Translations', function(Translations) { return Translations.query('app.admin.manage_abuses').$promise; }]
|
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// trainings
|
|
|
|
.state('app.admin.trainings', {
|
|
|
|
url: '/admin/trainings',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/trainings/index.html.erb" %>',
|
2016-07-13 18:15:14 +02:00
|
|
|
controller: 'TrainingsAdminController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
trainingsPromise: ['Training', function (Training) { return Training.query().$promise; }],
|
|
|
|
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.trainings', 'app.shared.trainings']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.admin.trainings_new', {
|
|
|
|
url: '/admin/trainings/new',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/trainings/new.html" %>',
|
2016-07-13 18:15:14 +02:00
|
|
|
controller: 'NewTrainingController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.trainings_new', 'app.shared.trainings']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.admin.trainings_edit', {
|
|
|
|
url: '/admin/trainings/:id/edit',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/trainings/edit.html" %>',
|
2016-07-13 18:15:14 +02:00
|
|
|
controller: 'EditTrainingController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
trainingPromise: ['Training', '$stateParams', function (Training, $stateParams) { return Training.get({ id: $stateParams.id }).$promise; }],
|
|
|
|
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.shared.trainings').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
// events
|
|
|
|
.state('app.admin.events', {
|
|
|
|
url: '/admin/events',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/events/index.html.erb" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'AdminEventsController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
eventsPromise: ['Event', function (Event) { return Event.query({ page: 1 }).$promise; }],
|
|
|
|
categoriesPromise: ['Category', function (Category) { return Category.query().$promise; }],
|
|
|
|
themesPromise: ['EventTheme', function (EventTheme) { return EventTheme.query().$promise; }],
|
|
|
|
ageRangesPromise: ['AgeRange', function (AgeRange) { return AgeRange.query().$promise; }],
|
|
|
|
priceCategoriesPromise: ['PriceCategory', function (PriceCategory) { return PriceCategory.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.admin.events').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.admin.events_new', {
|
|
|
|
url: '/admin/events/new',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "events/new.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'NewEventController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
categoriesPromise: ['Category', function (Category) { return Category.query().$promise; }],
|
|
|
|
themesPromise: ['EventTheme', function (EventTheme) { return EventTheme.query().$promise; }],
|
|
|
|
ageRangesPromise: ['AgeRange', function (AgeRange) { return AgeRange.query().$promise; }],
|
|
|
|
priceCategoriesPromise: ['PriceCategory', function (PriceCategory) { return PriceCategory.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.events_new', 'app.shared.event']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.admin.events_edit', {
|
|
|
|
url: '/admin/events/:id/edit',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "events/edit.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'EditEventController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
eventPromise: ['Event', '$stateParams', function (Event, $stateParams) { return Event.get({ id: $stateParams.id }).$promise; }],
|
|
|
|
categoriesPromise: ['Category', function (Category) { return Category.query().$promise; }],
|
|
|
|
themesPromise: ['EventTheme', function (EventTheme) { return EventTheme.query().$promise; }],
|
|
|
|
ageRangesPromise: ['AgeRange', function (AgeRange) { return AgeRange.query().$promise; }],
|
|
|
|
priceCategoriesPromise: ['PriceCategory', function (PriceCategory) { return PriceCategory.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.events_edit', 'app.shared.event']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.admin.event_reservations', {
|
|
|
|
url: '/admin/events/:id/reservations',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/events/reservations.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'ShowEventReservationsController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
eventPromise: ['Event', '$stateParams', function (Event, $stateParams) { return Event.get({ id: $stateParams.id }).$promise; }],
|
|
|
|
reservationsPromise: ['Reservation', '$stateParams', function (Reservation, $stateParams) { return Reservation.query({ reservable_id: $stateParams.id, reservable_type: 'Event' }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.admin.event_reservations').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// pricing
|
|
|
|
.state('app.admin.pricing', {
|
|
|
|
url: '/admin/pricing',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/pricing/index.html.erb" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'EditPricingController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
plans: ['Plan', function (Plan) { return Plan.query().$promise; }],
|
|
|
|
groups: ['Group', function (Group) { return Group.query().$promise; }],
|
|
|
|
machinesPricesPromise: ['Price', function (Price) { return Price.query({ priceable_type: 'Machine', plan_id: 'null' }).$promise; }],
|
|
|
|
trainingsPricingsPromise: ['TrainingsPricing', function (TrainingsPricing) { return TrainingsPricing.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.pricing', 'app.shared.member_select', 'app.shared.coupon']).$promise; }],
|
2018-11-21 11:08:53 +01:00
|
|
|
trainingsPromise: ['Training', function (Training) { return Training.query().$promise; }],
|
|
|
|
machineCreditsPromise: ['Credit', function (Credit) { return Credit.query({ creditable_type: 'Machine' }).$promise; }],
|
|
|
|
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
|
|
|
|
trainingCreditsPromise: ['Credit', function (Credit) { return Credit.query({ creditable_type: 'Training' }).$promise; }],
|
2019-04-04 18:00:19 +02:00
|
|
|
couponsPromise: ['Coupon', function (Coupon) { return Coupon.query({ page: 1, filter: 'all' }).$promise; }],
|
2018-11-21 11:08:53 +01:00
|
|
|
spacesPromise: ['Space', function (Space) { return Space.query().$promise; }],
|
|
|
|
spacesPricesPromise: ['Price', function (Price) { return Price.query({ priceable_type: 'Space', plan_id: 'null' }).$promise; }],
|
|
|
|
spacesCreditsPromise: ['Credit', function (Credit) { return Credit.query({ creditable_type: 'Space' }).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// plans
|
|
|
|
.state('app.admin.plans', {
|
|
|
|
abstract: true,
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
prices: ['Pricing', function (Pricing) { return Pricing.query().$promise; }],
|
|
|
|
groups: ['Group', function (Group) { return Group.query().$promise; }],
|
|
|
|
partners: ['User', function (User) { return User.query({ role: 'partner' }).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.admin.plans.new', {
|
|
|
|
url: '/admin/plans/new',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/plans/new.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'NewPlanController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.plans.new', 'app.shared.plan']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.admin.plans.edit', {
|
|
|
|
url: '/admin/plans/:id/edit',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/plans/edit.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'EditPlanController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
spaces: ['Space', function (Space) { return Space.query().$promise; }],
|
|
|
|
machines: ['Machine', function (Machine) { return Machine.query().$promise; }],
|
|
|
|
plans: ['Plan', function (Plan) { return Plan.query().$promise; }],
|
|
|
|
planPromise: ['Plan', '$stateParams', function (Plan, $stateParams) { return Plan.get({ id: $stateParams.id }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.plans.edit', 'app.shared.plan']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// coupons
|
|
|
|
.state('app.admin.coupons_new', {
|
|
|
|
url: '/admin/coupons/new',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/coupons/new.html" %>',
|
2016-08-04 14:26:07 +02:00
|
|
|
controller: 'NewCouponController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.coupons_new', 'app.shared.coupon']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.admin.coupons_edit', {
|
|
|
|
url: '/admin/coupons/:id/edit',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/coupons/edit.html" %>',
|
2016-08-04 14:26:07 +02:00
|
|
|
controller: 'EditCouponController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
couponPromise: ['Coupon', '$stateParams', function (Coupon, $stateParams) { return Coupon.get({ id: $stateParams.id }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.coupons_edit', 'app.shared.coupon']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// invoices
|
|
|
|
.state('app.admin.invoices', {
|
|
|
|
url: '/admin/invoices',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/invoices/index.html.erb" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'InvoicesController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-20 12:57:10 +01:00
|
|
|
settings: ['Setting', function (Setting) {
|
|
|
|
return Setting.query({
|
2019-07-30 16:06:35 +02:00
|
|
|
names: `['invoice_legals', 'invoice_text', 'invoice_VAT-rate', 'invoice_VAT-active', 'invoice_order-nb', 'invoice_code-value', \
|
2019-09-17 13:00:25 +02:00
|
|
|
'invoice_code-active', 'invoice_reference', 'invoice_logo', 'accounting_journal_code', 'accounting_card_client_code', \
|
2019-09-19 11:51:14 +02:00
|
|
|
'accounting_card_client_label', 'accounting_wallet_client_code', 'accounting_wallet_client_label', \
|
|
|
|
'accounting_other_client_code', 'accounting_other_client_label', 'accounting_wallet_code', 'accounting_wallet_label', \
|
|
|
|
'accounting_VAT_code', 'accounting_VAT_label', 'accounting_subscription_code', 'accounting_subscription_label', \
|
|
|
|
'accounting_Machine_code', 'accounting_Machine_label', 'accounting_Training_code', 'accounting_Training_label', \
|
|
|
|
'accounting_Event_code', 'accounting_Event_label', 'accounting_Space_code', 'accounting_Space_label']` }).$promise;
|
2018-11-20 12:57:10 +01:00
|
|
|
}],
|
|
|
|
invoices: [ 'Invoice', function (Invoice) {
|
|
|
|
return Invoice.list({
|
2016-05-31 17:01:26 +02:00
|
|
|
query: { number: '', customer: '', date: null, order_by: '-reference', page: 1, size: 20 }
|
2018-11-21 11:08:53 +01:00
|
|
|
}).$promise;
|
2018-11-20 12:57:10 +01:00
|
|
|
}],
|
2019-01-08 17:32:45 +01:00
|
|
|
closedPeriods: [ 'AccountingPeriod', function(AccountingPeriod) { return AccountingPeriod.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.admin.invoices').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// members
|
|
|
|
.state('app.admin.members', {
|
|
|
|
url: '/admin/members',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/members/index.html.erb" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'AdminMembersController'
|
2018-10-25 16:50:16 +02:00
|
|
|
},
|
|
|
|
'groups@app.admin.members': {
|
|
|
|
templateUrl: '<%= asset_path "admin/groups/index.html.erb" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'GroupsController'
|
2018-10-25 16:50:16 +02:00
|
|
|
},
|
|
|
|
'tags@app.admin.members': {
|
|
|
|
templateUrl: '<%= asset_path "admin/tags/index.html.erb" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'TagsController'
|
2018-10-25 16:50:16 +02:00
|
|
|
},
|
|
|
|
'authentification@app.admin.members': {
|
|
|
|
templateUrl: '<%= asset_path "admin/authentications/index.html.erb" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'AuthentificationController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
membersPromise: ['Member', function (Member) { return Member.list({ query: { search: '', order_by: 'id', page: 1, size: 20 } }).$promise; }],
|
|
|
|
adminsPromise: ['Admin', function (Admin) { return Admin.query().$promise; }],
|
|
|
|
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
|
|
|
|
tagsPromise: ['Tag', function (Tag) { return Tag.query().$promise; }],
|
|
|
|
authProvidersPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.admin.members').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.admin.members_new', {
|
|
|
|
url: '/admin/members/new',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/members/new.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'NewMemberController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.members_new', 'app.shared.user', 'app.shared.user_admin']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2019-09-24 12:21:19 +02:00
|
|
|
.state('app.admin.members_import', {
|
|
|
|
url: '/admin/members/import',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/members/import.html" %>',
|
|
|
|
controller: 'ImportMembersController'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.members_import', 'app.shared.user', 'app.shared.user_admin']).$promise; }],
|
|
|
|
tags: ['Tag', function(Tag) { return Tag.query().$promise }]
|
|
|
|
}
|
|
|
|
})
|
2019-09-25 16:37:42 +02:00
|
|
|
.state('app.admin.members_import_result', {
|
|
|
|
url: '/admin/members/import/:id/results',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/members/import_result.html" %>',
|
|
|
|
controller: 'ImportMembersResultController'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.members_import_result', 'app.shared.user', 'app.shared.user_admin']).$promise; }],
|
|
|
|
importItem: ['Import', '$stateParams', function(Import, $stateParams) { return Import.get({ id: $stateParams.id }).$promise }]
|
|
|
|
}
|
|
|
|
})
|
2018-10-25 16:50:16 +02:00
|
|
|
.state('app.admin.members_edit', {
|
|
|
|
url: '/admin/members/:id/edit',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/members/edit.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'EditMemberController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
memberPromise: ['Member', '$stateParams', function (Member, $stateParams) { return Member.get({ id: $stateParams.id }).$promise; }],
|
|
|
|
activeProviderPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.active().$promise; }],
|
|
|
|
walletPromise: ['Wallet', '$stateParams', function (Wallet, $stateParams) { return Wallet.getWalletByUser({ user_id: $stateParams.id }).$promise; }],
|
|
|
|
transactionsPromise: ['Wallet', 'walletPromise', function (Wallet, walletPromise) { return Wallet.transactions({ id: walletPromise.id }).$promise; }],
|
|
|
|
tagsPromise: ['Tag', function (Tag) { return Tag.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.members_edit', 'app.shared.user', 'app.shared.user_admin', 'app.shared.wallet']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.admin.admins_new', {
|
|
|
|
url: '/admin/admins/new',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/admins/new.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'NewAdminController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.admin.admins_new').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// authentification providers
|
|
|
|
.state('app.admin.authentication_new', {
|
|
|
|
url: '/admin/authentications/new',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/authentications/new.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'NewAuthenticationController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
mappingFieldsPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.mapping_fields().$promise; }],
|
|
|
|
authProvidersPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.authentication_new', 'app.shared.authentication', 'app.shared.oauth2']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.admin.authentication_edit', {
|
|
|
|
url: '/admin/authentications/:id/edit',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/authentications/edit.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'EditAuthenticationController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
providerPromise: ['AuthProvider', '$stateParams', function (AuthProvider, $stateParams) { return AuthProvider.get({ id: $stateParams.id }).$promise; }],
|
|
|
|
mappingFieldsPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.mapping_fields().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.authentication_edit', 'app.shared.authentication', 'app.shared.oauth2']).$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// statistics
|
|
|
|
.state('app.admin.statistics', {
|
|
|
|
url: '/admin/statistics',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/statistics/index.html.erb" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'StatisticsController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
membersPromise: ['Member', function (Member) { return Member.mapping().$promise; }],
|
|
|
|
statisticsPromise: ['Statistics', function (Statistics) { return Statistics.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.admin.statistics').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('app.admin.stats_graphs', {
|
|
|
|
url: '/admin/statistics/evolution',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/statistics/graphs.html" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'GraphsController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.admin.stats_graphs').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// configurations
|
|
|
|
.state('app.admin.settings', {
|
|
|
|
url: '/admin/settings',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/settings/index.html.erb" %>',
|
2016-03-23 18:39:41 +01:00
|
|
|
controller: 'SettingsController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-20 12:57:10 +01:00
|
|
|
settingsPromise: ['Setting', function (Setting) {
|
|
|
|
return Setting.query({
|
|
|
|
names: `['twitter_name', \
|
|
|
|
'about_title', \
|
|
|
|
'about_body', \
|
2019-04-18 12:30:00 +02:00
|
|
|
'privacy_body', \
|
|
|
|
'privacy_dpo', \
|
2018-11-20 12:57:10 +01:00
|
|
|
'about_contacts', \
|
|
|
|
'home_blogpost', \
|
|
|
|
'machine_explications_alert', \
|
|
|
|
'training_explications_alert', \
|
|
|
|
'training_information_message', \
|
|
|
|
'subscription_explications_alert', \
|
|
|
|
'event_explications_alert', \
|
|
|
|
'space_explications_alert', \
|
|
|
|
'booking_window_start', \
|
|
|
|
'booking_window_end', \
|
|
|
|
'booking_move_enable', \
|
|
|
|
'booking_move_delay', \
|
|
|
|
'booking_cancel_enable', \
|
|
|
|
'booking_cancel_delay', \
|
|
|
|
'main_color', \
|
|
|
|
'secondary_color', \
|
|
|
|
'fablab_name', \
|
|
|
|
'name_genre', \
|
|
|
|
'reminder_enable', \
|
|
|
|
'reminder_delay', \
|
|
|
|
'visibility_yearly', \
|
|
|
|
'visibility_others', \
|
|
|
|
'display_name_enable', \
|
2018-11-21 11:08:53 +01:00
|
|
|
'machines_sort_by']` }).$promise;
|
2018-11-20 12:57:10 +01:00
|
|
|
}],
|
2019-04-18 15:57:56 +02:00
|
|
|
privacyDraftsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'privacy_draft', history: true }).$promise; }],
|
2018-11-21 11:08:53 +01:00
|
|
|
cguFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'cgu-file' }).$promise; }],
|
|
|
|
cgvFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'cgv-file' }).$promise; }],
|
|
|
|
faviconFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'favicon-file' }).$promise; }],
|
|
|
|
profileImageFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'profile-image-file' }).$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.admin.settings').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
})
|
2015-05-05 03:10:25 +02:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
// OpenAPI Clients
|
|
|
|
.state('app.admin.open_api_clients', {
|
|
|
|
url: '/open_api_clients',
|
|
|
|
views: {
|
|
|
|
'main@': {
|
|
|
|
templateUrl: '<%= asset_path "admin/open_api_clients/index.html.erb" %>',
|
2016-05-09 18:15:04 +02:00
|
|
|
controller: 'OpenAPIClientsController'
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: {
|
2018-11-21 11:08:53 +01:00
|
|
|
clientsPromise: ['OpenAPIClient', function (OpenAPIClient) { return OpenAPIClient.query().$promise; }],
|
2018-11-21 11:32:50 +01:00
|
|
|
translations: ['Translations', function (Translations) { return Translations.query('app.admin.open_api_clients').$promise; }]
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
2018-11-21 11:08:53 +01:00
|
|
|
});
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
2015-05-05 03:10:25 +02:00
|
|
|
|
2018-11-21 11:08:53 +01:00
|
|
|
]);
|