Skip to content

Commit

Permalink
feat(my-pages-assets): HOTFIX - add charts to vehicle mileage screens (
Browse files Browse the repository at this point in the history
…#17298)

* fix: merge conflicts

* fix(my-pages-assets): chart fixes (#17289)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* feat(my-pages): add back "other" for organ donation registration (#17228)

* feat: add back "other" for organ donation registration

* refactor: update api client for organ donations

* refactor: texts

* fix: as

* fix: type safety

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Ásdís Erna Guðmundsdóttir <[email protected]>
  • Loading branch information
3 people authored Dec 19, 2024
1 parent 5e15271 commit 9dd9a33
Show file tree
Hide file tree
Showing 32 changed files with 1,389 additions and 354 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,20 @@ export class HealthDirectorateService {
if (data === null) {
return null
}
const hasExceptionComment: boolean =
data.exceptionComment !== undefined && data.exceptionComment.length > 0
const hasExceptions: boolean =
data.exceptions !== undefined && data.exceptions.length > 0
const donorStatus: Donor = {
isDonor: data?.isDonor ?? true,
isDonor: data.isDonor,
limitations: {
hasLimitations:
((data?.exceptions?.length ?? 0) > 0 && data?.isDonor) ?? false,
limitedOrgansList: data?.exceptions,
comment: data?.exceptionComment,
((hasExceptionComment || hasExceptions) && data.isDonor) ?? false,
limitedOrgansList: data.exceptions,
comment: data.exceptionComment,
},
isMinor: data.isMinor ?? false,
isTemporaryResident: data.isTemporaryResident ?? false,
}
return donorStatus
}
Expand All @@ -62,11 +68,15 @@ export class HealthDirectorateService {
input: DonorInput,
locale: Locale,
): Promise<void> {
const filteredList =
input.organLimitations?.filter((item) => item !== 'other') ?? []

return await this.organDonationApi.updateOrganDonation(
auth,
{
isDonor: input.isDonor,
exceptions: input.organLimitations ?? [],
exceptions: filteredList,
exceptionComment: input.comment,
},
locale === 'is' ? organLocale.Is : organLocale.En,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ export class Donor {

@Field(() => Limitations, { nullable: true })
limitations?: Limitations

@Field(() => Boolean, { defaultValue: false })
isMinor!: boolean

@Field(() => Boolean, { defaultValue: false })
isTemporaryResident!: boolean
}

@ObjectType('HealthDirectorateOrganDonation')
Expand All @@ -54,4 +60,7 @@ export class DonorInput {

@Field(() => [String], { nullable: true })
organLimitations?: string[]

@Field({ nullable: true })
comment?: string
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
{
"openapi": "3.0.0",
"paths": {
"/v1/me/organ-donor-status": {
"/v1/donation-exceptions": {
"get": {
"operationId": "MeDonorStatusController_getOrganDonorStatus",
"description": "Get user's donation-exception donor status",
"operationId": "DonationExceptionController_getOrgans",
"description": "Gets a list of organs that can be omitted from an donation-exception donation",
"parameters": [
{
"name": "ip",
"required": false,
"in": "query",
"description": "The IP address of the user",
"schema": { "type": "string" }
},
{
"name": "locale",
"required": false,
Expand All @@ -26,7 +19,10 @@
"description": "",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/OrganDonorDto" }
"schema": {
"type": "array",
"items": { "$ref": "#/components/schemas/OrganDto" }
}
}
}
},
Expand Down Expand Up @@ -63,37 +59,38 @@
}
}
},
"tags": ["me/organ-donor-status"]
},
"post": {
"operationId": "MeDonorStatusController_updateOrganDonorStatus",
"description": "Update user's donation-exception donor status",
"tags": ["donation-exceptions"]
}
},
"/v1/me/organ-donor-status": {
"get": {
"operationId": "MeDonorStatusController_getOrganDonorStatus",
"description": "Get user's donation-exception donor status",
"parameters": [
{
"name": "ip",
"name": "locale",
"required": false,
"in": "query",
"description": "The IP address of the user",
"schema": { "type": "string" }
"description": "The locale to use for the response",
"schema": { "$ref": "#/components/schemas/Locale" }
},
{
"name": "locale",
"name": "ip",
"required": false,
"in": "query",
"description": "The locale to use for the response",
"schema": { "$ref": "#/components/schemas/Locale" }
"description": "The IP address of the user",
"schema": { "type": "string" }
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/UpdateOrganDonorDto" }
}
}
},
"responses": {
"200": { "description": "" },
"200": {
"description": "",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/OrganDonorDto" }
}
}
},
"400": {
"description": "",
"content": {
Expand Down Expand Up @@ -128,33 +125,36 @@
}
},
"tags": ["me/organ-donor-status"]
}
},
"/v1/donation-exceptions": {
"get": {
"operationId": "DonationExceptionController_getOrgans",
"description": "Gets a list of organs that can be omitted from an donation-exception donation",
},
"post": {
"operationId": "MeDonorStatusController_updateOrganDonorStatus",
"description": "Update user's donation-exception donor status",
"parameters": [
{
"name": "locale",
"required": false,
"in": "query",
"description": "The locale to use for the response",
"schema": { "$ref": "#/components/schemas/Locale" }
},
{
"name": "ip",
"required": false,
"in": "query",
"description": "The IP address of the user",
"schema": { "type": "string" }
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": { "$ref": "#/components/schemas/OrganDto" }
}
}
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/UpdateOrganDonorDto" }
}
},
}
},
"responses": {
"200": { "description": "" },
"400": {
"description": "",
"content": {
Expand Down Expand Up @@ -188,7 +188,7 @@
}
}
},
"tags": ["donation-exceptions"]
"tags": ["me/organ-donor-status"]
}
}
},
Expand Down Expand Up @@ -226,24 +226,11 @@
},
"required": ["id", "name"]
},
"OrganDonorDto": {
"type": "object",
"properties": {
"isDonor": { "type": "boolean" },
"exceptions": {
"type": "array",
"items": { "$ref": "#/components/schemas/OrganDto" }
},
"exceptionComment": { "type": "string" },
"registrationDate": { "format": "date-time", "type": "string" }
},
"required": ["isDonor", "exceptions"]
},
"HttpProblemResponse": {
"type": "object",
"properties": {
"type": {
"type": "object",
"type": "string",
"description": "A URI reference that identifies the problem type"
},
"title": {
Expand All @@ -262,12 +249,27 @@
},
"required": ["type", "title"]
},
"OrganDonorDto": {
"type": "object",
"properties": {
"isDonor": { "type": "boolean" },
"exceptions": {
"type": "array",
"items": { "$ref": "#/components/schemas/OrganDto" }
},
"exceptionComment": { "type": "string" },
"registrationDate": { "format": "date-time", "type": "string" },
"isMinor": { "type": "boolean" },
"isTemporaryResident": { "type": "boolean" }
},
"required": ["isDonor", "exceptions"]
},
"UpdateOrganDonorDto": {
"type": "object",
"properties": {
"isDonor": { "type": "boolean" },
"exceptions": { "type": "array", "items": { "type": "string" } },
"exceptionComment": { "type": "object" }
"exceptionComment": { "type": "string" }
},
"required": ["isDonor", "exceptions"]
}
Expand Down
3 changes: 3 additions & 0 deletions libs/feature-flags/src/lib/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ export enum Features {
//New License service fetch enabled
licensesV2 = 'isLicensesV2Enabled',

//Is vehicle bulk mileage graph enabled?
isServicePortalVehicleBulkMileageSubdataPageEnabled = 'isServicePortalVehicleBulkMileageSubdataPageEnabled',

//Possible universities
isUniversityOfAkureyriEnabled = 'isUniversityOfAkureyriEnabled',
isAgriculturalUniversityOfIcelandEnabled = 'isAgriculturalUniversityOfIcelandEnabled',
Expand Down
28 changes: 28 additions & 0 deletions libs/portals/my-pages/assets/src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,34 @@ export const vehicleMessage = defineMessages({
id: 'sp.vehicles:permno',
defaultMessage: 'Fastanúmer',
},
viewChart: {
id: 'sp.vehicles:view-chart',
defaultMessage: 'Sjá línurit',
},
viewTable: {
id: 'sp.vehicles:view-table',
defaultMessage: 'Sjá töflu',
},
registrationHistory: {
id: 'sp.vehicles:registration-history',
defaultMessage: 'Skráningarsaga',
},
viewRegistrationHistory: {
id: 'sp.vehicles:view-registration-history',
defaultMessage: 'Sjá alla skráningarsögu',
},
lastRegistration: {
id: 'sp.vehicles:last-registration',
defaultMessage: 'Síðasta skráning',
},
lastStatus: {
id: 'sp.vehicles:last-status',
defaultMessage: 'Síðasta staða',
},
lastRegistered: {
id: 'sp.vehicles:last-registered',
defaultMessage: 'Síðast skráð',
},
verno: {
id: 'sp.vehicles:verno',
defaultMessage: 'Verksmiðjunúmer',
Expand Down Expand Up @@ -518,6 +542,10 @@ export const vehicleMessage = defineMessages({
id: 'sp.vehicles:total-weight',
defaultMessage: 'Heildarþyngd',
},
total: {
id: 'sp.vehicles:total',
defaultMessage: 'Samtals:',
},
width: {
id: 'sp.vehicles:width',
defaultMessage: 'Breidd',
Expand Down
11 changes: 6 additions & 5 deletions libs/portals/my-pages/assets/src/lib/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ export const assetsNavigation: PortalNavigationItem = {
],
},
{
name: m.vehiclesLookup,
path: AssetsPaths.AssetsVehiclesLookup,
},
{
name: m.vehiclesBulkMileage,
name: m.vehiclesRegisterMileage,
path: AssetsPaths.AssetsVehiclesBulkMileage,
children: [
{
Expand All @@ -71,6 +67,11 @@ export const assetsNavigation: PortalNavigationItem = {
},
],
},
{
name: m.vehiclesLookup,
path: AssetsPaths.AssetsVehiclesLookup,
},

{
name: m.vehiclesHistory,
path: AssetsPaths.AssetsVehiclesHistory,
Expand Down
Loading

0 comments on commit 9dd9a33

Please sign in to comment.