Commit 1150a8b4 authored by Dio Maulana's avatar Dio Maulana

tambah dialog konfirmasi ketika submit dia out of range

parent 80696031
...@@ -148,7 +148,8 @@ class Api { ...@@ -148,7 +148,8 @@ class Api {
} }
static Future<ApiResponse> shiftIn( static Future<ApiResponse> shiftIn(
String branchId, String nik, String shiftId, String photoBase64) async { String branchId, String nik, String shiftId, String photoBase64,
{int forceSubmit = 0}) async {
String apiUrl = "$baseUrl${endPoint}clock_in"; String apiUrl = "$baseUrl${endPoint}clock_in";
Position position = await Geolocator.getCurrentPosition(); Position position = await Geolocator.getCurrentPosition();
IpAddress ipAddress = IpAddress(type: RequestType.json); IpAddress ipAddress = IpAddress(type: RequestType.json);
...@@ -170,6 +171,7 @@ class Api { ...@@ -170,6 +171,7 @@ class Api {
"photo_base64": "data:image/jpeg;base64,$photoBase64", "photo_base64": "data:image/jpeg;base64,$photoBase64",
"ip": dataIp['ip'], "ip": dataIp['ip'],
"user_agent": userAgent, "user_agent": userAgent,
"forced_submit": forceSubmit,
}; };
String bodies = jsonEncode(data); String bodies = jsonEncode(data);
dynamic jsonObject = dynamic jsonObject =
...@@ -202,6 +204,7 @@ class Api { ...@@ -202,6 +204,7 @@ class Api {
return ApiResponse( return ApiResponse(
error: true, error: true,
msg: jsonObject['msg'], msg: jsonObject['msg'],
code: jsonObject['code'],
); );
} }
} }
...@@ -211,7 +214,8 @@ class Api { ...@@ -211,7 +214,8 @@ class Api {
} }
static Future<ApiResponse> shiftOut( static Future<ApiResponse> shiftOut(
String branchId, String nik, String photoBase64) async { String branchId, String nik, String photoBase64,
{int forceSubmit = 0}) async {
String apiUrl = "$baseUrl${endPoint}clock_out"; String apiUrl = "$baseUrl${endPoint}clock_out";
Position position = await Geolocator.getCurrentPosition(); Position position = await Geolocator.getCurrentPosition();
...@@ -233,6 +237,7 @@ class Api { ...@@ -233,6 +237,7 @@ class Api {
"photo_base64": photoBase64, "photo_base64": photoBase64,
"ip": dataIp['ip'], "ip": dataIp['ip'],
"user_agent": userAgent, "user_agent": userAgent,
"forced_submit": forceSubmit,
}; };
String bodies = jsonEncode(data); String bodies = jsonEncode(data);
dynamic jsonObject = dynamic jsonObject =
...@@ -260,6 +265,7 @@ class Api { ...@@ -260,6 +265,7 @@ class Api {
return ApiResponse( return ApiResponse(
error: true, error: true,
msg: jsonObject['msg'], msg: jsonObject['msg'],
code: jsonObject['code'],
); );
} }
} }
...@@ -316,10 +322,12 @@ class ApiResponse { ...@@ -316,10 +322,12 @@ class ApiResponse {
bool error; bool error;
String msg; String msg;
dynamic data; dynamic data;
String code;
ApiResponse({ ApiResponse({
required this.error, required this.error,
required this.msg, required this.msg,
this.data, this.data,
this.code = "",
}); });
} }
...@@ -14,6 +14,7 @@ Future<dynamic> modalDialogGlobal({ ...@@ -14,6 +14,7 @@ Future<dynamic> modalDialogGlobal({
bool isActiveCancelButton = false, bool isActiveCancelButton = false,
bool isCustomSecondButton = false, bool isCustomSecondButton = false,
String customSecondButtonText = '', String customSecondButtonText = '',
String cancelButtonText = "Batal",
Widget? navigateToCustomButton, Widget? navigateToCustomButton,
}) async { }) async {
return showDialog( return showDialog(
...@@ -61,8 +62,8 @@ Future<dynamic> modalDialogGlobal({ ...@@ -61,8 +62,8 @@ Future<dynamic> modalDialogGlobal({
onTap: () { onTap: () {
tapButtonCancel!(); tapButtonCancel!();
}, },
child: const CustomButton( child: CustomButton(
text: "Batal", text: cancelButtonText,
colorButton: Colors.transparent, colorButton: Colors.transparent,
colorText: Colors.black, colorText: Colors.black,
), ),
......
This diff is collapsed.
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