Skip to content

Commit

Permalink
Show only the first line of directions and ignore batch for prescript…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
jmbrunskill committed Jan 17, 2025
1 parent 3b7f43a commit f7ec982
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions client/packages/invoices/src/Prescriptions/DetailView/columns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,22 @@ export const usePrescriptionColumn = ({
accessor: ({ rowData }) => {
if ('lines' in rowData) {
const { lines } = rowData;
const noteSections = lines
.map(({ batch, note }) => ({
header: batch ?? '',
body: note ?? '',
}))
.filter(({ body }) => !!body);
if (!lines) return null;

// All the lines should have the same note, so we just take the first one
const lineWithNote = lines.find(({ note }) => !!note);
if (!lineWithNote) return null;

const noteSections = [
{
header: null,
body: lineWithNote.note ?? '',
},
];

return noteSections.length ? noteSections : null;
} else {
return rowData.batch && rowData.note
? { header: rowData.batch, body: rowData.note }
: null;
}
return null;
},
},
],
Expand Down

0 comments on commit f7ec982

Please sign in to comment.