Client - update preferences edition style

This commit is contained in:
Sam 2022-07-23 08:53:10 +02:00
parent 49b4c279cf
commit e3cb47f0f1

View File

@ -23,50 +23,66 @@
@updateTimezone="updateTZ" @updateTimezone="updateTZ"
/> />
</label> </label>
<label class="form-items"> <div class="form-items form-checkboxes">
{{ $t('user.PROFILE.FIRST_DAY_OF_WEEK') }} <span class="checkboxes-label">
<select id="weekm" v-model="userForm.weekm" :disabled="loading"> {{ $t('user.PROFILE.FIRST_DAY_OF_WEEK') }}
<option </span>
v-for="start in weekStart" <div class="checkboxes">
:value="start.value" <label v-for="start in weekStart" :key="start.label">
:key="start.value" <input
> type="radio"
{{ $t(`user.PROFILE.${start.label}`) }} :id="start.label"
</option> :name="start.label"
</select> :checked="start.value === userForm.weekm"
</label> :disabled="loading"
<label class="form-items"> @input="updateWeekM(start.value)"
{{ $t('user.PROFILE.UNITS.LABEL') }} />
<select <span class="checkbox-label">
id="imperial_units" {{ $t(`user.PROFILE.${start.label}`) }}
v-model="userForm.imperial_units" </span>
:disabled="loading" </label>
> </div>
<option </div>
v-for="unit in imperialUnits" <div class="form-items form-checkboxes">
:value="unit.value" <span class="checkboxes-label">
:key="unit.value" {{ $t('user.PROFILE.UNITS.LABEL') }}
> </span>
{{ $t(`user.PROFILE.UNITS.${unit.label}`) }} <div class="checkboxes">
</option> <label v-for="unit in imperialUnits" :key="unit.label">
</select> <input
</label> type="radio"
<label class="form-items"> :id="unit.label"
{{ $t('user.PROFILE.ASCENT_DATA') }} :name="unit.label"
<select :checked="unit.value === userForm.imperial_units"
id="display_ascent" :disabled="loading"
v-model="userForm.display_ascent" @input="updateImperialUnit(unit.value)"
:disabled="loading" />
> <span class="checkbox-label">
<option {{ $t(`user.PROFILE.UNITS.${unit.label}`) }}
v-for="status in ascentData" </span>
:value="status.value" </label>
:key="status.value" </div>
> </div>
{{ $t(`common.${status.label}`) }} <div class="form-items form-checkboxes">
</option> <span class="checkboxes-label">
</select> {{ $t('user.PROFILE.ASCENT_DATA') }}
</label> </span>
<div class="checkboxes">
<label v-for="status in ascentData" :key="status.label">
<input
type="radio"
:id="status.label"
:name="status.label"
:checked="status.value === userForm.display_ascent"
:disabled="loading"
@input="updateAscentDisplay(status.value)"
/>
<span class="checkbox-label">
{{ $t(`common.${status.label}`) }}
</span>
</label>
</div>
</div>
<div class="form-buttons"> <div class="form-buttons">
<button class="confirm" type="submit"> <button class="confirm" type="submit">
{{ $t('buttons.SUBMIT') }} {{ $t('buttons.SUBMIT') }}
@ -107,24 +123,24 @@
weekm: false, weekm: false,
}) })
const weekStart = [ const weekStart = [
{
label: 'MONDAY',
value: true,
},
{ {
label: 'SUNDAY', label: 'SUNDAY',
value: false, value: false,
}, },
{
label: 'MONDAY',
value: true,
},
] ]
const imperialUnits = [ const imperialUnits = [
{
label: 'IMPERIAL',
value: true,
},
{ {
label: 'METRIC', label: 'METRIC',
value: false, value: false,
}, },
{
label: 'IMPERIAL',
value: true,
},
] ]
const ascentData = [ const ascentData = [
{ {
@ -162,8 +178,43 @@
function updateTZ(value: string) { function updateTZ(value: string) {
userForm.timezone = value userForm.timezone = value
} }
function updateAscentDisplay(value: boolean) {
userForm.display_ascent = value
}
function updateImperialUnit(value: boolean) {
userForm.imperial_units = value
}
function updateWeekM(value: boolean) {
userForm.weekm = value
}
onUnmounted(() => { onUnmounted(() => {
store.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES) store.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
}) })
</script> </script>
<style lang="scss" scoped>
@import '~@/scss/vars.scss';
#user-preferences-edition {
.form-items {
padding-top: $default-padding * 0.5;
}
.form-checkboxes {
.checkboxes-label {
font-weight: bold;
}
.checkboxes {
display: flex;
gap: $default-padding;
flex-wrap: wrap;
.checkbox-label {
padding-left: $default-padding * 0.5;
}
label {
font-weight: normal;
}
}
}
}
</style>