complemetion document submit butto disabled if amount is - or 0
This commit is contained in:
parent
a87c790a62
commit
8cdc91354a
@ -229,12 +229,15 @@ export function DealerCompletionDocumentsModal({
|
||||
const hasPhotos = activityPhotos.length > 0;
|
||||
const hasDescription = completionDescription.trim().length > 0;
|
||||
|
||||
const hasValidExpenseItems = expenseItems.length > 0 &&
|
||||
expenseItems.every(item => item.description.trim() !== '' && item.amount >= 0);
|
||||
|
||||
const hasHSNSACErrors = isNonGst ? false : expenseItems.some(item => {
|
||||
const { isValid } = validateHSNSAC(item.hsnCode, item.isService);
|
||||
return !isValid;
|
||||
});
|
||||
|
||||
return hasCompletionDate && hasDocuments && hasPhotos && hasDescription && !hasHSNSACErrors;
|
||||
return hasCompletionDate && hasDocuments && hasPhotos && hasDescription && hasValidExpenseItems && !hasHSNSACErrors;
|
||||
}, [activityCompletionDate, completionDocuments, activityPhotos, completionDescription, isNonGst, expenseItems]);
|
||||
|
||||
// Get today's date in YYYY-MM-DD format for max date
|
||||
@ -1358,9 +1361,9 @@ export function DealerCompletionDocumentsModal({
|
||||
<div className="bg-amber-50 border border-amber-200 rounded-lg p-3 sm:p-4 flex items-start gap-2 sm:gap-3">
|
||||
<CircleAlert className="w-4 h-4 sm:w-5 sm:h-5 text-amber-600 flex-shrink-0 mt-0.5" />
|
||||
<div className="text-xs sm:text-sm text-amber-800">
|
||||
<p className="font-semibold mb-1">Missing Required Information</p>
|
||||
<p className="font-semibold mb-1">Missing or Invalid Information</p>
|
||||
<p>
|
||||
Please ensure completion date, at least one document/photo, and description are provided before submitting.
|
||||
Please ensure completion date, documents/photos, description, and expense details (non-negative amounts and descriptions) are provided before submitting.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user