refactor: kebab action
This commit is contained in:
parent
5ec6d1c9d5
commit
bc578d569c
11 changed files with 518 additions and 1357 deletions
|
|
@ -43,7 +43,7 @@ import SideMenu from 'components/SideMenu.vue';
|
|||
import ImageUploadDialog from 'components/ImageUploadDialog.vue';
|
||||
import { AddressForm } from 'components/form';
|
||||
import DialogForm from 'components/DialogForm.vue';
|
||||
import ToggleButton from 'src/components/button/ToggleButton.vue';
|
||||
import KebabAction from 'src/components/shared/KebabAction.vue';
|
||||
|
||||
const { locale, t } = useI18n();
|
||||
const $q = useQuasar();
|
||||
|
|
@ -496,10 +496,10 @@ async function onDelete(id: string) {
|
|||
dialog({
|
||||
color: 'negative',
|
||||
icon: 'mdi-trash-can-outline',
|
||||
title: t('deleteConfirmTitle'),
|
||||
actionText: t('agree'),
|
||||
title: t('dialog.title.confirmDelete'),
|
||||
actionText: t('general.delete'),
|
||||
persistent: true,
|
||||
message: t('deleteConfirmMessage'),
|
||||
message: t('dialog.message.confirmDelete'),
|
||||
action: async () => {
|
||||
await userStore.deleteById(id);
|
||||
|
||||
|
|
@ -1276,124 +1276,26 @@ watch(
|
|||
}
|
||||
"
|
||||
/>
|
||||
|
||||
<q-btn
|
||||
:id="`btn-dots-${props.row.username}`"
|
||||
icon="mdi-dots-vertical"
|
||||
size="sm"
|
||||
dense
|
||||
round
|
||||
flat
|
||||
@click.stop
|
||||
:key="props.row.id"
|
||||
>
|
||||
<q-menu class="bordered">
|
||||
<q-list v-close-popup>
|
||||
<q-item
|
||||
:id="`view-detail-btn-${props.row.username}-view`"
|
||||
@click.stop="
|
||||
() => {
|
||||
openDialog('INFO', props.row.id);
|
||||
}
|
||||
"
|
||||
v-close-popup
|
||||
clickable
|
||||
dense
|
||||
class="row q-py-sm"
|
||||
style="white-space: nowrap"
|
||||
>
|
||||
<q-icon
|
||||
name="mdi-eye-outline"
|
||||
class="col-3"
|
||||
size="xs"
|
||||
style="color: hsl(var(--green-6-hsl))"
|
||||
/>
|
||||
<span class="col-9 q-px-md flex items-center">
|
||||
{{ $t('general.viewDetail') }}
|
||||
</span>
|
||||
</q-item>
|
||||
|
||||
<q-item
|
||||
:id="`view-detail-btn-${props.row.username}-edit`"
|
||||
v-close-popup
|
||||
clickable
|
||||
dense
|
||||
class="row q-py-sm"
|
||||
style="white-space: nowrap"
|
||||
@click="
|
||||
() => {
|
||||
openDialog('INFO', props.row.id, true);
|
||||
}
|
||||
"
|
||||
>
|
||||
<q-icon
|
||||
name="mdi-pencil-outline"
|
||||
class="col-3"
|
||||
size="xs"
|
||||
style="color: hsl(var(--cyan-6-hsl))"
|
||||
/>
|
||||
<span class="col-9 q-px-md flex items-center">
|
||||
{{ $t('general.edit') }}
|
||||
</span>
|
||||
</q-item>
|
||||
<q-item
|
||||
:id="`view-detail-btn-${props.row.username}-delete`"
|
||||
dense
|
||||
v-close-popup
|
||||
:clickable="props.row.status === 'CREATED'"
|
||||
class="row"
|
||||
:class="{
|
||||
'surface-3': props.row.status !== 'CREATED',
|
||||
'app-text-muted': props.row.status !== 'CREATED',
|
||||
}"
|
||||
style="white-space: nowrap"
|
||||
@click="onDelete(props.row.id)"
|
||||
>
|
||||
<q-icon
|
||||
name="mdi-trash-can-outline"
|
||||
size="xs"
|
||||
class="col-3"
|
||||
:class="{
|
||||
'app-text-negative':
|
||||
props.row.status === 'CREATED',
|
||||
}"
|
||||
/>
|
||||
<span class="col-9 q-px-md flex items-center">
|
||||
{{ $t('general.delete') }}
|
||||
</span>
|
||||
</q-item>
|
||||
|
||||
<q-item dense>
|
||||
<q-item-section class="q-py-sm">
|
||||
<div
|
||||
class="q-pa-sm surface-2 rounded flex items-center"
|
||||
>
|
||||
<ToggleButton
|
||||
:id="`view-detail-btn-${props.row.username}-status`"
|
||||
two-way
|
||||
:model-value="props.row.status !== 'INACTIVE'"
|
||||
@click="
|
||||
async () => {
|
||||
triggerChangeStatus(
|
||||
props.row.id,
|
||||
props.row.status,
|
||||
);
|
||||
}
|
||||
"
|
||||
/>
|
||||
<span class="q-pl-md">
|
||||
{{
|
||||
props.row.status !== 'INACTIVE'
|
||||
? $t('general.open')
|
||||
: $t('general.close')
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
<KebabAction
|
||||
:id-name="props.row.username"
|
||||
:status="props.row.status"
|
||||
@view="
|
||||
() => {
|
||||
openDialog('INFO', props.row.id);
|
||||
}
|
||||
"
|
||||
@edit="
|
||||
() => {
|
||||
openDialog('INFO', props.row.id, true);
|
||||
}
|
||||
"
|
||||
@delete="onDelete(props.row.id)"
|
||||
@change-status="
|
||||
async () => {
|
||||
triggerChangeStatus(props.row.id, props.row.status);
|
||||
}
|
||||
"
|
||||
/>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
|
|
@ -1737,8 +1639,9 @@ watch(
|
|||
</div>
|
||||
|
||||
<div
|
||||
class="col-12 col-md-10 q-py-md q-pr-md q-pl-sm relative-position"
|
||||
class="col-12 col-md-10 q-py-md q-pr-md relative-position"
|
||||
id="user-form-content"
|
||||
:class="$q.screen.xs ? 'q-pl-md' : 'q-pl-sm'"
|
||||
style="height: 100%; max-height: 100; overflow-y: auto"
|
||||
>
|
||||
<FormInformation
|
||||
|
|
@ -1815,7 +1718,6 @@ watch(
|
|||
v-model:agencyFile="agencyFile"
|
||||
v-model:agencyFileList="agencyFileList"
|
||||
v-model:userId="userId"
|
||||
class="q-mb-xl"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1987,7 +1889,6 @@ watch(
|
|||
v-model:checkpoint="formData.checkpoint"
|
||||
v-model:checkpointEN="formData.checkpointEN"
|
||||
v-model:agencyFile="agencyFile"
|
||||
class="q-mb-xl"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue