cityssm/parking-ticket-system

View on GitHub
handlers/tickets-get/new.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { dateToString } from '@cityssm/utils-datetime';
import { getRecentParkingTicketVehicleMakeModelValues } from '../../database/parkingDB.js';
import { getConfigProperty } from '../../helpers/functions.config.js';
export default function handler(request, response) {
    const ticketNumber = request.params.ticketNumber;
    const vehicleMakeModelDatalist = getRecentParkingTicketVehicleMakeModelValues();
    response.render('ticket-edit', {
        headTitle: 'New Ticket',
        isCreate: true,
        ticket: {
            ticketNumber,
            licencePlateCountry: getConfigProperty('defaults.country'),
            licencePlateProvince: getConfigProperty('defaults.province')
        },
        issueDateMaxString: dateToString(new Date()),
        vehicleMakeModelDatalist
    });
}