update

parent 24053998
...@@ -66,6 +66,8 @@ export type ArtistInfoType = { ...@@ -66,6 +66,8 @@ export type ArtistInfoType = {
banners: BannerType[]; banners: BannerType[];
products: ProductType[]; products: ProductType[];
schedules: SchedulesType[]; schedules: SchedulesType[];
musicTypeDto:MusicType[];
provinceDto: ProvinceType[];
stories: StoriesType[]; stories: StoriesType[];
mnName: string | null; mnName: string | null;
mnPhone: string | null; mnPhone: string | null;
......
...@@ -227,7 +227,7 @@ ...@@ -227,7 +227,7 @@
@update:model-value="$emit('update:address', $event)" @update:model-value="$emit('update:address', $event)"
:options="provinceOptions" :options="provinceOptions"
option-value="name" option-value="fullName"
option-label="fullName" option-label="fullName"
type="text" type="text"
class="q-my-sm" class="q-my-sm"
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<q-tab-panels v-model="tab" animated> <q-tab-panels v-model="tab" animated>
<q-tab-panel name="information"> <q-tab-panel name="information">
<PersonalInformation <PersonalInformation
v-model:musics="musics"
:id="id" :id="id"
v-model:artist-code="artistCode" v-model:artist-code="artistCode"
:avatar="avatar" :avatar="avatar"
...@@ -88,6 +89,8 @@ ...@@ -88,6 +89,8 @@
:profession-options="professionOptions" :profession-options="professionOptions"
:artist-level-options="artistLevelOptions" :artist-level-options="artistLevelOptions"
:work-options="workOptions" :work-options="workOptions"
:province-options="provinceOptions"
:music-options="musicOptions"
@SetAvatar="setAvatar($event)" @SetAvatar="setAvatar($event)"
@deleteAvatar="deleteAvatar" @deleteAvatar="deleteAvatar"
@UpdateBirtday="UpdateBirtday($event)" @UpdateBirtday="UpdateBirtday($event)"
......
...@@ -35,6 +35,8 @@ import { ...@@ -35,6 +35,8 @@ import {
CardBankType, CardBankType,
TypeCardType, TypeCardType,
FileUploadType, FileUploadType,
MusicType,
ProvinceType,
} from 'src/assets/type'; } from 'src/assets/type';
export type AvatarType = { export type AvatarType = {
file?: File; file?: File;
...@@ -79,6 +81,7 @@ export default defineComponent({ ...@@ -79,6 +81,7 @@ export default defineComponent({
const cardBankOptions: Ref<CardBankType[]> = ref([]); const cardBankOptions: Ref<CardBankType[]> = ref([]);
const typeBankOptions: Ref<TypeCardType[]> = ref([]); const typeBankOptions: Ref<TypeCardType[]> = ref([]);
const workOptions: Ref<WorkType[]> = ref([]); const workOptions: Ref<WorkType[]> = ref([]);
const musicOptions: Ref<MusicType[]> = ref([]);
const sexOptions = ref([ const sexOptions = ref([
{ id: 1, name: 'Nam' }, { id: 1, name: 'Nam' },
{ id: 2, name: 'Nữ' }, { id: 2, name: 'Nữ' },
...@@ -109,7 +112,6 @@ export default defineComponent({ ...@@ -109,7 +112,6 @@ export default defineComponent({
const mnEmail: Ref<string | null> = ref(null); const mnEmail: Ref<string | null> = ref(null);
const qualification: Ref<QualificationType | null> = ref(null); const qualification: Ref<QualificationType | null> = ref(null);
const artistLevel: Ref<ArtistLevelType | null> = ref(null); const artistLevel: Ref<ArtistLevelType | null> = ref(null);
const address: Ref<string | null> = ref(null);
const status: Ref<number> = ref(1); const status: Ref<number> = ref(1);
const fields: Ref<FieldType | null> = ref(null); const fields: Ref<FieldType | null> = ref(null);
const fieldsPrivate: Ref<FieldType | null> = ref(null); const fieldsPrivate: Ref<FieldType | null> = ref(null);
...@@ -143,9 +145,13 @@ export default defineComponent({ ...@@ -143,9 +145,13 @@ export default defineComponent({
//state hot product //state hot product
const products: Ref<ProductType[]> = ref([]); const products: Ref<ProductType[]> = ref([]);
const statusHotProduct: Ref<number> = ref(2); const statusHotProduct: Ref<number> = ref(2);
const address: Ref<ProvinceType[]> =ref([])
const DataInsertHotProduct: Ref<ProductType | null> = ref(null); const DataInsertHotProduct: Ref<ProductType | null> = ref(null);
const DataUpdateHotProduct: Ref<ProductType | null> = ref(null); const DataUpdateHotProduct: Ref<ProductType | null> = ref(null);
const musics: Ref<MusicType[]> = ref([]);
const provinceOptions:Ref<ProvinceType[]> = ref([]);
//sate error input thong-tin-ca-nhan //sate error input thong-tin-ca-nhan
const check_infoBooking = ref(false); const check_infoBooking = ref(false);
const artistCodeRules = ref(false); const artistCodeRules = ref(false);
...@@ -163,6 +169,7 @@ export default defineComponent({ ...@@ -163,6 +169,7 @@ export default defineComponent({
const workRules = ref(false); const workRules = ref(false);
const qualificationRules = ref(false); const qualificationRules = ref(false);
const artistLevelRules = ref(false); const artistLevelRules = ref(false);
const musicRules = ref(false);
const errorMessEmail = ref( const errorMessEmail = ref(
i18n.global.t('artist.artistInformation.validateMessages.requireEmail') i18n.global.t('artist.artistInformation.validateMessages.requireEmail')
); );
...@@ -197,6 +204,14 @@ export default defineComponent({ ...@@ -197,6 +204,14 @@ export default defineComponent({
} }
} }
); );
watch(
() => musics.value,
(value) => {
if(value) {
musicRules.value = false;
}
}
);
watch( watch(
() => artistCode.value, () => artistCode.value,
(value) => { (value) => {
...@@ -237,14 +252,14 @@ export default defineComponent({ ...@@ -237,14 +252,14 @@ export default defineComponent({
} }
} }
); );
watch( // watch(
() => address.value, // () => address.value,
(value) => { // (value) => {
if (value) { // if (value) {
addressRules.value = false; // addressRules.value = false;
} // }
} // }
); // );
watch( watch(
() => phoneNumber.value, () => phoneNumber.value,
(value) => { (value) => {
...@@ -325,6 +340,7 @@ export default defineComponent({ ...@@ -325,6 +340,7 @@ export default defineComponent({
params: { artistId: route.params.id }, params: { artistId: route.params.id },
})) as AxiosResponse<BaseResponseBody<ArtistInfoType>>; })) as AxiosResponse<BaseResponseBody<ArtistInfoType>>;
const ArtistInformation = response.data.data; const ArtistInformation = response.data.data;
id.value = ArtistInformation.id; id.value = ArtistInformation.id;
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
...@@ -337,11 +353,12 @@ export default defineComponent({ ...@@ -337,11 +353,12 @@ export default defineComponent({
artistCode.value = ArtistInformation.artistCode; artistCode.value = ArtistInformation.artistCode;
fullName.value = ArtistInformation.fullName; fullName.value = ArtistInformation.fullName;
artistName.value = ArtistInformation.artistName; artistName.value = ArtistInformation.artistName;
// birthday.value = moment( birthday.value = moment(
// ArtistInformation.birthday, ArtistInformation.birthday,
// 'DD/MM/YYYY HH:mm:ss' 'DD/MM/YYYY HH:mm:ss'
// ).format('DD/MM/YYYY'); ).format('DD/MM/YYYY');
address.value = ArtistInformation.address;
// chooseAddress.value = ArtistInformation.address
status.value = ArtistInformation.status; status.value = ArtistInformation.status;
phoneNumber.value = ArtistInformation.phoneNumber; phoneNumber.value = ArtistInformation.phoneNumber;
email.value = ArtistInformation.email; email.value = ArtistInformation.email;
...@@ -371,14 +388,11 @@ export default defineComponent({ ...@@ -371,14 +388,11 @@ export default defineComponent({
socialEmbedded.value = ArtistInformation.socialEmbedded; socialEmbedded.value = ArtistInformation.socialEmbedded;
stories.value = ArtistInformation.stories; stories.value = ArtistInformation.stories;
schedules.value = ArtistInformation.schedules; schedules.value = ArtistInformation.schedules;
for (let index = 0; index < schedules.value.length; index++) { musics.value= ArtistInformation.musicTypeDto;
const element = schedules.value[index]; address.value = ArtistInformation.provinceDto;
formatSchedules.value.push( // console.log(provinceOptions.value,'12312312');
moment(element.scheduleTime, 'DD/MM/YYYY HH:mm:ss').format(
'YYYY/MM/DD'
)
);
}
}; };
const getFieldOptions = async () => { const getFieldOptions = async () => {
...@@ -435,6 +449,30 @@ export default defineComponent({ ...@@ -435,6 +449,30 @@ export default defineComponent({
} }
}; };
const getProvinceOptions = async () => {
const response = (await api ({
url : API_PATHS.getProvinceOptions,
method: 'GET',
params: {},
})) as AxiosResponse<BaseResponseBody<ProvinceType[]>>;
if(response.data.error.code === config.API_RES_CODE.OK.code){
provinceOptions.value = response.data.data
}
}
const getMusicTypeOptions = async () => {
const response = (await api ({
url: API_PATHS.getMusicTypeOptions,
method: 'GET',
params: {},
})) as AxiosResponse<BaseResponseBody<MusicType[]>>;
if(response.data.error.code === config.API_RES_CODE.OK.code) {
musicOptions.value = response.data.data
}
};
const getBankOptions = async () => { const getBankOptions = async () => {
const response = (await api({ const response = (await api({
url: API_PATHS.bankOptions, url: API_PATHS.bankOptions,
...@@ -712,10 +750,10 @@ export default defineComponent({ ...@@ -712,10 +750,10 @@ export default defineComponent({
hasError = true; hasError = true;
artistNameRules.value = true; artistNameRules.value = true;
} }
if (!address.value || !address.value.trim().length) { // if (!address.value || !address.value.trim().length) {
hasError = true; // hasError = true;
addressRules.value = true; // addressRules.value = true;
} // }
if (!birthday.value || !birthday.value?.trim().length) { if (!birthday.value || !birthday.value?.trim().length) {
hasError = true; hasError = true;
birthdayRules.value = true; birthdayRules.value = true;
...@@ -760,10 +798,10 @@ export default defineComponent({ ...@@ -760,10 +798,10 @@ export default defineComponent({
); );
} }
if (artistLevel.value === null) { // if (artistLevel.value === null) {
hasError = true; // hasError = true;
artistLevelRules.value = true; // artistLevelRules.value = true;
} // }
if (!fields.value) { if (!fields.value) {
hasError = true; hasError = true;
fieldRules.value = true; fieldRules.value = true;
...@@ -843,6 +881,7 @@ export default defineComponent({ ...@@ -843,6 +881,7 @@ export default defineComponent({
method: 'POST', method: 'POST',
data: { data: {
id: route.params.id, id: route.params.id,
musicTypeDto:musics.value,
avatar: avatarUploaded.value, avatar: avatarUploaded.value,
artistCode: artistCode.value, artistCode: artistCode.value,
artistName: artistName.value, artistName: artistName.value,
...@@ -912,6 +951,7 @@ export default defineComponent({ ...@@ -912,6 +951,7 @@ export default defineComponent({
}; };
onMounted(() => { onMounted(() => {
void getProvinceOptions();
void getInformationArtist(); void getInformationArtist();
void getFieldOptions(); void getFieldOptions();
void getNationalityOptions(); void getNationalityOptions();
...@@ -919,6 +959,7 @@ export default defineComponent({ ...@@ -919,6 +959,7 @@ export default defineComponent({
void getQualificationOptions(); void getQualificationOptions();
void getBankOptions(); void getBankOptions();
void getTypeCardOptions(); void getTypeCardOptions();
void getMusicTypeOptions();
}); });
return { return {
hidden_img, hidden_img,
...@@ -933,6 +974,7 @@ export default defineComponent({ ...@@ -933,6 +974,7 @@ export default defineComponent({
sex, sex,
nationality, nationality,
address, address,
status, status,
fields, fields,
works, works,
...@@ -954,11 +996,15 @@ export default defineComponent({ ...@@ -954,11 +996,15 @@ export default defineComponent({
professionOptions, professionOptions,
artistLevelOptions, artistLevelOptions,
workOptions, workOptions,
musicOptions,
musics,
getFieldOptions, getFieldOptions,
getNationalityOptions, getNationalityOptions,
getArtistLevelOptions, getArtistLevelOptions,
getQualificationOptions, getQualificationOptions,
getWorkOptions, getWorkOptions,
getMusicTypeOptions,
bankAccounts, bankAccounts,
products, products,
account, account,
...@@ -1032,7 +1078,9 @@ export default defineComponent({ ...@@ -1032,7 +1078,9 @@ export default defineComponent({
mnBookingEmailRules, mnBookingEmailRules,
errorMessmnBookingEmail, errorMessmnBookingEmail,
favoriteScore, favoriteScore,
provinceOptions,
check_infoBooking, check_infoBooking,
getProvinceOptions,
}; };
}, },
}); });
...@@ -320,14 +320,14 @@ export default defineComponent({ ...@@ -320,14 +320,14 @@ export default defineComponent({
} }
} }
); );
watch( // watch(
() => artistLevel.value, // () => artistLevel.value,
(value) => { // (value) => {
if (value) { // if (value) {
artistLevelRules.value = false; // artistLevelRules.value = false;
} // }
} // }
); // );
const getFieldOptions = async () => { const getFieldOptions = async () => {
const response = (await api({ const response = (await api({
...@@ -737,10 +737,7 @@ export default defineComponent({ ...@@ -737,10 +737,7 @@ export default defineComponent({
hasError = true; hasError = true;
workRules.value = true; workRules.value = true;
} }
// if(!address.value === null){
// hasError = true;
// addressRules.value = true;
// }
if (hasError === false) { if (hasError === false) {
void addArtist(); void addArtist();
} }
...@@ -797,7 +794,8 @@ export default defineComponent({ ...@@ -797,7 +794,8 @@ export default defineComponent({
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
birthday: birthday.value + ' 00:00:00', birthday: birthday.value + ' 00:00:00',
sex: sex.value, sex: sex.value,
address: address.value?.name, provinceDto: address.value,
address: null,
phoneNumber: phoneNumber.value, phoneNumber: phoneNumber.value,
email: email.value, email: email.value,
facebook: facebook.value, facebook: facebook.value,
...@@ -837,8 +835,12 @@ export default defineComponent({ ...@@ -837,8 +835,12 @@ export default defineComponent({
message: i18n.global.t('artist.actionMessages.addNewArtistAccess'), message: i18n.global.t('artist.actionMessages.addNewArtistAccess'),
actions: [{ icon: 'close', color: 'white' }], actions: [{ icon: 'close', color: 'white' }],
}); });
} else {
console.log(response.data.error.code);
}
} catch (error) {
} }
} catch (error) {}
}; };
const DeleteItemStories = (value: StoriesType) => { const DeleteItemStories = (value: StoriesType) => {
for (let i = 0; i < stories.value.length; i++) { for (let i = 0; i < stories.value.length; i++) {
......
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