Changeset 87c9f1e for src/sections


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

Location:
src/sections
Files:
7 edited
8 moved

Legend:

Unmodified
Added
Removed
  • src/sections/invoice/invoice-details.tsx

    r3c5302a r87c9f1e  
    261261              Date Issued
    262262            </Typography>
    263             {fDate(invoice.createDate)}
     263            {fDate(invoice.issueDate)}
    264264          </Stack>
    265265
  • src/sections/invoice/invoice-ee-pdf.tsx

    r3c5302a r87c9f1e  
    129129    discount,
    130130    invoiceTo,
    131     createDate,
     131    issueDate,
    132132    totalAmount,
    133133    invoiceFrom,
     
    229229          <View style={styles.col6}>
    230230            <Text style={[styles.subtitle1, styles.mb4]}>Date Issued</Text>
    231             <Text style={styles.body2}>{fDate(createDate)}</Text>
     231            <Text style={styles.body2}>{fDate(issueDate)}</Text>
    232232          </View>
    233233          <View style={styles.col6}>
  • src/sections/invoice/invoice-mk-pdf.tsx

    r3c5302a r87c9f1e  
    113113    discount,
    114114    invoiceTo,
    115     createDate,
     115    issueDate,
    116116    totalAmount,
    117117    invoiceFrom,
     
    179179          <View style={styles.col6}>
    180180            <Text style={[styles.subtitle1, styles.mb4]}>Date Issued</Text>
    181             <Text style={styles.body2}>{fDate(createDate)}</Text>
     181            <Text style={styles.body2}>{fDate(issueDate)}</Text>
    182182          </View>
    183183          <View style={styles.col6}>
  • 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,
  • src/sections/invoice/invoice-new-edit-status-date.tsx

    r3c5302a r87c9f1e  
    109109
    110110      <Controller
    111         name="createDate"
     111        name="issueDate"
    112112        control={control}
    113113        render={({ field, fieldState: { error } }) => (
  • src/sections/invoice/invoice-table-row.tsx

    r3c5302a r87c9f1e  
    5151    sent,
    5252    invoiceNumber,
    53     createDate,
     53    issueDate,
    5454    dueDate,
    5555    status,
     
    6060  } = row;
    6161
    62   console.log(createDate);
     62  console.log(issueDate);
    6363
    6464  const confirmSend = useBoolean();
     
    107107        <TableCell>
    108108          <ListItemText
    109             primary={format(new Date(createDate), 'dd MMM yyyy')}
    110             secondary={format(new Date(createDate), 'p')}
     109            primary={format(new Date(issueDate), 'dd MMM yyyy')}
     110            secondary={format(new Date(issueDate), 'p')}
    111111            primaryTypographyProps={{ typography: 'body2', noWrap: true }}
    112112            secondaryTypographyProps={{
  • src/sections/invoice/view/invoice-list-view.tsx

    r3c5302a r87c9f1e  
    5959  { id: 'currency', label: 'Currency' },
    6060  { id: 'invoicePeriod', label: 'Invoice Period' },
    61   { id: 'createDate', label: 'Create' },
     61  { id: 'issueDate', label: 'Create' },
    6262  { id: 'dueDate', label: 'Due' },
    6363  { id: 'sent', label: 'Sent', align: 'center' },
     
    152152
    153153  const table = useTable({
    154     defaultOrderBy: 'createDate',
     154    defaultOrderBy: 'issueDate',
    155155    defaultOrder: 'desc',
    156156    defaultDense: true,
     
    166166      collections.invoice,
    167167      JSON.stringify({
    168         where: [['createDate', '>=', filters.startDate]],
    169         orderBy: 'createDate',
     168        where: [['issueDate', '>=', filters.startDate]],
     169        orderBy: 'issueDate',
    170170        direction: 'desc',
    171171      }),
     
    275275    async (invoice: Invoice) => {
    276276      const serializedParams = JSON.stringify({
    277         where: [['createDate', '>=', filters.startDate]],
    278         orderBy: 'createDate',
     277        where: [['issueDate', '>=', filters.startDate]],
     278        orderBy: 'issueDate',
    279279        direction: 'desc',
    280280      });
     
    671671      inputData = inputData.filter(
    672672        (invoice) =>
    673           fTimestamp(invoice.createDate.getTime()) >= fTimestamp(startDate.getTime()) &&
    674           fTimestamp(invoice.createDate.getTime()) <= fTimestamp(endDate.getTime())
     673          fTimestamp(invoice.issueDate.getTime()) >= fTimestamp(startDate.getTime()) &&
     674          fTimestamp(invoice.issueDate.getTime()) <= fTimestamp(endDate.getTime())
    675675      );
    676676    }
Note: See TracChangeset for help on using the changeset viewer.