refactor(02): use new toggle button
This commit is contained in:
parent
415aa4bc87
commit
b4c01c7c28
3 changed files with 31 additions and 32 deletions
|
|
@ -13,7 +13,8 @@ import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
const optionStore = useOptionStore();
|
const optionStore = useOptionStore();
|
||||||
const prefixNameTh = defineModel<string>('prefixName');
|
const prefixName = defineModel<string>('prefixName');
|
||||||
|
const prefixNameEn = defineModel<string>('prefixNameEn');
|
||||||
const firstName = defineModel<string>('firstName');
|
const firstName = defineModel<string>('firstName');
|
||||||
const lastName = defineModel<string>('lastName');
|
const lastName = defineModel<string>('lastName');
|
||||||
const firstNameEN = defineModel<string>('firstNameEN');
|
const firstNameEN = defineModel<string>('firstNameEN');
|
||||||
|
|
@ -117,7 +118,7 @@ watch(
|
||||||
map-options
|
map-options
|
||||||
hide-selected
|
hide-selected
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
v-model="prefixNameTh"
|
v-model="prefixName"
|
||||||
input-debounce="0"
|
input-debounce="0"
|
||||||
option-label="label"
|
option-label="label"
|
||||||
option-value="value"
|
option-value="value"
|
||||||
|
|
@ -190,10 +191,11 @@ watch(
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
outlined
|
outlined
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
disable
|
:readonly="readonly"
|
||||||
|
:disable="!readonly"
|
||||||
class="col-1"
|
class="col-1"
|
||||||
:label="$t('formDialogInputPrefixName')"
|
:label="$t('formDialogInputPrefixName')"
|
||||||
v-model="firstName"
|
v-model="prefixNameEn"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<q-input
|
<q-input
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { Icon } from '@iconify/vue';
|
||||||
|
|
||||||
import AppBox from 'components/app/AppBox.vue';
|
import AppBox from 'components/app/AppBox.vue';
|
||||||
import AppCircle from 'components/app/AppCircle.vue';
|
import AppCircle from 'components/app/AppCircle.vue';
|
||||||
|
import ToggleButton from '../button/ToggleButton.vue';
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -143,22 +144,17 @@ defineEmits<{
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item dense>
|
<q-item dense>
|
||||||
<q-item-section class="q-py-sm">
|
<q-item-section class="q-py-sm">
|
||||||
<div class="q-pa-sm surface-2 rounded">
|
<div class="q-pa-sm surface-2 rounded flex items-center">
|
||||||
<q-toggle
|
<ToggleButton
|
||||||
dense
|
two-way
|
||||||
color="positive"
|
|
||||||
size="sm"
|
|
||||||
@click="$emit('toggleStatus', disabled === false)"
|
|
||||||
:model-value="!disabled"
|
:model-value="!disabled"
|
||||||
val="xs"
|
@click="$emit('toggleStatus', disabled === false)"
|
||||||
padding="none"
|
/>
|
||||||
>
|
<span class="q-pl-md">
|
||||||
<div class="q-ml-xs">
|
{{
|
||||||
{{
|
!disabled ? $t('switchOnLabel') : $t('switchOffLabel')
|
||||||
!disabled ? $t('switchOnLabel') : $t('switchOffLabel')
|
}}
|
||||||
}}
|
</span>
|
||||||
</div>
|
|
||||||
</q-toggle>
|
|
||||||
</div>
|
</div>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
|
|
||||||
|
|
@ -22,14 +22,12 @@ import PersonCard from 'components/shared/PersonCard.vue';
|
||||||
import StatCardComponent from 'components/StatCardComponent.vue';
|
import StatCardComponent from 'components/StatCardComponent.vue';
|
||||||
import AddButton from 'components/AddButton.vue';
|
import AddButton from 'components/AddButton.vue';
|
||||||
import TooltipComponent from 'components/TooltipComponent.vue';
|
import TooltipComponent from 'components/TooltipComponent.vue';
|
||||||
import FormDialog from 'components/FormDialog.vue';
|
|
||||||
import FormInformation from 'components/02_personnel-management/FormInformation.vue';
|
import FormInformation from 'components/02_personnel-management/FormInformation.vue';
|
||||||
import FormPerson from 'components/02_personnel-management/FormPerson.vue';
|
import FormPerson from 'components/02_personnel-management/FormPerson.vue';
|
||||||
import FormByType from 'components/02_personnel-management/FormByType.vue';
|
import FormByType from 'components/02_personnel-management/FormByType.vue';
|
||||||
import DrawerInfo from 'components/DrawerInfo.vue';
|
import DrawerInfo from 'components/DrawerInfo.vue';
|
||||||
import InfoForm from 'components/02_personnel-management/InfoForm.vue';
|
import InfoForm from 'components/02_personnel-management/InfoForm.vue';
|
||||||
import NoData from 'components/NoData.vue';
|
import NoData from 'components/NoData.vue';
|
||||||
import ProfileUpload from 'components/ProfileUpload.vue';
|
|
||||||
import PaginationComponent from 'components/PaginationComponent.vue';
|
import PaginationComponent from 'components/PaginationComponent.vue';
|
||||||
import useOptionStore from 'stores/options';
|
import useOptionStore from 'stores/options';
|
||||||
import ProfileBanner from 'components/ProfileBanner.vue';
|
import ProfileBanner from 'components/ProfileBanner.vue';
|
||||||
|
|
@ -37,6 +35,7 @@ import SideMenu from 'components/SideMenu.vue';
|
||||||
import ImageUploadDialog from 'components/ImageUploadDialog.vue';
|
import ImageUploadDialog from 'components/ImageUploadDialog.vue';
|
||||||
import { AddressForm } from 'components/form';
|
import { AddressForm } from 'components/form';
|
||||||
import DialogForm from 'components/DialogForm.vue';
|
import DialogForm from 'components/DialogForm.vue';
|
||||||
|
import ToggleButton from 'src/components/button/ToggleButton.vue';
|
||||||
|
|
||||||
const { locale, t } = useI18n();
|
const { locale, t } = useI18n();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
@ -1383,17 +1382,13 @@ watch(
|
||||||
|
|
||||||
<q-item dense>
|
<q-item dense>
|
||||||
<q-item-section class="q-py-sm">
|
<q-item-section class="q-py-sm">
|
||||||
<div class="q-pa-sm surface-2 rounded">
|
<div
|
||||||
<q-toggle
|
class="q-pa-sm surface-2 rounded flex items-center"
|
||||||
color="positive"
|
>
|
||||||
|
<ToggleButton
|
||||||
:id="`view-detail-btn-${props.row.username}-status`"
|
:id="`view-detail-btn-${props.row.username}-status`"
|
||||||
dense
|
two-way
|
||||||
size="sm"
|
:model-value="props.row.status !== 'INACTIVE'"
|
||||||
:label="
|
|
||||||
props.row.status !== 'INACTIVE'
|
|
||||||
? $t('switchOnLabel')
|
|
||||||
: $t('switchOffLabel')
|
|
||||||
"
|
|
||||||
@click="
|
@click="
|
||||||
async () => {
|
async () => {
|
||||||
triggerChangeStatus(
|
triggerChangeStatus(
|
||||||
|
|
@ -1402,8 +1397,14 @@ watch(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
:model-value="props.row.status !== 'INACTIVE'"
|
|
||||||
/>
|
/>
|
||||||
|
<span class="q-pl-md">
|
||||||
|
{{
|
||||||
|
props.row.status !== 'INACTIVE'
|
||||||
|
? $t('switchOnLabel')
|
||||||
|
: $t('switchOffLabel')
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue