Compare commits
3 Commits
501392e1c1
...
964889fd0b
| Author | SHA1 | Date | |
|---|---|---|---|
| 964889fd0b | |||
| b811accc48 | |||
|
|
3c098d1c69 |
@@ -281,7 +281,7 @@ class NotifikasiWaService {
|
|||||||
async runReminder() {
|
async runReminder() {
|
||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
let data = this.loadReminder();
|
let data = await this.loadReminder();
|
||||||
|
|
||||||
data = data?.filter(async (item) => {
|
data = data?.filter(async (item) => {
|
||||||
|
|
||||||
@@ -393,6 +393,7 @@ class NotifikasiWaService {
|
|||||||
const now = new Date();
|
const now = new Date();
|
||||||
const year = now.getFullYear();
|
const year = now.getFullYear();
|
||||||
const reminderAt = new Date(deviceReminder[0].reminder_at);
|
const reminderAt = new Date(deviceReminder[0].reminder_at);
|
||||||
|
const deviceName = new Date(deviceReminder[0].device_name);
|
||||||
|
|
||||||
// 🔹 ambil bulan & jam dalam timezone server
|
// 🔹 ambil bulan & jam dalam timezone server
|
||||||
const nowParts = new Intl.DateTimeFormat('en-US', {
|
const nowParts = new Intl.DateTimeFormat('en-US', {
|
||||||
@@ -439,7 +440,7 @@ class NotifikasiWaService {
|
|||||||
|
|
||||||
if (!checkNotifExist) {
|
if (!checkNotifExist) {
|
||||||
|
|
||||||
const deviceNotification = await getSparepartsByYearlyDb(yearly);
|
// const deviceNotification = await getSparepartsByYearlyDb(yearly);
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
error_code_id: yearly ?? chanel.value,
|
error_code_id: yearly ?? chanel.value,
|
||||||
@@ -455,6 +456,8 @@ class NotifikasiWaService {
|
|||||||
|
|
||||||
await this.saveReminder({
|
await this.saveReminder({
|
||||||
notification_log: resultNotificationError.notification_error_id,
|
notification_log: resultNotificationError.notification_error_id,
|
||||||
|
error_code_id: data['error_code_id'],
|
||||||
|
error_chanel: data['error_chanel'],
|
||||||
start_at: timeReminderString,
|
start_at: timeReminderString,
|
||||||
interval: 1,
|
interval: 1,
|
||||||
max: 3,
|
max: 3,
|
||||||
@@ -483,7 +486,7 @@ class NotifikasiWaService {
|
|||||||
|
|
||||||
const bodyMessage =
|
const bodyMessage =
|
||||||
`Hai ${dataUser.contact_name || "-"},\n` +
|
`Hai ${dataUser.contact_name || "-"},\n` +
|
||||||
`Diberitahukan bahwa terdapat sparepart pada device "${deviceNotification?.device_name ?? "-"}" ` +
|
`Diberitahukan bahwa terdapat sparepart pada device "${deviceName ?? "-"}" ` +
|
||||||
`yang telah memasuki jadwal perawatan tahunan.\n` +
|
`yang telah memasuki jadwal perawatan tahunan.\n` +
|
||||||
`\nSilakan segera lakukan pengecekan dan perawatan untuk memastikan kinerja tetap optimal.` +
|
`\nSilakan segera lakukan pengecekan dan perawatan untuk memastikan kinerja tetap optimal.` +
|
||||||
`\nDetail sparepart dapat dilihat pada link berikut:\n${shortUrl}`;
|
`\nDetail sparepart dapat dilihat pada link berikut:\n${shortUrl}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user