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,
|
SelectTrigger,
|
||||||
SelectValue,
|
SelectValue,
|
||||||
} from "@/components/ui/select";
|
} from "@/components/ui/select";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
|
||||||
type harvestSchema = z.infer<typeof harvestDetailsFormSchema>;
|
type harvestSchema = z.infer<typeof harvestDetailsFormSchema>;
|
||||||
|
|
||||||
export default function HarvestDetailsForm() {
|
export default function HarvestDetailsForm() {
|
||||||
const form = useForm<harvestSchema>({
|
const form = useForm<harvestSchema>({
|
||||||
resolver: zodResolver(harvestDetailsFormSchema),
|
resolver: zodResolver(harvestDetailsFormSchema),
|
||||||
defaultValues: {},
|
defaultValues: {
|
||||||
|
daysToFlower: 0,
|
||||||
|
daysToMaturity: 0,
|
||||||
|
harvestWindow: 0,
|
||||||
|
estimatedLossRate: 0,
|
||||||
|
harvestUnits: "",
|
||||||
|
estimatedRevenue: 0,
|
||||||
|
expectedYieldPer100ft: 0,
|
||||||
|
expectedYieldPerAcre: 0,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
@ -224,6 +234,9 @@ export default function HarvestDetailsForm() {
|
|||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
<div className="col-span-3 flex justify-center">
|
||||||
|
<Button type="submit">Save</Button>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -22,13 +22,27 @@ import {
|
|||||||
} from "@/components/ui/select";
|
} from "@/components/ui/select";
|
||||||
import { Textarea } from "@/components/ui/textarea";
|
import { Textarea } from "@/components/ui/textarea";
|
||||||
import { Switch } from "@/components/ui/switch";
|
import { Switch } from "@/components/ui/switch";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
|
||||||
type plantingSchema = z.infer<typeof plantingDetailsFormSchema>;
|
type plantingSchema = z.infer<typeof plantingDetailsFormSchema>;
|
||||||
|
|
||||||
export default function PlantingDetailsForm() {
|
export default function PlantingDetailsForm() {
|
||||||
const form = useForm<plantingSchema>({
|
const form = useForm<plantingSchema>({
|
||||||
resolver: zodResolver(plantingDetailsFormSchema),
|
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 (
|
return (
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
@ -289,7 +303,7 @@ export default function PlantingDetailsForm() {
|
|||||||
/>
|
/>
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="isPerennial"
|
name="autoCreateTasks"
|
||||||
render={({ field }: { field: any }) => (
|
render={({ field }: { field: any }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
@ -308,6 +322,9 @@ export default function PlantingDetailsForm() {
|
|||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
<div className="col-span-3 flex justify-center">
|
||||||
|
<Button type="submit">Save</Button>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user