corrected the payment proceed validation

This commit is contained in:
Vaibhav Surve 2025-11-13 12:26:39 +05:30
parent 68f17214fd
commit 214816ac0f
2 changed files with 25 additions and 20 deletions

View File

@ -197,8 +197,19 @@ class _ReimbursementBottomSheetState extends State<ReimbursementBottomSheet> {
return;
}
if (expenseTransactionDate != null &&
selectedDate.isBefore(expenseTransactionDate)) {
if (expenseTransactionDate != null && selectedDate != null) {
final normalizedSelected = DateTime(
selectedDate.year,
selectedDate.month,
selectedDate.day,
);
final normalizedTransaction = DateTime(
expenseTransactionDate.year,
expenseTransactionDate.month,
expenseTransactionDate.day,
);
if (normalizedSelected.isBefore(normalizedTransaction)) {
showAppSnackbar(
title: "Invalid Date",
message:
@ -208,11 +219,11 @@ class _ReimbursementBottomSheetState extends State<ReimbursementBottomSheet> {
return;
}
}
}
final success = await widget.onSubmit(
comment: commentCtrl.text.trim(),
reimburseTransactionId: txnCtrl.text
.trim(),
reimburseTransactionId: txnCtrl.text.trim(),
reimburseDate: dateStr.value,
reimburseById: controller.selectedReimbursedBy.value!.id,
statusId: widget.statusId,

View File

@ -170,10 +170,11 @@ class _UpdatePaymentRequestWithReimbursementState
dateStr.value.isEmpty ||
baseAmountCtrl.text.trim().isEmpty ||
taxAmountCtrl.text.trim().isEmpty ||
commentCtrl.text.trim().isEmpty) {
commentCtrl.text.trim().isEmpty ||
controller.selectedReimbursedBy.value == null) {
showAppSnackbar(
title: "Incomplete",
message: "Please fill all mandatory fields",
message: "Please fill all mandatory fields, including 'Paid By'",
type: SnackbarType.warning,
);
return;
@ -233,7 +234,6 @@ class _UpdatePaymentRequestWithReimbursementState
decoration: _inputDecoration("Enter transaction ID"),
),
MySpacing.height(16),
_requiredLabel("Transaction Date"),
MySpacing.height(8),
GestureDetector(
@ -266,8 +266,7 @@ class _UpdatePaymentRequestWithReimbursementState
),
),
MySpacing.height(16),
MyText.labelMedium("Paid By (Optional)"),
_requiredLabel("Paid By"),
MySpacing.height(8),
GestureDetector(
onTap: _showEmployeeList,
@ -294,7 +293,6 @@ class _UpdatePaymentRequestWithReimbursementState
),
),
MySpacing.height(16),
_requiredLabel("Base Amount"),
MySpacing.height(8),
TextField(
@ -303,7 +301,6 @@ class _UpdatePaymentRequestWithReimbursementState
decoration: _inputDecoration("Enter Base Amount"),
),
MySpacing.height(16),
_requiredLabel("GST Amount"),
MySpacing.height(8),
TextField(
@ -312,7 +309,6 @@ class _UpdatePaymentRequestWithReimbursementState
decoration: _inputDecoration("Enter GST Amount"),
),
MySpacing.height(16),
MyText.labelMedium("TDS Percent"),
MySpacing.height(8),
TextField(
@ -335,7 +331,6 @@ class _UpdatePaymentRequestWithReimbursementState
color: Colors.grey.shade600,
),
MySpacing.height(16),
Obx(() => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -353,7 +348,6 @@ class _UpdatePaymentRequestWithReimbursementState
],
)),
MySpacing.height(20),
_requiredLabel("Comment"),
MySpacing.height(8),
TextField(