Skip to content

Commit e8fbe7b

Browse files
committed
Modification of b-form-select elements in the admin/user edit
1 parent c34f61f commit e8fbe7b

2 files changed

Lines changed: 44 additions & 30 deletions

File tree

‎ProcessMaker/Http/Controllers/Admin/UserController.php‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,16 @@ public function edit(User $user)
3939
$permissionNames = $user->permissions()->pluck('name')->toArray();
4040
$permissionGroups = $all_permissions->sortBy('title')->groupBy('group')->sortKeys();
4141

42-
$availableLangs = [];
42+
$langs = [];
4343
foreach (scandir(resource_path('lang')) as $file) {
4444
preg_match("/([a-z]{2})\.json/", $file, $matches);
4545
if (!empty($matches)) {
46-
$availableLangs[] = $matches[1];
46+
$langs[] = $matches[1];
4747
}
4848
}
49+
// Our form controls need attribute:value pairs sot we convert the langs array to and associative one
50+
$availableLangs = array_combine($langs,$langs);
51+
4952
$currentUser = $user;
5053
$states = JsonData::states();
5154
$countries = JsonData::countries();

‎resources/views/admin/users/edit.blade.php‎

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class="mb-2"
137137
\'is-invalid\':errors.city}']) !!}
138138
<div class="invalid-feedback" v-if="errors.city">@{{errors.city}}</div>
139139
</div>
140-
<div class="form-group col">
140+
<div class="form-group col" v-show="formData.country === 'US'">
141141
{!! Form::label('state', __('State or Region')) !!}
142142
{!! Form::select('state',
143143
$states,
@@ -164,46 +164,57 @@ class="mb-2"
164164
</div>
165165
<div class="form-group col">
166166
{!! Form::label('country', __('Country')) !!}
167-
<b-form-select v-model="formData.country" :options="countries" placeholder="Select" class="form-control">
168-
<template slot="first">
169-
<option :value="null" disabled>{{__('Select')}}</option>
170-
</template>
171-
</b-form-select>
172-
<div class="invalid-feedback" v-if="errors.country">
173-
@{{errors.country}}
174-
</div>
167+
{!! Form::select('country',
168+
$countries,
169+
'formData.country',
170+
['id' => 'country',
171+
'class'=> 'form-control',
172+
'v-model' => 'formData.country',
173+
'v-bind:class' => '{\'form-control\':true, \'is-invalid\':errors.country}'
174+
])
175+
!!}
175176
</div>
176177
</div>
177178
<h5 class="mt-2">{{__('Localization')}}</h5>
178179
<div class="row">
179180
<div class="form-group col">
180181
{!!Form::label('datetime_format', __('Date Format'));!!}
181-
<b-form-select id="datetime_format" v-model="formData.datetime_format" class="form-control" :options="datetimeFormats">
182-
</b-form-select>
183-
<div class="invalid-feedback" v-if="errors.email">
184-
@{{errors.datetime_format}}
185-
</div>
182+
{!!Form::select('datetime_format',
183+
$datetimeFormats,
184+
'formData.datetime_format',
185+
['id' => 'datetime_format',
186+
'class' => 'form-control',
187+
'v-model' => 'formData.datetime_format',
188+
'v-bind:class' => '{\'form-control\':true, \'is-invalid\':errors.datetime_format}'
189+
])
190+
!!}
186191
</div>
187192
</div>
188193
<div class="row">
189194
<div class="form-group col">
190195
{!!Form::label('timezone', __('Time Zone'));!!}
191-
<b-form-select id="timezone" v-model="formData.timezone" class="form-control" :options="timezones">
192-
</b-form-select>
193-
<div class="invalid-feedback" v-if="errors.email">@{{errors.timezone}}
194-
</div>
196+
{!!Form::select('timezone',
197+
$timezones,
198+
'formData.timezone',
199+
['id'=>'timezone',
200+
'class'=> 'form-control',
201+
'v-model'=> 'formData.timezone',
202+
'v-bind:class' => '{\'form-control\':true, \'is-invalid\':errors.timezone}'
203+
])
204+
!!}
195205
</div>
196206

197207
<div class="form-group col">
198208
{!! Form::label('language', __('Language')) !!}
199-
200-
201-
<b-form-select id="language" v-model="formData.language" class="form-control" :options="langs">
202-
</b-form-select>
203-
204-
<div class="invalid-feedback" v-if="errors.language">
205-
@{{errors.language}}
206-
</div>
209+
{!!Form::select('language',
210+
$availableLangs,
211+
'formData.language',
212+
['id'=>'language',
213+
'class'=> 'form-control',
214+
'v-model'=> 'formData.language',
215+
'v-bind:class' => '{\'form-control\':true, \'is-invalid\':errors.language}'
216+
])
217+
!!}
207218
</div>
208219
</div>
209220
<div class="text-right mt-2">
@@ -661,7 +672,7 @@ class="multiselect__tag-icon"></i>
661672
}
662673
},
663674
loadTokens() {
664-
675+
665676
},
666677
generateToken() {
667678
ProcessMaker.apiClient({
@@ -679,7 +690,7 @@ class="multiselect__tag-icon"></i>
679690
ProcessMaker.alert(this.$t('Access token generated successfully'), "success");
680691
})
681692
},
682-
693+
683694
customLabel(options) {
684695
return `${options.name}`
685696
},

0 commit comments

Comments
 (0)