Commit 31fdd25c authored by Dio Maulana's avatar Dio Maulana

perbaikan dialog absen home

parent 8434da32
...@@ -9,7 +9,8 @@ Future<dynamic> modalDialogGlobal({ ...@@ -9,7 +9,8 @@ Future<dynamic> modalDialogGlobal({
required String title, required String title,
required String contentBody, required String contentBody,
required String buttonText, required String buttonText,
required void Function() tapButton, required void Function() tapButtonOk,
void Function()? tapButtonCancel,
bool isActiveCancelButton = false, bool isActiveCancelButton = false,
bool isCustomSecondButton = false, bool isCustomSecondButton = false,
String customSecondButtonText = '', String customSecondButtonText = '',
...@@ -49,7 +50,7 @@ Future<dynamic> modalDialogGlobal({ ...@@ -49,7 +50,7 @@ Future<dynamic> modalDialogGlobal({
), ),
InkWell( InkWell(
onTap: () { onTap: () {
tapButton(); tapButtonOk();
}, },
child: CustomButton( child: CustomButton(
text: buttonText, text: buttonText,
...@@ -58,10 +59,10 @@ Future<dynamic> modalDialogGlobal({ ...@@ -58,10 +59,10 @@ Future<dynamic> modalDialogGlobal({
(isActiveCancelButton) (isActiveCancelButton)
? InkWell( ? InkWell(
onTap: () { onTap: () {
Navigator.pop(context); tapButtonCancel!();
}, },
child: const CustomButton( child: const CustomButton(
text: "Cancel", text: "Batal",
colorButton: Colors.transparent, colorButton: Colors.transparent,
colorText: Colors.black, colorText: Colors.black,
), ),
......
...@@ -149,7 +149,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> { ...@@ -149,7 +149,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
title: "Error", title: "Error",
contentBody: "$e", contentBody: "$e",
buttonText: "OK", buttonText: "OK",
tapButton: () { tapButtonOk: () {
Navigator.pop(context); Navigator.pop(context);
}, },
); );
...@@ -216,7 +216,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> { ...@@ -216,7 +216,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
title: "Error", title: "Error",
contentBody: "$e", contentBody: "$e",
buttonText: "OK", buttonText: "OK",
tapButton: () { tapButtonOk: () {
Navigator.pop(context); Navigator.pop(context);
}, },
); );
...@@ -414,7 +414,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> { ...@@ -414,7 +414,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
title: "Gagal", title: "Gagal",
contentBody: apiResponse.msg, contentBody: apiResponse.msg,
buttonText: "OK", buttonText: "OK",
tapButton: () { tapButtonOk: () {
Navigator.pop(context); Navigator.pop(context);
}, },
); );
...@@ -451,7 +451,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> { ...@@ -451,7 +451,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
title: "Gagal", title: "Gagal",
contentBody: apiResponse.msg, contentBody: apiResponse.msg,
buttonText: "OK", buttonText: "OK",
tapButton: () { tapButtonOk: () {
Navigator.pop(context); Navigator.pop(context);
}, },
); );
......
...@@ -357,24 +357,13 @@ class _BodyWidgetState extends State<BodyWidget> { ...@@ -357,24 +357,13 @@ class _BodyWidgetState extends State<BodyWidget> {
title: "Gagal", title: "Gagal",
contentBody: apiResponse.msg, contentBody: apiResponse.msg,
buttonText: "Ok", buttonText: "Ok",
tapButton: () { tapButtonOk: () {
Navigator.pop(context); Navigator.pop(context);
}); });
} else { } else {
ProfileModel profileUser = ProfileModel profileUser =
apiResponse.data as ProfileModel; apiResponse.data as ProfileModel;
// if (profileUser.attendanceOut) {
// modalDialogGlobal(
// context: context,
// size: MediaQuery.of(context).size,
// title: "Gagal",
// contentBody: Strings.alreadyOut,
// buttonText: "Ok",
// tapButton: () {
// Navigator.pop(context);
// });
// return;
// }
if (profileUser.attendanceIn == false) { if (profileUser.attendanceIn == false) {
modalDialogGlobal( modalDialogGlobal(
context: context, context: context,
...@@ -382,22 +371,38 @@ class _BodyWidgetState extends State<BodyWidget> { ...@@ -382,22 +371,38 @@ class _BodyWidgetState extends State<BodyWidget> {
title: "Gagal", title: "Gagal",
contentBody: Strings.outButNotIn, contentBody: Strings.outButNotIn,
buttonText: "Ok", buttonText: "Ok",
tapButton: () { tapButtonOk: () {
Navigator.pop(context); Navigator.pop(context);
}); });
return; return;
} }
if (profileUser.attendanceOut) {
modalDialogGlobal(
context: context,
size: MediaQuery.of(context).size,
title: "Gagal",
contentBody: Strings.alreadyOut,
buttonText: "Ok",
tapButtonOk: () {
Navigator.pushNamed( Navigator.pushNamed(
context, context,
Routes.absentCamera, Routes.absentCamera,
arguments: AbsentCameraArguments( arguments: AbsentCameraArguments(
isIn: false, isIn: false,
branchModel: branchModel: widget
widget.nearestBranch[selectedOutlet], .nearestBranch[selectedOutlet],
profile: profileUser, profile: profileUser,
nik: nikUser, nik: nikUser,
), ),
); );
},
isActiveCancelButton: true,
tapButtonCancel: () {
Navigator.pop(context);
},
);
return;
}
} }
}); });
} }
...@@ -1015,25 +1020,40 @@ class _WidgetSelectShiftState extends State<WidgetSelectShift> { ...@@ -1015,25 +1020,40 @@ class _WidgetSelectShiftState extends State<WidgetSelectShift> {
title: "Gagal", title: "Gagal",
contentBody: apiResponse.msg, contentBody: apiResponse.msg,
buttonText: "Ok", buttonText: "Ok",
tapButton: () { tapButtonOk: () {
Navigator.pop(context); Navigator.pop(context);
Navigator.pop(context); Navigator.pop(context);
}); });
} else { } else {
ProfileModel profileUser = apiResponse.data as ProfileModel; ProfileModel profileUser = apiResponse.data as ProfileModel;
// if (profileUser.attendanceIn) { if (profileUser.attendanceIn) {
// modalDialogGlobal( modalDialogGlobal(
// context: context, context: context,
// size: MediaQuery.of(context).size, size: MediaQuery.of(context).size,
// title: "Gagal", title: "Gagal",
// contentBody: Strings.alreadyIn, contentBody: Strings.alreadyIn,
// buttonText: "Ok", buttonText: "Ok",
// tapButton: () { tapButtonOk: () {
// Navigator.pop(context); Navigator.popAndPushNamed(
// Navigator.pop(context); context,
// }); Routes.absentCamera,
// return; arguments: AbsentCameraArguments(
// } isIn: true,
branchModel: widget.branchModel,
shiftModel: widget.shiftList[selectedShift!],
profile: profileUser,
nik: widget.nik,
),
);
},
tapButtonCancel: () {
Navigator.pop(context);
Navigator.pop(context);
},
isActiveCancelButton: true,
);
return;
}
Navigator.popAndPushNamed( Navigator.popAndPushNamed(
context, context,
Routes.absentCamera, Routes.absentCamera,
......
...@@ -15,7 +15,9 @@ class Strings { ...@@ -15,7 +15,9 @@ class Strings {
static String pleaseWait = "Please wait..."; static String pleaseWait = "Please wait...";
static String cameraNotMounted = "Kamera tidak berhasil di load"; static String cameraNotMounted = "Kamera tidak berhasil di load";
static String alreadyIn = "Anda sudah melakukan absen masuk hari ini"; static String alreadyIn =
static String alreadyOut = "Anda sudah melakukan absen keluar hari ini"; "Anda sudah melakukan absen masuk hari ini, yakin ingin absen ulang ?";
static String outButNotIn = "Anda belum melaukan absen masuk"; static String alreadyOut =
"Anda sudah melakukan absen keluar hari ini, yakin ingin absen ulang ?";
static String outButNotIn = "Anda belum melakukan absen masuk";
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment