-
-
Of baseer op een meststof
-
- {fertilizers.map((fertilizer: Fertilizer) => (
-
- ))}
-
-
- )
-}
diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.fertilizer.manage.new.custom.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.fertilizer.manage.new.custom.tsx
deleted file mode 100644
index e5284b9d4..000000000
--- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.fertilizer.manage.new.custom.tsx
+++ /dev/null
@@ -1,236 +0,0 @@
-import {
- addFertilizer,
- addFertilizerToCatalogue,
- getFertilizerParametersDescription,
- getFertilizers,
-} from "@svenvw/fdm-core"
-import {
- type ActionFunctionArgs,
- data,
- type LoaderFunctionArgs,
- type MetaFunction,
- useLoaderData,
-} from "react-router"
-import { redirectWithSuccess } from "remix-toast"
-import { FormSchema } from "~/components/blocks/fertilizer/formschema"
-import { FarmNewCustomFertilizerBlock } from "~/components/blocks/fertilizer/new-custom-fertilizer-page"
-import { getSession } from "~/lib/auth.server"
-import { getCalendar } from "~/lib/calendar"
-import { clientConfig } from "~/lib/config"
-import { handleActionError, handleLoaderError } from "~/lib/error"
-import { fdm } from "~/lib/fdm.server"
-import { extractFormValuesFromRequest } from "~/lib/form"
-
-export const meta: MetaFunction = () => {
- return [
- { title: `Meststof toevoegen | ${clientConfig.name}` },
- {
- name: "description",
- content:
- "Voeg een meststof toe om deze te gebruiken op dit bedrijf.",
- },
- ]
-}
-
-export async function loader({ request, params }: LoaderFunctionArgs) {
- try {
- // Get the farm id
- const b_id_farm = params.b_id_farm
- if (!b_id_farm) {
- throw data("invalid: b_id_farm", {
- status: 400,
- statusText: "invalid: b_id_farm",
- })
- }
-
- // Get the session
- const session = await getSession(request)
-
- // Get selected fertilizer
- const fertilizerParameters = getFertilizerParametersDescription()
-
- const fertilizer = {
- p_id: undefined, // Added p_id
- p_source: b_id_farm,
- p_name_nl: "",
- p_type: undefined,
- p_type_rvo: undefined,
- p_dm: undefined,
- p_density: undefined,
- p_om: undefined,
- p_a: undefined,
- p_hc: undefined,
- p_eom: undefined,
- p_eoc: undefined,
- p_c_rt: undefined,
- p_c_of: undefined,
- p_c_if: undefined,
- p_c_fr: undefined,
- p_cn_of: undefined,
- p_n_rt: undefined,
- p_n_if: undefined,
- p_n_of: undefined,
- p_n_wc: undefined,
- p_no3_rt: undefined,
- p_nh4_rt: undefined,
- p_p_rt: undefined,
- p_k_rt: undefined,
- p_mg_rt: undefined,
- p_ca_rt: undefined,
- p_ne: undefined,
- p_s_rt: undefined,
- p_s_wc: undefined,
- p_cu_rt: undefined,
- p_zn_rt: undefined,
- p_na_rt: undefined,
- p_si_rt: undefined,
- p_b_rt: undefined,
- p_mn_rt: undefined,
- p_ni_rt: undefined,
- p_fe_rt: undefined,
- p_mo_rt: undefined,
- p_co_rt: undefined,
- p_as_rt: undefined,
- p_cd_rt: undefined,
- p_cr_rt: undefined,
- p_cr_vi: undefined,
- p_pb_rt: undefined,
- p_hg_rt: undefined,
- p_cl_rt: undefined,
- p_app_method_options: [],
- }
-
- // Get the available fertilizers
- const fertilizers = await getFertilizers(
- fdm,
- session.principal_id,
- b_id_farm,
- )
- const fertilizerOptions = fertilizers.map((fertilizer) => {
- return {
- p_id: fertilizer.p_id,
- p_name_nl: fertilizer.p_name_nl,
- }
- })
-
- // Return user information from loader
- return {
- fertilizerOptions: fertilizerOptions,
- fertilizer: fertilizer,
- fertilizerParameters: fertilizerParameters,
- }
- } catch (error) {
- throw handleLoaderError(error)
- }
-}
-
-/**
- * Renders the layout for managing farm settings.
- *
- * This component displays a sidebar that includes the farm header, navigation options, and a link to farm fields.
- * It also renders a main section containing the farm title, description, nested routes via an Outlet, and a notification toaster.
- */
-export default function FarmFertilizerPage() {
- const loaderData = useLoaderData