commit 6747d64d323d523a565dde06e3e2e79f0a4a7e40
parent 2fd95d329bc5de77e7e56aca9890c47287b0d19e
Author: triesap <137732411+triesap@users.noreply.github.com>
Date: Mon, 9 Dec 2024 01:51:10 +0000
Edit `/farm/land` and `/farm/land/add` page handlers, styles.
Diffstat:
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/routes/(app)/farm/land/+page.svelte b/src/routes/(app)/farm/land/+page.svelte
@@ -71,13 +71,13 @@
{/if}
</div>
</PageHeader>
- <div class={`flex flex-col w-full px-4 justify-start items-center`}>
+ <div class={`flex flex-col w-full px-4 gap-4 justify-start items-center`}>
{#if ld && ld.location_gcss.length}
{#each ld.location_gcss.filter((i) => i.kind === `farm_land`) as li}
<button
class={`group flex flex-row h-[5rem] w-full px-8 gap-8 justify-start items-center bg-layer-1-surface layer-1-active-surface round-36 el-re`}
on:click={async () => {
- await route(`/farm/land/add`);
+ await route(`/farm/land/view`, [[`id`, li.id]]);
}}
>
<div
diff --git a/src/routes/(app)/farm/land/add/+page.svelte b/src/routes/(app)/farm/land/add/+page.svelte
@@ -6,6 +6,7 @@
import { model_location_gcs_add_geocode } from "$lib/util/models-location-gcs";
import type { IClientGeolocationPosition } from "@radroots/client";
import type { GeocoderReverseResult } from "@radroots/geocoder";
+ import { location_gcs_form_fields } from "@radroots/models";
import {
ButtonGlyphSimple,
carousel_dec,
@@ -24,6 +25,7 @@
ls,
NavToolbar,
PageHeader,
+ route,
SelectMenu,
} from "@radroots/svelte-lib";
import { regex } from "@radroots/utils";
@@ -97,7 +99,12 @@
point: geol_pos,
kind: `farm_land`,
});
- console.log(JSON.stringify(location_gcs, null, 4), `location_gcs`);
+ if (`err` in location_gcs) {
+ return void (await dialog.alert(
+ `${$ls(`error.client.operation_failure`)}`,
+ ));
+ }
+ await route(`/farm/land`);
} catch (e) {
await catch_err(e, `submit`);
}
@@ -266,8 +273,12 @@
classes: `h-10 placeholder:text-[1.1rem]`,
placeholder: `${$ls(`common.name_of_farm_or_estate`)}`,
field: {
- charset: regex.description,
- validate: regex.description_ch,
+ charset:
+ location_gcs_form_fields
+ .label.charset,
+ validate:
+ location_gcs_form_fields
+ .label.validation,
validate_keypress: true,
},
}}