Commit c8330db4 authored by Tình Trương's avatar Tình Trương

update

parent 7b6b8a02
...@@ -94,4 +94,5 @@ export enum API_PATHS { ...@@ -94,4 +94,5 @@ export enum API_PATHS {
updateConfigSystem = 'config-page/update', updateConfigSystem = 'config-page/update',
addConfigSystem = 'config-page/add', addConfigSystem = 'config-page/add',
deleteConfigSystem = 'config-page/delete', deleteConfigSystem = 'config-page/delete',
getListVABInfo = 'information',
} }
...@@ -511,3 +511,33 @@ export type AddConfigSystem = { ...@@ -511,3 +511,33 @@ export type AddConfigSystem = {
url: string; url: string;
numIndex: number; numIndex: number;
}; };
export type VABInfoType = {
id: number;
comName: string;
logo: string;
email: string;
website: string;
phone: string;
address: string;
};
export type DetailVABInfoType = {
id: number;
comName: string;
logo: string;
email: string;
website: string;
phone: string;
address: string;
};
export type UpdateVABInfoType = {
id: number;
comName: string;
logo: string;
email: string;
website: string;
phone: string;
address: string;
};
...@@ -62,11 +62,11 @@ ...@@ -62,11 +62,11 @@
:rules="urlRules" :rules="urlRules"
clearable clearable
></q-input> ></q-input>
<!-- :rules="nameMenuRules" -->
<q-select <q-select
:model-value="nameMenu" :model-value="nameMenu"
@update:model-value="$emit('update:nameMenu', $event)" @update:model-value="$emit('update:nameMenu', $event)"
:label="$t('listConfigSystem.dialogLabel.fieldLabels.nameMenu')" :label="$t('listConfigSystem.dialogLabel.fieldLabels.nameMenu')"
:rules="nameMenuRules"
:options="nameMenuOptions" :options="nameMenuOptions"
multiple multiple
map-options map-options
...@@ -236,15 +236,15 @@ export default defineComponent({ ...@@ -236,15 +236,15 @@ export default defineComponent({
(val && val.trim().length) || (val && val.trim().length) ||
i18n.global.t('listConfigSystem.validateMessages.requireUrl'), i18n.global.t('listConfigSystem.validateMessages.requireUrl'),
]; ];
const nameMenuRules = [ // const nameMenuRules = [
(val?: number) => // (val?: number) =>
val !== undefined || // val !== undefined ||
i18n.global.t('listConfigSystem.validateMessages.requireNameMenu'), // i18n.global.t('listConfigSystem.validateMessages.requireNameMenu'),
]; // ];
return { return {
namePageRules, namePageRules,
urlRules, urlRules,
nameMenuRules, // nameMenuRules,
}; };
}, },
emits: [ emits: [
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
:model-value="isOpened" :model-value="isOpened"
@update:model-value="$emit('update:isOpened', $event)" @update:model-value="$emit('update:isOpened', $event)"
> >
<q-card class="full-width" style="max-width: 60rem" bordered> <q-card class="full-width" style="max-width: 80rem" bordered>
<q-form <q-form
greedy greedy
@submit.prevent=" @submit.prevent="
...@@ -30,55 +30,73 @@ ...@@ -30,55 +30,73 @@
style="max-height: calc(100vh - 10rem)" style="max-height: calc(100vh - 10rem)"
> >
<div class="row q-col-gutter-sm"> <div class="row q-col-gutter-sm">
<div class="col-12"> <div class="col-6">
<div class="row flex-center q-pt-sm"> <div class="row flex-center">
<div> <div class="q-mt-lg">
<q-card style="margin-bottom: 8px" v-if="image !== null"> <q-card v-if="logo !== null">
<q-img <q-img
:src="image"
style="height: 268px; width: 350px"
@click="uploadAvatar" @click="uploadAvatar"
> :src="logo"
</q-img> style="height: 390px; width: 350px; cursor: pointer"
></q-img>
<q-icon <q-icon
name="mdi-close-circle" name="mdi-close-circle"
style="position: absolute; right: 0; font-size: 18px" color="red"
style="
position: absolute;
right: 0;
font-size: 18px;
cursor: pointer;
"
@click="deleteAvatar" @click="deleteAvatar"
></q-icon> ></q-icon>
</q-card> </q-card>
<q-card v-else style="margin-bottom: 8px"> <div
<q-img @click="uploadAvatar"
src="~/assets/noavatar.png" v-else
style="height: 265px; width: 350px" style="
></q-img> height: 390px;
</q-card> width: 350px;
border: 2px dashed #5d319e;
<q-card @click="uploadAvatar"> border-radius: 4px;
<div align="center" class="flex flex-center q-py-xs"> cursor: pointer;
"
>
<div
style="
height: 390px;
width: 350px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
"
>
<q-icon <q-icon
style="color: #5d319e" style="color: #5d319e"
name="mdi-plus-circle-outline" name="mdi-cloud-upload"
:size="'xs'" size="xl"
></q-icon> ></q-icon>
<div class="q-mt-xs"> Tải ảnh lên
{{ $t('infoVAB.uploadImg') }}
</div> </div>
</div> </div>
<div>
<input <input
ref="upload" ref="upload"
hidden hidden
type="file"
@change="selectedFile($event.target.files)" @change="selectedFile($event.target.files)"
type="file"
accept="image/png, image/jpeg" accept="image/png, image/jpeg"
/> />
</q-card>
</div> </div>
</div> </div>
</div>
</div>
<div class="col-6">
<q-input <q-input
:model-value="name" :model-value="comName"
@update:model-value="$emit('update:name', $event)" @update:model-value="$emit('update:comName', $event)"
:label="$t('infoVAB.dialogLabel.infoVABLabels.name')" :label="$t('infoVAB.dialogLabel.infoVABLabels.comName')"
type="text" type="text"
class="q-my-sm q-pt-md" class="q-my-sm q-pt-md"
outlined outlined
...@@ -156,7 +174,7 @@ ...@@ -156,7 +174,7 @@
<template v-slot:body-cell-action=""> <template v-slot:body-cell-action="">
<q-td style="padding: 0" class="flex flex-center"> <q-td style="padding: 0" class="flex flex-center">
<q-btn flat round color="primary" icon="mdi-delete-outline"> <q-btn flat round color="primary" icon="mdi-delete-outline">
<q-tooltip :offset="[20, 10]">{{ <q-tooltip :offset="[10, 10]">{{
$t('infoVAB.toolTipMessage.deleteBankAccount') $t('infoVAB.toolTipMessage.deleteBankAccount')
}}</q-tooltip> }}</q-tooltip>
</q-btn> </q-btn>
...@@ -166,7 +184,7 @@ ...@@ -166,7 +184,7 @@
color="primary" color="primary"
icon="mdi-account-edit-outline" icon="mdi-account-edit-outline"
> >
<q-tooltip :offset="[20, 10]">{{ <q-tooltip :offset="[10, 10]">{{
$t('infoVAB.toolTipMessage.updateBankAccount') $t('infoVAB.toolTipMessage.updateBankAccount')
}}</q-tooltip> }}</q-tooltip>
</q-btn> </q-btn>
...@@ -242,7 +260,6 @@ ...@@ -242,7 +260,6 @@
import { defineComponent, ref, Ref, PropType } from 'vue'; import { defineComponent, ref, Ref, PropType } from 'vue';
import InfoVABAddUpdateBankAccountDialog from 'components/update-info-vab/info-vab-add-update-bank-account/index.vue'; import InfoVABAddUpdateBankAccountDialog from 'components/update-info-vab/info-vab-add-update-bank-account/index.vue';
import { i18n } from 'src/boot/i18n'; import { i18n } from 'src/boot/i18n';
//bankAccount //bankAccount
const bankAccountTableColumnsInfoVAB = [ const bankAccountTableColumnsInfoVAB = [
{ {
...@@ -318,10 +335,10 @@ export default defineComponent({ ...@@ -318,10 +335,10 @@ export default defineComponent({
required: true, required: true,
}, },
isUpdate: { type: Boolean, default: false }, isUpdate: { type: Boolean, default: false },
name: { type: String, required: true }, comName: { type: String, required: true },
image: { type: String, required: true }, logo: { type: String, required: true },
website: { type: String, required: true }, website: { type: String, required: true },
phone: { type: String, required: true }, phone: { type: Number, required: true },
email: { type: String, required: true }, email: { type: String, required: true },
address: { type: String, required: true }, address: { type: String, required: true },
bankAccountList: { type: Array as PropType<unknown[]>, required: true }, bankAccountList: { type: Array as PropType<unknown[]>, required: true },
...@@ -338,6 +355,7 @@ export default defineComponent({ ...@@ -338,6 +355,7 @@ export default defineComponent({
}; };
const upload = ref(null); const upload = ref(null);
const uploadAvatar = () => { const uploadAvatar = () => {
console.log(1);
// eslint-disable-next-line // eslint-disable-next-line
// @ts-ignore // @ts-ignore
// eslint-disable-next-line // eslint-disable-next-line
...@@ -407,6 +425,7 @@ export default defineComponent({ ...@@ -407,6 +425,7 @@ export default defineComponent({
selectedFile, selectedFile,
deleteAvatar, deleteAvatar,
uploadAvatar, uploadAvatar,
upload,
bankAccountTableColumnsInfoVAB, bankAccountTableColumnsInfoVAB,
addBankAccountDialogIsOpened, addBankAccountDialogIsOpened,
bank, bank,
...@@ -426,12 +445,12 @@ export default defineComponent({ ...@@ -426,12 +445,12 @@ export default defineComponent({
}, },
emits: [ emits: [
'update:isOpened', 'update:isOpened',
'update:name', 'update:comName',
'update:website', 'update:website',
'update:phone', 'update:phone',
'update:email', 'update:email',
'update:address', 'update:address',
'update:image', 'update:logo',
'SetAvatar', 'SetAvatar',
'deleteAvatar', 'deleteAvatar',
'saveInfoVAB', 'saveInfoVAB',
......
...@@ -846,8 +846,8 @@ export default { ...@@ -846,8 +846,8 @@ export default {
titleBankAccount: 'Danh sách tài khoản ngân hàng thụ hưởng', titleBankAccount: 'Danh sách tài khoản ngân hàng thụ hưởng',
tableColumnsInfoVAB: { tableColumnsInfoVAB: {
stt: 'STT', stt: 'STT',
name: 'Tên công ty', comName: 'Tên công ty',
image: 'Logo', logo: 'Logo',
website: 'Website', website: 'Website',
phone: 'Số điện thoại', phone: 'Số điện thoại',
email: 'Email', email: 'Email',
...@@ -869,7 +869,7 @@ export default { ...@@ -869,7 +869,7 @@ export default {
updateBankAccount: 'Cập nhật ngân hàng thụ hưởng', updateBankAccount: 'Cập nhật ngân hàng thụ hưởng',
}, },
infoVABLabels: { infoVABLabels: {
name: 'Tên công ty *', comName: 'Tên công ty *',
website: 'Website *', website: 'Website *',
phone: 'Số điện thoại *', phone: 'Số điện thoại *',
email: 'Email *', email: 'Email *',
......
...@@ -144,7 +144,6 @@ ...@@ -144,7 +144,6 @@
/> />
<AddUpdatePolicyDialog <AddUpdatePolicyDialog
isUpdate
v-model:isOpened="showDialogUpdate" v-model:isOpened="showDialogUpdate"
v-model:namePage="namePage" v-model:namePage="namePage"
v-model:content="content" v-model:content="content"
......
...@@ -11,47 +11,67 @@ ...@@ -11,47 +11,67 @@
:columns="infoVABTableColumns" :columns="infoVABTableColumns"
row-key="infoVABName" row-key="infoVABName"
separator="cell" separator="cell"
:rows-per-page-label="$t('recordPerPage')"
:pagination="{
rowsPerPage: 0,
}"
wrap-cells
:no-data-label="$t('emptyData')" :no-data-label="$t('emptyData')"
hide-pagination hide-pagination
class="sticky-header-table" class="sticky-header-table"
> >
<template v-slot:body-cell-action=""> <template v-slot:body-cell-action="item">
<q-td style="padding: 0" align="center"> <q-td style="padding: 0" align="center">
<q-btn <q-btn
flat flat
round round
color="primary" color="primary"
icon="mdi-book-edit-outline" icon="mdi-account-edit-outline"
@click="openUpdateInfoVABDialog()" @click="openUpdateInfoVABDialog(item.row.id)"
> >
<q-tooltip :offset="[20, 10]">{{ <q-tooltip :offset="[10, 10]">{{
$t('infoVAB.toolTipMessage.updateInfoVAB') $t('infoVAB.toolTipMessage.updateInfoVAB')
}}</q-tooltip> }}</q-tooltip>
</q-btn> </q-btn>
<q-btn flat round color="primary" icon="mdi-delete-outline"> <!-- <q-btn flat round color="primary" icon="mdi-delete-outline">
<q-tooltip :offset="[20, 10]">{{ <q-tooltip :offset="[10, 10]">{{
$t('infoVAB.toolTipMessage.updateInfoVAB') $t('infoVAB.toolTipMessage.updateInfoVAB')
}}</q-tooltip> }}</q-tooltip>
</q-btn> </q-btn> -->
</q-td>
</template>
<template v-slot:body-cell-stt="item">
<q-td :item="item" style="text-align: center">
{{ 1 + item.rowIndex + pageSize * (pageIndex - 1) }}
</q-td> </q-td>
</template> </template>
<template v-slot:body-cell-image="image"> <template v-slot:body-cell-logo="logo">
<q-td style="padding: auto; height: 100%" class="flex flex-center"> <q-td style="padding: auto; height: 100%" class="flex flex-center">
<q-img <q-img
style="width: 9rem" style="width: 9rem"
fit="contain" fit="contain"
:ratio="16 / 9" :ratio="16 / 9"
:src="configImg.API_IMAGE_ENDPOINT + image.row.image" :src="configImg.API_IMAGE_ENDPOINT + logo.row.logo"
></q-img> ></q-img>
</q-td> </q-td>
</template> </template>
</q-table> </q-table>
</div> </div>
<div class="col-12 q-mt-sm">
<Pagination
v-model:currentPage="pageIndex"
v-model:pageSize="pageSize"
:totalPage="totalPage"
@update:pageSize="changePageSize"
@update:currentPage="getListVABInfo"
/>
</div>
<UpdateInfoVABDialog <UpdateInfoVABDialog
v-model:isOpened="updateInfoVABDialogIsOpened" v-model:isOpened="updateInfoVABDialogIsOpened"
v-model:name="name" v-model:com-name="comName"
v-model:image="image" v-model:logo="logo"
v-model:website="website" v-model:website="website"
v-model:phone="phone" v-model:phone="phone"
v-model:email="email" v-model:email="email"
...@@ -68,10 +88,17 @@ import { i18n } from 'src/boot/i18n'; ...@@ -68,10 +88,17 @@ import { i18n } from 'src/boot/i18n';
import { defineComponent, onMounted, ref, Ref } from 'vue'; import { defineComponent, onMounted, ref, Ref } from 'vue';
import { AxiosResponse } from 'axios'; import { AxiosResponse } from 'axios';
import { api, BaseResponseBody } from 'src/boot/axios'; import { api, BaseResponseBody } from 'src/boot/axios';
import { FileUploadType } from 'src/assets/type'; import { Notify } from 'quasar';
import { config } from 'src/assets/configurations'; import Pagination from 'components/pagination/index.vue';
import {
FileUploadType,
PaginationResponse,
VABInfoType,
DetailVABInfoType,
UpdateVABInfoType,
} from 'src/assets/type';
import { config, API_PATHS } from 'src/assets/configurations';
import UpdateInfoVABDialog from 'components/update-info-vab/update-info-vab-dialog/index.vue'; import UpdateInfoVABDialog from 'components/update-info-vab/update-info-vab-dialog/index.vue';
export type AvatarType = { export type AvatarType = {
file?: File; file?: File;
url?: string | null; url?: string | null;
...@@ -79,32 +106,33 @@ export type AvatarType = { ...@@ -79,32 +106,33 @@ export type AvatarType = {
export default defineComponent({ export default defineComponent({
components: { components: {
Pagination,
UpdateInfoVABDialog, UpdateInfoVABDialog,
}, },
setup() { setup() {
const infoVABTableColumns = [ const infoVABTableColumns = [
// {
// name: 'index',
// field: 'index',
// required: true,
// label: 'STT',
// align: 'center',
// sortable: false,
// },
{ {
name: 'name', name: 'stt',
field: 'name', field: 'stt',
required: true, required: true,
label: i18n.global.t('infoVAB.tableColumnsInfoVAB.name'), label: 'STT',
align: 'center',
sortable: false,
},
{
name: 'comName',
field: 'comName',
required: true,
label: i18n.global.t('infoVAB.tableColumnsInfoVAB.comName'),
headerStyle: 'text-align: center !important;', headerStyle: 'text-align: center !important;',
align: 'left', align: 'left',
sortable: false, sortable: false,
}, },
{ {
name: 'image', name: 'logo',
field: 'image', field: 'logo',
required: true, required: true,
label: i18n.global.t('infoVAB.tableColumnsInfoVAB.image'), label: i18n.global.t('infoVAB.tableColumnsInfoVAB.logo'),
headerStyle: 'text-align: center !important;', headerStyle: 'text-align: center !important;',
align: 'center', align: 'center',
sortable: false, sortable: false,
...@@ -156,83 +184,112 @@ export default defineComponent({ ...@@ -156,83 +184,112 @@ export default defineComponent({
}, },
]; ];
const infoVABTableRows: Ref<unknown[]> = ref([ const infoVABTableRows: Ref<unknown[]> = ref([]);
{ name: 'VietNam Artist Booking' },
]);
const updateInfoVABDialogIsOpened = ref(false); const updateInfoVABDialogIsOpened = ref(false);
const name = ref(''); const comName: Ref<string | null> = ref(null);
const phone = ref(''); const phone: Ref<string> = ref('');
const email = ref(''); const email: Ref<string> = ref('');
const address = ref(''); const address: Ref<string> = ref('');
const website = ref(''); const website: Ref<string> = ref('');
const image: Ref<string | null> = ref(null); const logo: Ref<string | null> = ref(null);
const imageChange: Ref<string> = ref('');
const infoVABId: Ref<number | undefined> = ref(undefined); const infoVABId: Ref<number | undefined> = ref(undefined);
const avatarFile: Ref<File | null> = ref(null); const avatarFile: Ref<File | null> = ref(null);
const avatarUploaded: Ref<string> = ref(''); const avatarUploaded: Ref<string> = ref('');
const pageIndex = ref(1);
const pageSize = ref(20);
const totalPage = ref(1);
const changePageSize = () => {
pageIndex.value = 1;
void getListVABInfo();
};
const VABInfoId: Ref<number | undefined> = ref(undefined);
//gọi api ds //gọi api ds
const getListInfoVAB = async () => { const getListVABInfo = async () => {
// const response = (await api({ try {
// url: API_PATHS.getListBanner, const response = (await api({
// method: 'GET', url: API_PATHS.getListVABInfo,
// params: { method: 'GET',
// name: nameBanner.value, params: {
// }, pageIndex: pageIndex.value,
// })) as AxiosResponse<BaseResponseBody<BannerType[]>>; pageSize: pageSize.value,
// if (response.data.error.code === config.API_RES_CODE.OK.code) { },
// bannerTableRows.value = response.data.data; })) as AxiosResponse<BaseResponseBody<PaginationResponse<VABInfoType>>>;
// } if (response.data.error.code === config.API_RES_CODE.OK.code) {
infoVABTableRows.value = response.data.data.data;
totalPage.value = response.data.data.totalPages;
}
} catch (error) {}
}; };
const openUpdateInfoVABDialog = () => { const openUpdateInfoVABDialog = (id: number) => {
void getDetailInfoVAB(); void getDetailInfoVAB(id);
updateInfoVABDialogIsOpened.value = true; updateInfoVABDialogIsOpened.value = true;
}; };
//gọi api detail //gọi api detail
const getDetailInfoVAB = async () => { const getDetailInfoVAB = async (id: number) => {
// try { try {
// const response = (await api({ const response = (await api({
// url: API_PATHS.getDetailBanner, url: API_PATHS.getDetailInfoVAB,
// method: 'GET', method: 'GET',
// params: { params: {
// id: id, id: id,
// }, },
// })) as AxiosResponse<BaseResponseBody<DetailBannerType>>; })) as AxiosResponse<BaseResponseBody<DetailVABInfoType>>;
// if (response.data.error.code === config.API_RES_CODE.OK.code) { if (response.data.error.code === config.API_RES_CODE.OK.code) {
// bannerId.value = response.data.data.id; VABInfoId.value = response.data.data.id;
// name.value = response.data.data.name; logo.value = config.API_IMAGE_ENDPOINT + response.data.data.logo;
// status.value = response.data.data.status; imageChange.value = response.data.data.logo;
// } comName.value = response.data.data.comName;
// } catch (error) {} email.value = response.data.data.email;
website.value = response.data.data.website;
phone.value = response.data.data.phone;
address.value = response.data.data.address;
}
} catch (error) {}
}; };
//gọi api update //gọi api update
const updateInfoVAB = async () => { const updateInfoVAB = async () => {
// const data = { if (avatarFile.value) {
// id: bannerId.value, avatarUploaded.value = await callApiUploadAvatar(avatarFile.value);
// name: name.value, void confirmUpdatePost(avatarUploaded.value);
// status: status.value, } else {
// }; void confirmUpdatePost(imageChange.value);
// const response = (await api({ }
// url: API_PATHS.updateBanner, };
// method: 'POST',
// data, const confirmUpdatePost = async (logo: string) => {
// })) as AxiosResponse<BaseResponseBody<UpdateBannerType[]>>; const data = {
// if (response.data.error.code === config.API_RES_CODE.OK.code) { id: VABInfoId.value,
// updateBannerDialogIsOpened.value = false; logo,
// Notify.create({ comName: comName.value,
// type: 'positive', email: email.value,
// message: i18n.global.t('banner.actionMessages.updateBannerAccess'), website: website.value,
// actions: [{ icon: 'close', color: 'white' }], address: address.value,
// }); phone: phone.value,
// void getListBanner(); };
// } const response = (await api({
url: API_PATHS.updateInfoVAB,
method: 'POST',
data,
})) as AxiosResponse<BaseResponseBody<UpdateVABInfoType[]>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
updateInfoVABDialogIsOpened.value = false;
Notify.create({
type: 'positive',
message: i18n.global.t('post.actionMessages.updatePostAccess'),
actions: [{ icon: 'close', color: 'white' }],
});
void getListVABInfo();
}
}; };
const setAvatar = (value: { file?: File; url?: string }) => { const setAvatar = (value: { file?: File; url?: string }) => {
avatarFile.value = value.file as File; avatarFile.value = value.file as File;
image.value = value.url as string; logo.value = value.url as string;
}; };
const callApiUploadAvatar = async (file: File) => { const callApiUploadAvatar = async (file: File) => {
...@@ -255,20 +312,20 @@ export default defineComponent({ ...@@ -255,20 +312,20 @@ export default defineComponent({
} }
}; };
const deleteAvatar = () => { const deleteAvatar = () => {
image.value = null; logo.value = null;
}; };
const configImg = config; const configImg = config;
onMounted(() => { onMounted(() => {
void getListInfoVAB(); void getListVABInfo();
}); });
return { return {
updateInfoVABDialogIsOpened, updateInfoVABDialogIsOpened,
infoVABTableColumns, infoVABTableColumns,
infoVABTableRows, infoVABTableRows,
getListInfoVAB, getListVABInfo,
name, comName,
phone, phone,
email, email,
address, address,
...@@ -277,12 +334,16 @@ export default defineComponent({ ...@@ -277,12 +334,16 @@ export default defineComponent({
openUpdateInfoVABDialog, openUpdateInfoVABDialog,
getDetailInfoVAB, getDetailInfoVAB,
updateInfoVAB, updateInfoVAB,
image, logo,
setAvatar, setAvatar,
callApiUploadAvatar, callApiUploadAvatar,
deleteAvatar, deleteAvatar,
configImg, configImg,
avatarUploaded, pageIndex,
pageSize,
totalPage,
changePageSize,
VABInfoId,
}; };
}, },
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment