clean up some fields. Increase font size and contrast
This commit is contained in:
@@ -14,7 +14,7 @@ router.get('/by-customer', (req, res) => {
|
||||
|
||||
const clocks = db
|
||||
.prepare(
|
||||
`SELECT id, manufacturer, model, description
|
||||
`SELECT id, description, note
|
||||
FROM clocks WHERE customer_id = ? ORDER BY id DESC`
|
||||
)
|
||||
.all(customerId);
|
||||
|
||||
+9
-34
@@ -28,8 +28,7 @@ export function getOrderDetail(id: string | number) {
|
||||
.prepare(
|
||||
`SELECT so.*, c.name AS customer_name, c.address_line1, c.address_line2, c.city, c.state, c.zip,
|
||||
c.phone, c.alt_phone, c.email,
|
||||
cl.manufacturer, cl.model, cl.serial_number, cl.alternate_id, cl.reference,
|
||||
cl.description AS clock_description
|
||||
cl.description AS clock_description, cl.note AS clock_note
|
||||
FROM service_orders so
|
||||
JOIN customers c ON c.id = so.customer_id
|
||||
LEFT JOIN clocks cl ON cl.id = so.clock_id
|
||||
@@ -123,32 +122,12 @@ router.post('/orders', (req, res) => {
|
||||
let clockId = b.existing_clock_id ? Number(b.existing_clock_id) : null;
|
||||
|
||||
if (!clockId) {
|
||||
const newClockFields = [
|
||||
b.new_clock_manufacturer,
|
||||
b.new_clock_model,
|
||||
b.new_clock_serial_number,
|
||||
b.new_clock_alternate_id,
|
||||
b.new_clock_reference,
|
||||
b.new_clock_description,
|
||||
];
|
||||
const hasNewClock = newClockFields.some((v) => v && v.trim());
|
||||
const hasNewClock = [b.new_clock_description, b.new_clock_note].some((v) => v && v.trim());
|
||||
|
||||
if (hasNewClock) {
|
||||
const info = db
|
||||
.prepare(
|
||||
`INSERT INTO clocks
|
||||
(customer_id, manufacturer, model, serial_number, alternate_id, reference, description)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
.run(
|
||||
customerId,
|
||||
b.new_clock_manufacturer || null,
|
||||
b.new_clock_model || null,
|
||||
b.new_clock_serial_number || null,
|
||||
b.new_clock_alternate_id || null,
|
||||
b.new_clock_reference || null,
|
||||
b.new_clock_description || null
|
||||
);
|
||||
.prepare(`INSERT INTO clocks (customer_id, description, note) VALUES (?, ?, ?)`)
|
||||
.run(customerId, b.new_clock_description || null, b.new_clock_note || null);
|
||||
clockId = Number(info.lastInsertRowid);
|
||||
}
|
||||
}
|
||||
@@ -158,17 +137,14 @@ router.post('/orders', (req, res) => {
|
||||
const orderInfo = db
|
||||
.prepare(
|
||||
`INSERT INTO service_orders
|
||||
(order_number, customer_id, clock_id, job_type, service_rep, technician,
|
||||
date_in, due_date, cust_po, terms)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
||||
(order_number, customer_id, clock_id, job_type, date_in, due_date, cust_po, terms)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
.run(
|
||||
orderNumber,
|
||||
customerId,
|
||||
clockId,
|
||||
b.job_type || null,
|
||||
b.service_rep || null,
|
||||
b.technician || null,
|
||||
b.date_in || todayStr(),
|
||||
b.due_date || null,
|
||||
b.cust_po || null,
|
||||
@@ -243,19 +219,18 @@ router.post('/orders/:id', (req, res) => {
|
||||
|
||||
db.prepare(
|
||||
`UPDATE service_orders SET
|
||||
job_type = ?, service_rep = ?, technician = ?, status = ?,
|
||||
date_out = ?, due_date = ?, cust_po = ?, terms = ?,
|
||||
job_type = ?, status = ?,
|
||||
date_out = ?, due_date = ?, cust_po = ?, terms = ?, internal_note = ?,
|
||||
tax = ?, shipping = ?, pickup_delivery = ?, service_call = ?, disposal = ?, amount_paid = ?
|
||||
WHERE id = ?`
|
||||
).run(
|
||||
b.job_type || null,
|
||||
b.service_rep || null,
|
||||
b.technician || null,
|
||||
STATUSES.includes(b.status) ? b.status : 'OPEN',
|
||||
b.date_out || null,
|
||||
b.due_date || null,
|
||||
b.cust_po || null,
|
||||
b.terms || null,
|
||||
b.internal_note || null,
|
||||
parseCents(b.tax),
|
||||
parseCents(b.shipping),
|
||||
parseCents(b.pickup_delivery),
|
||||
|
||||
Reference in New Issue
Block a user