|
|
@@ -81,6 +81,15 @@ export default function PlaceForm({ type, onSuccess, place }: PlaceFormProps) {
|
|
|
coverImage = res.file_url
|
|
|
}
|
|
|
|
|
|
+ if (!description.trim()) {
|
|
|
+ setError('Укажите описание')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!address.trim()) {
|
|
|
+ setError('Укажите адрес')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
const parsedLat = parseFloat(lat)
|
|
|
const parsedLng = parseFloat(lng)
|
|
|
if (isNaN(parsedLat) || isNaN(parsedLng)) {
|
|
|
@@ -90,8 +99,8 @@ export default function PlaceForm({ type, onSuccess, place }: PlaceFormProps) {
|
|
|
|
|
|
const body: Record<string, unknown> = {
|
|
|
title,
|
|
|
- description: description || undefined,
|
|
|
- address: address || undefined,
|
|
|
+ description: description.trim(),
|
|
|
+ address: address.trim(),
|
|
|
lat: parsedLat,
|
|
|
lng: parsedLng,
|
|
|
access_info: accessInfo || undefined,
|
|
|
@@ -173,42 +182,46 @@ export default function PlaceForm({ type, onSuccess, place }: PlaceFormProps) {
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
- <label className="mb-1 block text-sm text-white/60">Описание</label>
|
|
|
+ <label className="mb-1 block text-sm text-white/60">Описание *</label>
|
|
|
<textarea
|
|
|
value={description}
|
|
|
onChange={(e) => setDescription(e.target.value)}
|
|
|
rows={4}
|
|
|
+ required
|
|
|
className="w-full rounded-lg border border-white/10 bg-white/5 px-4 py-3 text-white outline-none focus:border-green-500"
|
|
|
/>
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
- <label className="mb-1 block text-sm text-white/60">Адрес</label>
|
|
|
+ <label className="mb-1 block text-sm text-white/60">Адрес *</label>
|
|
|
<input
|
|
|
value={address}
|
|
|
onChange={(e) => setAddress(e.target.value)}
|
|
|
+ required
|
|
|
className="w-full rounded-lg border border-white/10 bg-white/5 px-4 py-3 text-white outline-none focus:border-green-500"
|
|
|
/>
|
|
|
</div>
|
|
|
|
|
|
<div className="grid grid-cols-5 gap-4">
|
|
|
<div className="col-span-2">
|
|
|
- <label className="mb-1 block text-sm text-white/60">Широта</label>
|
|
|
+ <label className="mb-1 block text-sm text-white/60">Широта *</label>
|
|
|
<input
|
|
|
type="number"
|
|
|
step="any"
|
|
|
value={lat}
|
|
|
onChange={(e) => setLat(e.target.value)}
|
|
|
+ required
|
|
|
className="w-full rounded-lg border border-white/10 bg-white/5 px-3 py-3 text-white outline-none focus:border-green-500"
|
|
|
/>
|
|
|
</div>
|
|
|
<div className="col-span-2">
|
|
|
- <label className="mb-1 block text-sm text-white/60">Долгота</label>
|
|
|
+ <label className="mb-1 block text-sm text-white/60">Долгота *</label>
|
|
|
<input
|
|
|
type="number"
|
|
|
step="any"
|
|
|
value={lng}
|
|
|
onChange={(e) => setLng(e.target.value)}
|
|
|
+ required
|
|
|
className="w-full rounded-lg border border-white/10 bg-white/5 px-3 py-3 text-white outline-none focus:border-green-500"
|
|
|
/>
|
|
|
</div>
|