diff --git a/libs/service-portal/assets/src/lib/messages.ts b/libs/service-portal/assets/src/lib/messages.ts index daa67aff96c3..eb688c5e5955 100644 --- a/libs/service-portal/assets/src/lib/messages.ts +++ b/libs/service-portal/assets/src/lib/messages.ts @@ -198,6 +198,10 @@ export const vehicleMessage = defineMessages({ id: 'sp.vehicles:vehicle-mileage-intro', defaultMessage: `Sýnir kílómetrastöðu fyrir hvert ár. Athugið að einungis er hægt að skrá einu sinni fyrir hvert tímabil, sjá nánar um það hér.`, }, + vehicleBulkMileageIntro: { + id: 'sp.vehicles:vehicle-bulk-mileage-intro', + defaultMessage: `Yfirlit yfir skráða kílómetrastöðu. Að minnsta kosti 30 dagar verða að líða á milli skráningar kílómetrastöðu, sjá nánar um það hér.`, + }, historyIntro: { id: 'sp.vehicles:vehicles-history-intro', defaultMessage: `Hér má nálgast upplýsingar um þinn ökutækjaferil úr ökutækjaskrá Samgöngustofu.`, @@ -912,6 +916,10 @@ export const vehicleMessage = defineMessages({ id: 'sp.vehicles:bulk-post-mileage', defaultMessage: 'Magnskrá kílómetrastöðu', }, + bulkPostMileageWithFile: { + id: 'sp.vehicles:bulk-post-mileage-with-file', + defaultMessage: 'Magnskrá með skjali', + }, jobOverview: { id: 'sp.vehicles:job-overview', defaultMessage: 'Yfirlit skráninga', @@ -1018,21 +1026,30 @@ export const vehicleMessage = defineMessages({ }, fileUploadAcceptedTypes: { id: 'sp.vehicles:file-upload-accepted-types', - defaultMessage: 'Tekið er við skjölum með endingu; .csv, .xls', + defaultMessage: 'Tekið er við skjölum með endingu; .csv', }, dataAboutJob: { id: 'sp.vehicles:data-about-job', - defaultMessage: 'Hér finnur þú upplýsingar um skráningu', + defaultMessage: + 'Hér finnur þú upplýsingar um skráningu. Að vinna úr magnskráningarskjali getur tekið þónokkrar mínútur. ', }, refreshDataAboutJob: { id: 'sp.vehicles:refresh-data-about-job', defaultMessage: - 'Til að sækja nýjustu stöðu er hægt að smella á "Uppfæra stöðu"', + 'Til að sækja nýjustu stöðu á skráningarkeyrslunni er hægt að smella á "Uppfæra stöðu"', }, refreshJob: { id: 'sp.vehicles:refresh-job', defaultMessage: 'Uppfæra stöðu', }, + mileagePostSuccess: { + id: 'sp.vehicles:mileage-post-success', + defaultMessage: 'Kílómetraskráning tókst', + }, + mileagePutSuccess: { + id: 'sp.vehicles:mileage-put-success', + defaultMessage: 'Uppfærsla á kílómetraskráningu tókst', + }, mileageHistoryFetchFailed: { id: 'sp.vehicles:mileage-history-fetch-failed', defaultMessage: 'Eitthvað fór úrskeiðis við að sækja fyrri skráningar', diff --git a/libs/service-portal/assets/src/screens/VehicleBulkMileage/VehicleBulkMileage.tsx b/libs/service-portal/assets/src/screens/VehicleBulkMileage/VehicleBulkMileage.tsx index c22e2ae8201b..635218334b18 100644 --- a/libs/service-portal/assets/src/screens/VehicleBulkMileage/VehicleBulkMileage.tsx +++ b/libs/service-portal/assets/src/screens/VehicleBulkMileage/VehicleBulkMileage.tsx @@ -27,13 +27,12 @@ const VehicleBulkMileage = () => { const [vehicles, setVehicles] = useState>([]) const [page, setPage] = useState(1) const [totalPages, setTotalPages] = useState(1) - const [pageSize, setPageSize] = useState(10) - const { data, loading, error, fetchMore } = useVehiclesListQuery({ + const { data, loading, error } = useVehiclesListQuery({ variables: { input: { page, - pageSize, + pageSize: 10, }, }, }) @@ -111,6 +110,7 @@ const VehicleBulkMileage = () => { totalPages={totalPages} renderLink={(page, className, children) => ( @@ -118,6 +143,8 @@ const VehicleBulkMileageJobDetail = () => { { size="default" variant="utility" onClick={handleFileDownload} + disabled={!displayRegistrationData} > {formatMessage(vehicleMessage.downloadErrors)} @@ -201,7 +229,7 @@ const VehicleBulkMileageJobDetail = () => { - {!!registrations?.requests.length && + {displayRegistrationData && registrations?.requests.map((j) => ( @@ -223,10 +251,13 @@ const VehicleBulkMileageJobDetail = () => { ))} - {(!registrations || registrationLoading) && ( + {!displayRegistrationData && ( )} diff --git a/libs/service-portal/core/src/components/TableGrid/TableGrid.tsx b/libs/service-portal/core/src/components/TableGrid/TableGrid.tsx index 5bb99cdde91c..11f2be0c14fe 100644 --- a/libs/service-portal/core/src/components/TableGrid/TableGrid.tsx +++ b/libs/service-portal/core/src/components/TableGrid/TableGrid.tsx @@ -1,6 +1,14 @@ import React, { FC } from 'react' -import { Text, Table as T, Column, Columns } from '@island.is/island-ui/core' +import { + Text, + Table as T, + Column, + Columns, + SkeletonLoader, +} from '@island.is/island-ui/core' import { tableStyles } from '../../utils/utils' +import { EmptyTable } from '../EmptyTable/EmptyTable' +import { MessageDescriptor } from 'react-intl' interface TableItem { title: string @@ -13,6 +21,8 @@ interface Props { title?: string subtitle?: string mt?: boolean + loading?: boolean + emptyMessage?: MessageDescriptor } export const TableGrid: FC> = ({ @@ -20,6 +30,8 @@ export const TableGrid: FC> = ({ title, subtitle, mt, + loading, + emptyMessage, }) => { return ( @@ -36,46 +48,48 @@ export const TableGrid: FC> = ({ - {dataArray.map((row, ii) => ( - - {row.map( - (rowitem, iii) => - rowitem && ( - - - - - {rowitem.title} - - - - - {rowitem.value} - - - - - ), - )} - - ))} + {loading && } + {!loading && + dataArray.map((row, ii) => ( + + {row.map( + (rowitem, iii) => + rowitem && ( + + + + + {rowitem.title} + + + + + {rowitem.value} + + + + + ), + )} + + ))} ) diff --git a/libs/service-portal/core/src/lib/messages.ts b/libs/service-portal/core/src/lib/messages.ts index fc72b9ef77cc..7c459b2c841b 100644 --- a/libs/service-portal/core/src/lib/messages.ts +++ b/libs/service-portal/core/src/lib/messages.ts @@ -5,6 +5,10 @@ export const m = defineMessages({ id: 'service.portal:reference', defaultMessage: 'Tilvísun', }, + goToPage: { + id: 'service.portal:go-to-page', + defaultMessage: 'Fara á síðu', + }, print: { id: 'service.portal:print', defaultMessage: 'Prenta',