Ignore:
Timestamp:
02/27/25 00:42:38 (5 weeks ago)
Author:
Naum Shapkarovski <naumshapkarovski@…>
Branches:
main
Children:
32e9876
Parents:
3c5302a
Message:

update the seed script. update the prisma schema, use mapping

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sections/invoice/invoice-new-edit-form.tsx

    r3c5302a r87c9f1e  
    8181  const NewInvoiceSchema = Yup.object().shape({
    8282    invoiceNumber: Yup.string().nullable().required('Invoice number is required'),
    83     createDate: Yup.mixed<any>().nullable().required('Create date is required'),
     83    issueDate: Yup.mixed<any>().nullable().required('Create date is required'),
    8484    dueDate: Yup.mixed<any>()
    8585      .required('Due date is required')
     
    8787        'date-min',
    8888        'Due date must be later than create date',
    89         (value, { parent }) => value.getTime() > parent.createDate.getTime()
     89        (value, { parent }) => value.getTime() > parent.issueDate.getTime()
    9090      ),
    9191    invoiceFrom: Yup.mixed<any>().nullable().required('Invoice from is required'),
     
    117117          ? currentInvoice?.invoiceNumber
    118118          : incrementInvoiceNumber(tenant?.lastInvoiceNumber),
    119       createDate: currentInvoice?.createDate ? new Date(currentInvoice.createDate) : new Date(),
     119      issueDate: currentInvoice?.issueDate ? new Date(currentInvoice.issueDate) : new Date(),
    120120      dueDate: currentInvoice?.dueDate
    121121        ? new Date(currentInvoice.dueDate)
     
    175175
    176176      // Ensure dates are valid Date objects
    177       const createDate =
    178         data.createDate instanceof Date ? data.createDate : new Date(data.createDate);
     177      const issueDate = data.issueDate instanceof Date ? data.issueDate : new Date(data.issueDate);
    179178      const dueDate = data.dueDate instanceof Date ? data.dueDate : new Date(data.dueDate);
    180179
    181180      const currentTime = new Date();
    182       createDate.setHours(
     181      issueDate.setHours(
    183182        currentTime.getHours(),
    184183        currentTime.getMinutes(),
     
    197196        invoiceNumber: incrementInvoiceNumber(tenant?.lastInvoiceNumber),
    198197        status: 'draft',
    199         createDate,
     198        issueDate,
    200199        dueDate,
    201200        items: items.filter((item) => item.service !== null) as CreateInvoice['items'],
     
    246245      if (currentInvoice) {
    247246        // Ensure dates are valid Date objects
    248         const createDate =
    249           data.createDate instanceof Date ? data.createDate : new Date(data.createDate);
     247        const issueDate =
     248          data.issueDate instanceof Date ? data.issueDate : new Date(data.issueDate);
    250249        const dueDate = data.dueDate instanceof Date ? data.dueDate : new Date(data.dueDate);
    251250
     
    259258        const writeData = {
    260259          ...data,
    261           createDate,
     260          issueDate,
    262261          dueDate,
    263262          items,
     
    312311
    313312        // Ensure dates are valid Date objects
    314         const createDate =
    315           data.createDate instanceof Date ? data.createDate : new Date(data.createDate);
     313        const issueDate =
     314          data.issueDate instanceof Date ? data.issueDate : new Date(data.issueDate);
    316315        const dueDate = data.dueDate instanceof Date ? data.dueDate : new Date(data.dueDate);
    317316
     
    325324        const writeData = {
    326325          ...data,
    327           createDate,
     326          issueDate,
    328327          dueDate,
    329328          items,
Note: See TracChangeset for help on using the changeset viewer.