This commit is contained in:
@@ -2,231 +2,405 @@
|
||||
<v-container fluid>
|
||||
<gz-report-selector ref="reportSelector"></gz-report-selector>
|
||||
<h2 class="red--text" v-if="$ay.dev">
|
||||
todo: revisit after add vendor to support usertype contractor TEST SAVE
|
||||
when have vendor and make sure wont' allow without vendor chosen and make
|
||||
sure if not error is clear
|
||||
todo: revisit after add vendor to support usertype contractor
|
||||
</h2>
|
||||
<v-row v-if="formState.ready">
|
||||
<v-col>
|
||||
<v-form ref="form">
|
||||
<v-row>
|
||||
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
||||
{{ formState }}
|
||||
<div v-if="formState.ready">
|
||||
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
v-model="obj.name"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:label="$ay.t('Name')"
|
||||
:rules="[form().required(this, 'name')]"
|
||||
:error-messages="form().serverErrors(this, 'name')"
|
||||
ref="name"
|
||||
data-cy="name"
|
||||
@input="fieldValueChanged('name')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-form ref="form">
|
||||
<v-tabs mobile-breakpoint="100" v-model="tab">
|
||||
<v-tab>{{ $ay.t("User") }}</v-tab>
|
||||
<v-tab v-if="obj.id != 0">{{ $ay.t("UserSettings") }}</v-tab>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'subVendorId') && obj.userType == 5"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<gz-pick-list
|
||||
:ayaType="ayaTypes().Vendor"
|
||||
:showEditIcon="true"
|
||||
v-model="obj.subVendorId"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:label="$ay.t('Vendor')"
|
||||
ref="subVendorId"
|
||||
data-cy="subVendorId"
|
||||
:error-messages="form().serverErrors(this, 'subVendorId')"
|
||||
@input="fieldValueChanged('subVendorId')"
|
||||
></gz-pick-list>
|
||||
</v-col>
|
||||
<v-tabs-items v-model="tab">
|
||||
<v-tab-item class="mt-4">
|
||||
<v-row>
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
v-model="obj.name"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:label="$ay.t('Name')"
|
||||
:rules="[form().required(this, 'name')]"
|
||||
:error-messages="form().serverErrors(this, 'name')"
|
||||
ref="name"
|
||||
data-cy="name"
|
||||
@input="fieldValueChanged('name')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
v-model="obj.employeeNumber"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:label="$ay.t('UserEmployeeNumber')"
|
||||
:error-messages="form().serverErrors(this, 'employeeNumber')"
|
||||
ref="employeeNumber"
|
||||
data-cy="employeeNumber"
|
||||
@input="fieldValueChanged('employeeNumber')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'subVendorId') && obj.userType == 5"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<gz-pick-list
|
||||
:ayaType="ayaTypes().Vendor"
|
||||
:showEditIcon="true"
|
||||
v-model="obj.subVendorId"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:label="$ay.t('Vendor')"
|
||||
ref="subVendorId"
|
||||
data-cy="subVendorId"
|
||||
:error-messages="form().serverErrors(this, 'subVendorId')"
|
||||
@input="fieldValueChanged('subVendorId')"
|
||||
></gz-pick-list>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<gz-role-picker
|
||||
:label="$ay.t('AuthorizationRoles')"
|
||||
v-model="obj.roles"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
ref="roles"
|
||||
testId="roles"
|
||||
:error-messages="form().serverErrors(this, 'roles')"
|
||||
@input="fieldValueChanged('roles')"
|
||||
limitSelectionTo="inside"
|
||||
></gz-role-picker>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
v-model="obj.employeeNumber"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:label="$ay.t('UserEmployeeNumber')"
|
||||
:error-messages="
|
||||
form().serverErrors(this, 'employeeNumber')
|
||||
"
|
||||
ref="employeeNumber"
|
||||
data-cy="employeeNumber"
|
||||
@input="fieldValueChanged('employeeNumber')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'Active')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-checkbox
|
||||
v-model="obj.active"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:label="$ay.t('Active')"
|
||||
ref="active"
|
||||
data-cy="active"
|
||||
:error-messages="form().serverErrors(this, 'active')"
|
||||
@change="fieldValueChanged('active')"
|
||||
></v-checkbox>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<gz-role-picker
|
||||
:label="$ay.t('AuthorizationRoles')"
|
||||
v-model="obj.roles"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
ref="roles"
|
||||
testId="roles"
|
||||
:error-messages="form().serverErrors(this, 'roles')"
|
||||
@input="fieldValueChanged('roles')"
|
||||
limitSelectionTo="inside"
|
||||
></gz-role-picker>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'UserType')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-select
|
||||
v-model="obj.userType"
|
||||
:items="selectLists.usertypes"
|
||||
item-text="name"
|
||||
item-value="id"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:label="$ay.t('UserType')"
|
||||
ref="usertype"
|
||||
data-cy="usertype"
|
||||
:rules="[form().integerValid(this, 'usertype')]"
|
||||
:error-messages="form().serverErrors(this, 'usertype')"
|
||||
@input="fieldValueChanged('usertype')"
|
||||
></v-select>
|
||||
</v-col>
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'Active')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-checkbox
|
||||
v-model="obj.active"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:label="$ay.t('Active')"
|
||||
ref="active"
|
||||
data-cy="active"
|
||||
:error-messages="form().serverErrors(this, 'active')"
|
||||
@change="fieldValueChanged('active')"
|
||||
></v-checkbox>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
name="username"
|
||||
id="username"
|
||||
v-model="login"
|
||||
:readonly="formState.readOnly"
|
||||
prepend-icon="$ayiUser"
|
||||
autocomplete="off"
|
||||
autocorrect="off"
|
||||
autocapitalize="off"
|
||||
spellcheck="false"
|
||||
:label="$ay.t('NewLogin')"
|
||||
:error-messages="form().serverErrors(this, 'login')"
|
||||
ref="login"
|
||||
@input="fieldValueChanged('login')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'UserType')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-select
|
||||
v-model="obj.userType"
|
||||
:items="selectLists.usertypes"
|
||||
item-text="name"
|
||||
item-value="id"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:label="$ay.t('UserType')"
|
||||
ref="usertype"
|
||||
data-cy="usertype"
|
||||
:rules="[form().integerValid(this, 'usertype')]"
|
||||
:error-messages="form().serverErrors(this, 'usertype')"
|
||||
@input="fieldValueChanged('usertype')"
|
||||
></v-select>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
name="password"
|
||||
id="password"
|
||||
v-model="password"
|
||||
:readonly="formState.readOnly"
|
||||
:append-outer-icon="reveal ? '$ayiEye' : '$ayiEyeSlash'"
|
||||
prepend-icon="$ayiKey"
|
||||
:label="$ay.t('NewPassword')"
|
||||
:type="reveal ? 'text' : 'password'"
|
||||
:error-messages="form().serverErrors(this, 'password')"
|
||||
ref="password"
|
||||
@input="fieldValueChanged('password')"
|
||||
@click:append-outer="reveal = !reveal"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<gz-date-time-picker
|
||||
:label="$ay.t('LastLogin')"
|
||||
v-model="obj.lastLogin"
|
||||
readonly
|
||||
disabled
|
||||
ref="lastLogin"
|
||||
testId="lastLogin"
|
||||
></gz-date-time-picker>
|
||||
</v-col>
|
||||
<v-col v-if="form().showMe(this, 'Notes')" cols="12">
|
||||
<v-textarea
|
||||
v-model="obj.notes"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:label="$ay.t('UserNotes')"
|
||||
:error-messages="form().serverErrors(this, 'notes')"
|
||||
ref="notes"
|
||||
data-cy="notes"
|
||||
@input="fieldValueChanged('notes')"
|
||||
auto-grow
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
name="username"
|
||||
id="username"
|
||||
v-model="login"
|
||||
:readonly="formState.readOnly"
|
||||
prepend-icon="$ayiUser"
|
||||
autocomplete="off"
|
||||
autocorrect="off"
|
||||
autocapitalize="off"
|
||||
spellcheck="false"
|
||||
:label="$ay.t('NewLogin')"
|
||||
:error-messages="form().serverErrors(this, 'login')"
|
||||
ref="login"
|
||||
@input="fieldValueChanged('login')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col v-if="form().showMe(this, 'Tags')" cols="12">
|
||||
<gz-tag-picker
|
||||
v-model="obj.tags"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
ref="tags"
|
||||
data-cy="tags"
|
||||
:error-messages="form().serverErrors(this, 'tags')"
|
||||
@input="fieldValueChanged('tags')"
|
||||
></gz-tag-picker>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
name="password"
|
||||
id="password"
|
||||
v-model="password"
|
||||
:readonly="formState.readOnly"
|
||||
:append-outer-icon="reveal ? '$ayiEye' : '$ayiEyeSlash'"
|
||||
prepend-icon="$ayiKey"
|
||||
:label="$ay.t('NewPassword')"
|
||||
:type="reveal ? 'text' : 'password'"
|
||||
:error-messages="form().serverErrors(this, 'password')"
|
||||
ref="password"
|
||||
@input="fieldValueChanged('password')"
|
||||
@click:append-outer="reveal = !reveal"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<gz-date-time-picker
|
||||
:label="$ay.t('LastLogin')"
|
||||
v-model="obj.lastLogin"
|
||||
readonly
|
||||
disabled
|
||||
ref="lastLogin"
|
||||
testId="lastLogin"
|
||||
></gz-date-time-picker>
|
||||
</v-col>
|
||||
<v-col v-if="form().showMe(this, 'Notes')" cols="12">
|
||||
<v-textarea
|
||||
v-model="obj.notes"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:label="$ay.t('UserNotes')"
|
||||
:error-messages="form().serverErrors(this, 'notes')"
|
||||
ref="notes"
|
||||
data-cy="notes"
|
||||
@input="fieldValueChanged('notes')"
|
||||
auto-grow
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<gz-custom-fields
|
||||
v-model="obj.customFields"
|
||||
:formKey="formCustomTemplateKey"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:parentVM="this"
|
||||
ref="customFields"
|
||||
data-cy="customFields"
|
||||
:error-messages="form().serverErrors(this, 'customFields')"
|
||||
@input="fieldValueChanged('customFields')"
|
||||
></gz-custom-fields>
|
||||
</v-col>
|
||||
<v-col v-if="form().showMe(this, 'Tags')" cols="12">
|
||||
<gz-tag-picker
|
||||
v-model="obj.tags"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
ref="tags"
|
||||
data-cy="tags"
|
||||
:error-messages="form().serverErrors(this, 'tags')"
|
||||
@input="fieldValueChanged('tags')"
|
||||
></gz-tag-picker>
|
||||
</v-col>
|
||||
|
||||
<v-col v-if="form().showMe(this, 'Wiki')" cols="12">
|
||||
<gz-wiki
|
||||
:ayaType="ayaType"
|
||||
:ayaId="obj.id"
|
||||
ref="wiki"
|
||||
v-model="obj.wiki"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
@input="fieldValueChanged('wiki')"
|
||||
></gz-wiki
|
||||
></v-col>
|
||||
<v-col cols="12">
|
||||
<gz-custom-fields
|
||||
v-model="obj.customFields"
|
||||
:formKey="formCustomTemplateKey"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:parentVM="this"
|
||||
ref="customFields"
|
||||
data-cy="customFields"
|
||||
:error-messages="form().serverErrors(this, 'customFields')"
|
||||
@input="fieldValueChanged('customFields')"
|
||||
></gz-custom-fields>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'Attachments') && obj.id"
|
||||
cols="12"
|
||||
>
|
||||
<gz-attachments
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:ayaType="ayaType"
|
||||
:ayaId="obj.id"
|
||||
></gz-attachments
|
||||
></v-col>
|
||||
</v-row>
|
||||
</v-form>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-col v-if="form().showMe(this, 'Wiki')" cols="12">
|
||||
<gz-wiki
|
||||
:ayaType="ayaType"
|
||||
:ayaId="obj.id"
|
||||
ref="wiki"
|
||||
v-model="obj.wiki"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
@input="fieldValueChanged('wiki')"
|
||||
></gz-wiki
|
||||
></v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'Attachments') && obj.id"
|
||||
cols="12"
|
||||
>
|
||||
<gz-attachments
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:ayaType="ayaType"
|
||||
:ayaId="obj.id"
|
||||
></gz-attachments
|
||||
></v-col>
|
||||
</v-row>
|
||||
</v-tab-item>
|
||||
<v-tab-item v-if="obj.id != 0" class="mt-4">
|
||||
<v-row>
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-select
|
||||
v-model="optionsObj.translationId"
|
||||
:items="selectLists.translations"
|
||||
item-text="name"
|
||||
item-value="id"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('Translation')"
|
||||
ref="translationId"
|
||||
:error-messages="form().serverErrors(this, 'translationId')"
|
||||
@input="fieldValueChanged('translationId')"
|
||||
></v-select>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
v-model="optionsObj.emailAddress"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('UserEmailAddress')"
|
||||
:error-messages="form().serverErrors(this, 'emailAddress')"
|
||||
ref="emailAddress"
|
||||
@input="fieldValueChanged('emailAddress')"
|
||||
data-cy="emailAddress"
|
||||
type="email"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'Phone1')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-text-field
|
||||
v-model="optionsObj.phone1"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:label="$ay.t('UserPhone1')"
|
||||
ref="phone1"
|
||||
data-cy="phone1"
|
||||
type="tel"
|
||||
:error-messages="form().serverErrors(this, 'phone1')"
|
||||
@input="fieldValueChanged('phone1')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'Phone2')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-text-field
|
||||
v-model="optionsObj.phone2"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:label="$ay.t('UserPhone2')"
|
||||
ref="phone2"
|
||||
data-cy="phone2"
|
||||
type="tel"
|
||||
:error-messages="form().serverErrors(this, 'phone2')"
|
||||
@input="fieldValueChanged('phone2')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'Phone3')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-text-field
|
||||
v-model="optionsObj.phone3"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="formState.readOnly"
|
||||
:label="$ay.t('UserPageAddress')"
|
||||
ref="phone3"
|
||||
data-cy="phone3"
|
||||
type="tel"
|
||||
:error-messages="form().serverErrors(this, 'phone3')"
|
||||
@input="fieldValueChanged('phone3')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
v-model="optionsObj.mapUrlTemplate"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('MapUrlTemplate')"
|
||||
:error-messages="
|
||||
form().serverErrors(this, 'mapUrlTemplate')
|
||||
"
|
||||
ref="mapUrlTemplate"
|
||||
@input="fieldValueChanged('mapUrlTemplate')"
|
||||
data-cy="mapUrlTemplate"
|
||||
></v-text-field>
|
||||
<v-select
|
||||
:items="selectLists.mapUrls"
|
||||
item-text="name"
|
||||
item-value="value"
|
||||
@input="mapUrlSelectionChanged"
|
||||
></v-select>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
v-model="optionsObj.currencyName"
|
||||
hint="e.g. USD, EUR, GBP, AUD, CAD etc"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('CurrencyCode')"
|
||||
:rules="[form().required(this, 'currencyName')]"
|
||||
:error-messages="form().serverErrors(this, 'currencyName')"
|
||||
ref="currencyName"
|
||||
@input="fieldValueChanged('currencyName')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
v-model="optionsObj.languageOverride"
|
||||
:placeholder="locale().getBrowserFirstLanguage()"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('LanguageCode')"
|
||||
:error-messages="
|
||||
form().serverErrors(this, 'languageOverride')
|
||||
"
|
||||
ref="languageOverride"
|
||||
@input="fieldValueChanged('languageOverride')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
v-model="optionsObj.timeZoneOverride"
|
||||
:placeholder="locale().getBrowserTimeZoneName()"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('TimeZone')"
|
||||
:error-messages="
|
||||
form().serverErrors(this, 'timeZoneOverride')
|
||||
"
|
||||
ref="timeZoneOverride"
|
||||
@input="fieldValueChanged('timeZoneOverride')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<!-- https://vuetifyjs.com/en/components/color-pickers -->
|
||||
<span class="v-label v-label--active theme--light">
|
||||
{{ $ay.t("UserColor") }}
|
||||
</span>
|
||||
<v-color-picker
|
||||
v-model="optionsObj.uiColor"
|
||||
:readonly="formState.readOnly"
|
||||
hide-mode-switch
|
||||
mode="hexa"
|
||||
:error-messages="form().serverErrors(this, 'uiColor')"
|
||||
ref="uiColor"
|
||||
@input="fieldValueChanged('uiColor')"
|
||||
></v-color-picker>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-tab-item>
|
||||
</v-tabs-items>
|
||||
</v-tabs>
|
||||
</v-form>
|
||||
</div>
|
||||
<template v-if="!formState.ready">
|
||||
<v-progress-circular
|
||||
indeterminate
|
||||
@@ -303,7 +477,49 @@ export default {
|
||||
return {
|
||||
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
|
||||
selectLists: {
|
||||
usertypes: []
|
||||
usertypes: [],
|
||||
translations: [],
|
||||
mapUrls: [
|
||||
{
|
||||
name: "Apple",
|
||||
value:
|
||||
"http://maps.apple.com/?q={ayaddress}<|>http://maps.apple.com/?ll={aylatitude},{aylongitude}"
|
||||
},
|
||||
{
|
||||
name: "Bing",
|
||||
value:
|
||||
"https://bing.com/maps/default.aspx?where1={ayaddress}<|>https://bing.com/maps/default.aspx?cp={aylatitude}~{aylongitude}&lvl=17&style=r&sp=point.{aylatitude}_{aylongitude}"
|
||||
},
|
||||
{
|
||||
name: "Google",
|
||||
value:
|
||||
"https://www.google.com/maps/search/?api=1&query={ayaddress}<|>https://www.google.com/maps/search/?api=1&query={aylatitude},{aylongitude}"
|
||||
},
|
||||
{
|
||||
name: "MapQuest",
|
||||
value:
|
||||
"https://mapquest.com/?center={ayaddress}&zoom=17<|>https://mapquest.com/?center={aylatitude},{aylongitude}&zoom=17"
|
||||
},
|
||||
{
|
||||
name: "Open Street Map",
|
||||
value:
|
||||
"https://www.openstreetmap.org/search?query={ayaddress}<|>https://www.openstreetmap.org/?mlat={aylatitude}&mlon={aylongitude}#map=17/{aylatitude}/{aylongitude}"
|
||||
},
|
||||
{
|
||||
name: "geo URI",
|
||||
value: "geo:{aylatitude},{aylongitude}"
|
||||
},
|
||||
{
|
||||
name: "Waze",
|
||||
value:
|
||||
"https://waze.com/ul?q={ayaddress}<|>https://www.waze.com/ul?ll={aylatitude},{aylongitude}&navigate=yes&zoom=17"
|
||||
},
|
||||
{
|
||||
name: "Yandex",
|
||||
value:
|
||||
"https://yandex.ru/maps/?mode=search&text={ayaddress}&z=17<|>https://yandex.ru/maps/?ll={aylatitude},{aylongitude}&z=12&l=map"
|
||||
}
|
||||
]
|
||||
},
|
||||
obj: {
|
||||
id: 0,
|
||||
@@ -322,9 +538,36 @@ export default {
|
||||
tags: [],
|
||||
lastLogin: null
|
||||
},
|
||||
|
||||
optionsObj: {
|
||||
/*concurrency": 7490431,
|
||||
"translationId": 1,
|
||||
"emailAddress": null,
|
||||
"uiColor": "#000000",
|
||||
"languageOverride": null,
|
||||
"timeZoneOverride": null,
|
||||
"currencyName": "USD",
|
||||
"hour12": true,
|
||||
"userId": 1 */
|
||||
id: 0,
|
||||
concurrency: 0,
|
||||
emailAddress: null,
|
||||
phone1: null,
|
||||
phone2: null,
|
||||
phone3: null,
|
||||
mapUrlTemplate: null,
|
||||
uiColor: null,
|
||||
languageOverride: null,
|
||||
timeZoneOverride: null,
|
||||
currencyName: null,
|
||||
hour12: null,
|
||||
translationId: null
|
||||
},
|
||||
|
||||
login: null,
|
||||
password: null,
|
||||
reveal: true,
|
||||
tab: 0,
|
||||
formState: {
|
||||
ready: false,
|
||||
dirty: false,
|
||||
@@ -383,6 +626,16 @@ export default {
|
||||
ayaTypes: function() {
|
||||
return window.$gz.type;
|
||||
},
|
||||
translation() {
|
||||
return window.$gz.translation;
|
||||
},
|
||||
locale() {
|
||||
return window.$gz.locale;
|
||||
},
|
||||
mapUrlSelectionChanged(val) {
|
||||
this.optionsObj.mapUrlTemplate = val;
|
||||
this.fieldValueChanged("mapUrlTemplate");
|
||||
},
|
||||
form() {
|
||||
return window.$gz.form;
|
||||
},
|
||||
@@ -392,6 +645,7 @@ export default {
|
||||
!this.formState.loading &&
|
||||
!this.formState.readOnly
|
||||
) {
|
||||
console.log("FieldValueChanged for ", ref);
|
||||
window.$gz.form.fieldValueChanged(this, ref);
|
||||
}
|
||||
},
|
||||
@@ -427,6 +681,8 @@ export default {
|
||||
valid: true,
|
||||
loading: false
|
||||
});
|
||||
|
||||
await vm.getUserOptionsDataFromApi();
|
||||
}
|
||||
} catch (error) {
|
||||
window.$gz.errorHandler.handleFormError(error, vm);
|
||||
@@ -479,6 +735,7 @@ export default {
|
||||
//PUT - only concurrency token is returned (**warning, if server changes object other fields then this needs to act more like POST above but is more efficient this way**)
|
||||
//Handle "put" of an existing record (UPDATE)
|
||||
vm.obj.concurrency = res.data.concurrency;
|
||||
await vm.submitOptions();
|
||||
}
|
||||
|
||||
//Update the form status
|
||||
@@ -561,6 +818,77 @@ export default {
|
||||
} finally {
|
||||
vm.formState.loading = false;
|
||||
}
|
||||
},
|
||||
async getUserOptionsDataFromApi() {
|
||||
let vm = this;
|
||||
vm.formState.loading = true;
|
||||
|
||||
let url = `user-option/${vm.obj.id}`;
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
try {
|
||||
let res = await window.$gz.api.get(url);
|
||||
|
||||
if (res.error) {
|
||||
//Not found?
|
||||
if (res.error.code == "2010") {
|
||||
window.$gz.form.handleObjectNotFound(vm);
|
||||
}
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
vm.optionsObj = res.data;
|
||||
// vm.activeTranslationId = res.data.translationId;
|
||||
|
||||
//Update the form status
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
dirty: false,
|
||||
valid: true,
|
||||
loading: false
|
||||
});
|
||||
//modify the menu as necessary
|
||||
generateMenu(vm);
|
||||
}
|
||||
} catch (error) {
|
||||
//Update the form status
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
loading: false
|
||||
});
|
||||
window.$gz.errorHandler.handleFormError(error, vm);
|
||||
}
|
||||
},
|
||||
async submitOptions() {
|
||||
let vm = this;
|
||||
if (vm.canSave) {
|
||||
vm.formState.loading = true;
|
||||
|
||||
let url = `user-option/${vm.obj.id}`;
|
||||
|
||||
//clear any errors vm might be around from previous submit
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
try {
|
||||
let res = await window.$gz.api.upsert(url, vm.optionsObj);
|
||||
|
||||
vm.formState.loading = false;
|
||||
if (res.error) {
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
//UserOptions is never a POST as it always exists and can't be deleted so always a PUT
|
||||
|
||||
//Handle "put" of an existing record (UPDATE)
|
||||
vm.optionsObj.concurrency = res.data.concurrency;
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
dirty: false
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
vm.formState.loading = false;
|
||||
window.$gz.errorHandler.handleFormError(error, vm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -778,5 +1106,16 @@ async function populateSelectionLists(vm) {
|
||||
vm.selectLists.usertypes = window.$gz.enums.getSelectionList(
|
||||
"insideusertype"
|
||||
);
|
||||
|
||||
//------------
|
||||
//http://localhost:7575/api/v8/translation/list
|
||||
let res = await window.$gz.api.get("translation/list");
|
||||
if (res.error) {
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
//window.$gz.errorHandler.handleFormError(res.error, vm);
|
||||
} else {
|
||||
vm.selectLists.translations = res.data;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user