mirror of
https://github.com/ForFarmTeam/ForFarm.git
synced 2025-12-19 14:04:08 +01:00
feat: add default values and save button to harvest and planting detail forms
This commit is contained in:
parent
3d020fcd58
commit
5117f6399b
@ -20,13 +20,23 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
type harvestSchema = z.infer<typeof harvestDetailsFormSchema>;
|
||||
|
||||
export default function HarvestDetailsForm() {
|
||||
const form = useForm<harvestSchema>({
|
||||
resolver: zodResolver(harvestDetailsFormSchema),
|
||||
defaultValues: {},
|
||||
defaultValues: {
|
||||
daysToFlower: 0,
|
||||
daysToMaturity: 0,
|
||||
harvestWindow: 0,
|
||||
estimatedLossRate: 0,
|
||||
harvestUnits: "",
|
||||
estimatedRevenue: 0,
|
||||
expectedYieldPer100ft: 0,
|
||||
expectedYieldPerAcre: 0,
|
||||
},
|
||||
});
|
||||
return (
|
||||
<Form {...form}>
|
||||
@ -224,6 +234,9 @@ export default function HarvestDetailsForm() {
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<div className="col-span-3 flex justify-center">
|
||||
<Button type="submit">Save</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
);
|
||||
|
||||
@ -22,13 +22,27 @@ import {
|
||||
} from "@/components/ui/select";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
type plantingSchema = z.infer<typeof plantingDetailsFormSchema>;
|
||||
|
||||
export default function PlantingDetailsForm() {
|
||||
const form = useForm<plantingSchema>({
|
||||
resolver: zodResolver(plantingDetailsFormSchema),
|
||||
defaultValues: {},
|
||||
defaultValues: {
|
||||
daysToEmerge: 0,
|
||||
plantSpacing: 0,
|
||||
rowSpacing: 0,
|
||||
plantingDepth: 0,
|
||||
averageHeight: 0,
|
||||
startMethod: "",
|
||||
lightProfile: "",
|
||||
soilConditions: "",
|
||||
plantingDetails: "",
|
||||
pruningDetails: "",
|
||||
isPerennial: false,
|
||||
autoCreateTasks: false,
|
||||
},
|
||||
});
|
||||
return (
|
||||
<Form {...form}>
|
||||
@ -289,7 +303,7 @@ export default function PlantingDetailsForm() {
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="isPerennial"
|
||||
name="autoCreateTasks"
|
||||
render={({ field }: { field: any }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
@ -308,6 +322,9 @@ export default function PlantingDetailsForm() {
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<div className="col-span-3 flex justify-center">
|
||||
<Button type="submit">Save</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user