adding logbook page totals

This commit is contained in:
2025-05-16 10:13:01 -05:00
parent b6be7a9d2c
commit cc8e2f55fe

View File

@@ -61,7 +61,7 @@ const durationOfFlight: ColumnDef<ILogbookEntry> = {
}, },
cell: (info: CellContext<ILogbookEntry, unknown>) => cell: (info: CellContext<ILogbookEntry, unknown>) =>
info.getValue() ? parseFloat(info.getValue() as string).toFixed(1) : '', info.getValue() ? parseFloat(info.getValue() as string).toFixed(1) : '',
footer: (info) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '' footer: (info: HeaderContext<ILogbookEntry, unknown>) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : ''
} }
const notes: ColumnDef<ILogbookEntry> = { const notes: ColumnDef<ILogbookEntry> = {
id: 'notes', id: 'notes',
@@ -97,9 +97,9 @@ export const authColumns: ColumnDef<ILogbookEntry>[] = [
align: 'right', align: 'right',
headerAlign: 'right' headerAlign: 'right'
}, },
cell: (info: any) => cell: (info: CellContext<ILogbookEntry, unknown>) =>
info.getValue() ? parseFloat(info.getValue()).toFixed(1) : '', info.getValue() ? parseFloat(info.getValue() as string).toFixed(1) : '',
footer: (info) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '' footer: (info: HeaderContext<ILogbookEntry, unknown>) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : ''
}, },
{ {
id: 'landings', id: 'landings',
@@ -112,7 +112,7 @@ export const authColumns: ColumnDef<ILogbookEntry>[] = [
id: 'landingsDay', id: 'landingsDay',
accessorKey: 'landingsDay', accessorKey: 'landingsDay',
header: 'Day', header: 'Day',
footer: (info) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '', footer: (info: HeaderContext<ILogbookEntry, unknown>) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '',
meta: { meta: {
align: 'right', align: 'right',
headerAlign: 'right' headerAlign: 'right'
@@ -122,7 +122,7 @@ export const authColumns: ColumnDef<ILogbookEntry>[] = [
id: 'landingsNight', id: 'landingsNight',
accessorKey: 'landingsNight', accessorKey: 'landingsNight',
header: 'Night', header: 'Night',
footer: (info) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '', footer: (info: HeaderContext<ILogbookEntry, unknown>) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '',
meta: { meta: {
align: 'right', align: 'right',
headerAlign: 'right' headerAlign: 'right'
@@ -141,31 +141,31 @@ export const authColumns: ColumnDef<ILogbookEntry>[] = [
id: 'instrumentActual', id: 'instrumentActual',
accessorKey: 'instrumentActual', accessorKey: 'instrumentActual',
header: 'Actual', header: 'Actual',
footer: (info) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '', footer: (info: HeaderContext<ILogbookEntry, unknown>) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '',
meta: { meta: {
align: 'right', align: 'right',
headerAlign: 'right' headerAlign: 'right'
}, },
cell: (info: any) => cell: (info: CellContext<ILogbookEntry, unknown>) =>
info.getValue() ? parseFloat(info.getValue()).toFixed(1) : '', info.getValue() ? parseFloat(info.getValue() as string).toFixed(1) : '',
}, },
{ {
id: 'instrumentSimulated', id: 'instrumentSimulated',
accessorKey: 'instrumentSimulated', accessorKey: 'instrumentSimulated',
header: 'Simulated', header: 'Simulated',
footer: (info) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '', footer: (info: HeaderContext<ILogbookEntry, unknown>) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '',
meta: { meta: {
align: 'right', align: 'right',
headerAlign: 'right' headerAlign: 'right'
}, },
cell: (info: any) => cell: (info: CellContext<ILogbookEntry, unknown>) =>
info.getValue() ? parseFloat(info.getValue()).toFixed(1) : '' info.getValue() ? parseFloat(info.getValue() as string).toFixed(1) : ''
}, },
{ {
id: 'instrumentApproaches', id: 'instrumentApproaches',
accessorKey: 'instrumentApproaches', accessorKey: 'instrumentApproaches',
header: 'Approaches', header: 'Approaches',
footer: (info) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '', footer: (info: HeaderContext<ILogbookEntry, unknown>) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '',
meta: { meta: {
align: 'right', align: 'right',
headerAlign: 'right' headerAlign: 'right'
@@ -175,7 +175,7 @@ export const authColumns: ColumnDef<ILogbookEntry>[] = [
id: 'instrumentHolds', id: 'instrumentHolds',
accessorKey: 'instrumentHolds', accessorKey: 'instrumentHolds',
header: 'Holds', header: 'Holds',
footer: (info) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '', footer: (info: HeaderContext<ILogbookEntry, unknown>) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '',
meta: { meta: {
align: 'right', align: 'right',
headerAlign: 'right' headerAlign: 'right'
@@ -185,7 +185,7 @@ export const authColumns: ColumnDef<ILogbookEntry>[] = [
id: 'instrumentNavTrack', id: 'instrumentNavTrack',
accessorKey: 'instrumentNavTrack', accessorKey: 'instrumentNavTrack',
header: 'Nav/Track', header: 'Nav/Track',
footer: (info) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '', footer: (info: HeaderContext<ILogbookEntry, unknown>) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '',
meta: { meta: {
align: 'right', align: 'right',
headerAlign: 'right' headerAlign: 'right'
@@ -204,73 +204,73 @@ export const authColumns: ColumnDef<ILogbookEntry>[] = [
id: 'groundTrainingReceived', id: 'groundTrainingReceived',
accessorKey: 'groundTrainingReceived', accessorKey: 'groundTrainingReceived',
header: 'Ground Training Received', header: 'Ground Training Received',
footer: (info) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '', footer: (info: HeaderContext<ILogbookEntry, unknown>) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '',
meta: { meta: {
align: 'right', align: 'right',
headerAlign: 'right' headerAlign: 'right'
}, },
cell: (info: any) => cell: (info: CellContext<ILogbookEntry, unknown>) =>
info.getValue() ? parseFloat(info.getValue()).toFixed(1) : '' info.getValue() ? parseFloat(info.getValue() as string).toFixed(1) : ''
}, },
{ {
id: 'flightTrainingReceived', id: 'flightTrainingReceived',
accessorKey: 'flightTrainingReceived', accessorKey: 'flightTrainingReceived',
header: 'Flight Training Received', header: 'Flight Training Received',
footer: (info) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '', footer: (info: HeaderContext<ILogbookEntry, unknown>) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '',
meta: { meta: {
align: 'right', align: 'right',
headerAlign: 'right' headerAlign: 'right'
}, },
cell: (info: any) => cell: (info: CellContext<ILogbookEntry, unknown>) =>
info.getValue() ? parseFloat(info.getValue()).toFixed(1) : '' info.getValue() ? parseFloat(info.getValue() as string).toFixed(1) : ''
}, },
{ {
id: 'crossCountry', id: 'crossCountry',
accessorKey: 'crossCountry', accessorKey: 'crossCountry',
header: 'Cross Country', header: 'Cross Country',
footer: (info) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '', footer: (info: HeaderContext<ILogbookEntry, unknown>) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '',
meta: { meta: {
align: 'right', align: 'right',
headerAlign: 'right' headerAlign: 'right'
}, },
cell: (info: any) => cell: (info: CellContext<ILogbookEntry, unknown>) =>
info.getValue() ? parseFloat(info.getValue()).toFixed(1) : '' info.getValue() ? parseFloat(info.getValue() as string).toFixed(1) : ''
}, },
{ {
id: 'night', id: 'night',
accessorKey: 'night', accessorKey: 'night',
header: 'Night', header: 'Night',
footer: (info) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '', footer: (info: HeaderContext<ILogbookEntry, unknown>) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '',
meta: { meta: {
align: 'right', align: 'right',
headerAlign: 'right' headerAlign: 'right'
}, },
cell: (info: any) => cell: (info: CellContext<ILogbookEntry, unknown>) =>
info.getValue() ? parseFloat(info.getValue()).toFixed(1) : '' info.getValue() ? parseFloat(info.getValue() as string).toFixed(1) : ''
}, },
{ {
id: 'solo', id: 'solo',
accessorKey: 'solo', accessorKey: 'solo',
header: 'Solo', header: 'Solo',
footer: (info) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '', footer: (info: HeaderContext<ILogbookEntry, unknown>) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '',
meta: { meta: {
align: 'right', align: 'right',
headerAlign: 'right' headerAlign: 'right'
}, },
cell: (info: any) => cell: (info: CellContext<ILogbookEntry, unknown>) =>
info.getValue() ? parseFloat(info.getValue()).toFixed(1) : '' info.getValue() ? parseFloat(info.getValue() as string).toFixed(1) : ''
}, },
{ {
id: 'pilotInCommand', id: 'pilotInCommand',
accessorKey: 'pilotInCommand', accessorKey: 'pilotInCommand',
header: 'Pilot In Command', header: 'Pilot In Command',
footer: (info) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '', footer: (info: HeaderContext<ILogbookEntry, unknown>) => columnTotal(info) > 0 ? columnTotal(info).toFixed(1) : '',
meta: { meta: {
align: 'right', align: 'right',
headerAlign: 'right' headerAlign: 'right'
}, },
cell: (info: any) => cell: (info: CellContext<ILogbookEntry, unknown>) =>
info.getValue() ? parseFloat(info.getValue()).toFixed(1) : '' info.getValue() ? parseFloat(info.getValue() as string).toFixed(1) : ''
} }
] ]
}, },