diff --git a/rumahSehat_jwt/.gradle/7.5.1/executionHistory/executionHistory.lock b/rumahSehat_jwt/.gradle/7.5.1/executionHistory/executionHistory.lock index b8ad173ea5de609ad94eb96f0a02d6e512b4d699..aeba4225130e44972dcc1bd3dad0561b316fc40b 100644 Binary files a/rumahSehat_jwt/.gradle/7.5.1/executionHistory/executionHistory.lock and b/rumahSehat_jwt/.gradle/7.5.1/executionHistory/executionHistory.lock differ diff --git a/rumahSehat_jwt/.gradle/7.5.1/fileHashes/fileHashes.lock b/rumahSehat_jwt/.gradle/7.5.1/fileHashes/fileHashes.lock index 3b50503d81b195618eb3a048f36e548dd3eff328..0eb411740d861e6d39fdd48c3839e27ec8b3ab85 100644 Binary files a/rumahSehat_jwt/.gradle/7.5.1/fileHashes/fileHashes.lock and b/rumahSehat_jwt/.gradle/7.5.1/fileHashes/fileHashes.lock differ diff --git a/rumahSehat_jwt/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/rumahSehat_jwt/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 3f37e5d951ec1db14d3b2941aa7147184627a98d..3f22ea9f2b1aa3341651ca2c0048ddc3688e72c7 100644 Binary files a/rumahSehat_jwt/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/rumahSehat_jwt/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/rumahSehat_jwt/src/main/java/apap/tk/rumahSehat_jwt/service/TagihanServiceImpl.java b/rumahSehat_jwt/src/main/java/apap/tk/rumahSehat_jwt/service/TagihanServiceImpl.java index 48c016249fc54a5c1b98cb358e8b284ecbd0a289..05cb085e663513af9bbb1d79c7836aa8c424ed28 100644 --- a/rumahSehat_jwt/src/main/java/apap/tk/rumahSehat_jwt/service/TagihanServiceImpl.java +++ b/rumahSehat_jwt/src/main/java/apap/tk/rumahSehat_jwt/service/TagihanServiceImpl.java @@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.transaction.Transactional; +import java.time.LocalDateTime; import java.util.List; @Service @@ -43,6 +44,7 @@ public class TagihanServiceImpl { pasienModel.setSaldo(saldo - jumlahTagihan); pasienDb.save(pasienModel); tagihanModel.setIsPaid(true); + tagihanModel.setTanggalBayar(LocalDateTime.now()); return tagihanDb.save(tagihanModel); } else { return tagihanModel; diff --git a/rumahSehat_mobile/lib/tagihan/TagihanModel.dart b/rumahSehat_mobile/lib/tagihan/TagihanModel.dart index 0a76de025971ce617dc588eb068391102192edb3..4f775fca606ba6814d08eec13f20cac42b816c3d 100644 --- a/rumahSehat_mobile/lib/tagihan/TagihanModel.dart +++ b/rumahSehat_mobile/lib/tagihan/TagihanModel.dart @@ -1,7 +1,7 @@ class TagihanModel { final String kode; final String tanggalTerbuat; - final String tanggalBayar; + final String? tanggalBayar; final bool isPaid; final int jumlahTagihan; @@ -14,12 +14,23 @@ class TagihanModel { }); factory TagihanModel.fromJson(Map<String, dynamic> json) { - return TagihanModel( - kode: json['kode'], - tanggalTerbuat: json['tanggalTerbuat'], - tanggalBayar: json['tanggalBayar'], - isPaid: json['isPaid'], - jumlahTagihan: json['jumlahTagihan'], - ); + if(json['tanggalBayar'] == null) { + return TagihanModel( + kode: json['kode'], + tanggalTerbuat: json['tanggalTerbuat'], + tanggalBayar: null, + isPaid: json['isPaid'], + jumlahTagihan: json['jumlahTagihan'], + ); + } else { + return TagihanModel( + kode: json['kode'], + tanggalTerbuat: json['tanggalTerbuat'], + tanggalBayar: json['tanggalBayar'], + isPaid: json['isPaid'], + jumlahTagihan: json['jumlahTagihan'], + ); + } + } } diff --git a/rumahSehat_mobile/lib/tagihan/view_detail_tagihan.dart b/rumahSehat_mobile/lib/tagihan/view_detail_tagihan.dart index 837f6c549f5fc6fe93c3fe9f562c520efabdeba9..dbb1e43f95331f8dbd2f8c21e8074b6bb1db6881 100644 --- a/rumahSehat_mobile/lib/tagihan/view_detail_tagihan.dart +++ b/rumahSehat_mobile/lib/tagihan/view_detail_tagihan.dart @@ -24,8 +24,7 @@ class TagihanDetailScreen extends StatelessWidget{ centerTitle: true, leading: IconButton(icon: Icon(Icons.arrow_back_ios), onPressed: () { - Navigator.pushNamed( - context, HomeScreen.routeName); + Navigator.pop(context); },), ), body: Column( @@ -46,7 +45,7 @@ class TagihanDetailScreen extends StatelessWidget{ sizedBox, TagihanFieldRow(field: 'Tanggal Terbuat', value: convertTanggal(tagihanToView.tanggalTerbuat)), sizedBox, - TagihanFieldRow(field: 'Tanggal Bayar', value: convertTanggal(tagihanToView.tanggalTerbuat)), + TagihanFieldRow(field: 'Tanggal Bayar', value: convertTanggal(tagihanToView.tanggalBayar)), sizedBox, TagihanFieldRow(field: 'Status', value: getStatus(tagihanToView.isPaid)), sizedBox, @@ -70,9 +69,14 @@ class TagihanDetailScreen extends StatelessWidget{ } } -String convertTanggal(String dateTime) { - String tanggal = dateTime.substring(0,10); - return tanggal; +String convertTanggal(String? dateTime) { + if (dateTime == null) { + return "Belum Dibayar"; + + } else { + String tanggal = dateTime.substring(0,10); + return tanggal; + } } String getStatus(bool isPaid) { diff --git a/rumahSehat_mobile/lib/url_settings.dart b/rumahSehat_mobile/lib/url_settings.dart index ca4f67c533fb557d093aee1ee2883685fef32df3..85010eef1e381284a08c0479d1fb001979c8e5c9 100644 --- a/rumahSehat_mobile/lib/url_settings.dart +++ b/rumahSehat_mobile/lib/url_settings.dart @@ -1,4 +1,4 @@ -const String base_url = "http://192.168.1.13:8081/api"; +const String base_url = "http://192.168.100.47:8081/api"; const String doctor_url = base_url + "/dokter"; const String get_alldoctor_url = doctor_url + "/viewAll"; @@ -17,6 +17,6 @@ const String auth_login = base_url + "/auth/login"; const String get_all_tagihan_url = base_url + "/tagihan/viewAll"; const String pay_tagihan = base_url + "/tagihan/pay"; -const String resep_url = base_url + "/resep"; +const String resep_url = base_url + "/appointment"; const String get_resep_url = resep_url + "/view"; const String get_obat_url = resep_url + "/get-jumlah"; \ No newline at end of file