|
9 | 9 | <h1>{{__('Profile')}}</h1> |
10 | 10 | <div class="row"> |
11 | 11 | <div class="col-8"> |
12 | | - <nav> |
13 | | - <div class="nav nav-tabs" id="nav-tab" role="tablist"> |
14 | | - <a class="nav-item nav-link active" id="nav-home-tab" data-toggle="tab" href="#nav-home" role="tab" |
15 | | - aria-controls="nav-home" aria-selected="true">Information</a> |
16 | | - <a class="nav-item nav-link" id="nav-profile-tab" data-toggle="tab" href="#nav-profile" role="tab" |
17 | | - aria-controls="nav-profile" aria-selected="false">Permissions</a> |
18 | | - <a class="nav-item nav-link" id="nav-contact-tab" data-toggle="tab" href="#nav-contact" role="tab" |
19 | | - aria-controls="nav-contact" aria-selected="false">Groups</a> |
20 | | - </div> |
21 | | - </nav> |
22 | | - <div class="card card-body tab-content mt-3" id="nav-tabContent"> |
23 | | - <div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-home-tab"> |
24 | | - <h4 class="mt-2">{{__('Contact Information')}}</h4> |
25 | | - <table class="table"> |
26 | | - <tr> |
27 | | - <td align="center"><i class="fas fa-envelope fa-lg text-secondary pr-1"></i></td> |
28 | | - <td>{{__('Email')}}</td> |
29 | | - <td width="100%"><a href="mailto:{{$user->email}}">{{$user->email}}</a></td> |
30 | | - </tr> |
31 | | - <tr> |
32 | | - <td align="center"><i class="fas fa-phone fa-lg text-secondary pr-1"></i></td> |
33 | | - <td>{{__('Phone')}}</td> |
34 | | - <td><a href="{{'tel:' . $user->phone}}">{{$user->phone}}</a></td> |
35 | | - </tr> |
36 | | - @if ($user->fax) |
37 | | - <tr> |
38 | | - <td align="center"><i class="fas fa-fax fa-lg text-secondary pr-1"></i></td> |
39 | | - <td>{{__('Fax')}}</td> |
40 | | - <td><a href="{{'tel:' . $user->fax}}">{{$user->fax}}</a></td> |
41 | | - </tr> |
42 | | - @endif |
43 | | - @if ($user->cell) |
44 | | - <tr> |
45 | | - <td align="center"><i class="fas fa-mobile-alt fa-lg text-secondary pr-1"></i></td> |
46 | | - <td>{{__('Cell')}}</td> |
47 | | - <td><a href="{{'tel:' . $user->cell}}">{{$user->cell}}</a></td> |
48 | | - </tr> |
49 | | - @endif |
| 12 | + <div class="card card-body mt-3"> |
| 13 | + <h4 class="mt-2">{{__('Contact Information')}}</h4> |
| 14 | + <table class="table"> |
| 15 | + <tr> |
| 16 | + <td align="center"><i class="fas fa-envelope fa-lg text-secondary pr-1"></i></td> |
| 17 | + <td>{{__('Email')}}</td> |
| 18 | + <td width="100%"><a href="mailto:{{$user->email}}">{{$user->email}}</a></td> |
| 19 | + </tr> |
| 20 | + <tr> |
| 21 | + <td align="center"><i class="fas fa-phone fa-lg text-secondary pr-1"></i></td> |
| 22 | + <td>{{__('Phone')}}</td> |
| 23 | + <td><a href="{{'tel:' . $user->phone}}">{{$user->phone}}</a></td> |
| 24 | + </tr> |
| 25 | + @if ($user->fax) |
| 26 | + <tr> |
| 27 | + <td align="center"><i class="fas fa-fax fa-lg text-secondary pr-1"></i></td> |
| 28 | + <td>{{__('Fax')}}</td> |
| 29 | + <td><a href="{{'tel:' . $user->fax}}">{{$user->fax}}</a></td> |
| 30 | + </tr> |
| 31 | + @endif |
| 32 | + @if ($user->cell) |
| 33 | + <tr> |
| 34 | + <td align="center"><i class="fas fa-mobile-alt fa-lg text-secondary pr-1"></i></td> |
| 35 | + <td>{{__('Cell')}}</td> |
| 36 | + <td><a href="{{'tel:' . $user->cell}}">{{$user->cell}}</a></td> |
| 37 | + </tr> |
| 38 | + @endif |
50 | 39 |
|
51 | 40 |
|
52 | | - @if($user->address) |
53 | | - <tr> |
54 | | - <td colspan="3"> |
55 | | - <h4 class="mb-0 mt-3">{{__('Address')}}</h4> |
56 | | - </td> |
57 | | - </tr> |
58 | | - <tr> |
59 | | - <td colspan="3"> |
60 | | - {{$user->address}}<br> |
61 | | - {{$user->city}}, {{$user->state}} {{$user->postal}} {{$user->country}} |
62 | | - </td> |
63 | | - </tr> |
64 | | - @endif |
65 | | - </table> |
66 | | - </div> |
67 | | - @if($current_user->is_administrator===true) |
68 | | - <div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-profile-tab"> |
69 | | - <table class="table mb-0"> |
70 | | - <thead> |
71 | | - <tr> |
72 | | - <th>Would you like to make this user an admin?</th> |
73 | | - <th><input type="checkbox" v-model="isAdmin"></th> |
74 | | - </tr> |
75 | | - <tr> |
76 | | - <th>Permissions</th> |
77 | | - <th><input type="checkbox" v-model="selectAll" @click="select" :disabled="isAdmin = isAdmin"></th> |
78 | | - </tr> |
79 | | - </thead> |
80 | | - <tbody> |
81 | | - <tr v-for="permission in permissions"> |
82 | | - <td>@{{permission.name}}<br>@{{permission.description}}</td> |
83 | | - <td><input type="checkbox" :value="permission.id" v-model="selected" :disabled="isAdmin = isAdmin"></td> |
84 | | - </tr> |
85 | | - </tbody> |
86 | | - </table> |
87 | | - <hr class="mt-0"> |
88 | | - <button class="btn btn-secondary float-right" @click="onUpdate">SUBMIT</button> |
89 | | - </div> |
90 | | - @endif |
91 | | - <div class="tab-pane fade" id="nav-contact" role="tabpanel" aria-labelledby="nav-contact-tab">...vvv</div> |
| 41 | + @if($user->address) |
| 42 | + <tr> |
| 43 | + <td colspan="3"> |
| 44 | + <h4 class="mb-0 mt-3">{{__('Address')}}</h4> |
| 45 | + </td> |
| 46 | + </tr> |
| 47 | + <tr> |
| 48 | + <td colspan="3"> |
| 49 | + {{$user->address}}<br> |
| 50 | + {{$user->city}}, {{$user->state}} {{$user->postal}} {{$user->country}} |
| 51 | + </td> |
| 52 | + </tr> |
| 53 | + @endif |
| 54 | + </table> |
92 | 55 | </div> |
93 | 56 | </div> |
94 | 57 | <div class="col-4"> |
|
118 | 81 | new Vue({ |
119 | 82 | el: '#profileForm', |
120 | 83 | data: { |
121 | | - user: @json($user), |
122 | | - permissions: @json($all_permissions), |
123 | | - userPermissionIds: @json($permission_ids), |
124 | | - selected: [], |
125 | | - selectAll: false, |
126 | | - isAdmin: false |
127 | | - }, |
128 | | - beforeMount() { |
129 | | - this.isSuperUser() |
130 | | - }, |
131 | | - mounted() { |
132 | | - this.hasPermission() |
| 84 | + user: @json($user) |
133 | 85 | }, |
134 | 86 | computed: { |
135 | 87 | avatar() { |
|
140 | 92 | initials: this.user.firstname.match(/./u)[0] + this.user.lastname.match(/./u)[0] |
141 | 93 | }]; |
142 | 94 | } |
143 | | - }, |
144 | | - methods: { |
145 | | - select() { |
146 | | - this.selected = []; |
147 | | - if (!this.selectAll) { |
148 | | - for (let permission in this.permissions) { |
149 | | - this.selected.push(this.permissions[permission].id); |
150 | | - } |
151 | | - } |
152 | | - }, |
153 | | - onUpdate() { |
154 | | - if(this.isAdmin === true) { |
155 | | - ProcessMaker.apiClient.put("/users/" + this.user.id, { |
156 | | - is_administrator: this.isAdmin, |
157 | | - email: this.user.email, |
158 | | - username: this.user.username |
159 | | - }) |
160 | | - .then(response => { |
161 | | - ProcessMaker.alert('{{__('Admin successfully added ')}}', 'success'); |
162 | | - location.reload(); |
163 | | - }) |
164 | | - } |
165 | | - else{ |
166 | | - ProcessMaker.apiClient.put("/permissions", { |
167 | | - permission_ids: this.selected, |
168 | | - user_id: this.user.id |
169 | | - }) |
170 | | - .then(response => { |
171 | | - ProcessMaker.alert('{{__('Permission successfully added ')}}', 'success'); |
172 | | - location.reload(); |
173 | | - }) |
174 | | - } |
175 | | - }, |
176 | | - hasPermission() { |
177 | | - if(this.userPermissionIds){ |
178 | | - this.selected = this.userPermissionIds |
179 | | - } |
180 | | - }, |
181 | | - isSuperUser() { |
182 | | - if(this.user.is_administrator === true) { |
183 | | - this.isAdmin = true |
184 | | - } |
185 | | - } |
186 | 95 | } |
187 | 96 | }); |
188 | 97 | </script> |
|
0 commit comments