Refactor code to improve readability and fix bugs in Gangguan and Monalisa components
This commit is contained in:
		| @@ -871,21 +871,69 @@ const setAgreementDialog = (status: boolean, progress: number) => { | ||||
| const getDetail = async () => { | ||||
|   const dateValue = filters.value?.periode.split(' s/d ') | ||||
|   const ref = dataSelected.value | ||||
|   const { posko, uid, up3 } = filters.value | ||||
|  | ||||
|   const query = { | ||||
|   var query = { | ||||
|     dateFrom: ref?.tanggal ? reformatDate(ref?.tanggal, 'yyyy/MM/dd', 'yyyy-MM-dd') : '', | ||||
|     dateTo: ref?.tanggal ? reformatDate(ref?.tanggal, 'yyyy/MM/dd', 'yyyy-MM-dd') : '', | ||||
|     posko: progressSelected.value == 0 ? 0 : ref?.id_posko ? ref?.id_posko : 0, | ||||
|     idUid: progressSelected.value == 0 ? 0 : ref?.id_uid ? ref?.id_uid : 0, | ||||
|     idUp3: progressSelected.value == 0 ? 0 : ref?.id_up3 ? ref?.id_up3 : 0, | ||||
|     idRegu: ref?.id_regu ? ref?.id_regu : 0, | ||||
|     idUlp: progressSelected.value == 0 ? 0 : ref?.id_ulp ? ref?.id_ulp : 0, | ||||
|     posko: 0, | ||||
|     idUid: 0, | ||||
|     idUp3: 0, | ||||
|     idUlp: 0, | ||||
|     idRegu: 0, | ||||
|     idUlp: 0, | ||||
|     namaRegional: ref?.nama_regional ? ref?.nama_regional : '', | ||||
|     media: ref?.media ? ref?.media : '', | ||||
|     isSelesai: progressSelected.value, | ||||
|     tanggal: ref?.tanggal ? reformatDate(ref?.tanggal, 'yyyy/MM/dd', 'yyyy-MM-dd') : '' | ||||
|   } | ||||
|  | ||||
|   if (isGroupBy.value) { | ||||
|     query = { | ||||
|       ...query, | ||||
|       idUid: ref?.id_uid | ||||
|     } | ||||
|     if (uid.id != 0) { | ||||
|       query = { | ||||
|         ...query, | ||||
|         idUp3: ref?.id_up3 | ||||
|       } | ||||
|  | ||||
|       if (up3.id != 0) { | ||||
|         query = { | ||||
|           ...query, | ||||
|           posko: ref?.id_posko | ||||
|         } | ||||
|  | ||||
|         if (posko.id != 0) { | ||||
|           query = { | ||||
|             ...query, | ||||
|             idUlp: ref?.id_ulp | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } else { | ||||
|     if (uid.id != 0) { | ||||
|       query = { | ||||
|         ...query, | ||||
|         idUid: uid.id | ||||
|       } | ||||
|       if (up3.id != 0) { | ||||
|         query = { | ||||
|           ...query, | ||||
|           idUp3: up3.id | ||||
|         } | ||||
|         if (posko.id != 0) { | ||||
|           query = { | ||||
|             ...query, | ||||
|             posko: posko.id | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   loadingSubData.value = true | ||||
|   await requestGraphQl(queries.gangguan.rekap.gangguanAllDetail, query) | ||||
|     .then((result) => { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user