const app = require('../app')
const { logo, menuIcon, userIcon, dashboardIcon, roleIcon, dropdownIcon, dropupIcon } = require('../assets')
const assets = require('../assets')
app.component('appArea', {
transclude: true,
template: html`
{{crud.titlePlural}}
Administration
Users
Roles
{{$root.userArea.titleText}}
{{$ctrl.api.user.name}}
{{$ctrl.api.user.name}}
Log out
`,
controller: function($rootScope, $mdSidenav, $mdMedia, $scope, cruds, api, $location) {
window.$rootScope = $rootScope
this.api = api
this.cruds = cruds.filter(crud => crud.showNav !== false)
$scope.assets = assets
$scope.$mdMedia = $mdMedia
this.showNav = false
this.toggleNav = () => {
$mdSidenav('left').toggle()
}
this.logout = async () => {
await api.logout()
$location.url('/login')
}
}
})