diff --git a/TODO.md b/TODO.md index 809da28..9bf886b 100644 --- a/TODO.md +++ b/TODO.md @@ -5,10 +5,6 @@ development plans for the application. ## High Priority -- **Implement Payment Processing**: The current rent payment system in - `routes/tenant/rent/pay/index.tsx` is a placeholder. It needs to be fully - implemented with a payment provider like Stripe to handle real transactions - securely. ## Backend & API @@ -27,6 +23,7 @@ development plans for the application. - Tenant invitation and management (`islands/LandlordInviteTenant.tsx`) - Messaging with tenants (`islands/LandlordMessageThreads.tsx`) - Financial tracking and reporting + - **Complete Tenant Dashboard**: Finalize all features under the `routes/tenant/` directory. This includes: - Viewing lease documents diff --git a/islands/dialogs/AddLeaseDialog.tsx b/islands/dialogs/AddLeaseDialog.tsx index c248bd6..914e5d0 100644 --- a/islands/dialogs/AddLeaseDialog.tsx +++ b/islands/dialogs/AddLeaseDialog.tsx @@ -29,7 +29,6 @@ export default function AddLeaseDialog( .toISOString().split("T")[0], rent: propertyCost !== undefined ? String(propertyCost) : "", security_deposit: "", - lease_status: "", }); return ( @@ -102,14 +101,6 @@ export default function AddLeaseDialog( onInput={(e) => setForm({ ...form, security_deposit: e.currentTarget.value })} /> - - setForm({ ...form, lease_status: e.currentTarget.value })} - />
+ +
+ + + ); + })() + : null; + + return [popAddLease, popupAddLeaseDialog || propertySelectionDialog] as const; } diff --git a/routes/api/create/lease.ts b/routes/api/create/lease.ts index 1a3d004..df221ec 100644 --- a/routes/api/create/lease.ts +++ b/routes/api/create/lease.ts @@ -1,15 +1,16 @@ // routes/api/create/lease.ts import { define } from "../../../utils.ts"; -import { createLease, getProperty } from "../../../services/propertyService.ts"; +import { createLease } from "../../../services/leaseService.ts"; +import { getProperty } from "../../../services/propertyService.ts"; import { SessionCookie } from "../../auth/callback.ts"; export const handler = define.handlers({ async POST(ctx) { try { - const stateData: SessionCookie = ctx.state.data; + const _stateData: SessionCookie = ctx.state.data; const form = await ctx.req.formData(); const sender = form.get("sender"); - const tenant_id = stateData.user_id; + const tenant_id = form.get("tenant_id")?.toString(); const propertyId = form.get("property_id")?.toString() || ""; const title = form.get("title")?.toString() || ""; const rent = Number(form.get("rent")); @@ -19,18 +20,20 @@ export const handler = define.handlers({ const end_date = form.get("end_date") ? Date.parse(form.get("end_date")?.toString() + "T00:00:00") : null; + const security_deposit = Number(form.get("security_deposit")) || 0; const property = await getProperty(propertyId); if (property.length == 1 && start_date && end_date) { const owner_id = property[0].owner_id as string; await createLease( - propertyId, - tenant_id, - owner_id, title, - rent, + propertyId, + owner_id, start_date, end_date, + rent, + security_deposit, + tenant_id, ); } diff --git a/services/leaseService.ts b/services/leaseService.ts index e35d174..2ddd6ed 100644 --- a/services/leaseService.ts +++ b/services/leaseService.ts @@ -57,7 +57,7 @@ export async function createLease( end_date, rent, security_deposit, - lease_status: "draft", + lease_status: "new", lease_document_url: null, payment_schedule_id: payment_schedule_id || null, late_fee_rules: null,