WOOHOO
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { ChangeEvent } from "react";
|
||||
import { ChangeEvent, FormEvent } from "react";
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
@@ -25,6 +25,12 @@ export const ShippingModal = ({
|
||||
handleChange,
|
||||
setShippingData,
|
||||
}: ShippingModalProps) => {
|
||||
|
||||
const handleSubmit = (e: FormEvent) => {
|
||||
e.preventDefault();
|
||||
onSave(shippingData);
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onClose}>
|
||||
<DialogContent className="sm:max-w-[600px]">
|
||||
@@ -34,38 +40,42 @@ export const ShippingModal = ({
|
||||
</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="grid gap-4 py-4">
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium">Method Name</label>
|
||||
<Input
|
||||
name="name"
|
||||
placeholder="Shipping Method Name"
|
||||
value={shippingData.name}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="grid gap-4 py-4">
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium">Method Name</label>
|
||||
<Input
|
||||
name="name"
|
||||
placeholder="Shipping Method Name"
|
||||
value={shippingData.name}
|
||||
onChange={handleChange}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium">Price</label>
|
||||
<Input
|
||||
name="price"
|
||||
type="number"
|
||||
step="0.01"
|
||||
placeholder="Price (£)"
|
||||
value={shippingData.price}
|
||||
onChange={handleChange}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium">Price</label>
|
||||
<Input
|
||||
name="price"
|
||||
type="number"
|
||||
step="0.01"
|
||||
placeholder="Price (£)"
|
||||
value={shippingData.price}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<DialogFooter className="flex justify-end gap-2">
|
||||
<Button variant="outline" onClick={onClose}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button onClick={() => onSave(shippingData)}>
|
||||
{editing ? "Update Shipping Method" : "Create Shipping Method"}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
<DialogFooter className="flex justify-end gap-2">
|
||||
<Button type="button" variant="outline" onClick={onClose}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button type="submit">
|
||||
{editing ? "Update Shipping Method" : "Create Shipping Method"}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user