diff --git a/SpringTkApap/src/main/java/spring/TK/SpringTkApap/user/controller/PasienRestController.java b/SpringTkApap/src/main/java/spring/TK/SpringTkApap/user/controller/PasienRestController.java index ef8079e79ad113319e6f9fc0b395d11691c5559a..862b375bada15080dfc58dadc19d4ea38d471376 100644 --- a/SpringTkApap/src/main/java/spring/TK/SpringTkApap/user/controller/PasienRestController.java +++ b/SpringTkApap/src/main/java/spring/TK/SpringTkApap/user/controller/PasienRestController.java @@ -67,13 +67,13 @@ public class PasienRestController { return pasienRestService.retrievePasien(); } - @PutMapping(value = "/top-up/{uuid}") - private PasienModel topUpSaldo(@PathVariable("uuid") String uuid, @RequestBody PasienModel pasien){ + @PostMapping(value = "/top-up/{username}") + private PasienModel topUpSaldo(@PathVariable("username") String username, @RequestBody PasienDTO pasien, BindingResult bindingResult){ try{ - return pasienRestService.topUpSaldo(uuid, pasien); + return pasienRestService.topUpSaldo(username, pasien); } catch (NoSuchElementException e) { throw new ResponseStatusException( - HttpStatus.NOT_FOUND, "Pasien dengan id " + uuid + " tidak ditemukan." + HttpStatus.NOT_FOUND, "Pasien dengan username " + username + " tidak ditemukan." ); } } diff --git a/SpringTkApap/src/main/java/spring/TK/SpringTkApap/user/service/PasienRestService.java b/SpringTkApap/src/main/java/spring/TK/SpringTkApap/user/service/PasienRestService.java index 4fed5b7624c87ece173bc47c189089d8e60a0d61..2e742e309fd16e656f00f067bb82dd89b76fd9bd 100644 --- a/SpringTkApap/src/main/java/spring/TK/SpringTkApap/user/service/PasienRestService.java +++ b/SpringTkApap/src/main/java/spring/TK/SpringTkApap/user/service/PasienRestService.java @@ -10,5 +10,5 @@ public interface PasienRestService { List<PasienModel> retrievePasien(); PasienModel getPasien(String uuid); PasienModel getPasienByUsername(String username); - PasienModel topUpSaldo(String uuid, PasienModel pasienUpdate); + PasienModel topUpSaldo(String username, PasienDTO pasienUpdate); } diff --git a/SpringTkApap/src/main/java/spring/TK/SpringTkApap/user/service/PasienRestServiceImpl.java b/SpringTkApap/src/main/java/spring/TK/SpringTkApap/user/service/PasienRestServiceImpl.java index 7d75236b37d2a1142afe2f3c8e98f16d1be7cd46..a39b0577e0d7d077109534624b2ad76ecd70a6f9 100644 --- a/SpringTkApap/src/main/java/spring/TK/SpringTkApap/user/service/PasienRestServiceImpl.java +++ b/SpringTkApap/src/main/java/spring/TK/SpringTkApap/user/service/PasienRestServiceImpl.java @@ -66,9 +66,9 @@ public class PasienRestServiceImpl implements PasienRestService { } @Override - public PasienModel topUpSaldo(String uuid, PasienModel pasienUpdate) { - PasienModel pasien = getPasien(uuid); - pasien.setSaldo(pasienUpdate.getSaldo()); + public PasienModel topUpSaldo(String username, PasienDTO pasienUpdate) { + PasienModel pasien = getPasienByUsername(username); + pasien.setSaldo(pasien.getSaldo() + Integer.valueOf(pasienUpdate.getSaldo())); return pasienDb.save(pasien); } diff --git a/tk_apap_flutter/lib/pages/CreateAppointment.dart b/tk_apap_flutter/lib/pages/CreateAppointment.dart index e1477a544925db112e23e1487b244b749043d727..9eac0f9ff16713088683b95d961a665dea342c0b 100644 --- a/tk_apap_flutter/lib/pages/CreateAppointment.dart +++ b/tk_apap_flutter/lib/pages/CreateAppointment.dart @@ -20,7 +20,7 @@ class _CreateAppointmentState extends State<CreateAppointment> { // Data yang diperlukan tanggal dan waktu, dropdown [namaDokter - Tarif] Future<List<Dokter>> getAllDoktor() async { - var uri = Uri.parse('http://10.5.90.122:8080/api/doktor/all'); + var uri = Uri.parse('http://192.168.18.47:8080/api/doktor/all'); dynamic token = await SessionManager().get('token'); String tknString = ('Bearer $token'); print(tknString); @@ -103,7 +103,7 @@ class _CreateAppointmentState extends State<CreateAppointment> { String strUsername = username; var response = await http.post( Uri.parse( - 'http://10.5.90.122:8080/api/appointment/create'), + 'http://192.168.18.47:8080/api/appointment/create'), headers: { 'Accept': 'application/json', 'Content-Type': 'application/json; charset=UTF-8', diff --git a/tk_apap_flutter/lib/pages/LihatProfil.dart b/tk_apap_flutter/lib/pages/LihatProfil.dart index 374db93045547a6e2867a83e7e8e656753a773ee..2bb7b04de61fb2947b10acb774142841e4dd48f5 100644 --- a/tk_apap_flutter/lib/pages/LihatProfil.dart +++ b/tk_apap_flutter/lib/pages/LihatProfil.dart @@ -7,12 +7,13 @@ import 'package:tk_apap_flutter/widgets/drawerWidget.dart'; import 'package:flutter/material.dart'; import '../DTO/PasienDTO.dart'; import 'package:http/http.dart' as http; +import 'package:tk_apap_flutter/pages/TopUpSaldo.dart'; class LihatProfil extends StatelessWidget { static const routeName = '/edit'; Future<PasienDTO> getPasien() async { - var uri = Uri.parse('http://10.0.2.2:8080/api/pasien/getself'); + var uri = Uri.parse('http://192.168.18.47:8080/api/pasien/getself'); dynamic token = await SessionManager().get('token'); String tknString = ('Bearer $token'); http.Response response = await http.get(uri, headers: { @@ -105,24 +106,36 @@ class LihatProfil extends StatelessWidget { ), FadeAnimation( 2, - Container( - height: 50, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: const Color(0xff0d47a1), - ), - child: Center( - child: Text( - "Top up saldo", - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 20, - fontFamily: 'Poppins', + TextButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + TopUpSaldo()), + ); + }, + child: + Container( + height: 50, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: const Color(0xff0d47a1), + ), + child: Center( + child: Text( + "Top up saldo", + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 20, + fontFamily: 'Poppins', + ), ), ), - ), - )), + ) + ), + ), SizedBox( height: 70, ), diff --git a/tk_apap_flutter/lib/pages/TopUpSaldo.dart b/tk_apap_flutter/lib/pages/TopUpSaldo.dart new file mode 100644 index 0000000000000000000000000000000000000000..adc2637c30530ed5ce1a9cf9918d421f37451e4e --- /dev/null +++ b/tk_apap_flutter/lib/pages/TopUpSaldo.dart @@ -0,0 +1,388 @@ +import 'dart:convert'; +import 'dart:developer'; + +import 'package:flutter_session_manager/flutter_session_manager.dart'; +import 'package:tk_apap_flutter/animation/FadeAnimation.dart'; +import 'package:tk_apap_flutter/widgets/drawerWidget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import '../DTO/PasienDTO.dart'; +import 'package:http/http.dart' as http; + +import 'LihatProfil.dart'; + +class TopUpSaldo extends StatelessWidget { + static const routeName = '/lihatProfile'; + + String jumlahTopUp; + var textJumlahTopUp = TextEditingController(); + + Future<PasienDTO> getPasien() async { + var uri = Uri.parse('http://192.168.18.47:8080/api/pasien/getself'); + dynamic token = await SessionManager().get('token'); + String tknString = ('Bearer $token'); + http.Response response = await http.get(uri, headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json; charset=UTF-8', + 'Authorization': tknString + }); + log(response.statusCode.toString()); + if (response.statusCode == 200) { + Map jsonData = jsonDecode(response.body); + PasienDTO pasien = PasienDTO.createPasien( + jsonData['name'] as String, + jsonData['username'] as String, + jsonData['email'] as String, + jsonData['saldo'].toString()); + log("Menembak API get profil pasien."); + return pasien; + } else { + throw response.statusCode; + } + } + + @override + Widget build(BuildContext context) { + final GlobalKey<ScaffoldState> _scaffoldKey = + new GlobalKey<ScaffoldState>(); + + return Scaffold( + backgroundColor: Colors.white, + key: _scaffoldKey, + drawer: CustomDrawer(), + appBar: AppBar( + title: Text( + 'Top Up Saldo', + style: TextStyle( + fontFamily: 'Poppins', + fontWeight: FontWeight.bold, + ), + ), + backgroundColor: const Color(0xff0d47a1), + centerTitle: true, + leading: IconButton( + icon: Icon( + Icons.short_text, + size: 40, + ), + onPressed: () => _scaffoldKey.currentState.openDrawer(), + ), + ), + body: FutureBuilder<PasienDTO>( + future: getPasien(), + builder: (context, snapshot) { + if (snapshot.hasData) { + PasienDTO pasien = snapshot.data; + return SingleChildScrollView( + child: Padding( + padding: EdgeInsets.only(top: 35, left: 35, right: 35), + child: Column( + children: <Widget>[ + SizedBox( + height: 100, + ), + Container( + child: Text( + 'Saldo: ${pasien.saldo.toString()}', + style: TextStyle( + fontSize: 30, + ), + )), + SizedBox( + height: 30, + ), + Container( + width: 260, + height: 40, + child: TextFormField( + keyboardType: TextInputType.number, + controller: textJumlahTopUp, + onChanged: (val) { + jumlahTopUp = val; + }, + inputFormatters: <TextInputFormatter>[ + FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), + ], + validator: (value) { + if (value.isEmpty) { + return 'Jumlah Top Up is Empty'; + } + return null; + }, + decoration: InputDecoration( + labelText: "Jumlah Top Up", + border: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(8)), + ) + ), + ), + ), + SizedBox( + height: 30, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + TextButton( + onPressed: () { + jumlahTopUp = "50000"; + textJumlahTopUp.text = jumlahTopUp; + }, + child: + Container( + height: 45, + width: 85, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: const Color(0xff0d47a1), + ), + child: Center( + child: Text( + "50.000", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 20, + fontFamily: 'Poppins', + ), + ), + ), + ) + ), + TextButton( + onPressed: () { + jumlahTopUp = "100000"; + textJumlahTopUp.text = jumlahTopUp; + }, + child: + Container( + height: 45, + width: 85, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: const Color(0xff0d47a1), + ), + child: Center( + child: Text( + "100.000", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 20, + fontFamily: 'Poppins', + ), + ), + ), + ) + ), + TextButton( + onPressed: () { + jumlahTopUp = "150000"; + textJumlahTopUp.text = jumlahTopUp; + }, + child: + Container( + height: 45, + width: 85, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: const Color(0xff0d47a1), + ), + child: Center( + child: Text( + "150.000", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 20, + fontFamily: 'Poppins', + ), + ), + ), + ) + ), + ] + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + TextButton( + onPressed: () { + jumlahTopUp = "250000"; + textJumlahTopUp.text = jumlahTopUp; + }, + child: + Container( + height: 45, + width: 85, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: const Color(0xff0d47a1), + ), + child: Center( + child: Text( + "250.000", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 20, + fontFamily: 'Poppins', + ), + ), + ), + ) + ), + TextButton( + onPressed: () { + jumlahTopUp = "500000"; + textJumlahTopUp.text = jumlahTopUp; + }, + child: + Container( + height: 45, + width: 85, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: const Color(0xff0d47a1), + ), + child: Center( + child: Text( + "500.000", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 20, + fontFamily: 'Poppins', + ), + ), + ), + ) + ), + TextButton( + onPressed: () { + jumlahTopUp = ""; + textJumlahTopUp.text = jumlahTopUp; + }, + child: + Container( + height: 45, + width: 85, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: const Color(0xff0d47a1), + ), + child: Center( + child: Text( + "Nominal Lain", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 18, + fontFamily: 'Poppins', + ), + ), + ), + ) + ), + ] + ), + SizedBox( + height: 30, + ), + TextButton( + onPressed: () async { + dynamic token = await SessionManager().get("token"); + String tknString = "Bearer $token"; + dynamic username = await SessionManager().get("username"); + String strUsername = username; + var response = await http.post( + Uri.parse( + 'http://192.168.18.47:8080/api/pasien/top-up/' + strUsername), + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json; charset=UTF-8', + 'Authorization': tknString}, + body: jsonEncode(<String, String>{ + 'nama': pasien.nama, + 'username': pasien.username, + 'email': pasien.email, + 'saldo': jumlahTopUp, + }), + ); + if (response.statusCode == 200) { + showDialog<String>( + context: context, + builder: (BuildContext context) => AlertDialog( + title: const Text( + 'Top up saldo berhasil!'), + actions: <Widget>[ + TextButton( + onPressed: () => + Navigator.push( + context, + MaterialPageRoute(builder: (context) => LihatProfil()) + ), + child: const Text('OK'), + ) + ], + ), + ); + } else { + showDialog<String>( + context: context, + builder: (BuildContext context) => AlertDialog( + title: Text(response.reasonPhrase), + actions: <Widget>[ + TextButton( + onPressed: () => + Navigator.push( + context, + MaterialPageRoute(builder: (context) => LihatProfil()) + ), + child: Text('${response.statusCode}'), + ) + ], + ), + ); + } + }, + child: + Container( + height: 50, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: const Color(0xff0d47a1), + ), + child: Center( + child: Text( + "Top up saldo", + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 20, + fontFamily: 'Poppins', + ), + ), + ), + ) + ), + SizedBox( + height: 70, + ), + ], + ), + ), + ); + } else { + return const CircularProgressIndicator(); + } + }), + ); + } +} diff --git a/tk_apap_flutter/lib/pages/login.dart b/tk_apap_flutter/lib/pages/login.dart index 75e14a505217c4ee4e75e2e3ec20a0784f0a81ed..49dafdbc619d630959c0ad19579de7bf42dc04f8 100644 --- a/tk_apap_flutter/lib/pages/login.dart +++ b/tk_apap_flutter/lib/pages/login.dart @@ -25,11 +25,11 @@ class _LoginState extends State<Login> { UserLogin user = UserLogin("", ""); bool _isHidden = true; - final url = Uri.parse('http://10.0.2.2:8080/api/authenticate'); //TODO:ubah sesuai IP Address, nanti pakai link web + final url = Uri.parse( + 'http://192.168.18.47:8080/api/authenticate'); //TODO:ubah sesuai IP Address, nanti pakai link web - final header = <String, String> { - 'Content-Type': - 'application/json; charset=UTF-8' + final header = <String, String>{ + 'Content-Type': 'application/json; charset=UTF-8' }; Future save() async { @@ -39,15 +39,14 @@ class _LoginState extends State<Login> { 'password': user.password, }); - final response = await http.post(url, - headers: header, - body: body); + final response = await http.post(url, headers: header, body: body); if (response.body.isNotEmpty) { final json = jsonEncode(response.body).toString(); Map<String, dynamic> jsonResponse = await stringToMap(json); print(jsonResponse); - if (jsonResponse["role"] == "PASIEN") { // TODO: PASIEN + if (jsonResponse["role"] == "PASIEN") { + // TODO: PASIEN saveSession(jsonResponse); Navigator.of(context).pushReplacementNamed(HomeScreen.routeName); } else { @@ -86,7 +85,6 @@ class _LoginState extends State<Login> { return; }, child: SingleChildScrollView( - child: Form( key: _formKey, child: Column( @@ -97,46 +95,60 @@ class _LoginState extends State<Login> { decoration: const BoxDecoration( color: const Color(0xffe3f2fd), ), - child: - Column( + child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ - const SizedBox(height: 30,), + const SizedBox( + height: 30, + ), new Image.asset( 'assets/Logo.png', width: 180.0, height: 180.0, fit: BoxFit.cover, ), - const SizedBox(height: 20,), + const SizedBox( + height: 20, + ), Container( width: 325, height: 420, decoration: const BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(15)), + borderRadius: + BorderRadius.all(Radius.circular(15)), ), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - const SizedBox(height: 30,), - const Text("Selamat Datang!", + const SizedBox( + height: 30, + ), + const Text( + "Selamat Datang!", style: TextStyle( fontSize: 28, - fontWeight:FontWeight.bold - ),), - const SizedBox(height: 10,), - const Text("Silahkan login akun RumahSehat", + fontWeight: FontWeight.bold), + ), + const SizedBox( + height: 10, + ), + const Text( + "Silahkan login akun RumahSehat", style: TextStyle( color: Colors.black, fontSize: 15, - ),), - const SizedBox(height: 30,), + ), + ), + const SizedBox( + height: 30, + ), Container( width: 260, height: 60, child: TextFormField( - controller: TextEditingController(text: user.username), + controller: TextEditingController( + text: user.username), onChanged: (val) { user.username = val; }, @@ -149,19 +161,21 @@ class _LoginState extends State<Login> { decoration: InputDecoration( labelText: "Username", border: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(8)), - ) - ), + borderRadius: BorderRadius.all( + Radius.circular(8)), + )), ), ), - const SizedBox(height: 20,), + const SizedBox( + height: 20, + ), Container( width: 260, height: 60, child: TextFormField( obscureText: _isHidden, - controller: - TextEditingController(text: user.password), + controller: TextEditingController( + text: user.password), onChanged: (val) { user.password = val; }, @@ -172,23 +186,24 @@ class _LoginState extends State<Login> { return null; }, decoration: InputDecoration( - suffixIcon: - InkWell( + suffixIcon: InkWell( onTap: _togglePasswordView, child: Icon( - _isHidden ? - Icons.visibility : - Icons.visibility_off, + _isHidden + ? Icons.visibility + : Icons.visibility_off, ), ), labelText: "Password", border: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(8)), - ) - ), + borderRadius: BorderRadius.all( + Radius.circular(8)), + )), ), ), - const SizedBox(height: 30,), + const SizedBox( + height: 30, + ), TextButton( onPressed: () { if (_formKey.currentState.validate()) { @@ -199,18 +214,18 @@ class _LoginState extends State<Login> { alignment: Alignment.center, width: 250, decoration: const BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(20)), + borderRadius: BorderRadius.all( + Radius.circular(20)), color: const Color(0xff0d47a1), ), child: Padding( padding: EdgeInsets.all(12.0), - child: - Text('Login', + child: Text( + 'Login', style: TextStyle( color: Colors.white, fontSize: 20, - fontWeight: FontWeight.bold - ), + fontWeight: FontWeight.bold), ), ), ), @@ -224,19 +239,20 @@ class _LoginState extends State<Login> { const Text('Belum punya akun?'), TextButton( style: TextButton.styleFrom( - primary: const Color(0xff0d47a1), // Text Color + primary: const Color( + 0xff0d47a1), // Text Color ), onPressed: () { Navigator.push( context, MaterialPageRoute( - builder: - (context)=>Register() - ), + builder: (context) => + Register()), ); }, - child: const Text('Register',), - + child: const Text( + 'Register', + ), ), ], ), @@ -253,11 +269,11 @@ class _LoginState extends State<Login> { ); }), ); - } Future<Map<String, dynamic>> stringToMap(String jsonResponse) async { - List<String> list = jsonResponse.replaceAll("{", "").replaceAll("}", "").split(","); + List<String> list = + jsonResponse.replaceAll("{", "").replaceAll("}", "").split(","); Map<String, dynamic> newMap = LinkedHashMap(); for (String e in list) { List<String> listElement = e.split("\\\""); @@ -277,6 +293,4 @@ class _LoginState extends State<Login> { _isHidden = !_isHidden; }); } - - } diff --git a/tk_apap_flutter/lib/pages/register.dart b/tk_apap_flutter/lib/pages/register.dart index aed187f424fb8d95252937e5acfcc27bbaf2e2ea..dc246e683d09093987f274659558c751c2e1cd3d 100644 --- a/tk_apap_flutter/lib/pages/register.dart +++ b/tk_apap_flutter/lib/pages/register.dart @@ -1,14 +1,9 @@ -import 'dart:collection'; import 'dart:convert'; import 'package:flutter/services.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:tk_apap_flutter/DTO/Pasien.dart'; import 'package:flutter/material.dart'; -import 'package:google_fonts/google_fonts.dart'; import 'package:http/http.dart' as http; -import 'package:flutter_session_manager/flutter_session_manager.dart'; -import 'package:tk_apap_flutter/pages/HomeScreen.dart'; import 'Login.dart'; @@ -26,7 +21,6 @@ class _RegisterState extends State<Register> { final pasien = Pasien(); final GlobalKey<FormState> _formKey = GlobalKey<FormState>(); - // final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); String name; String username; @@ -35,48 +29,12 @@ class _RegisterState extends State<Register> { String umur; bool _isHidden = true; - // Future save() async { - // var res = await http.post(url, - // headers: {'Content-Type': 'application/json'}, - // body: json.encode({ - // 'name': pasien.name, - // 'username': pasien.username, - // 'email': pasien.email, - // 'password': pasien.password, - // 'umur': pasien.umur, - // })); - // print(res.body); - // print("hey"); - // - // if (res.body != null) { - // Navigator.pop(context); - // } - - // final body = jsonEncode(<String, String>{ - // 'name': pasien.name, - // 'username': pasien.username, - // 'email': pasien.email, - // 'password': pasien.password, - // 'umur': pasien.umur, - // }); - // - // final response = await http.post(url, - // headers: header, - // body: body); - // - // if (response.body != null) { - // final json = jsonEncode(response.body).toString(); - // print(response.body); - // Navigator.pop(context); - // } - // } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, - // key: _scaffoldKey, body: Builder(builder: (BuildContext context) { return SafeArea( child: NotificationListener<OverscrollIndicatorNotification>( @@ -264,16 +222,9 @@ class _RegisterState extends State<Register> { TextButton( onPressed: () async { if (_formKey.currentState.validate()) { - // Pasien pasienBaru = - // await registerPasien(name, username, email, password, umur, context); - // setState(() { - // pasien = pasienBaru; - // }); - - // save(); var response = await http.post( Uri.parse( - 'http://10.5.90.122:8080/api/pasien/register'), + 'http://192.168.18.47:8080/api/pasien/register'), headers: { 'Accept': 'application/json', 'Content-Type': 'application/json'}, @@ -382,40 +333,4 @@ class _RegisterState extends State<Register> { }); } - // Future<Pasien> registerPasien( - // String name, String username, String email, String password, String umur, BuildContext context) async { - // var Url = Uri.parse('http://192.168.1.100:8080/api/pasien'); - // var response = await http.post(Url, - // headers: <String, String>{ - // "Content-Type": "application/json" - // }, - // body: jsonEncode(<String, String>{ - // 'name': name, - // 'username': username, - // 'email': email, - // 'password': password, - // 'umur': umur, - // })); - // - // String responseString = response.body; - // print(responseString); - // print("itu response string, dan udah masuk method registerPasien"); - // - // if (response.statusCode == 200) { - // print("Masuk statuscode == 200"); - // showDialog<String>( - // context: context, - // builder: (BuildContext context) => AlertDialog( - // title: const Text( - // 'Registrasi berhasil!'), - // actions: <Widget>[ - // TextButton( - // onPressed: () => - // Navigator.pop(context, 'OK'), - // child: const Text('OK'), - // ) - // ], - // ), - // ); - }