1
+ <script setup>
2
+ import { Head , Link , useForm } from " @inertiajs/inertia-vue3" ;
3
+ import {
4
+ mdiAccount ,
5
+ mdiAccountCircle ,
6
+ mdiLock ,
7
+ mdiMail ,
8
+ mdiAsterisk ,
9
+ mdiFormTextboxPassword ,
10
+ mdiArrowLeftBoldOutline ,
11
+ } from " @mdi/js" ;
12
+ import SectionMain from " @/Components/SectionMain.vue" ;
13
+ import CardBox from " @/Components/CardBox.vue" ;
14
+ import BaseDivider from " @/Components/BaseDivider.vue" ;
15
+ import FormField from " @/Components/FormField.vue" ;
16
+ import FormControl from " @/Components/FormControl.vue" ;
17
+ import BaseButton from " @/Components/BaseButton.vue" ;
18
+ import BaseButtons from " @/Components/BaseButtons.vue" ;
19
+ import LayoutAuthenticated from " @/layouts/LayoutAuthenticated.vue" ;
20
+ import SectionTitleLineWithButton from " @/Components/SectionTitleLineWithButton.vue" ;
21
+
22
+ const props = defineProps ({
23
+ user: {
24
+ type: Object ,
25
+ default : () => ({}),
26
+ },
27
+ });
28
+
29
+ const profileForm = useForm ({
30
+ name: props .user .name ,
31
+ email: props .user .email ,
32
+ });
33
+ const passwordForm = useForm ({
34
+ old_password: " " ,
35
+ new_password: " " ,
36
+ confirm_password: " " ,
37
+ });
38
+ </script >
39
+
40
+ <template >
41
+ <LayoutAuthenticated >
42
+ <SectionMain >
43
+ <SectionTitleLineWithButton :icon =" mdiAccount" title =" Profile" main >
44
+ <BaseButton
45
+ :route-name =" route('dashboard')"
46
+ :icon =" mdiArrowLeftBoldOutline"
47
+ label =" Back"
48
+ color =" white"
49
+ rounded-full
50
+ small
51
+ />
52
+ </SectionTitleLineWithButton >
53
+
54
+ <div class =" grid grid-cols-1 lg:grid-cols-2 gap-6" >
55
+ <CardBox
56
+ title =" Edit Profile"
57
+ :icon =" mdiAccountCircle"
58
+ form
59
+ @submit.prevent =" profileForm.post(route('admin.account.info.store'))"
60
+ >
61
+ <FormField
62
+ label =" Name"
63
+ help =" Required. Your name"
64
+ :class =" { 'text-red-400': profileForm.errors.name }"
65
+ >
66
+ <FormControl
67
+ v-model =" profileForm.name"
68
+ :icon =" mdiAccount"
69
+ name =" name"
70
+ required
71
+ :error =" profileForm.errors.name"
72
+ />
73
+ </FormField >
74
+ <FormField
75
+ label =" Email"
76
+ help =" Required. Your e-mail"
77
+ :class =" { 'text-red-400': profileForm.errors.email }"
78
+ >
79
+ <FormControl
80
+ v-model =" profileForm.email"
81
+ :icon =" mdiMail"
82
+ type =" email"
83
+ name =" email"
84
+ required
85
+ :error =" profileForm.errors.email"
86
+ />
87
+ </FormField >
88
+
89
+ <template #footer >
90
+ <BaseButtons >
91
+ <BaseButton color =" info" type =" submit" label =" Submit" />
92
+ </BaseButtons >
93
+ </template >
94
+ </CardBox >
95
+
96
+ <CardBox
97
+ title =" Change Password"
98
+ :icon =" mdiLock"
99
+ form
100
+ @submit.prevent ="
101
+ passwordForm.post(route('admin.account.password.store'))
102
+ "
103
+ >
104
+ <FormField
105
+ label =" Current password"
106
+ help =" Required. Your current password"
107
+ :class =" { 'text-red-400': passwordForm.errors.old_password }"
108
+ >
109
+ <FormControl
110
+ v-model =" passwordForm.old_password"
111
+ :icon =" mdiAsterisk"
112
+ name =" old_password"
113
+ type =" password"
114
+ required
115
+ :error =" passwordForm.errors.old_password"
116
+ />
117
+ </FormField >
118
+
119
+ <BaseDivider />
120
+
121
+ <FormField
122
+ label =" New password"
123
+ help =" Required. New password"
124
+ :class =" { 'text-red-400': passwordForm.errors.new_password }"
125
+ >
126
+ <FormControl
127
+ v-model =" passwordForm.new_password"
128
+ :icon =" mdiFormTextboxPassword"
129
+ name =" new_password"
130
+ type =" password"
131
+ required
132
+ :error =" passwordForm.errors.new_password"
133
+ />
134
+ </FormField >
135
+
136
+ <FormField
137
+ label =" Confirm password"
138
+ help =" Required. New password one more time"
139
+ :class =" { 'text-red-400': passwordForm.errors.confirm_password }"
140
+ >
141
+ <FormControl
142
+ v-model =" passwordForm.confirm_password"
143
+ :icon =" mdiFormTextboxPassword"
144
+ name =" confirm_password"
145
+ type =" password"
146
+ required
147
+ :error =" passwordForm.errors.confirm_password"
148
+ />
149
+ </FormField >
150
+
151
+ <template #footer >
152
+ <BaseButtons >
153
+ <BaseButton type =" submit" color =" info" label =" Submit" />
154
+ </BaseButtons >
155
+ </template >
156
+ </CardBox >
157
+ </div >
158
+ </SectionMain >
159
+ </LayoutAuthenticated >
160
+ </template >
0 commit comments