actions half done

This commit is contained in:
2025-07-24 00:32:10 +05:30
parent 79a2ffac33
commit 4ac357fba7
2 changed files with 206 additions and 6 deletions

View File

@@ -41,6 +41,7 @@ import { Avatar, AvatarFallback } from "@/components/ui/avatar";
import { cn } from "@/lib/utils";
import { formatDateToHumanReadable } from "@/utils/dateUtils";
import { Card, CardHeader, CardTitle } from "@/components/ui/card";
import ClaimViewModal from "./claim-view-modal";
//creating types out of schema auto generated.
type Claim = z.infer<typeof ClaimUncheckedCreateInputObjectSchema>;
@@ -99,9 +100,9 @@ export default function ClaimsRecentTable({
const claimsPerPage = 5;
const offset = (currentPage - 1) * claimsPerPage;
const [currentClaim, setCurrentClaim] = useState<Claim | undefined>(
undefined
);
const [currentClaim, setCurrentClaim] = useState<
ClaimWithServiceLines | undefined
>(undefined);
const [selectedClaimId, setSelectedClaimId] = useState<number | null>(null);
const handleSelectClaim = (claim: Claim) => {
@@ -170,17 +171,17 @@ export default function ClaimsRecentTable({
},
});
const handleEditClaim = (claim: Claim) => {
const handleEditClaim = (claim: ClaimWithServiceLines) => {
setCurrentClaim(claim);
setIsEditClaimOpen(true);
};
const handleViewClaim = (claim: Claim) => {
const handleViewClaim = (claim: ClaimWithServiceLines) => {
setCurrentClaim(claim);
setIsViewClaimOpen(true);
};
const handleDeleteClaim = (claim: Claim) => {
const handleDeleteClaim = (claim: ClaimWithServiceLines) => {
setCurrentClaim(claim);
setIsDeleteClaimOpen(true);
};
@@ -464,6 +465,16 @@ export default function ClaimsRecentTable({
entityName={currentClaim?.patientName}
/>
{isViewClaimOpen && currentClaim && (
<ClaimViewModal
isOpen={isViewClaimOpen}
onClose={() => setIsViewClaimOpen(false)}
onOpenChange={(open) => setIsViewClaimOpen(open)}
onEditClaim={(claim) => handleEditClaim(claim)}
claim={currentClaim}
/>
)}
{/* Pagination */}
{totalPages > 1 && (
<div className="bg-white px-4 py-3 border-t border-gray-200">