DONE: add 30 minutes banner popup when pc not submitted the customer list, disable terima button when the confirmation form is not yet printed on teller; WIP: auto approve from operasi for gadai between 10k - 45k, wire up with whatsapp template message
This commit is contained in:
@@ -1992,7 +1992,7 @@ class PembiayaanOnlineService
|
||||
'slot' => 'BATCH2',
|
||||
'label' => 'Batch 2',
|
||||
'mula' => '11:00',
|
||||
'cutoff' => '15:00',
|
||||
'cutoff' => '16:30',
|
||||
'proses' => '16:30',
|
||||
],
|
||||
];
|
||||
@@ -2000,7 +2000,7 @@ class PembiayaanOnlineService
|
||||
|
||||
public function suggestSlot()
|
||||
{
|
||||
$now = Carbon::now();
|
||||
$now = Carbon::now('Asia/Kuala_Lumpur');
|
||||
$mins = ((int) $now->format('G')) * 60 + (int) $now->format('i');
|
||||
$jadual = $this->slotJadual();
|
||||
$batch1 = $jadual[0];
|
||||
@@ -2009,36 +2009,44 @@ class PembiayaanOnlineService
|
||||
$cutoff2 = $this->hmToMinutes($batch2['cutoff']);
|
||||
|
||||
if ($mins < $cutoff1) {
|
||||
return [
|
||||
'slot' => $batch1['slot'],
|
||||
'cutoff' => $batch1['cutoff'],
|
||||
'proses' => $batch1['proses'],
|
||||
'lewat' => false,
|
||||
'baki_minit' => $cutoff1 - $mins,
|
||||
'nota' => 'Dalam waktu Batch 1',
|
||||
'jadual' => $jadual,
|
||||
];
|
||||
return $this->slotPayload($batch1, false, $cutoff1 - $mins, 'Dalam waktu Batch 1', $now, $jadual);
|
||||
}
|
||||
|
||||
if ($mins < $cutoff2) {
|
||||
return [
|
||||
'slot' => $batch2['slot'],
|
||||
'cutoff' => $batch2['cutoff'],
|
||||
'proses' => $batch2['proses'],
|
||||
'lewat' => false,
|
||||
'baki_minit' => $cutoff2 - $mins,
|
||||
'nota' => 'Dalam waktu Batch 2',
|
||||
'jadual' => $jadual,
|
||||
];
|
||||
return $this->slotPayload($batch2, false, $cutoff2 - $mins, 'Dalam waktu Batch 2', $now, $jadual);
|
||||
}
|
||||
|
||||
$lewat = $this->slotPayload(
|
||||
$batch2,
|
||||
true,
|
||||
0,
|
||||
'Selepas cutoff Batch 2 — masih boleh hantar; Operasi mungkin proses esok',
|
||||
$now,
|
||||
$jadual
|
||||
);
|
||||
$lewat['proses'] = $batch2['proses'] . ' (hari berikutnya jika sudah lewat)';
|
||||
|
||||
return $lewat;
|
||||
}
|
||||
|
||||
protected function slotPayload(array $batch, $lewat, $bakiMinit, $nota, Carbon $now, array $jadual)
|
||||
{
|
||||
$parts = explode(':', (string) $batch['cutoff']);
|
||||
$cutoffAt = $now->copy()->setTime(
|
||||
isset($parts[0]) ? (int) $parts[0] : 0,
|
||||
isset($parts[1]) ? (int) $parts[1] : 0,
|
||||
0
|
||||
);
|
||||
|
||||
return [
|
||||
'slot' => $batch2['slot'],
|
||||
'cutoff' => $batch2['cutoff'],
|
||||
'proses' => $batch2['proses'] . ' (hari berikutnya jika sudah lewat)',
|
||||
'lewat' => true,
|
||||
'baki_minit' => 0,
|
||||
'nota' => 'Selepas cutoff Batch 2 — masih boleh hantar; Operasi mungkin proses esok',
|
||||
'slot' => $batch['slot'],
|
||||
'cutoff' => $batch['cutoff'],
|
||||
'cutoff_at' => $cutoffAt->toIso8601String(),
|
||||
'server_now' => $now->toIso8601String(),
|
||||
'proses' => $batch['proses'],
|
||||
'lewat' => (bool) $lewat,
|
||||
'baki_minit' => (int) $bakiMinit,
|
||||
'nota' => $nota,
|
||||
'jadual' => $jadual,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user