Skip to content

Commit 0fc9de4

Browse files
committed
admin module, profile form
1 parent 87528c3 commit 0fc9de4

File tree

5 files changed

+41
-18
lines changed

5 files changed

+41
-18
lines changed

examples/crm/routes/app/routes/administration/routes/permissions/Index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import Crud from '@/utils/crud/components/Crud.vue'
1616
export default {
1717
data () {
1818
return {
19-
prefix: 'admin',
19+
prefix: 'crud/admin',
2020
path: 'permissions',
2121
pageTitle: 'admin.permissions'
2222
}
@@ -27,7 +27,7 @@ export default {
2727
permissionUsers: {
2828
title: this.$t('itemElements.permissionUsers.title'),
2929
url: 'admin/permissions/{id}/users',
30-
controller: 'admin/user-permissions',
30+
controller: 'crud/admin/user-permissions',
3131
itemObject: 'user_permissions',
3232
columns: [
3333
{

examples/crm/routes/app/routes/administration/routes/user-permissions/Index.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<crud
33
:prefix="prefix"
44
:path="path"
5+
:paths="paths"
56
:pageTitle="pageTitle"
67
:fieldsInfo="fieldsInfo"
78
:detailsTitle="$t('detailsTitle')"
@@ -16,8 +17,11 @@ import Crud from '@/utils/crud/components/Crud.vue'
1617
export default {
1718
data () {
1819
return {
19-
prefix: 'admin',
20+
prefix: 'crud/admin',
2021
path: 'user-permissions',
22+
paths: {
23+
i: 'admin/user-permissions'
24+
},
2125
pageTitle: 'admin.userPermissions'
2226
}
2327
},
@@ -31,7 +35,7 @@ export default {
3135
},
3236
{
3337
type: 'select',
34-
url: 'admin/users',
38+
url: 'crud/admin/users',
3539
list: {
3640
value: 'id',
3741
text: 'name',
@@ -54,7 +58,7 @@ export default {
5458
},
5559
{
5660
type: 'select',
57-
url: 'admin/permissions',
61+
url: 'crud/admin/permissions',
5862
list: {
5963
value: 'id',
6064
text: 'name',

examples/crm/routes/app/routes/administration/routes/users/Index.vue

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
<template>
2-
<crud :prefix="prefix" :path="path" :pageTitle="pageTitle" :fieldsInfo="fieldsInfo" :detailsTitle="$t('detailsTitle')"
3-
:customButtons="buttons" :itemElements="itemElements" ref="crud">
2+
<crud
3+
:prefix="prefix"
4+
:path="path"
5+
:paths="paths"
6+
:pageTitle="pageTitle"
7+
:fieldsInfo="fieldsInfo"
8+
:detailsTitle="$t('detailsTitle')"
9+
:customButtons="buttons"
10+
:itemElements="itemElements"
11+
ref="crud"
12+
>
413
</crud>
514
</template>
615

@@ -14,8 +23,12 @@ import {
1423
export default {
1524
data () {
1625
return {
17-
prefix: 'admin',
26+
prefix: 'crud/admin',
1827
path: 'users',
28+
paths: {
29+
i: 'admin/users',
30+
st: 'admin/users'
31+
},
1932
pageTitle: 'admin.users'
2033
}
2134
},
@@ -25,7 +38,7 @@ export default {
2538
userPermissions: {
2639
title: this.$t('itemElements.userPermissions.title'),
2740
url: 'admin/users/{id}/permissions',
28-
controller: 'admin/user-permissions',
41+
controller: 'crud/admin/user-permissions',
2942
itemObject: 'permission_users',
3043
columns: [
3144
{
@@ -73,7 +86,7 @@ export default {
7386
},
7487
{
7588
type: 'select',
76-
url: 'admin/user-types',
89+
url: 'crud/admin/user-types',
7790
list: {
7891
value: 'id',
7992
text: 'name',
@@ -105,7 +118,7 @@ export default {
105118
'openAlertBox'
106119
]),
107120
resetPassword (item) {
108-
Vue.http.put(this.prefix + '/' + this.path + '/' + item.id + '/reset-password')
121+
Vue.http.put('admin/users/' + item.id + '/reset-password')
109122
.then((response) => {
110123
this.openAlertBox(['alertSuccess', this.$t('passwordReseted')])
111124
this.getItems()

src/utils/auth/components/LoginForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<v-layout v-if="loginWait" class="login-loader" justify-center align-center>
33
<v-progress-circular indeterminate v-bind:size="100" v-bind:width="5" color="primary"></v-progress-circular>
44
</v-layout>
5-
<v-layout v-else row wrap class="white" color="primary" ma-3>
5+
<v-layout v-else row wrap class="white" color="primary">
66
<v-alert class="login-failed" type="error" :value="loginFailed" dismissible>
77
{{ $t('global.login.failed') }}
88
</v-alert>

src/utils/auth/store/actions.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,27 @@ const actions = {
4848
})
4949
},
5050
editUser ({
51-
commit
51+
commit,
52+
dispatch
5253
}, data) {
5354
Vue.http.post('auth/user', data)
54-
.then(response => response.json())
55-
.then((result) => {
55+
.then(response => {
56+
let result = response.json()
5657
commit('editUser', result)
58+
}, (error) => {
59+
dispatch('openAlertBox', ['alertError', error.statusText], { root: true })
5760
})
5861
},
5962
editPassword ({
60-
commit
63+
commit,
64+
dispatch
6165
}, data) {
6266
Vue.http.post('auth/user-password', data)
63-
.then(response => response.json())
64-
.then((result) => {
67+
.then(response => {
68+
let result = response.json()
6569
commit('editPassword', result)
70+
}, (error) => {
71+
dispatch('openAlertBox', ['alertError', error.statusText], { root: true })
6672
})
6773
}
6874
}

0 commit comments

Comments
 (0)