diff --git a/index.html b/index.html index f3fe019..e16e6da 100644 --- a/index.html +++ b/index.html @@ -155,10 +155,16 @@ nav dashboard Dasbor
- supervisor_account Kegiatan dan Dokumentasi + article_person Program Kerja +
+
+ supervisor_account Pengajuan Program Kerja +
+
+ monitoring Monitoring dan Evaluasi
- supervisor_account Manajemen Agen & User + manage_accounts Manajemen Agen & User
quick_references Laporan @@ -198,18 +204,45 @@ nav { location = "/login.html"; } + window.userDetails = detail.data; window.agents = (await fetch("/api/getagents").then(r=>r.json()).catch(e=>{ moly.alert.show("Koneksi Gagal","Gagal menyambung ke server. Harap periksa koneksi jaringan."); return {data: []}; })).data; - window.userDetails = detail.data; - const loggedInAgent = agents.find(a=>a.agentID == userDetails.agentID) + let units = (await fetch("/api/getunits").then(r=>r.json()).catch(e=>{ + moly.alert.show("Koneksi Gagal","Gagal menyambung ke server. Harap periksa koneksi jaringan."); + return {data: []}; + })).data; + userDetails.info = agents.find(e=>e.agentID == userDetails.agentID); + userDetails.info.unitKerja = units.find(e=>e.deplID == userDetails.info.deplID).unitKerja; + units = null; + delete userDetails.agentID; + const loggedInAgent = userDetails.info; + agents = agents.filter(e=> e.deplID == userDetails.info.deplID); // if (!window.evtSource) window.evtSource = new EventSource("/events"); window.addEventListener("viewChange", async ()=>{ if (window.evtSource) evtSource.onmessage = null; }); async function domReady() { + switch (userDetails.level) { + case 1: + $('[data-path="kegiatan"],[data-path="submission"],[data-path="agen"]').remove(); + break; + case 2: + $('[data-path="kegiatan"],[data-path="laporan"],[data-path="agen"],[data-path="monev"]').remove(); + break; + case 3: + $('[data-path="monev"],[data-path="submission"],[data-path="agen"],[data-path="laporan"]').remove(); + break; + case 0: + $('[data-path="kegiatan"],[data-path="submission"],[data-path="monev"]').remove(); + break; + default: + getJson("/auth/logout"); + location="/login.html"; + break; + } $('#vernum').text(`v${vernum}`) $('#lo').click(async()=>{ const res = await fetch('/auth/logout').catch(e=>{ @@ -233,12 +266,12 @@ nav moly.loadScreen.close(id); window.shellnavigating = false; }); - $('#blocker').remove(); $($('.item')[0]).trigger("click"); + $('#blocker').remove(); } (async ()=>{ let time = 0 - while (typeof window.moly === "undefined" && time < 10000) { + while (typeof window.moly === "undefined" || typeof window.userDetails === "undefined" || typeof window.agents === "undefined" && time < 10000) { await new Promise(resolve => setTimeout(resolve, 50)); time += 50; } @@ -247,6 +280,7 @@ nav while (typeof window.moly !== "undefined" && document.readyState !== "complete") { await new Promise(resolve => setTimeout(resolve, 100)); } + time = null; domReady(); } })() diff --git a/modules/kegiatan-proker-view.html b/modules/kegiatan-proker-edit.html similarity index 100% rename from modules/kegiatan-proker-view.html rename to modules/kegiatan-proker-edit.html diff --git a/modules/kegiatan.html b/modules/kegiatan.html index bda6faf..47694f1 100644 --- a/modules/kegiatan.html +++ b/modules/kegiatan.html @@ -173,8 +173,15 @@ st.style = statusStyles[v.journal.at(-1).status]; $(ro).click(async()=>{ const data = v; - const vw = await moly.dialog.show({title: "Detil Program Kerja", content: "/modules/kegiatan-proker-view.html", fetching: true, data}); - if(vw) populateProker(); + if (data.journal.at(-1).status < 2) + { + const vw = await moly.dialog.show({title: "Detil Program Kerja", content: "/modules/kegiatan-proker-edit.html", fetching: true, data}); + if(vw) populateProker(); + } + else if (data.journal.at(-1).status > 2) + { + alert("To Advance the proker") + } }) $('#proker #pkContent').append(ro); }); @@ -198,7 +205,7 @@ moly.loadScreen.close(loadid); return; } - const submission = await postJson('/api/submitpk',{agentid: userDetails.agentID, year: Number($('#pkYear').val())}); + const submission = await postJson('/api/submitpk',{agentid: userDetails.info.agentID, year: Number($('#pkYear').val())}); if(submission.status != 202) { moly.alert.show("Pengajuan Program Kerja Gagal","Program Kerja tidak berhasil diajukan. Silakan ulangi kembali beberapa saat lagi.") diff --git a/modules/submission-process.html b/modules/submission-process.html new file mode 100644 index 0000000..b2f3512 --- /dev/null +++ b/modules/submission-process.html @@ -0,0 +1,50 @@ +
+ Catatan Persetujuan/Penolakan Program Kerja Tahun
+ Agen Perubahan +
+ +
+ Tolak +   + Setujui +
+ \ No newline at end of file diff --git a/modules/submission-view.html b/modules/submission-view.html new file mode 100644 index 0000000..d3d00cd --- /dev/null +++ b/modules/submission-view.html @@ -0,0 +1,101 @@ +
+ Kegiatan +   + + Target Waktu +   +
+ +   + +
+ + + + Bulan Mulai + + +
+ Sasaran Kegiatan:
+ +
+
+ Sasaran Entitas:
+ +
+
+ Indikator:
+ +
+
+ Rencana Aksi:
+ +
+
+
+ Sebelumnya + Berikutnya +
+ Tanggapi +
+
+ \ No newline at end of file diff --git a/modules/submission.html b/modules/submission.html new file mode 100644 index 0000000..84adc59 --- /dev/null +++ b/modules/submission.html @@ -0,0 +1,252 @@ + +
+ Daftar Agen Perubahan
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
NoNIPNama Agen
+ Data Kosong +
+
+
+ +
+ Program Kerja Agen Perubahan
+ +
+
+ Tahun:  + + +   +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
NoKegiatanSasaranTarget WaktuWaktu MulaiStatus
Data Kosong
+
+
+ \ No newline at end of file