update

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