archive habbit weekly
Mon Dec 05 2022 01:49:31 GMT+0000 (Coordinated Universal Time)
Saved by @GodFather #javascript
// temporarily disabled
// function getJournalDaily() {
// const url = "/student/habit-daily";
// const loading = `
// <tr class="loading-dot bg-white-2">
// <td colspan="8">
// <div class="d-flex align-items-center">
// <div>
// <div class="snippet col-1" data-title=".dot-flashing">
// <div class="stage">
// <div class="dot-flashing"></div>
// </div>
// </div>
// </div>
// <p class="grey-6 ml-4">Memuat pembiasaan harian...</p>
// </div>
// </td>
// </tr>`;
// $.ajax({
// method: 'get',
// dataType: 'json',
// data: {
// currentEmptyHabit,
// },
// url: url,
// success: function(response) {
// let emptyDate = moment(response.emptyDateHabit[currentEmptyHabit]);
// let today = moment(moment().format('YYYY-MM-DD'));
// let dateTimeAgo = today.diff(emptyDate, 'days');
// let startOfWeek = moment(response.emptyDateHabit[currentEmptyHabit]).startOf('isoWeek').format('YYYY-MM-DD');
// let endOfWeek = moment(response.emptyDateHabit[currentEmptyHabit]).endOf('isoWeek').format('YYYY-MM-DD');
// if (response.emptyDateHabit == []) {
// let infoBoxHabbitDone = (`
// <div class="info-box-success mt-4">
// <div>
// <x-icon classicon="fill-dark-green" type="done" />
// </div>
// <div class="ml-4">
// Alhamdulillah... semua jurnal <b>sudah selesai</b> diisi.
// </div>
// </div>
// `);
// $('#infobox-habbit').html(infoBoxHabbitDone);
// $('.icon-status').html(`<x-icon classicon="fill-green-3" type="done" />`);
// } else {
// if (dateTimeAgo === 1) {
// let habitType = '';
// if (response.habitProgress.undone.SALAT_ZIKIR.length != 0) {
// habitType = 'SALAT_ZIKIR';
// } else if (response.habitProgress.undone.DAILY.length != 0) {
// habitType = 'DAILY';
// } else if (response.habitProgress.undone.WEEKLY.length != 0) {
// habitType = 'WEEKLY';
// }
// let infoBoxYesterday = (`
// <div class="info-box-group mt-4">
// <div class="info-box-danger">
// <div>
// <x-icon classicon="fill-dark-red" type="due" />
// </div>
// <div class="ml-4">
// Kamu belum selesai mengisi jurnal <b>kemarin</b> (${moment(response.emptyDateHabit[currentEmptyHabit]).format("dddd, DD MMMM YYYY")}).
// Ayo tuntaskan sebelum lupa. Semangaaat!
// </div>
// </div>
// <div class="info-box-button">
// <div id="fill-journal-daily" class="info-box-button-item font-15 line-h20 font-w600 blue cursor-pointer" data-currentdate="${response.emptyDateHabit[currentEmptyHabit]}" data-startdate="${startOfWeek}" data-enddate="${endOfWeek}" data-habitType="${habitType}">
// Isi Jurnal
// </div>
// <div class="info-box-button-item grey-3 cursor-pointer" type="button" onClick="getJournalDaily()" ${currentEmptyHabit == (response.emptyDateHabit.length - 1) ? 'disabled' : ''}>
// Lewati
// </div>
// </div>
// </div>
// `);
// $('#infobox-habbit').html(infoBoxYesterday);
// } else if (dateTimeAgo === 0) {
// let infoBoxToday = (`
// <div class="info-box-primary mt-4">
// <div>
// <x-icon classicon="fill-dark-blue" type="pin" />
// </div>
// <div class="ml-4">
// Ayo selesaikan mengisi <b>jurnal hari ini</b> (${moment(response.emptyDateHabit[currentEmptyHabit]).format("dddd, DD MMMM YYYY")})!
// </div>
// </div>
// `);
// $('#infobox-habbit').html(infoBoxToday);
// if (response.habitProgress.progress == 0) {
// $('.icon-status').html(`<x-icon classicon="fill-red-3" type="unknown" />`);
// } else {
// $('.salat-zikir-dashboard').removeClass('d-none');
// if (response.habitProgress.progress == 47) {
// $('#progress-salat-zikir').css('width', `100` + '%');
// } else {
// $('#progress-salat-zikir').css('width', `${response.habitProgress.progress * 2}` + '%');
// }
// $('#progress-salat-zikir').attr('aria-valuenow', `${response.habitProgress.progress}`);
// $('#progress-salat-zikir').attr('aria-valuemax', response.habitProgress.max);
// }
// } else if (dateTimeAgo > 0 && dateTimeAgo != 1) {
// let habitType = '';
// if (response.habitProgress.undone.SALAT_ZIKIR.length != 0) {
// habitType = 'SALAT_ZIKIR';
// } else if (response.habitProgress.undone.DAILY.length != 0) {
// habitType = 'DAILY';
// } else if (response.habitProgress.undone.WEEKLY.length != 0) {
// habitType = 'WEEKLY';
// }
// let infoBoxDayAgo = (`
// <div class="info-box-group mt-4">
// <div class="info-box-danger">
// <div>
// <x-icon classicon="fill-dark-red" type="due" />
// </div>
// <div class="ml-4">
// Kamu belum selesai mengisi jurnal <b>${dateTimeAgo} hari yang lalu</b> (${moment(response.emptyDateHabit[currentEmptyHabit]).format("dddd, DD MMMM YYYY")}).
// Ayo tuntaskan sebelum lupa. Semangaaat!
// </div>
// </div>
// <div class="info-box-button">
// <div id="fill-journal-daily" class="info-box-button-item font-15 line-h20 font-w600 blue cursor-pointer" data-currentdate="${response.emptyDateHabit[currentEmptyHabit]}" data-startdate="${startOfWeek}" data-enddate="${endOfWeek}" data-habitType="${habitType}">
// Isi Jurnal
// </div>
// <div class="info-box-button-item grey-3 cursor-pointer" type="button" onClick="getJournalDaily()" ${currentEmptyHabit == (response.emptyDateHabit.length - 1) ? 'disabled' : ''}>
// Lewati
// </div>
// </div>
// </div>
// `);
// $('#infobox-habbit').html(infoBoxDayAgo);
// }
// }
// currentEmptyHabit += 1;
// },
// error: function(error) {}
// });
// }
// function getJournalWeekly() {
// const url = "/student/habit-weekly";
// const loading = `
// <tr class="loading-dot bg-white-2">
// <td colspan="8">
// <div class="d-flex align-items-center">
// <div>
// <div class="snippet col-1" data-title=".dot-flashing">
// <div class="stage">
// <div class="dot-flashing"></div>
// </div>
// </div>
// </div>
// <p class="grey-6 ml-4">Memuat pembiasaan harian...</p>
// </div>
// </td>
// </tr>`;
// $.ajax({
// method: 'get',
// dataType: 'json',
// url: url,
// success: function(response) {
// let dataDeedNull = 0;
// response.draftHabituationReport.forEach((index, key) => {
// if (index.deeds == null) {
// dataDeedNull += 1;
// }
// });
// if (dataDeedNull > 0) {
// let infoBoxDayAgo = (`
// <div class="info-box-group mt-4">
// <div class="info-box-danger">
// <div>
// <x-icon classicon="fill-dark-red" type="due" />
// </div>
// <div class="ml-4">
// Kamu belum selesai mengisi jurnal <b>minggu lalu</b> (${moment(response.startOfWeek).format("DD MMMM YYYY")} - ${moment(response.endOfWeek).format("DD MMMM YYYY")}). Ayo tuntaskan sebelum lupa. Semangaaat!
// </div>
// </div>
// <div class="info-box-button">
// <div id="fill-journal-weekly" class="info-box-button-item font-15 line-h20 font-w600 blue cursor-pointer" data-startdate="${response.startOfWeek}" data-enddate="${response.endOfWeek}">
// Isi Jurnal
// </div>
// <div class="info-box-button-item grey-3 cursor-pointer" type="button" onClick="getJournalDaily()">
// Lewati
// </div>
// </div>
// </div>
// `);
// $('#infobox-habbit').html(infoBoxDayAgo);
// } else {
// getJournalDaily();
// }
// },
// error: function(error) {}
// });
// }



Comments