diff --git a/README.md b/README.md
index 9f2d45e..feb52f4 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,8 @@ Open the web dashboard at [http://localhost:3000](http://localhost:3000).
The dashboard's **Vehicles** view provides a dedicated vehicle register containing make, model, model year, engine, transmission, fuel type, color, VIN, license plate, mileage, owner, and service-record count. The **Service records** form stores these vehicle details and can autofill them, along with the customer, when an existing VIN or license plate is entered. Customer contact information can also be autofilled by customer email or by a unique customer name. Names are not unique, so duplicate names are allowed; when a name matches multiple customers, the form asks for an email instead of choosing one incorrectly. It supports adding, listing, and editing service records with service date, VIN, license plate number, car mileage, customer, technician, complaint, and status. Adding a record creates or updates the linked customer and vehicle, technician, and service order in one transaction.
+Service records can also include optional used parts and labor lines. Parts support a part number, quantity, and unit price. Labor supports used time in hours and an hourly price. Line totals and the service-record total are calculated automatically and stored with the service order.
+
The **Accounts** view supports reading, adding, editing, and deleting users with `read`, `add`, and `delete` rights. A default `admin` account is created automatically, and the last administrator cannot be deleted. These permissions are currently stored as staff access profiles; login/session enforcement can be added when authentication is required.
Check that the database is ready:
diff --git a/init.sql b/init.sql
index fabab93..0f9a5ee 100644
--- a/init.sql
+++ b/init.sql
@@ -64,6 +64,8 @@ CREATE TABLE IF NOT EXISTS service_order_items (
service_order_id UUID NOT NULL REFERENCES service_orders(service_order_id) ON DELETE CASCADE,
item_type TEXT NOT NULL CHECK (item_type IN ('labor', 'part')),
description TEXT NOT NULL,
+ part_number TEXT,
+ labor_time_minutes INTEGER CHECK (labor_time_minutes IS NULL OR labor_time_minutes > 0),
quantity NUMERIC(10, 2) NOT NULL DEFAULT 1 CHECK (quantity > 0),
unit_price NUMERIC(12, 2) NOT NULL CHECK (unit_price >= 0),
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
diff --git a/public/app.js b/public/app.js
index 1dc38f9..912f9d3 100644
--- a/public/app.js
+++ b/public/app.js
@@ -1,4 +1,4 @@
-const state = { orders: [], users: [], vehicles: [] };
+const state = { orders: [], users: [], vehicles: [], recordItems: [] };
const $ = (selector) => document.querySelector(selector);
async function request(url, options) {
@@ -53,7 +53,7 @@ function renderOrders() {
const serviceDate = String(order.service_date || '').slice(0, 10);
return (!vehicleFilter || vehicleText.includes(vehicleFilter)) && (!customerFilter || customerText.includes(customerFilter)) && (!technicianFilter || technicianText.includes(technicianFilter)) && (!filters.dateFrom || serviceDate >= filters.dateFrom) && (!filters.dateTo || serviceDate <= filters.dateTo) && (!filters.status || order.status === filters.status);
});
- $('#orders-table').innerHTML = visibleOrders.length ? visibleOrders.map((order) => `