50 lines
1.8 KiB
HTML
50 lines
1.8 KiB
HTML
<div style="text-align: center;">
|
|
<span>Catatan Persetujuan/Penolakan Program Kerja Tahun <span id="yr"></span></span><br>
|
|
<span>Agen Perubahan <span id="nm"></span></span>
|
|
</div>
|
|
<textarea id="notes" style="width: 100%;height: 6em;margin: 1em 0; resize: none;" maxlength="126" placeholder="Harap isikan catatan (wajib)">
|
|
</textarea>
|
|
<div style="display: grid;grid-template-columns: auto 1fr auto;">
|
|
<a-button id="decline" type="negative">Tolak</a-button>
|
|
|
|
<a-button id="approve">Setujui</a-button>
|
|
</div>
|
|
<script type="module">
|
|
const thisDialog = moly.lastDialog();
|
|
const data = thisDialog.data;
|
|
function µ(selector)
|
|
{
|
|
if (selector) return $(thisDialog.box).find(selector);
|
|
return $(thisDialog.box);
|
|
}
|
|
µ('#yr').text(data.year);
|
|
µ('#nm').text(agents.find(e=>e.agentID == data.agentid).name);
|
|
µ('#decline').click(()=>{
|
|
data.newstatus = 1;
|
|
process();
|
|
})
|
|
µ('#approve').click(()=>{
|
|
data.newstatus = 3;
|
|
process();
|
|
})
|
|
async function process()
|
|
{
|
|
const loadid = moly.loadScreen.show("Memroses Program Kerja...","sonar",'#main');
|
|
data.notes = µ('#notes').val();
|
|
if(data.notes.length < 5)
|
|
{
|
|
moly.alert.show("Catatan Belum Dilengkapi","Harap isikan catatan dengan pesan yang bermakna.");
|
|
moly.loadScreen.close(loadid);
|
|
return;
|
|
}
|
|
const process = await postJson('/api/processpk',data);
|
|
if(process.status != 202)
|
|
{
|
|
moly.alert.show("Tanggapi Program Kerja","Gagal mengirimkan tanggapan. Silakan ulangi kembali beberapa saat lagi.");
|
|
moly.loadScreen.close(loadid);
|
|
return;
|
|
}
|
|
thisDialog.resolve(data.newstatus);
|
|
moly.loadScreen.close(loadid);
|
|
}
|
|
</script> |