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

perbaikan dialog absen home

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