-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpal.ts
More file actions
96 lines (87 loc) · 2.58 KB
/
Copy pathpal.ts
File metadata and controls
96 lines (87 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<div className="p-4 max-w-2xl mx-auto">
<div className="mb-4">
<Link href="/vendors" className="text-blue-500 hover:text-blue-700">
← Back to Vendors
</Link>
</div>
<Form onSubmit={handleSubmit} className="bg-white rounded-lg shadow p-6">
<h1 className="text-2xl font-bold mb-6">Create New Vendor</h1>
{error && (
<FormMessage className="mb-4 p-4 bg-red-50 text-red-500 rounded">
{error}
</FormMessage>
)}
<div className="space-y-4">
<FormItem>
<FormLabel>Vendor Name *</FormLabel>
<Input
type="text"
name="vendorName"
value={formData.vendorName}
onChange={handleChange}
required
className="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500"
/>
</FormItem>
<FormItem>
<FormLabel>Contact Person *</FormLabel>
<Input
type="text"
name="contactPerson"
value={formData.contactPerson}
onChange={handleChange}
required
className="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500"
/>
</FormItem>
<FormItem>
<FormLabel>Email *</FormLabel>
<Input
type="email"
name="email"
value={formData.email}
onChange={handleChange}
required
className="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500"
/>
</FormItem>
<FormItem>
<FormLabel>Phone</FormLabel>
<Input
type="tel"
name="phone"
value={formData.phone}
onChange={handleChange}
className="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500"
/>
</FormItem>
<FormItem>
<FormLabel>Address</FormLabel>
<TextArea
name="address"
value={formData.address}
onChange={handleChange}
rows={3}
className="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500"
/>
</FormItem>
<div className="flex justify-end space-x-4">
<Link
href="/vendors"
className="px-4 py-2 text-gray-600 hover:text-gray-800"
>
Cancel
</Link>
<Button
type="submit"
disabled={isSubmitting}
className={`px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50 ${
isSubmitting ? 'cursor-not-allowed' : ''
}`}
>
{isSubmitting ? 'Creating...' : 'Create Vendor'}
</Button>
</div>
</div>
</Form>
</div>