Add rent amount field to location form
- Add rentAmount field to BillingLocation interface (stored in cents) - Implement Zod validation with conditional requirement when rent notification is enabled - Add rent amount input field to LocationEditForm with decimal display - Update all database operations to persist rentAmount - Add localization strings for both English and Croatian - Fix missing notes field in insertOne/insertMany operations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -194,14 +194,37 @@ export const LocationEditForm: FC<LocationEditFormProps> = ({ location, yearMont
|
||||
</fieldset>
|
||||
|
||||
{rentDueNotification && (
|
||||
<fieldset className="fieldset mt-2 p-2">
|
||||
<legend className="fieldset-legend">{t("rent-due-day-label")}</legend>
|
||||
<select defaultValue={location?.rentDueDay ?? 1} className="select input-bordered w-full" name="rentDueDay">
|
||||
{Array.from({ length: 28 }, (_, i) => i + 1).map(day => (
|
||||
<option key={day} value={day}>{day}</option>
|
||||
))}
|
||||
</select>
|
||||
</fieldset>
|
||||
<>
|
||||
<fieldset className="fieldset mt-2 p-2">
|
||||
<legend className="fieldset-legend">{t("rent-due-day-label")}</legend>
|
||||
<select defaultValue={location?.rentDueDay ?? 1} className="select input-bordered w-full" name="rentDueDay">
|
||||
{Array.from({ length: 28 }, (_, i) => i + 1).map(day => (
|
||||
<option key={day} value={day}>{day}</option>
|
||||
))}
|
||||
</select>
|
||||
</fieldset>
|
||||
<fieldset className="fieldset mt-2 p-2">
|
||||
<legend className="fieldset-legend">{t("rent-amount-label")}</legend>
|
||||
<input
|
||||
id="rentAmount"
|
||||
name="rentAmount"
|
||||
type="number"
|
||||
step="0.01"
|
||||
min="0"
|
||||
placeholder={t("rent-amount-placeholder")}
|
||||
className="input input-bordered w-full placeholder:text-gray-600"
|
||||
defaultValue={location?.rentAmount ? (location.rentAmount / 100).toFixed(2) : ""}
|
||||
/>
|
||||
<div id="rentAmount-error" aria-live="polite" aria-atomic="true">
|
||||
{state.errors?.rentAmount &&
|
||||
state.errors.rentAmount.map((error: string) => (
|
||||
<p className="mt-2 text-sm text-red-500" key={error}>
|
||||
{error}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
</fieldset>
|
||||
</>
|
||||
)}
|
||||
</fieldset>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user