chore: file formatting
This commit is contained in:
@@ -1,38 +1,21 @@
|
||||
import { BytescaleUploader } from "@/components/BytescaleUploader/BytescaleUploader";
|
||||
import SeoFields from "@/components/SeoFields/SeoFields";
|
||||
import { useEffect } from "react";
|
||||
import { BytescaleUploader } from '@/components/BytescaleUploader/BytescaleUploader';
|
||||
import SeoFields from '@/components/SeoFields/SeoFields';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
|
||||
import {
|
||||
Accordion,
|
||||
AccordionContent,
|
||||
AccordionItem,
|
||||
AccordionTrigger,
|
||||
} from "@/components/ui/accordion";
|
||||
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion';
|
||||
|
||||
import { Plus, Trash2 } from "lucide-react";
|
||||
import { Plus, Trash2 } from 'lucide-react';
|
||||
|
||||
interface Props {
|
||||
open: boolean;
|
||||
@@ -65,8 +48,8 @@ export default function HealthPackageModal({
|
||||
? prev.slug
|
||||
: pkgForm.name
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, "-")
|
||||
.replace(/(^-|-$)/g, ""),
|
||||
.replace(/[^a-z0-9]+/g, '-')
|
||||
.replace(/(^-|-$)/g, ''),
|
||||
}));
|
||||
}
|
||||
}, [pkgForm.name]);
|
||||
@@ -76,8 +59,8 @@ export default function HealthPackageModal({
|
||||
...inclusionsList,
|
||||
{
|
||||
id: Date.now(),
|
||||
category: "",
|
||||
items: "",
|
||||
category: '',
|
||||
items: '',
|
||||
},
|
||||
]);
|
||||
};
|
||||
@@ -86,11 +69,7 @@ export default function HealthPackageModal({
|
||||
setInclusionsList(inclusionsList.filter((item) => item.id !== id));
|
||||
};
|
||||
|
||||
const handleUpdateInclusionField = (
|
||||
id: number,
|
||||
field: string,
|
||||
value: string,
|
||||
) => {
|
||||
const handleUpdateInclusionField = (id: number, field: string, value: string) => {
|
||||
setInclusionsList(
|
||||
inclusionsList.map((item) =>
|
||||
item.id === id
|
||||
@@ -98,8 +77,8 @@ export default function HealthPackageModal({
|
||||
...item,
|
||||
[field]: value,
|
||||
}
|
||||
: item,
|
||||
),
|
||||
: item
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
@@ -108,7 +87,7 @@ export default function HealthPackageModal({
|
||||
<DialogContent className="w-full !max-w-7xl h-[92vh] flex flex-col p-0 overflow-hidden">
|
||||
<DialogHeader className="px-6 py-5 border-b bg-background sticky top-0 z-20">
|
||||
<DialogTitle className="text-2xl font-bold">
|
||||
{editingPackage ? "Edit Health Package" : "Create Health Package"}
|
||||
{editingPackage ? 'Edit Health Package' : 'Create Health Package'}
|
||||
</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
@@ -120,21 +99,17 @@ export default function HealthPackageModal({
|
||||
<div className="sticky top-0 bg-background z-10 pb-2">
|
||||
<h3 className="text-lg font-bold">Profile & Pricing</h3>
|
||||
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Main package information
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">Main package information</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-5">
|
||||
<div className="space-y-2">
|
||||
<Label className="font-semibold">Package Image</Label>
|
||||
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Recommended size: 650 × 250
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground">Recommended size: 650 × 250</p>
|
||||
|
||||
<BytescaleUploader
|
||||
value={pkgForm.image || ""}
|
||||
value={pkgForm.image || ''}
|
||||
folderPath="/health-packages"
|
||||
onChange={(url) =>
|
||||
setPkgForm({
|
||||
@@ -149,9 +124,7 @@ export default function HealthPackageModal({
|
||||
<div>
|
||||
<p className="font-semibold">Active Visibility</p>
|
||||
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Show this package publicly
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">Show this package publicly</p>
|
||||
</div>
|
||||
|
||||
<Switch
|
||||
@@ -227,11 +200,9 @@ export default function HealthPackageModal({
|
||||
|
||||
<Input
|
||||
type="number"
|
||||
value={pkgForm.price || ""}
|
||||
value={pkgForm.price || ''}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value
|
||||
? Number(e.target.value)
|
||||
: undefined;
|
||||
const value = e.target.value ? Number(e.target.value) : undefined;
|
||||
|
||||
setPkgForm({
|
||||
...pkgForm,
|
||||
@@ -242,20 +213,16 @@ export default function HealthPackageModal({
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="font-semibold">
|
||||
Discounted Price (₹)
|
||||
</Label>
|
||||
<Label className="font-semibold">Discounted Price (₹)</Label>
|
||||
|
||||
<Input
|
||||
type="number"
|
||||
disabled={!pkgForm.price}
|
||||
value={pkgForm.discountedPrice || ""}
|
||||
value={pkgForm.discountedPrice || ''}
|
||||
onChange={(e) =>
|
||||
setPkgForm({
|
||||
...pkgForm,
|
||||
discountedPrice: e.target.value
|
||||
? Number(e.target.value)
|
||||
: undefined,
|
||||
discountedPrice: e.target.value ? Number(e.target.value) : undefined,
|
||||
})
|
||||
}
|
||||
/>
|
||||
@@ -300,21 +267,15 @@ export default function HealthPackageModal({
|
||||
<div>
|
||||
<h3 className="text-lg font-bold">Tests & Inclusions</h3>
|
||||
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Group tests into categories
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">Group tests into categories</p>
|
||||
</div>
|
||||
|
||||
<Badge variant="outline">
|
||||
{inclusionsList.length} Groups
|
||||
</Badge>
|
||||
<Badge variant="outline">{inclusionsList.length} Groups</Badge>
|
||||
</div>
|
||||
|
||||
<Accordion type="multiple" className="space-y-4">
|
||||
{inclusionsList.map((inc, index) => {
|
||||
const testCount = inc.items
|
||||
?.split(",")
|
||||
.filter(Boolean).length;
|
||||
const testCount = inc.items?.split(',').filter(Boolean).length;
|
||||
|
||||
return (
|
||||
<AccordionItem
|
||||
@@ -325,13 +286,9 @@ export default function HealthPackageModal({
|
||||
<AccordionTrigger className="hover:no-underline w-full">
|
||||
<div className="flex w-full items-center justify-between">
|
||||
<div className="flex flex-col items-start text-left">
|
||||
<p className="font-semibold">
|
||||
{inc.category || `Group ${index + 1}`}
|
||||
</p>
|
||||
<p className="font-semibold">{inc.category || `Group ${index + 1}`}</p>
|
||||
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{testCount || 0} tests included
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground">{testCount || 0} tests included</p>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
@@ -354,13 +311,7 @@ export default function HealthPackageModal({
|
||||
<Input
|
||||
placeholder="Routine Blood Tests"
|
||||
value={inc.category}
|
||||
onChange={(e) =>
|
||||
handleUpdateInclusionField(
|
||||
inc.id,
|
||||
"category",
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
onChange={(e) => handleUpdateInclusionField(inc.id, 'category', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -373,18 +324,10 @@ export default function HealthPackageModal({
|
||||
rows={4}
|
||||
placeholder="CBC, LFT, RFT, TSH"
|
||||
value={inc.items}
|
||||
onChange={(e) =>
|
||||
handleUpdateInclusionField(
|
||||
inc.id,
|
||||
"items",
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
onChange={(e) => handleUpdateInclusionField(inc.id, 'items', e.target.value)}
|
||||
/>
|
||||
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Separate each test using commas
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground">Separate each test using commas</p>
|
||||
</div>
|
||||
</div>
|
||||
</AccordionContent>
|
||||
@@ -427,7 +370,7 @@ export default function HealthPackageModal({
|
||||
</Button>
|
||||
|
||||
<Button className="px-10" onClick={onSave}>
|
||||
{editingPackage ? "Save Changes" : "Create Package"}
|
||||
{editingPackage ? 'Save Changes' : 'Create Package'}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
|
||||
Reference in New Issue
Block a user