Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(my-pages-assets): HOTFIX - add charts to vehicle mileage screens #17298

Merged
merged 3 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading