checkClockedIn method
Implementation
checkClockedIn(BuildContext context) async {
final CollectStockController controller = Get.put(CollectStockController());
// await controller
// .callDealerDetailsApi(storage.read("PARTNER_ID_LOGIN") ?? "");
// if ((loginController.seectedRole?.name ==
// MenusUtils.distributorRole ||
// loginController.seectedRole?.name == MenusUtils.rmRole)) {
await callDroDistributerListApi(1, "", false);
// } else {
// dro 402
// controller.callDealerDetailsApi(storage.read("PARTNER_ID_LOGIN") ?? "");
// await controller.callCreditLimitApi(userId);
// controller.userId = userId;
// controller.setData(userId, partnerId, userId, userLevelName, "",
// "FIELD_FORCE_AGENT", storage.read("FULL_NAME") ?? "");
return;
WidgetsBinding.instance.addPostFrameCallback((_) {
Helper.progressDialog(context, "Please wait..");
});
dio
.get(
'${ApiConstant.ffmBaseUrl}ffm-attendance-svc/attendance/status',
queryParameters: {'date': getCurrentDate()},
options: Options(
headers: {
'Authorization': 'Bearer Authorization',
'Content-Type': 'application/x-www-form-urlencoded',
'X-UserId': storage.read("XUSER_ID")
},
),
)
.then((response) async {
Get.back();
if (response.data != null) {
ClockinOutModel model = ClockinOutModel();
print(response.data);
Map<String, dynamic> creditData = response.data;
model = ClockinOutModel.fromJson(creditData);
// if (true) {
if (model.clockIn!.status! && !model.clockOut!.status!) {
final CollectStockController controller =
Get.put(CollectStockController());
await controller
.callDealerDetailsApi(storage.read("PARTNER_ID_LOGIN") ?? "");
// if ((loginController.seectedRole?.name ==
// MenusUtils.distributorRole ||
// loginController.seectedRole?.name == MenusUtils.rmRole)) {
// await callDroDistributerListApi(1, "", false);
// } else {
// dro 402
// controller.callDealerDetailsApi(storage.read("PARTNER_ID_LOGIN") ?? "");
await controller.callCreditLimitApi(userId);
controller.userId = userId;
controller.setData(userId, partnerId, userId, userLevelName, "",
"FIELD_FORCE_AGENT", storage.read("FULL_NAME") ?? "");
// }
} else {
Helper.messageDialog(
Get.context!,
"Cannot collect stock",
"Should be clocked in and not clocked out",
);
}
}
}, onError: (error) {
print(error.toString());
Get.back();
Helper.messageDialog(Get.context!, "Try Again!!", error.toString());
});
}