update

parent 2c1a94f5
......@@ -58,6 +58,7 @@ export type ArtistInfoType = {
nationality: NationalityType;
rovince: ProvinceType[];
fields: FieldType[];
Classifications: ClassificationOptions[];
works: WorkType[];
qualification: QualificationType;
artistLevel: ArtistLevelType;
......@@ -101,6 +102,16 @@ export type FieldType = {
numIndex: number;
};
export type ClassificationOptions = {
id: number;
name: string;
status:number | null;
description: string | null;
numIndex: number;
};
export type NationalityType = {
id: number;
name: string;
......@@ -253,6 +264,8 @@ export type DetailUnit = {
email: string;
phoneNumber: string;
status: number;
userName: string;
password: string;
fields: Array<FieldType>;
contracts: Array<Contract>;
};
......
......@@ -176,6 +176,9 @@
</q-tabs>
<q-separator />
<q-tab-panels v-model="tabContent" animated>
<q-tab-panel
v-for="(info, index) in languageOptions"
......@@ -191,7 +194,15 @@
toolbar-toggle-color="yellow-8"
toolbar-bg="primary"
style="height: 100%"
:definitions="{
upload: {
tip: 'Upload to cloud',
icon: 'cloud_upload',
label: 'Upload',
handler: insertImg,
},
}"
:toolbar="[
[
{
......@@ -267,8 +278,7 @@
['undo', 'redo'],
['viewsource'],
['upload']
['upload'],
]"
:fonts="{
arial: 'Arial',
......@@ -280,13 +290,19 @@
times_new_roman: 'Times New Roman',
verdana: 'Verdana',
}"
>
>
<template #upload>
<q-btn @click="uploadFile" flat class="text-white" dense size="sm" icon="cloud_upload">
<q-btn
@click="uploadFile"
flat
class="text-white"
dense
size="sm"
icon="cloud_upload"
>
</q-btn>
</template>
</q-editor>
</q-editor>
</q-tab-panel>
</q-tab-panels>
</div>
......@@ -317,8 +333,11 @@
</template>
<script lang="ts">
import { defineComponent, PropType, ref } from 'vue';
import { defineComponent, PropType, ref, Ref } from 'vue';
import { i18n } from 'src/boot/i18n';
import { Editor } from 'react-draft-wysiwyg';
import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
export default defineComponent({
props: {
isOpened: {
......@@ -350,15 +369,11 @@ export default defineComponent({
},
},
setup(_, context) {
methods: {},
const uploadImage = ref(null);
setup(_, context) {
// const content = ref(null)
const uploadImage = ref(null);
const uploadFile = () => {
// eslint-disable-next-line
// @ts-ignore
......@@ -366,14 +381,43 @@ export default defineComponent({
uploadImage.value?.click();
};
const selectedFile = (value: FileList) => {
context.emit('SetAvatar', {
file: value[0],
url: URL.createObjectURL(value[0]),
});
};
const insertImg = () => {
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
// create an input file element to open file dialog
const input = document.createElement('input');
input.type = 'file';
input.accept = '.png, .jpg'; // file extensions allowed
input.onchange = (e) => {
// const div = `<img src="${url}>`
const files = (<HTMLInputElement & EventTarget>e.target).files;
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
const url = URL.createObjectURL(files[0]);
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
document.execCommand(
'insertHTML',
true,
'<div><img src="' + url + '" /></div>'
);
};
input.click();
};
const deleteAvatar = () => {
context.emit('deleteAvatar');
};
......@@ -402,6 +446,8 @@ export default defineComponent({
const tab = ref('vi');
const tabContent = ref('vi');
const content: Ref<string> = ref('');
return {
nameRules,
imageRules,
......@@ -413,7 +459,10 @@ export default defineComponent({
deleteAvatar,
tab,
tabContent,
uploadFile
content,
uploadFile,
insertImg,
// uploadStory
};
},
emits: [
......
......@@ -419,6 +419,37 @@ export default defineComponent({
},
},
setup() {
const selectedFile = () => {
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
// create an input file element to open file dialog
const input = document.createElement('input');
input.type = 'file';
input.accept = '.png, .jpg'; // file extensions allowed
input.onchange = (e) => {
// const div = `<img src="${url}>`
const files = (<HTMLInputElement & EventTarget>e.target).files;
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
const url = URL.createObjectURL(files[0]);
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
document.execCommand(
'insertHTML',
true,
'<div><img src="' + url + '" /></div>'
);
};
input.click();
};
const namePageRules = [
(val?: string) =>
(val && val.trim().length) ||
......@@ -435,6 +466,7 @@ export default defineComponent({
namePageRules,
urlRules,
selectedFile,
// nameMenuRules,
// tabNamePage,
// tabContent,
......
......@@ -118,9 +118,6 @@ export default defineComponent({
// ];
// const taxCodeRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requireTaxCode'),
// (val?: string) =>
// (val && val.trim().length <= 20) ||
// i18n.global.t('customer.validateMessages.LengthTaxCode'),
// ];
......
......@@ -77,36 +77,46 @@ export default defineComponent({
position.value = props.customerInfo.position;
level.value = props.customerInfo.level;
};
const userNameRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireUserName'),
];
const passwordRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requirePassword'),
];
// const userNameRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requireUserName'),
// ];
// const passwordRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requirePassword'),
// ];
const codeRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireCode'),
(val?: string) =>
(val && val.trim().length <= 50) ||
i18n.global.t('customer.validateMessages.lengthCode'),
];
const customerNameRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireCustomerName'),
];
const businessNameRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireBusinessName'),
];
const taxCodeRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireTaxCode'),
(val && val.trim().length <= 50) ||
i18n.global.t('customer.validateMessages.lengthCustomerName'),
];
// const businessNameRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requireBusinessName'),
// ];
// const taxCodeRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requireTaxCode'),
// ];
const phoneRules = [
(val?: string) =>
(val && val.trim().length) ||
......@@ -122,45 +132,45 @@ export default defineComponent({
(val: string) =>
isEmail(val) || i18n.global.t('customer.validateMessages.isEmail'),
];
const addressRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireAddress'),
];
const businessTypeRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireBusinessType'),
];
const levelRules = [
(val?: CustomerLevelType) =>
val !== null ||
i18n.global.t('customer.validateMessages.requireRatings'),
];
const representativeRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireRepresentative'),
];
const positionRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requiredPosition'),
];
// const addressRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requireAddress'),
// ];
// const businessTypeRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requireBusinessType'),
// ];
// const levelRules = [
// (val?: CustomerLevelType) =>
// val !== null ||
// i18n.global.t('customer.validateMessages.requireRatings'),
// ];
// const representativeRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requireRepresentative'),
// ];
// const positionRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requiredPosition'),
// ];
return {
isPwd: ref(true),
userNameRules,
// userNameRules,
customerNameRules,
businessNameRules,
passwordRules,
// businessNameRules,
// passwordRules,
codeRules,
taxCodeRules,
// taxCodeRules,
emailRules,
levelRules,
addressRules,
businessTypeRules,
representativeRules,
positionRules,
// levelRules,
// addressRules,
// businessTypeRules,
// representativeRules,
// positionRules,
phoneRules,
userName,
fullName,
......
......@@ -31,6 +31,37 @@
>
<div class="row q-col-gutter-sm">
<div class="col-6">
<q-input
:model-value="userName"
@update:model-value="$emit('update:userName', $event)"
:label="`${$t('loginPage.usernameInputLabel')} *`"
:rules="usernameInputRules"
class="q-my-sm"
outlined
clearable
>
</q-input>
<q-input
:model-value="password"
@update:model-value="$emit('update:password', $event)"
:label="`${$t('loginPage.passwordInputLabel')} *`"
:rules="passwordInputRules"
class="q-my-sm"
:type="isPwd ? 'password' : 'text'"
outlined
clearable
>
<template v-slot:append>
<q-icon
:name="isPwd ? 'visibility_off' : 'visibility'"
class="cursor-pointer"
@click="isPwd = !isPwd"
/>
</template>
</q-input>
<q-input
:model-value="code"
@update:model-value="$emit('update:code', $event)"
......@@ -100,10 +131,9 @@
<q-select
:model-value="fields"
@update:model-value="$emit('update:fields', $event)"
:label="$t('managingUnit.dialogLabel.fieldLabels.fields')"
label="Phân loại"
:options="fieldsOptions"
:rules="fieldsRules"
multiple
map-options
option-value="id"
option-label="name"
......@@ -213,15 +243,14 @@
</q-td>
</template>
</q-table>
{{ check_artistList }}
<div
<!-- <div
v-if="check_artistList"
style="color: #c10015; font-size: 12px"
>
Vui lòng chọn ảnh
</div>
</div> -->
</div>
<div></div>
<!-- ngân hàng -->
......@@ -371,7 +400,7 @@ import { isMobilePhone } from '../../../boot/functions';
import { API_PATHS } from 'src/assets/configurations.example';
import { AxiosResponse } from 'axios';
import { api, BaseResponseBody } from 'src/boot/axios';
import { FieldType, ArtistInfoType, Contract } from 'src/assets/type';
import { FieldType, ArtistInfoType, Contract, ClassificationOptions } from 'src/assets/type';
import { config } from 'src/assets/configurations.example';
import UnitAddUpdateArtistDialog from '../unit-add-update-artist/index.vue';
import UnitAddUpdateBankAccountDialog from '../unit-add-update-bank-account/index.vue';
......@@ -514,21 +543,26 @@ export default defineComponent({
check_artistList: { type: Boolean, required: true },
isUpdate: { type: Boolean, default: false },
fieldsOptions: { type: Array, required: true },
fields: { type: Number, required: true },
code: { type: String, required: true },
name: { type: String, required: true },
representative: { type: String, required: true },
userName: { type: String, required: true },
password: { type: String, required: true },
email: { type: String, required: true },
address: { type: String, required: true },
phoneNumber: { type: String, required: true },
status: { type: Number, required: true },
artistList: { type: Array as PropType<unknown[]>, required: true },
bankAccountList: { type: Array as PropType<unknown[]>, required: true },
},
setup(props, context) {
const addArtistDialogIsOpened = ref(false);
const updateArtistDialogIsOpened = ref(false);
const fieldsAddOptions: Ref<FieldType[]> = ref([]);
const fieldsOptions: Ref<ClassificationOptions[]> = ref([]);
const artistOptions: Ref<ArtistInfoType[]> = ref([]);
const artistField: Ref<{ id: number; name: string } | undefined> =
ref(undefined);
......@@ -551,6 +585,13 @@ export default defineComponent({
const bankOptions: Ref<number | undefined> = ref(undefined);
const cardTypeOptions: Ref<number | undefined> = ref(undefined);
const usernameInputRules = [
(val?: string) => (val && val.trim().length) || 'Vui lòng nhập tài khoản',
];
const passwordInputRules = [
(val?: string) => (val && val.trim().length) || 'Vui lòng nhập mật khẩu',
];
const codeRules = [
(val?: string) =>
(val && val.trim().length) ||
......@@ -647,15 +688,15 @@ export default defineComponent({
}
);
//gọi api lĩnh vực
//gọi api lĩnh vực
const getFieldOptions = async () => {
const response = (await api({
url: API_PATHS.getFieldOptions,
url: API_PATHS.getClassificationOptions,
method: 'GET',
params: {},
})) as AxiosResponse<BaseResponseBody<FieldType[]>>;
})) as AxiosResponse<BaseResponseBody<ClassificationOptions[]>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
fieldsAddOptions.value = response.data.data;
fieldsOptions.value = response.data.data;
}
};
......@@ -842,6 +883,12 @@ export default defineComponent({
openAddBankAccountDialog,
updateBankAccountDialogIsOpened,
updateNewBankAccount,
usernameInputRules,
passwordInputRules,
isPwd: ref(true),
fieldsOptions,
};
},
emits: [
......@@ -857,6 +904,8 @@ export default defineComponent({
'update:status',
'update:artistList',
'update:check_artistList',
'update:userName',
'update:password',
'addNewUnit',
],
});
......
......@@ -104,7 +104,7 @@
type="text"
class="q-my-sm"
outlined
:rules="unitRules"
hide-bottom-space
></q-input>
......@@ -127,7 +127,7 @@
@update:model-value="$emit('update:birthday', $event)"
:label="$t('userPage.dialogLabel.fieldLabels.birthday')"
outlined
:rules="birthdayRules"
hide-bottom-space
>
<template v-slot:append>
......
......@@ -75,7 +75,7 @@
type="text"
class="q-my-sm"
outlined
:rules="unitRules"
hide-bottom-space
></q-input>
......@@ -98,7 +98,7 @@
@update:model-value="$emit('update:birthday', $event)"
:label="$t('userPage.dialogLabel.fieldLabels.birthday')"
outlined
:rules="birthdayRules"
hide-bottom-space
>
<template v-slot:append>
......
......@@ -96,9 +96,9 @@ export default {
mobileNumber: 'Số điện thoại *',
address: 'Địa chỉ',
phoneNumber: 'Số máy bàn',
unit: 'Đơn vị phòng ban *',
unit: 'Đơn vị phòng ban',
sex: 'Giới tính *',
birthday: 'Ngày sinh *',
birthday: 'Ngày sinh',
group: 'Thuộc nhóm *',
scheduleAccess: 'Lịch truy cập',
status: 'Trạng thái',
......@@ -341,7 +341,7 @@ export default {
businessType: 'Loại doanh nghiệp ',
representative: 'Người đại diện ',
position: 'Chức vụ ',
phone: 'Số điện thoại ',
phone: 'Số điện thoại *',
status: 'Trạng thái',
},
},
......
......@@ -18,7 +18,7 @@
<q-select
v-model="fieldSelected"
:options="fieldsOptions"
label="Lĩnh vực"
label="Phân loại"
option-label="name"
option-value="id"
dense
......@@ -138,6 +138,8 @@
v-model:fields="unitField"
v-model:fieldsOptions="fieldsOptions"
v-model:name="unitName"
v-model:userName="unitUserName"
v-model:password="unitPassword"
v-model:phoneNumber="unitPhoneNumber"
v-model:representative="unitRepresentative"
v-model:status="unitStatus"
......@@ -155,6 +157,8 @@
v-model:fields="unitField"
v-model:fieldsOptions="fieldsOptions"
v-model:name="unitName"
v-model:userName="unitUserName"
v-model:password="unitPassword"
v-model:phoneNumber="unitPhoneNumber"
v-model:representative="unitRepresentative"
v-model:status="unitStatus"
......@@ -178,6 +182,7 @@ import {
FieldType,
ArtistOwnerAdd,
DetailUnit,
ClassificationOptions,
} from 'src/assets/type';
import { config, API_PATHS } from 'src/assets/configurations.example';
import AddUpdateUnitDialog from 'components/units-manager/add-update-unit-dialog/index.vue';
......@@ -279,17 +284,20 @@ export default defineComponent({
const pageSize = ref(20);
const totalPage = ref(0);
const unitNameKeyword = ref('');
const fieldsOptions: Ref<FieldType[]> = ref([]);
const fieldsOptions: Ref<ClassificationOptions[]> = ref([]);
const fieldSelected: Ref<FieldType | undefined> = ref();
const addUnitDialogIsOpened = ref(false);
const updateUnitDialogIsOpened = ref(false);
const unitField: Ref<FieldType[] | undefined> = ref(undefined);
const unitField: Ref<ClassificationOptions[] | undefined> = ref(undefined);
const unitCode = ref('');
const unitName = ref('');
const unitRepresentative = ref('');
const unitEmail = ref('');
const unitAddress = ref('');
const unitPhoneNumber = ref('');
const unitUserName = ref('');
const unitPassword = ref('');
const unitStatus: Ref<number> = ref(UnitStatus.active);
const unitArtistList: Ref<unknown[]> = ref([]);
const unitId: Ref<number | undefined> = ref(undefined);
......@@ -304,7 +312,7 @@ export default defineComponent({
pageIndex: pageIndex.value,
pageSize: pageSize.value,
name: unitNameKeyword.value,
fields: fieldSelected.value?.id,
classification: fieldSelected.value?.id,
},
})) as AxiosResponse<BaseResponseBody<PaginationResponse<ArtistOwner>>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
......@@ -323,8 +331,11 @@ export default defineComponent({
unitAddress.value = '';
unitPhoneNumber.value = '';
unitArtistList.value = [];
unitUserName.value = '';
unitPassword.value = '';
unitStatus.value = UnitStatus.active;
addUnitDialogIsOpened.value = true;
};
const openUpdateUnitDialog = (id: number) => {
......@@ -352,6 +363,8 @@ export default defineComponent({
unitStatus.value = response.data.data.status;
unitArtistList.value = response.data.data.contracts;
unitField.value = response.data.data.fields;
unitUserName.value = response.data.data.userName;
unitPassword.value = response.data.data.password;
}
} catch (error) {}
};
......@@ -405,10 +418,10 @@ export default defineComponent({
//gọi api lĩnh vực
const getFieldOptions = async () => {
const response = (await api({
url: API_PATHS.getFieldOptions,
url: API_PATHS.getClassificationOptions,
method: 'GET',
params: {},
})) as AxiosResponse<BaseResponseBody<FieldType[]>>;
})) as AxiosResponse<BaseResponseBody<ClassificationOptions[]>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
fieldsOptions.value = response.data.data;
}
......@@ -424,7 +437,9 @@ export default defineComponent({
email: unitEmail.value,
phoneNumber: unitPhoneNumber.value,
status: unitStatus.value,
fields: unitField.value,
classification: unitField.value,
userName: unitUserName.value,
password: unitPassword.value,
contracts: unitArtistList.value,
};
const response = (await api({
......@@ -461,7 +476,9 @@ export default defineComponent({
email: unitEmail.value,
phoneNumber: unitPhoneNumber.value,
status: unitStatus.value,
fields: unitField.value,
classification: unitField.value,
userName: unitUserName.value,
password: unitPassword.value,
contracts: unitArtistList.value,
};
const response = (await api({
......@@ -497,6 +514,7 @@ export default defineComponent({
confirmDeleteManagingUnits,
deleteManagingUnits,
fieldsOptions,
status,
managingUnitTableColumns,
managingUnitTableRows,
......@@ -514,6 +532,8 @@ export default defineComponent({
unitEmail,
unitAddress,
unitPhoneNumber,
unitUserName,
unitPassword,
unitStatus,
openAddUnitDialog,
unitArtistList,
......
......@@ -11,7 +11,7 @@ import AddNewUserDialogComponent from '../../components/user-management/add-new-
import UpdateUserDialogComponent from '../../components/user-management/update-user-dialog/index.vue';
import { GroupInfoType } from '../nhom-nguoi-dung/UserGroup';
import Pagination from 'components/pagination/index.vue';
// import moment from 'moment';
import moment from 'moment';
export default defineComponent({
components: {
......@@ -128,6 +128,7 @@ export default defineComponent({
},
})) as AxiosResponse<BaseResponseBody<PaginationResponse<UserObject>>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
userTableRows.value = response.data.data.data;
totalPage.value = response.data.data.totalPages;
}
......@@ -312,11 +313,11 @@ export default defineComponent({
group.value = response.data.data.groups;
address.value = userInfo.address as string;
id.value = userInfo.id;
// birthday.value = moment(userInfo.birthday).format('YYYY-MM-DD') as string;
// birthday.value = moment(
// userInfo.birthday,
// 'DD/MM/YYYY HH:mm:ss'
// ).format('DD/MM/YYYY');
birthday.value = moment(userInfo.birthday).format('YYYY-MM-DD') as string;
birthday.value = moment(
userInfo.birthday,
'DD/MM/YYYY HH:mm:ss'
).format('DD/MM/YYYY');
email.value = userInfo.email as string;
fullName.value = userInfo.fullName as string;
mobileNumber.value = userInfo.mobileNumber as string;
......@@ -330,6 +331,7 @@ export default defineComponent({
};
const updateUser = async () => {
try {
const response = (await api({
url: API_PATHS.updateUser,
......
......@@ -38,8 +38,14 @@
<q-table
:rows="userTableRows"
:columns="userTableColumns"
row-key="name"
separator="cell"
row-key="userName"
virtual-scroll
separator="cell"
:rows-per-page-label="$t('recordPerPage')"
:pagination="{
rowsPerPage: 0,
}"
wrap-cells
hide-pagination
:no-data-label="$t('emptyData')"
>
......@@ -60,7 +66,7 @@
</div>
</q-td>
</template>
<template v-slot:body-cell-action="item">
<!-- <template v-slot:body-cell-action="item">
<q-td style="padding: 0" class="flex flex-center">
<q-btn
flat
......@@ -96,7 +102,7 @@
}}</q-tooltip>
</q-btn>
</q-td>
</template>
</template> -->
</q-table>
</div>
<div class="col-12 q-mt-sm">
......
......@@ -32,7 +32,7 @@ const selectedPageRoles: Ref<string[]> = ref([]);
const addNewGroupInfo = async ($store: Store<StateInterface>) => {
try {
const response = (await api({
// url: API_PATHS.addNewGroupUser,
url: API_PATHS.addNewGroupUser,
method: 'POST',
data: {
group: {
......
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