diff --git a/src/module/auth/views/Register.vue b/src/module/auth/views/Register.vue index d7cd991..86c7272 100644 --- a/src/module/auth/views/Register.vue +++ b/src/module/auth/views/Register.vue @@ -383,13 +383,23 @@ return uyeBilgileriStore.mahalleList.length === 0 }) - const ChangeIl = (e: Event, v: string | number, d: Record) => { + const ChangeIl = async (e: Event, v: string | number, d: Record) => { uyeBilgileriStore.formData.ilceId = '' - uyeBilgileriStore.ilceList = d.ilceler - } - const ChangeIlce = (e: Event, v: string | number, d: Record) => { uyeBilgileriStore.formData.mahalleId = '' - uyeBilgileriStore.mahalleList = d.mahalleler + uyeBilgileriStore.mahalleList = [] + if (Object.keys(d).length === 0) { + uyeBilgileriStore.ilceList = [] + return + } + uyeBilgileriStore.ilceList = await dataStore.GetIlcelerByIlId(v) + } + const ChangeIlce = async (e: Event, v: string | number, d: Record) => { + uyeBilgileriStore.formData.mahalleId = '' + if (Object.keys(d).length === 0) { + uyeBilgileriStore.mahalleList = [] + return + } + uyeBilgileriStore.mahalleList = await dataStore.GetMahallelerByIlceId(v) } const PasswordCheck = (e: KeyboardEvent) => { if ( diff --git a/src/module/cekilisler/components/display/FormPiyangoIrtibatBilgileriDisplay.vue b/src/module/cekilisler/components/display/FormPiyangoIrtibatBilgileriDisplay.vue index 200f615..7c9b4ce 100644 --- a/src/module/cekilisler/components/display/FormPiyangoIrtibatBilgileriDisplay.vue +++ b/src/module/cekilisler/components/display/FormPiyangoIrtibatBilgileriDisplay.vue @@ -38,10 +38,13 @@ const GetData = async () => { loaded.value = false let dt = await dataStore.dataGet( - 'IrtibatBilgi/GetIrtibatBilgiCekilis/' + piyangoStore.selectedLottery + 'IrtibatBilgi/GetIrtibatBilgiCekilis/' + piyangoStore.selectedLottery, + { + skipErrorForStatuses: [404] + } ) - if (dt !== 'errorfalse') { + if (dt !== 'errorfalse' && !dt?._error) { Object.assign(piyangoContactStore.contactData, dt) } setTimeout(()=>{ diff --git a/src/module/cekilisler/components/form/FormPiyangoBilgileri.vue b/src/module/cekilisler/components/form/FormPiyangoBilgileri.vue index 3c75aa6..4b767b5 100644 --- a/src/module/cekilisler/components/form/FormPiyangoBilgileri.vue +++ b/src/module/cekilisler/components/form/FormPiyangoBilgileri.vue @@ -443,9 +443,14 @@ return piyangoStore.lotteryData.ilId === null || ilceList.value.length === 0 }) - const ChangeIl = (e: Event, v: string | number, d: Record) => { + const ChangeIl = async (e: Event, v: string | number, d: Record) => { piyangoStore.lotteryData.ilceId = '' - ilceList.value = d.ilceler + if (Object.keys(d).length === 0) { + ilceList.value = [] + formChanged.value = true + return + } + ilceList.value = await dataStore.GetIlcelerByIlId(v) formChanged.value = true } const OnKeyup = () => { @@ -474,11 +479,8 @@ piyangoStore.lotteryData.ilceId !== null && piyangoStore.lotteryData.ilceId !== '' ) { - let ilO = globalDataStore.ilList.filter((v: Record) => { - return v.id === piyangoStore.lotteryData.ilId - }) - if (ilO.length !== 0) - ilceList.value.splice(0, ilceList.value.length, ...(ilO[0]['ilceler'] as IIl[])) + const ilceler = await dataStore.GetIlcelerByIlId(piyangoStore.lotteryData.ilId) + ilceList.value.splice(0, ilceList.value.length, ...(ilceler as IIl[])) } if (piyangoStore.lotteryData.amacpiyangoId === 2) { diff --git a/src/module/cekilisler/components/form/FormPiyangoIrtibatBilgileri.vue b/src/module/cekilisler/components/form/FormPiyangoIrtibatBilgileri.vue index addaf89..76a5e2c 100644 --- a/src/module/cekilisler/components/form/FormPiyangoIrtibatBilgileri.vue +++ b/src/module/cekilisler/components/form/FormPiyangoIrtibatBilgileri.vue @@ -87,11 +87,14 @@ const GetData = async () => { loaded.value = false let dt = await dataStore.dataGet( - 'IrtibatBilgi/GetIrtibatBilgiCekilis/' + piyangoStore.selectedLottery + 'IrtibatBilgi/GetIrtibatBilgiCekilis/' + piyangoStore.selectedLottery, + { + skipErrorForStatuses: [404] + } ) piyangoContactStore.ResetFormData() - if (dt !== 'errorfalse') { + if (dt !== 'errorfalse' && !dt?._error) { Object.assign(piyangoContactStore.contactData, dt) Object.assign(piyangoContactStore.safeContactData, dt) } else { diff --git a/src/module/cekilisler/components/panel/PanelPiyangoKatilimci.vue b/src/module/cekilisler/components/panel/PanelPiyangoKatilimci.vue index 11264bf..2aa3317 100644 --- a/src/module/cekilisler/components/panel/PanelPiyangoKatilimci.vue +++ b/src/module/cekilisler/components/panel/PanelPiyangoKatilimci.vue @@ -255,7 +255,7 @@ label="İlçe" :listData="ilceList" listText="ad" - listVal="id" + listVal="ad" modelKey="ilce" v-model="piyangoKatilimciStore.piyangoKatilimciUserFormData.ilce" :invalidText="piyangoKatilimciValidationStore.userFormInvalidTexts.ilce" @@ -391,13 +391,14 @@ piyangoKatilimciValidationStore.userFormChanged = true } - const ChangeIl = (e: Event, v: string | number, d: Record) => { + const ChangeIl = async (e: Event, v: string | number, d: Record) => { piyangoKatilimciStore.piyangoKatilimciUserFormData.ilce = '' if (Object.keys(d).length === 0) { ilceList.value = [] return } - ilceList.value.splice(0, ilceList.value.length, ...d.ilceler) + const ilceler = await dataStore.GetIlcelerByIlId(d.id) + ilceList.value.splice(0, ilceList.value.length, ...ilceler) piyangoKatilimciValidationStore.userFormChanged = true } const ilceDisabled = computed(() => { @@ -417,13 +418,11 @@ piyangoKatilimciStore.piyangoKatilimciUserFormData.ilce !== null && piyangoKatilimciStore.piyangoKatilimciUserFormData.ilce !== '' ) { - let ilO: Record[] = globalDataStore.ilList.filter( - (v: Record) => { - return v.ad === piyangoKatilimciStore.piyangoKatilimciUserFormData.il - } - ) - if (ilO.length !== 0) - ilceList.value.splice(0, ilceList.value.length, ...ilO[0]['ilceler']) + const selectedIl = dataStore.GetIlByName(piyangoKatilimciStore.piyangoKatilimciUserFormData.il) + if (selectedIl !== undefined) { + const ilceler = await dataStore.GetIlcelerByIlId(selectedIl.id) + ilceList.value.splice(0, ilceList.value.length, ...ilceler) + } } })