diff --git a/.DS_Store b/.DS_Store index dce91cda7281e6439a6094eb8774bf5c95ef1b23..74690d10c4f146a2367844eb324445a9f1671cce 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Archive.zip b/Archive.zip new file mode 100644 index 0000000000000000000000000000000000000000..4ec83d5daf607b32ab53149694fe0f4a6f4d14f3 Binary files /dev/null and b/Archive.zip differ diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 1c0326eef08e9218020679d607fc0b2aa26897b4..0000000000000000000000000000000000000000 --- a/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM openjdk:17-alpine -ARG JAR_FILE=backend/RumahSehat/build/libs/RumahSehat-0.0.1-SNAPSHOT.jar -COPY ${JAR_FILE} app.jar -EXPOSE 9099 -ENTRYPOINT ["java","-jar","/app.jar"] diff --git a/README.md b/README.md index 4ff8e8f8ee915752345b96fc2506f1da2390459f..0c54721d893b8878ca603ae0fba3a19140feda22 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,43 @@ # Tugas Akhir + ## Authors -* **Fransisco William Sudianto** - *2006596535* - *C* -* **Adham Muhammad Farid** - *2006597632* - *C* -* **Alma Aqila Hansa** - *2006597626* - *C* -* **Hafizh Salam** - *1906399171* - *C* -* **Zachra Shafira Ramadhanty** - *2006597033* - *C* + +- **Fransisco William Sudianto** - _2006596535_ - _C_ +- **Adham Muhammad Farid** - _2006597632_ - _C_ +- **Alma Aqila Hansa** - _2006597626_ - _C_ +- **Hafizh Salam** - _1906399171_ - _C_ +- **Zachra Shafira Ramadhanty** - _2006597033_ - _C_ --- + **Kontrak Tahap 1 Tugas Akhir** -| NPM | Nama Lengkap | Fitur yang akan diselesaikan | -| ----------| --- | ---------- | -| 2006596535| Fransisco William Sudianto | Persiapan TK | -| 2006597632 | Adham Muhammad Farid | Persiapan TK | -| 2006597626 | Alma Aqila Hansa | Persiapan TK | -| 2006597626 | Hafizh Salam | Persiapan TK | -| 2006597033 | Zachra Shafira Ramadhanty | Persiapan TK | -— ---- +| NPM | Nama Lengkap | Fitur yang akan diselesaikan | +| ---------- | -------------------------- | ---------------------------- | +| 2006596535 | Fransisco William Sudianto | Persiapan TK | +| 2006597632 | Adham Muhammad Farid | Persiapan TK | +| 2006597626 | Alma Aqila Hansa | Persiapan TK | +| 1906399171 | Hafizh Salam | Persiapan TK | +| 2006597033 | Zachra Shafira Ramadhanty | Persiapan TK | + **Kontrak Tahap 2 Tugas Akhir** -| NPM | Nama Lengkap | Fitur yang akan diselesaikan | -| ----------| --- | ---------- | -| 2006596535| Fransisco William Sudianto | 1, 2 | -| 2006597632 | Adham Muhammad Farid | 9, 11 | -| 2006597626 | Alma Aqila Hansa |10,12 | -| 2006597626 | Hafizh Salam | 8, 15 | -| 2006597033 | Zachra Shafira Ramadhanty | 5 | -— ---- +| NPM | Nama Lengkap | Fitur yang akan diselesaikan | +| ---------- | -------------------------- | ---------------------------- | +| 2006596535 | Fransisco William Sudianto | 1, 2 | +| 2006597632 | Adham Muhammad Farid | 9, 11 | +| 2006597626 | Alma Aqila Hansa | 10,12 | +| 1906399171 | Hafizh Salam | 8, 15 | +| 2006597033 | Zachra Shafira Ramadhanty | 5 | + **Kontrak Tahap 3 Tugas Akhir** -| NPM | Nama Lengkap | Fitur yang akan diselesaikan | -| ----------| --- | ---------- | -| 2006596535| Fransisco William Sudianto | 3, 4 | -| 2006597632 | Adham Muhammad Farid | 21 | -| 2006597626 | Alma Aqila Hansa |14,16 | -| 2006597626 | Hafizh Salam | 13, 17 | -| 2006597033 | Zachra Shafira Ramadhanty | 6, 7 | +| NPM | Nama Lengkap | Fitur yang akan diselesaikan | +| ---------- | -------------------------- | ---------------------------- | +| 2006596535 | Fransisco William Sudianto | 3, 4 | +| 2006597632 | Adham Muhammad Farid | 22 | +| 2006597626 | Alma Aqila Hansa | 14,16 | +| 1906399171 | Hafizh Salam | 13, 17 | +| 2006597033 | Zachra Shafira Ramadhanty | 6, 7 | + --- diff --git a/app.env b/app.env deleted file mode 100644 index 471d724379a23ce396e9bc6e96bf08500a3c29f3..0000000000000000000000000000000000000000 --- a/app.env +++ /dev/null @@ -1,6 +0,0 @@ -SPRING_PROFILES_ACTIVE=prod - -MYSQL_ROOT_PASSWORD=password123456! -MYSQL_DATABASE=apap_db -MYSQL_USER=apap_user -MYSQL_PASSWORD=password1234! \ No newline at end of file diff --git a/backend.zip b/backend.zip new file mode 100644 index 0000000000000000000000000000000000000000..0c733e49850c708a2589b247d4d60f392d26fc26 Binary files /dev/null and b/backend.zip differ diff --git a/backend/RumahSehat/.DS_Store b/backend/RumahSehat/.DS_Store index e84cda3e08f03e57d78226ffab7c5ff59e7ded50..217705281793b6a5d03a622a9b7ff06ccef9f0d4 100644 Binary files a/backend/RumahSehat/.DS_Store and b/backend/RumahSehat/.DS_Store differ diff --git a/backend/RumahSehat/src/main/.DS_Store b/backend/RumahSehat/src/main/.DS_Store index 53ba2daccc192b4eb19b86b0cc4199bd67491384..7970f23836c5a96dca4061f9b36224a0d5691f84 100644 Binary files a/backend/RumahSehat/src/main/.DS_Store and b/backend/RumahSehat/src/main/.DS_Store differ diff --git a/backend/RumahSehat/src/main/java/.DS_Store b/backend/RumahSehat/src/main/java/.DS_Store index d132082a9aedbe243cf5b8e4c5ee4d003ebb089d..37fc510a9ea32ae7face4277784c7c728e73d112 100644 Binary files a/backend/RumahSehat/src/main/java/.DS_Store and b/backend/RumahSehat/src/main/java/.DS_Store differ diff --git a/backend/RumahSehat/src/main/java/apap/.DS_Store b/backend/RumahSehat/src/main/java/apap/.DS_Store index e0f9d4a5fdf594d54a4e99f65c115c21bbb6199e..40c002582af0477d8f6ab61f55bf736eb523f7b1 100644 Binary files a/backend/RumahSehat/src/main/java/apap/.DS_Store and b/backend/RumahSehat/src/main/java/apap/.DS_Store differ diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/.DS_Store b/backend/RumahSehat/src/main/java/apap/tugasakhir/.DS_Store index 0ad28f4cb356303f40f25e46a11d0c10eb56a095..9f3ad5f0c771f7d8fcd6fd4a0fd84bf0d01920e6 100644 Binary files a/backend/RumahSehat/src/main/java/apap/tugasakhir/.DS_Store and b/backend/RumahSehat/src/main/java/apap/tugasakhir/.DS_Store differ diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/controller/ResepController.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/controller/ResepController.java index f8e5d5e9980cdd50640a9a10990f6ec6dfa70c3b..2ae98d30930594a96e102e84e7c07d130a7c9b91 100644 --- a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/controller/ResepController.java +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/controller/ResepController.java @@ -48,48 +48,6 @@ public class ResepController { @Autowired TagihanService tagihanService; - // @GetMapping("/all") - // public ResponseEntity getAllCovidCases() { - // log.info("api get all covid case"); - // return ResponseEntity.ok(""); - // } - - // @GetMapping("/add") - // public String createResep(Model model) { - // List<ObatModel> obatModelList = obatService.getAll(); - // ResepModel newResep = new ResepModel(); - // ObatModel newObat = new ObatModel(); - - - // // JumlahModel newJumlah = new JumlahModel(); - // // newJumlah.setResep(newResep); - // // newJumlah.setObat(newObat); - // // newJumlah.setKuantitas(0); - - - // // Integer kuantitas = new Integer(0); - - // model.addAttribute("kuantitas",kuantitas); - // model.addAttribute("newObat", newObat); - // model.addAttribute("obatModelList", obatModelList); - // return "resep/form-add-resep"; - // } - - // @PostMapping("/add") - // public String postCreateResep( - // @ModelAttribute ObatModel newObat, - // @ModelAttribute Integer kuantitas, - // Model model - // ) { - - // System.out.println(newObat.getId()+ " " + kuantitas); - - // // model.addAttribute("newResep", newResep); - // return "resep/form-add-resep"; - // } - - - @GetMapping("/add") public String addResep(Model model) { ResepModel resep = new ResepModel(); @@ -117,6 +75,9 @@ public class ResepController { resepService.addResep(resep); + for(ObatModel xObat : obatService.getAllFromResep(resep)) { + System.out.println(xObat.getNama()); + } return "resep/add-resep"; @@ -156,8 +117,15 @@ public class ResepController { public String detailResep(Model model, @PathVariable Long id) { ResepModel resep = resepService.getResepById(id); // ini dummy - AppointmentModel appointmentModelDummy = appointmentService.getAppointmentByKode("11"); + AppointmentModel appointmentModelDummy = appointmentService.getAppointmentByKode("APT-5"); resep.setAppointment(appointmentModelDummy); + appointmentModelDummy.setResep(resep); + System.out.println("ini APT1: " + appointmentModelDummy); + System.out.println("ini APT1: " + appointmentModelDummy.getResep()); + System.out.println("ini id resep: " + resep.getId()); + System.out.println("ini objek resep: " + resep); + System.out.println("ini attribute resep: " + resep.getAppointment()); + System.out.println("--------- di bawah ini iterate 2"); AppointmentModel appointmentModel = resep.getAppointment(); List<JumlahModel> listJumlahFirst = resep.getListJumlah(); @@ -172,7 +140,14 @@ public class ResepController { } } } + resepService.addResep(resep); + + String msg = "Not Yet Confirmed"; + if(appointmentModel.getIsDone()) { + msg = "Confirmed"; + } + model.addAttribute("appointment_status", msg); model.addAttribute("listObatKuantitas", listObatKuantitas); model.addAttribute("appointmentModel", appointmentModel); model.addAttribute("resep", resep); @@ -181,6 +156,7 @@ public class ResepController { @PostMapping(value = "/{id}", params = {"confirm"}) private String konfirmasiDetailResep( @PathVariable Long id, + // @ModelAttribute ResepModel resep, Model model) { ResepModel resep = resepService.getResepById(id); @@ -205,15 +181,18 @@ public class ResepController { } } } + if(appointmentModel.getIsDone()) { + canConfirmed = false; + } if (canConfirmed) { + appointmentModel.setIsDone(true); resep.setIsDone(true); TagihanModel tagihan = new TagihanModel(); tagihan.setAppointment(appointmentModel); tagihan.setTanggalTerbuat(LocalDateTime.now()); - // tagihan.setTanggalBayar(LocalDateTime.now()); //harusnya null tagihan.setIsPaid(false); appointmentModel.setTagihan(tagihan); @@ -225,11 +204,8 @@ public class ResepController { } tagihan.setJumlahTagihan(appointmentModel.getDokter().getTarif() + jumlahTagihan); - - // System.out.println("Tagihan Appointment= " + tagihan.getAppointment()); - // System.out.println("Appointment tagihan = " + appointmentModel.getTagihan()); - // System.out.println("Jumlah tagihan = " + tagihan.getJumlahTagihan()); - + appointmentService.add(appointmentModel); + resepService.update(resep); tagihanService.add(tagihan); return "resep/success-confirmed"; } diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/controller/ResepRestController.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/controller/ResepRestController.java index 5f10f98abbc818645cf1f1698f4b0b9234524c9e..cc34594b99a2c0ef93634d61baa75b0df89084ed 100644 --- a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/controller/ResepRestController.java +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/controller/ResepRestController.java @@ -1,5 +1,6 @@ package apap.tugasakhir.RumahSehat.controller; +import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -11,9 +12,13 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import apap.tugasakhir.RumahSehat.models.AppointmentModel; +import apap.tugasakhir.RumahSehat.models.HelperObatAdham; +import apap.tugasakhir.RumahSehat.models.HelperResepAdham; import apap.tugasakhir.RumahSehat.models.JumlahModel; import apap.tugasakhir.RumahSehat.models.ObatModel; import apap.tugasakhir.RumahSehat.models.ResepModel; +import apap.tugasakhir.RumahSehat.service.AppointmentService; import apap.tugasakhir.RumahSehat.service.DokterService; import apap.tugasakhir.RumahSehat.service.ObatService; import apap.tugasakhir.RumahSehat.service.PasienService; @@ -35,6 +40,9 @@ public class ResepRestController { @Autowired PasienService pasienService; + @Autowired + AppointmentService appointmentService; + @GetMapping("/{id}") @@ -59,6 +67,46 @@ public class ResepRestController { return resepService.getAll(); } + @GetMapping("/helper/{id}") + public HelperResepAdham resepDetailFullApi(@PathVariable Long id, Model model) { + HelperResepAdham helperResep = new HelperResepAdham(); + List<HelperObatAdham> listObatNewResep = new ArrayList<>(); + helperResep.setListObat(listObatNewResep); + + ResepModel resep = resepService.getResepById(id); + Collection<ObatModel> listObat = obatService.getAllFromResep(resep); + List<JumlahModel> listJumlah = resep.getListJumlah(); + for (AppointmentModel xAppointmentModel : appointmentService.getAll()) { + if(xAppointmentModel.getResep().getId() == id) { + helperResep.setIdResep(id); + helperResep.setNamaPasien(xAppointmentModel.getPasien().getNama()); + helperResep.setNamaDokter(xAppointmentModel.getDokter().getNama()); + helperResep.setStatusResep(xAppointmentModel.getResep().getIsDone() ? "Done" : "Not Yet Done"); + + if (xAppointmentModel.getResep().getApoteker() == null) { + helperResep.setNamaApotekerConfirm("Not yet confirmed by any apoteker"); + } else { + helperResep.setNamaApotekerConfirm(xAppointmentModel.getResep().getApoteker().getNama()); + } + } + } + for (ObatModel xObatModel : listObat) { + for(JumlahModel xJumlah: xObatModel.getListJumlah()){ + for(JumlahModel resepJumlah : listJumlah) { + if (xJumlah.getIdJumlah() == resepJumlah.getIdJumlah()) { + HelperObatAdham helperAdhamNew = new HelperObatAdham(); + helperAdhamNew.setHargaObat(xObatModel.getHarga()); + helperAdhamNew.setNamaObat(xObatModel.getNama()); + helperAdhamNew.setKuantitasObat(resepJumlah.getKuantitas()); + + helperResep.getListObat().add(helperAdhamNew); + } + } + } + } + return helperResep; + } + // @PostMapping("/pengajar/add/{code}") // public String addPengajarSubmitPage(@ModelAttribute PengajarModel pengajar, @PathVariable String code, // Model model) { diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/controller/TagihanController.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/controller/TagihanController.java new file mode 100644 index 0000000000000000000000000000000000000000..09c2984bf7be2c48452bb3b6691232c4cad39a4b --- /dev/null +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/controller/TagihanController.java @@ -0,0 +1,36 @@ +package apap.tugasakhir.RumahSehat.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +import org.springframework.web.bind.annotation.RequestMapping; + +import apap.tugasakhir.RumahSehat.service.AppointmentService; +import apap.tugasakhir.RumahSehat.service.ObatService; +import apap.tugasakhir.RumahSehat.service.ResepService; +import apap.tugasakhir.RumahSehat.service.TagihanService; + +@Controller +@RequestMapping(value = "/tagihan") +public class TagihanController { + + @Autowired + ObatService obatService; + + @Autowired + ResepService resepService; + + @Autowired + AppointmentService appointmentService; + + @Autowired + TagihanService tagihanService; + + @GetMapping("/chart") + public String showTagihanChart(Model model) { + return "chart-tagihan"; + } + +} diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/controller/TagihanRestController.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/controller/TagihanRestController.java new file mode 100644 index 0000000000000000000000000000000000000000..070abc0a39b5f1e148832ceaa81b6ec3fac8cf87 --- /dev/null +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/controller/TagihanRestController.java @@ -0,0 +1,221 @@ +package apap.tugasakhir.RumahSehat.controller; + +import java.io.Console; +import java.time.LocalDate; +import java.time.Month; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import apap.tugasakhir.RumahSehat.models.AppointmentModel; +import apap.tugasakhir.RumahSehat.models.HelperModelTagihanAdham; +import apap.tugasakhir.RumahSehat.models.TagihanModel; +import apap.tugasakhir.RumahSehat.service.AppointmentService; +import apap.tugasakhir.RumahSehat.service.HelperAdhamService; +import apap.tugasakhir.RumahSehat.service.TagihanService; + +@RestController +@RequestMapping(value = "/api/tagihan") +public class TagihanRestController { + + @Autowired + TagihanService tagihanService; + + @Autowired + AppointmentService appointmentService; + + @Autowired + HelperAdhamService helperAdhamService; + + + @GetMapping("") + public List<TagihanModel> tagihanAll( Model model) { + return tagihanService.getAll(); + } + + @GetMapping("/chart") + public List<HelperModelTagihanAdham> tagihanChart() { + + helperAdhamService.deleteAll(); // reset semuanya + for(AppointmentModel appointmentEach: appointmentService.getAll() ) { + Integer umurPasien = appointmentEach.getPasien().getUmur(); + Integer jumlahTagihanPasien = appointmentEach.getTagihan().getJumlahTagihan(); + LocalDate localDate = appointmentEach.getTagihan().getTanggalTerbuat().toLocalDate(); + + + // kalau helpernya belum terbuat + HelperModelTagihanAdham helper = null;; + if(helperAdhamService.getHelperByTanggal(localDate) == null) { + helper = new HelperModelTagihanAdham(); + helper.setTanggal(localDate); + if (umurPasien <= 15) { + helper.setRange1(jumlahTagihanPasien); + } else if (umurPasien >= 16 && umurPasien <= 30) { + helper.setRange2(jumlahTagihanPasien); + } else if (umurPasien >= 31 && umurPasien <= 45) { + helper.setRange3(jumlahTagihanPasien); + } else if (umurPasien >= 46 && umurPasien <= 60) { + helper.setRange4(jumlahTagihanPasien); + } else if (umurPasien >= 61) { + helper.setRange5(jumlahTagihanPasien); + } + } else { + helper = helperAdhamService.getHelperByTanggal(localDate); + if (umurPasien <= 15) { + helper.setRange1(helper.getRange1() + jumlahTagihanPasien); + } else if (umurPasien >= 16 && umurPasien <= 30) { + helper.setRange2(helper.getRange2() + jumlahTagihanPasien); + } else if (umurPasien >= 31 && umurPasien <= 45) { + helper.setRange3(helper.getRange3() + jumlahTagihanPasien); + } else if (umurPasien >= 46 && umurPasien <= 60) { + helper.setRange4(helper.getRange4() + jumlahTagihanPasien); + } else if (umurPasien >= 61) { + helper.setRange5(helper.getRange5() + jumlahTagihanPasien); + } + } + helperAdhamService.add(helper); + } + + return helperAdhamService.getAll(); + } + + @GetMapping("/chart/{bulan}/{tahun}") + public List<HelperModelTagihanAdham> tagihanChartBulan( + @PathVariable Integer bulan, + @PathVariable Integer tahun, + Model model) { + + List<HelperModelTagihanAdham> oldList = this.tagihanChart(); + List<HelperModelTagihanAdham> finalList = new ArrayList<>(); + + for(HelperModelTagihanAdham item : oldList) { + if(item.getTanggal().getMonthValue() == bulan && item.getTanggal().getYear() == tahun) { + finalList.add(item); + } + } + return finalList; + } + @GetMapping("/chart/{tahun}") + public List<HelperModelTagihanAdham> tagihanChartTahun( + @PathVariable Integer tahun, + Model model) { + + List<HelperModelTagihanAdham> oldList = this.tagihanChart(); + + HelperModelTagihanAdham jan = new HelperModelTagihanAdham(); + HelperModelTagihanAdham feb = new HelperModelTagihanAdham(); + HelperModelTagihanAdham mar = new HelperModelTagihanAdham(); + HelperModelTagihanAdham apr = new HelperModelTagihanAdham(); + HelperModelTagihanAdham mei = new HelperModelTagihanAdham(); + HelperModelTagihanAdham jun = new HelperModelTagihanAdham(); + HelperModelTagihanAdham jul = new HelperModelTagihanAdham(); + HelperModelTagihanAdham aug = new HelperModelTagihanAdham(); + HelperModelTagihanAdham sep = new HelperModelTagihanAdham(); + HelperModelTagihanAdham okt = new HelperModelTagihanAdham(); + HelperModelTagihanAdham nov = new HelperModelTagihanAdham(); + HelperModelTagihanAdham des = new HelperModelTagihanAdham(); + + jan.setTanggal(LocalDate.of(1, 1, 1)); + feb.setTanggal(LocalDate.of(1, 2, 1)); + mar.setTanggal(LocalDate.of(1, 3, 1)); + apr.setTanggal(LocalDate.of(1, 4, 1)); + mei.setTanggal(LocalDate.of(1, 5, 1)); + jun.setTanggal(LocalDate.of(1, 6, 1)); + jul.setTanggal(LocalDate.of(1, 7, 1)); + aug.setTanggal(LocalDate.of(1, 8, 1)); + sep.setTanggal(LocalDate.of(1, 9, 1)); + okt.setTanggal(LocalDate.of(1, 10, 1)); + nov.setTanggal(LocalDate.of(1, 11, 1)); + des.setTanggal(LocalDate.of(1, 12, 1)); + + List<HelperModelTagihanAdham> finalList = new ArrayList<>(Arrays.asList(jan, feb, mar, apr, mei, jun, jul, aug, sep, okt, nov, des)); + + + for(HelperModelTagihanAdham helperOld : oldList) { + if(helperOld.getTanggal().getYear() == tahun) { + int bulan = helperOld.getTanggal().getMonthValue(); + for (HelperModelTagihanAdham helperNew : finalList) { + if (helperNew.getTanggal().getMonthValue() == bulan) { + helperNew.setRange1(helperNew.getRange1() + helperOld.getRange1()); + helperNew.setRange2(helperNew.getRange2() + helperOld.getRange2()); + helperNew.setRange3(helperNew.getRange3() + helperOld.getRange3()); + helperNew.setRange4(helperNew.getRange4() + helperOld.getRange4()); + helperNew.setRange5(helperNew.getRange5() + helperOld.getRange5()); + } + } + } + } + + return finalList; + } + + @GetMapping("/chart/kuantitas") + public List<HelperModelTagihanAdham> tagihanChartKuantitas( + Model model) { + List<HelperModelTagihanAdham> listFinal = new ArrayList<>(); + + HelperModelTagihanAdham helper = new HelperModelTagihanAdham(); + for(AppointmentModel appointmentEach: appointmentService.getAll() ) { + Integer umurPasien = appointmentEach.getPasien().getUmur(); + // Integer jumlahTagihanPasien = appointmentEach.getTagihan().getJumlahTagihan(); + LocalDate localDate = appointmentEach.getTagihan().getTanggalTerbuat().toLocalDate(); + // kalau helpernya belum terbuat + if (appointmentEach.getTagihan() != null) { + if (umurPasien <= 15) { + helper.setRange1(helper.getRange1() + 1); + } else if (umurPasien >= 16 && umurPasien <= 30) { + helper.setRange2(helper.getRange2() + 1); + } else if (umurPasien >= 31 && umurPasien <= 45) { + helper.setRange3(helper.getRange3() + 1); + } else if (umurPasien >= 46 && umurPasien <= 60) { + helper.setRange4(helper.getRange4() + 1); + } else if (umurPasien >= 61) { + helper.setRange5(helper.getRange5() + 1); + } + // listFinal.add(helper); + } + } + // listFinal.sort((x,y) -> x.getTanggal().compareTo(y.getTanggal())); + listFinal.add(helper); + + return listFinal; + } + @GetMapping("/chart/total-tagihan") + public List<HelperModelTagihanAdham> tagihanChartTotalTagihan( + Model model) { + List<HelperModelTagihanAdham> listFinal = new ArrayList<>(); + + HelperModelTagihanAdham helper = new HelperModelTagihanAdham(); + for(AppointmentModel appointmentEach: appointmentService.getAll() ) { + Integer umurPasien = appointmentEach.getPasien().getUmur(); + LocalDate localDate = appointmentEach.getTagihan().getTanggalTerbuat().toLocalDate(); + if (appointmentEach.getTagihan() != null) { + // cek apakah dia udah bayar (uda ada tanggal bayar) + if (umurPasien <= 15) { + helper.setRange1(helper.getRange1() + appointmentEach.getTagihan().getJumlahTagihan()); + } else if (umurPasien >= 16 && umurPasien <= 30) { + helper.setRange2(helper.getRange2() + appointmentEach.getTagihan().getJumlahTagihan()); + } else if (umurPasien >= 31 && umurPasien <= 45) { + helper.setRange3(helper.getRange3() + appointmentEach.getTagihan().getJumlahTagihan()); + } else if (umurPasien >= 46 && umurPasien <= 60) { + helper.setRange4(helper.getRange4() + appointmentEach.getTagihan().getJumlahTagihan()); + } else if (umurPasien >= 61) { + helper.setRange5(helper.getRange5() + appointmentEach.getTagihan().getJumlahTagihan()); + } + } + } + listFinal.add(helper); + + return listFinal; + } +} diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/AppointmentModel.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/AppointmentModel.java index 71d7e0817ce281ad11673581af451b2d64c5b06d..d4f44627bd56f8f5c28a44a9ff01105ad23a05c9 100644 --- a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/AppointmentModel.java +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/AppointmentModel.java @@ -61,11 +61,12 @@ public class AppointmentModel implements Serializable{ @OnDelete(action = OnDeleteAction.CASCADE) private PasienModel pasien; + @JsonIgnore @OneToOne(cascade = CascadeType.ALL) @JoinColumn(name = "kode_tagihan", referencedColumnName = "kode") private TagihanModel tagihan; - // @JsonIgnore + @JsonIgnore @OneToOne(cascade = CascadeType.ALL) @JoinColumn(name = "resep_id", referencedColumnName = "id") private ResepModel resep; diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/HelperModelTagihanAdham.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/HelperModelTagihanAdham.java new file mode 100644 index 0000000000000000000000000000000000000000..965e7c4af4b7ebd4b821d49c936b07b8c26b9b48 --- /dev/null +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/HelperModelTagihanAdham.java @@ -0,0 +1,54 @@ +package apap.tugasakhir.RumahSehat.models; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; + +import org.hibernate.annotations.ColumnDefault; + +import java.io.Serializable; +import java.time.LocalDate; + + + + +@Setter +@Getter +@AllArgsConstructor +@NoArgsConstructor +@Entity +@Table(name = "helper_tagihan") +public class HelperModelTagihanAdham implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", nullable = false) + private Long id; + + // @Column(name = "list_kode_tagihan_added") + // private List<String> listKodeTagihanAdded; + + @Column(name = "tanggal") + private LocalDate tanggal; + + @Column(name = "range_1") + private Integer range1 = 0; + + @Column(name = "range_2") + private Integer range2 = 0; + + @Column(name = "range_3") + private Integer range3 = 0; + + @Column(name = "range_4") + private Integer range4 = 0; + + @Column(name = "range_5") + private Integer range5 = 0; + +} + diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/HelperObatAdham.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/HelperObatAdham.java new file mode 100644 index 0000000000000000000000000000000000000000..5b07ac876fb20696d98c9ed5bcec44c79756b2a7 --- /dev/null +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/HelperObatAdham.java @@ -0,0 +1,44 @@ +package apap.tugasakhir.RumahSehat.models; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; + +import org.hibernate.annotations.ColumnDefault; + +import java.io.Serializable; +import java.time.LocalDate; + + + + +@Setter +@Getter +// @AllArgsConstructor +// @NoArgsConstructor +// @Entity +// @Table(name = "helper_obatt_adham") +public class HelperObatAdham { + + // @Id + // @GeneratedValue(strategy = GenerationType.IDENTITY) + // @Column(name = "id", nullable = false) + // private Long id; + + // @Column(name = "list_kode_tagihan_added") + // private List<String> listKodeTagihanAdded; + + // @Column(name = "nama_obat") + private String namaObat; + + // @Column(name = "harga_obat") + private Integer hargaObat; + + // @Column(name = "kuantitas_obat") + private Integer kuantitasObat; + +} diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/HelperResepAdham.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/HelperResepAdham.java new file mode 100644 index 0000000000000000000000000000000000000000..ebda519b49b039aa2fbc81abcb5aa5e04a61d7fc --- /dev/null +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/HelperResepAdham.java @@ -0,0 +1,39 @@ +package apap.tugasakhir.RumahSehat.models; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; + +import org.hibernate.annotations.ColumnDefault; + +import java.io.Serializable; +import java.time.LocalDate; +import java.util.List; + + + + +@Setter +@Getter +// @AllArgsConstructor +// @NoArgsConstructor +// @Entity +// @Table(name = "helper_obatt_adham") +public class HelperResepAdham { + + private Long idResep; + + private String namaPasien; + + private String namaDokter; + + private String statusResep; + + private String namaApotekerConfirm; + + private List<HelperObatAdham> listObat; +} diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/ResepModel.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/ResepModel.java index 590f3697fcc0dcce3fda6d77ed5da5fed60678e9..cd18b38e389f637c0deb5f9ff4409bba8aefd3a3 100644 --- a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/ResepModel.java +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/ResepModel.java @@ -52,7 +52,7 @@ public class ResepModel implements Serializable { @OneToMany(mappedBy = "resep", fetch = FetchType.LAZY, cascade = CascadeType.ALL) List<JumlahModel> listJumlah; - // @JsonIgnore + @JsonIgnore @OneToOne(mappedBy = "resep") private AppointmentModel appointment; diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/TagihanModel.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/TagihanModel.java index 3e124d77957146321e7af46dbf60f7a589f03ce8..2da19e07863e796d7db1047d06310ea004f12537 100644 --- a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/TagihanModel.java +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/models/TagihanModel.java @@ -7,6 +7,9 @@ import lombok.Setter; import org.hibernate.annotations.GenericGenerator; import org.springframework.format.annotation.DateTimeFormat; + +import com.fasterxml.jackson.annotation.JsonIgnore; + import javax.persistence.*; import javax.validation.constraints.NotNull; import java.io.Serializable; @@ -34,8 +37,8 @@ public class TagihanModel implements Serializable { @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm") private LocalDateTime tanggalTerbuat; - @NotNull - @Column(name = "tanggal_bayar", nullable = false) + // Gua ubah lagi + @Column(name = "tanggal_bayar") @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm") private LocalDateTime tanggalBayar; @@ -47,6 +50,7 @@ public class TagihanModel implements Serializable { @Column(name = "jumlah_tagihan", nullable = false) private Integer jumlahTagihan; + @JsonIgnore @OneToOne(mappedBy = "tagihan") private AppointmentModel appointment; diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/repository/HelperAdhamDb.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/repository/HelperAdhamDb.java new file mode 100644 index 0000000000000000000000000000000000000000..1a0f2aa60e0091f4d60ee5b8188339af1fe6496b --- /dev/null +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/repository/HelperAdhamDb.java @@ -0,0 +1,25 @@ +package apap.tugasakhir.RumahSehat.repository; +import java.time.LocalDate; +import java.util.List; +import java.util.Optional; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +import apap.tugasakhir.RumahSehat.models.DokterModel; +import apap.tugasakhir.RumahSehat.models.HelperModelTagihanAdham; +import apap.tugasakhir.RumahSehat.models.TagihanModel; + +@Repository +public interface HelperAdhamDb extends JpaRepository<HelperModelTagihanAdham, Long> { + Optional<HelperModelTagihanAdham> findById(Long id); + Optional<HelperModelTagihanAdham> findByTanggal(LocalDate tanggal); + + @Query( + value = "SELECT * FROM helper_tagihan ORDER BY tanggal;", + nativeQuery = true) + List<HelperModelTagihanAdham> findAll(); + +} + diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/AppointmentService.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/AppointmentService.java index b0805a0a96000cd567eacd9795ad141d67d1774c..0801d3e8cdbb2b596afff118d9cba3ebebab8990 100644 --- a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/AppointmentService.java +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/AppointmentService.java @@ -12,6 +12,7 @@ import apap.tugasakhir.RumahSehat.models.ResepModel; public interface AppointmentService { public AppointmentModel getAppointmentByKode(String kode); public List<AppointmentModel> getAll(); + public void add(AppointmentModel appointment); // public Collection<AppointmentModel> getAllFromResep(ResepModel resep); } diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/AppointmentServiceImpl.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/AppointmentServiceImpl.java index efe28c32a8bcd76fa421232acbe1a4e72ec142da..935e504d00026e6949128bb981e5f67e85bf1f25 100644 --- a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/AppointmentServiceImpl.java +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/AppointmentServiceImpl.java @@ -29,5 +29,11 @@ public class AppointmentServiceImpl implements AppointmentService { public AppointmentModel getAppointmentByKode(String kode) { Optional<AppointmentModel> appointment = appointmentDb.findByKode(kode); return appointment.orElse(null); + } + + @Override + public void add(AppointmentModel appointment) { + appointmentDb.save(appointment); + } } diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/HelperAdhamService.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/HelperAdhamService.java new file mode 100644 index 0000000000000000000000000000000000000000..7bce1b34f2459d8900ef6df967a5db00319f246a --- /dev/null +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/HelperAdhamService.java @@ -0,0 +1,18 @@ +package apap.tugasakhir.RumahSehat.service; +import java.time.LocalDate; +import java.util.Collection; +import java.util.List; + +import org.springframework.stereotype.Service; + +import apap.tugasakhir.RumahSehat.models.HelperModelTagihanAdham; +import apap.tugasakhir.RumahSehat.models.TagihanModel; + +@Service +public interface HelperAdhamService { + public HelperModelTagihanAdham getHelperById(Long id); + public HelperModelTagihanAdham getHelperByTanggal(LocalDate tanggal); + public List<HelperModelTagihanAdham> getAll(); + public void deleteAll(); + public void add(HelperModelTagihanAdham tagihan); +} diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/HelperAdhamServiceImpl.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/HelperAdhamServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..38ead5d9ba7cf3bb998dc49d2f859286ccde131e --- /dev/null +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/HelperAdhamServiceImpl.java @@ -0,0 +1,44 @@ +package apap.tugasakhir.RumahSehat.service; +import java.time.LocalDate; +import java.util.List; +import java.util.Optional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import apap.tugasakhir.RumahSehat.models.HelperModelTagihanAdham; +import apap.tugasakhir.RumahSehat.repository.HelperAdhamDb; + +@Service +public class HelperAdhamServiceImpl implements HelperAdhamService { + + @Autowired + HelperAdhamDb helperAdhamDb; + + @Override + public HelperModelTagihanAdham getHelperById(Long id) { + Optional<HelperModelTagihanAdham> helper = helperAdhamDb.findById(id); + return helper.orElse(null); + } + + @Override + public List<HelperModelTagihanAdham> getAll() { + return helperAdhamDb.findAll(); + } + + @Override + public void add(HelperModelTagihanAdham helper) { + helperAdhamDb.save(helper); + } + + @Override + public HelperModelTagihanAdham getHelperByTanggal(LocalDate tanggal) { + Optional<HelperModelTagihanAdham> helper = helperAdhamDb.findByTanggal(tanggal); + return helper.orElse(null); + } + + @Override + public void deleteAll() { + helperAdhamDb.deleteAll(); + } +} diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/ResepService.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/ResepService.java index 731200df58fb0c1e08406a95f420c6b2f6a4f8d8..4760caa6790ac87a87c46fb65831909433196511 100644 --- a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/ResepService.java +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/ResepService.java @@ -9,6 +9,7 @@ import apap.tugasakhir.RumahSehat.models.ResepModel; @Service public interface ResepService { void addResep(ResepModel resep); + void update(ResepModel resep); public ResepModel getResepById(Long id); public void deleteResep(ResepModel user); public List<ResepModel> getAll(); diff --git a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/ResepServiceImpl.java b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/ResepServiceImpl.java index 06ba8615e382e8e40c8769685ba80e4447b18313..44a0340282fab8ac862edbe02d86f31ca4c7db8f 100644 --- a/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/ResepServiceImpl.java +++ b/backend/RumahSehat/src/main/java/apap/tugasakhir/RumahSehat/service/ResepServiceImpl.java @@ -42,6 +42,9 @@ public class ResepServiceImpl implements ResepService { // System.out.println(resepService.getResepById(resep.getId())); } } + public void update(ResepModel resep) { + resepDb.save(resep); + } @Override public ResepModel getResepById(Long id) { diff --git a/backend/RumahSehat/src/main/resources/.DS_Store b/backend/RumahSehat/src/main/resources/.DS_Store index fd9f3bf4366edac067c2f15541ec4210ec5dcb57..a0595138b173ab819241f698dd5a434159863c41 100644 Binary files a/backend/RumahSehat/src/main/resources/.DS_Store and b/backend/RumahSehat/src/main/resources/.DS_Store differ diff --git a/backend/RumahSehat/src/main/resources/application-dev.yml b/backend/RumahSehat/src/main/resources/application-dev.yml deleted file mode 100644 index 233ebdf408760588a063b6fe641ac5372c55cdaf..0000000000000000000000000000000000000000 --- a/backend/RumahSehat/src/main/resources/application-dev.yml +++ /dev/null @@ -1,32 +0,0 @@ -spring: - # konfigurasi untuk koneksi db - datasource: - driver-class-name: com.mysql.jdbc.Driver - - # sesuaikan nama database anda dengan di bawah ini - url: jdbc:mysql://localhost:3306/apap_db?useSSL=false&serverTimezone=Asia/Jakarta - - # sesuaikan dengan NAMA dan PASSWORD anda dengan username password di bawah ini - username: apap_user - password: password1234! - - jpa: - properties: - hibernate: - dialect: org.hibernate.dialect.MySQL5InnoDBDialect - format_sql: true - - # pembuatan database (create || create-drop || validate || update) - hibernate.ddl-auto: create-drop - - show-sql: true - - # Templates reloading during development - thymeleaf: - prefix: file:src/main/resources/templates/ - cache: false - - # Static resources reloading during development - web: - resources: - static-locations: file:src/main/resources/static/ diff --git a/backend/RumahSehat/src/main/resources/application-prod.yml b/backend/RumahSehat/src/main/resources/application-prod.yml deleted file mode 100644 index 0b0c85b20c6984187f54c59a1bed9c6f78e74516..0000000000000000000000000000000000000000 --- a/backend/RumahSehat/src/main/resources/application-prod.yml +++ /dev/null @@ -1,26 +0,0 @@ -server: - address: 0.0.0.0 - port: 8080 - -spring: - # konfigurasi untuk koneksi db - datasource: - driver-class-name: com.mysql.jdbc.Driver - - # sesuaikan nama database anda dengan di bawah ini - url: jdbc:mysql://db:3306/apap_db?useSSL=false&serverTimezone=Asia/Jakarta - - # sesuaikan dengan NAMA dan PASSWORD anda dengan username password di bawah ini - username: apap_user - password: password1234! - - jpa: - properties: - hibernate: - dialect: org.hibernate.dialect.MySQL5InnoDBDialect - format_sql: true - - # pembuatan database (create || create-drop || validate || update - hibernate.ddl-auto: create-drop - - show-sql: true diff --git a/backend/RumahSehat/src/main/resources/application.properties b/backend/RumahSehat/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..091a6c3c218b33d4f3752740aa4f9b215bd558ea --- /dev/null +++ b/backend/RumahSehat/src/main/resources/application.properties @@ -0,0 +1,18 @@ +#konfigurasi untuk koneksi MySQL +spring.sql.init.platform=mysql +spring.datasource.driver-class-name=com.mysql.jdbc.Driver + +#sesuaikan NAMA_DATABASE dengan nama database anda +spring.datasource.url=jdbc:mysql://localhost:3307/tkapap?useSSL=false&serverTimezone=Asia/Jakarta + +#sesuaikan dengan NAMA dan PASSWORD mysql anda +spring.datasource.username=root +spring.datasource.password= + +#optimize query untuk db MySQL +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect + +#pembuatan database (create || create drop || validate || update) +spring.jpa.hibernate.ddl-auto=update + +server.port=2020 diff --git a/backend/RumahSehat/src/main/resources/application.yml b/backend/RumahSehat/src/main/resources/application.yml deleted file mode 100644 index 2ad99807a80a62661bb68a84af21be8c6a10089e..0000000000000000000000000000000000000000 --- a/backend/RumahSehat/src/main/resources/application.yml +++ /dev/null @@ -1,3 +0,0 @@ -spring: - profiles: - default: dev diff --git a/backend/RumahSehat/src/main/resources/archie-xampp.zip b/backend/RumahSehat/src/main/resources/archie-xampp.zip new file mode 100644 index 0000000000000000000000000000000000000000..7e9115482486b324bdf3d8ba4850073960ebd0a3 Binary files /dev/null and b/backend/RumahSehat/src/main/resources/archie-xampp.zip differ diff --git a/backend/RumahSehat/src/main/resources/archive.zip b/backend/RumahSehat/src/main/resources/archive.zip new file mode 100644 index 0000000000000000000000000000000000000000..5a0b094c032545a4c640a4bea66df50c37c67061 Binary files /dev/null and b/backend/RumahSehat/src/main/resources/archive.zip differ diff --git a/backend/RumahSehat/src/main/resources/example.txt b/backend/RumahSehat/src/main/resources/example.txt deleted file mode 100644 index f9b0e7cf1b28aceebe4ede73acc79e9eb0d4cb54..0000000000000000000000000000000000000000 Binary files a/backend/RumahSehat/src/main/resources/example.txt and /dev/null differ diff --git a/backend/RumahSehat/src/main/resources/templates/chart-tagihan copy-.html b/backend/RumahSehat/src/main/resources/templates/chart-tagihan copy-.html new file mode 100644 index 0000000000000000000000000000000000000000..bae64d9c97e7ccff62794ded48b69e67b66eca3c --- /dev/null +++ b/backend/RumahSehat/src/main/resources/templates/chart-tagihan copy-.html @@ -0,0 +1,262 @@ +<!DOCTYPE html> +<html lang="en" xmlns:th="http://thymeleaf.org"> + <head> + <meta charset="UTF-8" /> + <title>Lihat Semua Kasus - UTS APAP 2022</title> + <object th:include="fragments/fragment :: css" th:remove="tag"></object> + <object th:include="fragments/fragment :: js" th:remove="tag"></object> + + <script + src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.9.1/chart.min.js" + integrity="sha512-ElRFoEQdI5Ht6kZvyzXhYG9NqjtkmlkfYk0wr6wHxU9JEHakS7UJZNeml5ALk+8IKlU6jDgMabC3vkumRokgJA==" + crossorigin="anonymous" + referrerpolicy="no-referrer" + ></script> + </head> + <style> + .show { + display: block !important; + } + </style> + <body> + <!-- <nav th:replace="fragments/fragment :: navbar(statistik)"></nav> --> + + <div class="container"> + <h1 class="mt-4 py-4">Statistik Tagihan</h1> + + <h2 class="mt-4 py-4">Chart</h2> + <div class="btn-group" role="group" aria-label="Basic example"> + <button + type="button" + id="line-button" + class="btn btn-primary" + onclick="changeToLine()" + > + Line Chart + </button> + <button + type="button" + id="bar-button" + class="btn btn-outline-primary" + onclick="changeToBar()" + > + Bar Chart + </button> + </div> + <div class="form-line"> + <div class="form-group"> + <label for="inputLine">Bulan</label> + <input + type="number" + class="form-control" + id="inputLineBulananBulan" + placeholder="Masukkan Bulan" + onchange="setChartLineBulananBulan()" + /> + </div> + <div class="form-group"> + <label for="inputLine">Tahun</label> + <input + type="number" + class="form-control" + id="inputLineTahunan" + placeholder="Masukkan Tahun" + onchange="setChartLineTahunan()" + /> + </div> + </div> + <div class="chart-container pb-5 mb-5" style="width: 80%"> + <canvas + id="myChartLine" + class="show" + style="display: none" + ></canvas> + <canvas id="myChartBar" class="" style="display: none"></canvas> + </div> + </div> + + <script> + var url = "/api/tagihan/chart"; + var valueBulananBulan = 0; + var valueTahunan = 0; + var myChartLine; + + function changeToBar() { + document + .getElementById("bar-button") + .classList.remove("btn-outline-primary"); + document + .getElementById("bar-button") + .classList.add("btn-primary"); + document + .getElementById("line-button") + .classList.add("btn-outline-primary"); + document + .getElementById("line-button") + .classList.remove("btn-primary"); + document.getElementById("myChartLine").classList.remove("show"); + document.getElementById("myChartBar").classList.add("show"); + } + function changeToLine() { + document + .getElementById("line-button") + .classList.remove("btn-outline-primary"); + document + .getElementById("line-button") + .classList.add("btn-primary"); + document + .getElementById("bar-button") + .classList.add("btn-outline-primary"); + document + .getElementById("bar-button") + .classList.remove("btn-primary"); + document.getElementById("myChartBar").classList.remove("show"); + document.getElementById("myChartLine").classList.add("show"); + } + + function setChartLineBulananBulan() { + valueBulananBulan = document.getElementById( + "inputLineBulananBulan" + ).value; + } + + function setChartLineTahunan() { + valueTahunan = + document.getElementById("inputLineTahunan").value; + url = "/api/tagihan/chart/" + valueTahunan; + if (myChartLine != undefined) { + destroyChart(); + } + callApi(); + } + + function destroyChart() { + myChartLine.destroy(); + } + + function callApi() { + $(document).ready(function () { + $.ajax({ + url: url, + method: "GET", + dataType: "json", + success: function (d) { + var tagihanData = []; + + var tempRange1 = []; + d.map((element) => { + tempRange1.push(element.range1); + }); + + var tempRange2 = []; + d.map((element) => { + tempRange2.push(element.range2); + }); + + var tempRange3 = []; + d.map((element) => { + tempRange3.push(element.range3); + }); + + var tempRange4 = []; + d.map((element) => { + tempRange4.push(element.range4); + }); + + var tempRange5 = []; + d.map((element) => { + tempRange5.push(element.range5); + }); + + tagihanData.push( + { + label: "[0-15]", + backgroundColor: "rgb(138, 201, 38)", + borderColor: "rgb(138, 201, 38)", + data: tempRange1, + }, + { + label: "[16-30]", + backgroundColor: "rgb(25, 130, 196)", + borderColor: "rgb(25, 130, 196)", + data: tempRange2, + }, + { + label: "[31-45]", + backgroundColor: "rgb(255, 202, 58)", + borderColor: "rgb(255, 202, 58)", + data: tempRange3, + }, + { + label: "[46-60]", + backgroundColor: "rgb(255, 89, 94)", + borderColor: "rgb(255, 89, 94)", + data: tempRange4, + }, + { + label: "[61 and up]", + backgroundColor: "rgb(106, 76, 147)", + borderColor: "rgb(106, 76, 147)", + data: tempRange5, + } + ); + console.log(tagihanData); + + const configLine = { + type: "line", + + data: { + datasets: tagihanData, + labels: d.map((element) => element.tanggal), + }, + options: {}, + }; + const configLineBulanan = { + type: "line", + + data: { + datasets: tagihanData, + labels: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "Desember", + ], + }, + options: {}, + }; + + const configBar = { + type: "bar", + + data: { + datasets: tagihanData, + labels: d.map((element) => element.tanggal), + }, + options: {}, + }; + + myChartLine = new Chart( + document.getElementById("myChartLine"), + configLineBulanan + ); + + // const myChartBar = new Chart( + // document.getElementById("myChartBar"), + // configBar + // ); + }, + }); + }); + } + </script> + </body> +</html> diff --git a/backend/RumahSehat/src/main/resources/templates/chart-tagihan.html b/backend/RumahSehat/src/main/resources/templates/chart-tagihan.html new file mode 100644 index 0000000000000000000000000000000000000000..dd319e0d616dd7a66b1cbec96de01eda32811974 --- /dev/null +++ b/backend/RumahSehat/src/main/resources/templates/chart-tagihan.html @@ -0,0 +1,493 @@ +<!DOCTYPE html> +<html lang="en" xmlns:th="http://thymeleaf.org"> + <head> + <meta charset="UTF-8" /> + <title>Lihat Semua Kasus - UTS APAP 2022</title> + <object th:include="fragments/fragment :: css" th:remove="tag"></object> + <object th:include="fragments/fragment :: js" th:remove="tag"></object> + + <script + src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.9.1/chart.min.js" + integrity="sha512-ElRFoEQdI5Ht6kZvyzXhYG9NqjtkmlkfYk0wr6wHxU9JEHakS7UJZNeml5ALk+8IKlU6jDgMabC3vkumRokgJA==" + crossorigin="anonymous" + referrerpolicy="no-referrer" + ></script> + </head> + <style> + .show { + display: block !important; + } + </style> + <body onload="initializeChart()"> + <!-- <nav th:replace="fragments/fragment :: navbar(statistik)"></nav> --> + + <div class="container"> + <h1 class="mt-4 py-4">Statistik Tagihan</h1> + + <h2 class="mt-4 py-4">Chart</h2> + <div class="btn-group" role="group" aria-label="Basic example"> + <button + type="button" + id="line-button" + class="btn btn-primary" + onclick="changeToLine()" + > + Line Chart + </button> + <button + type="button" + id="bar-button" + class="btn btn-outline-primary" + onclick="changeToBar()" + > + Bar Chart + </button> + </div> + <div class="form-line show" id="form-line" style="display: none"> + <label for="periode-line">Pilih Periode:</label> + <select + name="periode-line" + id="periode-line" + onchange="checkPeriode()" + > + <option value="bulanan">Bulanan</option> + <option value="tahunan">Tahunan</option> + </select> + <div + class="form-group show" + id="form-bulanan" + style="display: none" + > + <label for="inputLineBulananBulan">Bulan</label> + <input + type="number" + class="form-control" + id="inputLineBulananBulan" + placeholder="Masukkan Bulan" + onchange="setChartLineBulananBulan()" + /> + <label for="inputLineBulananTahun">Tahun</label> + <input + type="number" + class="form-control" + id="inputLineBulananTahun" + placeholder="Masukkan Tahun" + onchange="setChartLineBulananTahun()" + /> + </div> + <div class="form-group" id="form-tahunan" style="display: none"> + <label for="inputLineTahunan">Tahun</label> + <input + type="number" + class="form-control" + id="inputLineTahunan" + placeholder="Masukkan Tahun" + onchange="setChartLineTahunan()" + /> + </div> + <div class="chart-container pb-5 mb-5" style="width: 80%"> + <canvas + id="myChartLineBulanan" + class="lineBulan show" + style="display: none" + ></canvas> + <canvas + id="myChartLineTahunan" + class="lineTahun" + style="display: none" + ></canvas> + </div> + </div> + <div class="form-bar" id="form-bar" style="display: none"> + <label for="bar-type">Pilih Tipe Bar:</label> + <select name="bar-type" id="bar-type" onchange="checkBarType()"> + <option value="kuantitas">Kuantitas</option> + <option value="total">Total Tagihan</option> + </select> + <div class="chart-container pb-5 mb-5" style="width: 80%"> + <canvas + id="myChartBarKuantitas" + class="barKuantitas show" + style="display: none" + ></canvas> + <canvas + id="myChartBarTotalTagihan" + class="barTagihan" + style="display: none" + ></canvas> + </div> + </div> + </div> + + <script> + var valueBulananBulan = 0; + var valueBulananTahun = 0; + var myChartLineBulanan; + + var valueTahunan = 0; + var myChartLineTahunan; + + var myChartBarKuantitas; + var myChartBarTotalTagihan; + + var url = "/api/tagihan/chart"; // default url + + var barValue; + var lineValue; + + function changeToBar() { + document + .getElementById("bar-button") + .classList.remove("btn-outline-primary"); + document + .getElementById("bar-button") + .classList.add("btn-primary"); + document + .getElementById("line-button") + .classList.add("btn-outline-primary"); + document + .getElementById("line-button") + .classList.remove("btn-primary"); + + // document + // .getElementById("myChartLineBulanan") + // .classList.remove("show"); + document.getElementById("form-line").classList.remove("show"); + document.getElementById("form-bar").classList.add("show"); + + if (barValue == "kuantitas") { + setChartBarKuantitas(); + } else { + setChartBarTotalTagihan(); + } + } + function changeToLine() { + document + .getElementById("line-button") + .classList.remove("btn-outline-primary"); + document + .getElementById("line-button") + .classList.add("btn-primary"); + document + .getElementById("bar-button") + .classList.add("btn-outline-primary"); + document + .getElementById("bar-button") + .classList.remove("btn-primary"); + // document.getElementById("myChartBar").classList.remove("show"); + document.getElementById("form-line").classList.add("show"); + document.getElementById("form-bar").classList.remove("show"); + if (lineValue == "bulanan") { + setChartLineBulananBulan(); + } else { + setChartLineTahunan(); + } + } + function checkPeriode() { + if ( + document.getElementById("periode-line").value == "tahunan" + ) { + document + .getElementById("form-tahunan") + .classList.add("show"); + document + .getElementById("form-bulanan") + .classList.remove("show"); + document + .getElementById("myChartLineBulanan") + .classList.remove("show"); + document + .getElementById("myChartLineTahunan") + .classList.add("show"); + lineValue = "tahunan"; + url = "/api/tagihan/chart/" + valueTahunan; + setChartLineTahunan(); + } else { + document + .getElementById("form-tahunan") + .classList.remove("show"); + document + .getElementById("form-bulanan") + .classList.add("show"); + document + .getElementById("myChartLineBulanan") + .classList.add("show"); + document + .getElementById("myChartLineTahunan") + .classList.remove("show"); + lineValue = "bulanan"; + url = + "/api/tagihan/chart/" + + valueBulananBulan + + "/" + + valueBulananTahun; + setChartLineBulananBulan(); + } + } + + function checkBarType() { + if (document.getElementById("bar-type").value == "kuantitas") { + document + .getElementById("myChartBarTotalTagihan") + .classList.remove("show"); + document + .getElementById("myChartBarKuantitas") + .classList.add("show"); + setChartBarKuantitas(); + barValue = "kuantitas"; + } else { + document + .getElementById("myChartBarTotalTagihan") + .classList.add("show"); + document + .getElementById("myChartBarKuantitas") + .classList.remove("show"); + setChartBarTotalTagihan(); + barValue = "total-tagihan"; + } + } + + // LINE BULANAN + function setChartLineBulananBulan() { + valueBulananBulan = document.getElementById( + "inputLineBulananBulan" + ).value; + url = + "/api/tagihan/chart/" + + valueBulananBulan + + "/" + + valueBulananTahun; + if (myChartLineBulanan != undefined) { + destroyChart(); + } + callApi(); + } + function setChartLineBulananTahun() { + valueBulananTahun = document.getElementById( + "inputLineBulananTahun" + ).value; + url = + "/api/tagihan/chart/" + + valueBulananBulan + + "/" + + valueBulananTahun; + if (myChartLineBulanan != undefined) { + destroyChart(); + } + callApi(); + } + + // LINE TAHUNAN + function setChartLineTahunan() { + valueTahunan = + document.getElementById("inputLineTahunan").value; + url = "/api/tagihan/chart/" + valueTahunan; + if (myChartLineTahunan != undefined) { + destroyChart(); + } + callApi(); + } + + // BAR KUANTITAS + function setChartBarKuantitas() { + url = "/api/tagihan/chart/kuantitas"; + if (myChartBarKuantitas != undefined) { + destroyChart(); + } + callApi(); + } + // BAR TOTAL TAGIHAN + function setChartBarTotalTagihan() { + url = "/api/tagihan/chart/total-tagihan"; + if (myChartBarTotalTagihan != undefined) { + destroyChart(); + } + callApi(); + } + + function destroyChart() { + myChartLineBulanan.destroy(); + myChartLineTahunan.destroy(); + myChartBarKuantitas.destroy(); + myChartBarTotalTagihan.destroy(); + } + function initializeChart() { + callApi(); + console.log("masuk initialize"); + } + + function callApi() { + $(document).ready(function () { + $.ajax({ + url: url, + method: "GET", + dataType: "json", + success: function (d) { + var tagihanData = []; + var tagihanDataBar = []; + + var tempRange1 = []; + d.map((element) => { + tempRange1.push(element.range1); + }); + + var tempRange2 = []; + d.map((element) => { + tempRange2.push(element.range2); + }); + + var tempRange3 = []; + d.map((element) => { + tempRange3.push(element.range3); + }); + + var tempRange4 = []; + d.map((element) => { + tempRange4.push(element.range4); + }); + + var tempRange5 = []; + d.map((element) => { + tempRange5.push(element.range5); + }); + + tagihanData.push( + { + label: "[0-15]", + backgroundColor: "rgb(138, 201, 38)", + borderColor: "rgb(138, 201, 38)", + data: tempRange1, + }, + { + label: "[16-30]", + backgroundColor: "rgb(25, 130, 196)", + borderColor: "rgb(25, 130, 196)", + data: tempRange2, + }, + { + label: "[31-45]", + backgroundColor: "rgb(255, 202, 58)", + borderColor: "rgb(255, 202, 58)", + data: tempRange3, + }, + { + label: "[46-60]", + backgroundColor: "rgb(255, 89, 94)", + borderColor: "rgb(255, 89, 94)", + data: tempRange4, + }, + { + label: "[61 and up]", + backgroundColor: "rgb(106, 76, 147)", + borderColor: "rgb(106, 76, 147)", + data: tempRange5, + } + ); + tagihanDataBar.push({ + label: "label", + backgroundColor: "rgb(138, 201, 38)", + borderColor: "rgb(138, 201, 38)", + data: [ + tempRange1[0], + tempRange2[0], + tempRange3[0], + tempRange4[0], + tempRange5[0], + ], + }); + console.log(tagihanData); + + const configLineBulanan = { + type: "line", + + data: { + datasets: tagihanData, + labels: d.map((element) => element.tanggal), + }, + options: {}, + }; + const configLineTahunan = { + type: "line", + + data: { + datasets: tagihanData, + labels: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "Desember", + ], + }, + options: {}, + }; + + const configBarKuantitas = { + type: "bar", + + data: { + datasets: tagihanDataBar, + labels: [ + "[0-15]", + "[16-30]", + "[31-45]", + "[46-60]", + "[60 up]", + ], + }, + options: {}, + }; + + const configBarTotalTagihan = { + type: "bar", + + data: { + datasets: tagihanDataBar, + labels: [ + "[0-15]", + "[16-30]", + "[31-45]", + "[46-60]", + "[60 up]", + ], + }, + options: {}, + }; + + myChartLineTahunan = new Chart( + document.getElementById("myChartLineTahunan"), + configLineTahunan + ); + myChartLineBulanan = new Chart( + document.getElementById("myChartLineBulanan"), + configLineBulanan + ); + myChartBarKuantitas = new Chart( + document.getElementById("myChartBarKuantitas"), + configBarKuantitas + ); + myChartBarTotalTagihan = new Chart( + document.getElementById( + "myChartBarTotalTagihan" + ), + configBarTotalTagihan + ); + + // const myChartBar = new Chart( + // document.getElementById("myChartBar"), + // configBar + // ); + }, + }); + }); + } + </script> + </body> +</html> diff --git a/backend/RumahSehat/src/main/resources/templates/fragments/fragment.html b/backend/RumahSehat/src/main/resources/templates/fragments/fragment.html index 3b6af891307e133f0cb1de7436979fb9baf0af16..9f019cc6621feaa4ea4918ac6aadbcef591cdc4e 100644 --- a/backend/RumahSehat/src/main/resources/templates/fragments/fragment.html +++ b/backend/RumahSehat/src/main/resources/templates/fragments/fragment.html @@ -10,15 +10,17 @@ <head th:fragment="js"> <script src="https://code.jquery.com/jquery-3.4.1.min.js" - integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFIBw8HfCJo=" crossorigin="anonymous" ></script> - <script src="https://getbootstrap.com/docs/4.1/assets/js/vendor/popper.min.js"></script> + <!-- <script + src="https://code.jquery.com/jquery-3.4.1.min.js" + integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFIBw8HfCJo=" + crossorigin="anonymous" + ></script> --> <script th:src="@{/js/bootstrap.min.js}"></script> + <script src="https://getbootstrap.com/docs/4.1/assets/js/vendor/popper.min.js"></script> <!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous"> --> - <style> - - </style> + <style></style> </head> <body> <nav @@ -113,9 +115,9 @@ </ul> <div class="my-3 d-flex justify-content-center"> <a - th:href="@{/user/update-password}" - class="mx-2 btn btn-outline-warning" - >Ubah Password</a + th:href="@{/user/update-password}" + class="mx-2 btn btn-outline-warning" + >Ubah Password</a > </div> </nav> diff --git a/backend/RumahSehat/src/main/resources/templates/resep/form-add-resep.html b/backend/RumahSehat/src/main/resources/templates/resep/form-add-resep.html index c237cd36b46b71423ede144889b3b3aa55575a22..62db427889b962c817660ef067e28e3569c4a2f0 100644 --- a/backend/RumahSehat/src/main/resources/templates/resep/form-add-resep.html +++ b/backend/RumahSehat/src/main/resources/templates/resep/form-add-resep.html @@ -78,6 +78,7 @@ class="form-control" type="number" name="kuantitas" + min="0" th:field="*{listJumlah[__${iterationStatus.index}__].kuantitas}" /> <input diff --git a/backend/RumahSehat/src/main/resources/templates/resep/view-resep.html b/backend/RumahSehat/src/main/resources/templates/resep/view-resep.html index 44e070e3fc330ac0e8cff677c177b53589eadeb6..161b5fad3acf0412ae3391fdad1e2464e5f51240 100644 --- a/backend/RumahSehat/src/main/resources/templates/resep/view-resep.html +++ b/backend/RumahSehat/src/main/resources/templates/resep/view-resep.html @@ -33,7 +33,9 @@ <p th:text="'Nama Pasien: ' + ${appointmentModel.pasien.nama}" ></p> - <p th:text="'Status Resep: ' + ${resep.isDone}"></p> + <p + th:text="'Status Resep: ' + ${appointment_status}" + ></p> <!-- <p th:text="'Nama Apoteker: ' + ${#temporals.format(course.tanggalDimulai, 'dd MMMM yyyy HH:mm')}" ></p> --> @@ -48,7 +50,7 @@ th:object="${resep}" method="POST" > - <input type="hidden" th:field="*{id}" /> + <!-- <input type="hidden" th:field="*{id}" /> --> <table class="table"> <thead> <tr> diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 4144bb68c9bfdb4bf94479924504bb9e2138582c..0000000000000000000000000000000000000000 --- a/docker-compose.yml +++ /dev/null @@ -1,35 +0,0 @@ -version: "2" -services: - web: - build: - context: . - restart: always - ports: - - "10083:8080" - volumes: - - ./file-storage:/file-storage - - ./log:/log - env_file: - - app.env - depends_on: - - db - networks: - - frontend-network - - backend-network - db: - image: mariadb:10.4.24 - restart: always - env_file: - - app.env - volumes: - - mysql-db-volume:/var/lib/mysql - networks: - - backend-network - -volumes: - mysql-db-volume: - -networks: - frontend-network: - driver: bridge - backend-network: diff --git a/frontend/.DS_Store b/frontend/.DS_Store index 4e980faa024f9aa4d1176b1c1efce76c7cd889d8..e90b279b7e7dd9a3d3bdec45b201cf970ca3607c 100644 Binary files a/frontend/.DS_Store and b/frontend/.DS_Store differ diff --git a/frontend/.idea/.gitignore b/frontend/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..26d33521af10bcc7fd8cea344038eaaeb78d0ef5 --- /dev/null +++ b/frontend/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/frontend/.idea/frontend.iml b/frontend/.idea/frontend.iml new file mode 100644 index 0000000000000000000000000000000000000000..2bf8d119e771fd19d21331949450300932ef8fca --- /dev/null +++ b/frontend/.idea/frontend.iml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <excludeFolder url="file://$MODULE_DIR$/rumah_sehat/.dart_tool" /> + <excludeFolder url="file://$MODULE_DIR$/rumah_sehat/.pub" /> + <excludeFolder url="file://$MODULE_DIR$/rumah_sehat/build" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module> \ No newline at end of file diff --git a/frontend/.idea/modules.xml b/frontend/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..f3d93d75a82a3d44ced9d4c9a699263a135deab0 --- /dev/null +++ b/frontend/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/.idea/frontend.iml" filepath="$PROJECT_DIR$/.idea/frontend.iml" /> + </modules> + </component> +</project> \ No newline at end of file diff --git a/frontend/.idea/vcs.xml b/frontend/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..6c0b8635858dc7ad44b93df54b762707ce49eefc --- /dev/null +++ b/frontend/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$/.." vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/frontend/rumah_sehat/lib/features/home/home.dart b/frontend/rumah_sehat/lib/features/home/home.dart index 3d55872f1ca5e08b8979b73dd121da5ad71dbb5c..53e45b58471978244cc1f7d8e0d910f765619196 100644 --- a/frontend/rumah_sehat/lib/features/home/home.dart +++ b/frontend/rumah_sehat/lib/features/home/home.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:rumah_sehat/features/resep-confirm/resep-confirm.dart'; import 'package:rumah_sehat/features/tes/tes.dart'; class Home extends StatefulWidget { @@ -12,7 +13,7 @@ class _MyHomePageState extends State<Home> { List<Widget> _widgetOptions = <Widget>[ TesTes(), TesTes(), - TesTes(), + ResepConfirm(), TesTes(), TesTes(), TesTes(), diff --git a/frontend/rumah_sehat/lib/features/resep-confirm/resep-confirm.dart b/frontend/rumah_sehat/lib/features/resep-confirm/resep-confirm.dart new file mode 100644 index 0000000000000000000000000000000000000000..b5d1229e7f0bcab95b5b78c7eda6a3284b317e3d --- /dev/null +++ b/frontend/rumah_sehat/lib/features/resep-confirm/resep-confirm.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; +import 'package:rumah_sehat/models/meal.dart'; +import 'package:rumah_sehat/services/meal_service.dart'; + +class ResepConfirm extends StatelessWidget { + const ResepConfirm({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text('Resep Confirmation')), + body: Center( + child: FutureBuilder( + future: MealService.getMeal(), + builder: (context, snapshot) { + if (snapshot.hasData) { + final meal = snapshot.data as MealModel; + return ListView( + children: [ + Text( + meal.name, + style: TextStyle(fontSize: 32, fontWeight: FontWeight.bold), + ), + Text(meal.area), + Text(meal.instruction), + ], + ); + } + if (snapshot.hasError) { + return Text('Something went wrong'); + } + return CircularProgressIndicator(); + }, + ), + ), + ); + } +}