From 2a8f13e6d765fcb114dd69e229536006587c9e00 Mon Sep 17 00:00:00 2001 From: NazarMykhalkevych Date: Wed, 23 Jul 2025 17:33:16 +0300 Subject: [PATCH 1/3] feat(registration): update ui for submited --- .../confirm-registration-dialog.component.ts | 3 +- .../components/review/review.component.ts | 5 +- .../my-registrations.component.html | 8 ++- .../data-resources.component.html | 2 +- .../data-resources.component.ts | 1 + .../registration-card.component.html | 61 ++++++++----------- .../registration-card.component.ts | 9 ++- .../status-badge/default-statuses.ts | 20 ++++++ .../status-badge/status-badge.component.html | 3 + .../status-badge/status-badge.component.scss | 0 .../status-badge.component.spec.ts | 22 +++++++ .../status-badge/status-badge.component.ts | 25 ++++++++ .../registration/registration.mapper.ts | 10 ++- .../registry/map-registry-status.mapper.ts | 5 +- src/app/shared/models/index.ts | 1 + .../registration/registration-card.model.ts | 10 ++- .../registration-json-api.model.ts | 8 +++ src/app/shared/models/status-info.model.ts | 4 ++ src/assets/i18n/en.json | 1 + 19 files changed, 153 insertions(+), 45 deletions(-) create mode 100644 src/app/shared/components/status-badge/default-statuses.ts create mode 100644 src/app/shared/components/status-badge/status-badge.component.html create mode 100644 src/app/shared/components/status-badge/status-badge.component.scss create mode 100644 src/app/shared/components/status-badge/status-badge.component.spec.ts create mode 100644 src/app/shared/components/status-badge/status-badge.component.ts create mode 100644 src/app/shared/models/status-info.model.ts diff --git a/src/app/features/registries/components/confirm-registration-dialog/confirm-registration-dialog.component.ts b/src/app/features/registries/components/confirm-registration-dialog/confirm-registration-dialog.component.ts index a9f6a5e0b..f9989faba 100644 --- a/src/app/features/registries/components/confirm-registration-dialog/confirm-registration-dialog.component.ts +++ b/src/app/features/registries/components/confirm-registration-dialog/confirm-registration-dialog.component.ts @@ -61,10 +61,11 @@ export class ConfirmRegistrationDialogComponent { } submit(): void { + const embargoDate = new Date(this.form.value.embargoDate).toISOString(); this.actions .registerDraft( this.config.data.draftId, - this.form.value.embargoDate, + embargoDate, this.config.data.providerId, this.config.data.projectId, this.config.data.components diff --git a/src/app/features/registries/components/review/review.component.ts b/src/app/features/registries/components/review/review.component.ts index 0b24465d8..018f165aa 100644 --- a/src/app/features/registries/components/review/review.component.ts +++ b/src/app/features/registries/components/review/review.component.ts @@ -177,7 +177,10 @@ export class ReviewComponent { modal: true, data: { draftId: this.draftId(), - projectId: this.draftRegistration()?.branchedFrom?.id, + projectId: + this.draftRegistration()?.branchedFrom?.type === 'nodes' + ? this.draftRegistration()?.branchedFrom?.id + : null, providerId: this.draftRegistration()?.providerId, components, }, diff --git a/src/app/features/registries/pages/my-registrations/my-registrations.component.html b/src/app/features/registries/pages/my-registrations/my-registrations.component.html index 93e2fc49d..7d5f379bd 100644 --- a/src/app/features/registries/pages/my-registrations/my-registrations.component.html +++ b/src/app/features/registries/pages/my-registrations/my-registrations.component.html @@ -38,7 +38,11 @@ } @for (registration of draftRegistrations(); track registration.id) { - + } @if (draftRegistrationsTotalCount() > itemsPerPage) { itemsPerPage) { } diff --git a/src/app/shared/components/data-resources/data-resources.component.html b/src/app/shared/components/data-resources/data-resources.component.html index ec31469bb..66649cdeb 100644 --- a/src/app/shared/components/data-resources/data-resources.component.html +++ b/src/app/shared/components/data-resources/data-resources.component.html @@ -1,4 +1,4 @@ -
+
@if (hasData()) { data-resource diff --git a/src/app/shared/components/data-resources/data-resources.component.ts b/src/app/shared/components/data-resources/data-resources.component.ts index 8aaf2c13d..f05265078 100644 --- a/src/app/shared/components/data-resources/data-resources.component.ts +++ b/src/app/shared/components/data-resources/data-resources.component.ts @@ -11,6 +11,7 @@ import { ChangeDetectionStrategy, Component, HostBinding, input } from '@angular }) export class DataResourcesComponent { @HostBinding('class') classes = 'flex-1 flex'; + vertical = input(false); resourceId = input(); hasData = input(); hasAnalyticCode = input(); diff --git a/src/app/shared/components/registration-card/registration-card.component.html b/src/app/shared/components/registration-card/registration-card.component.html index 098685f27..a0180acfa 100644 --- a/src/app/shared/components/registration-card/registration-card.component.html +++ b/src/app/shared/components/registration-card/registration-card.component.html @@ -3,14 +3,11 @@ @if (registrationData()) {
-

{{ registrationData().title || 'project.registrations.card.noTitle' | translate }}

@@ -23,6 +20,9 @@

} --> + @if (!isDraft()) { + + }

@@ -63,7 +63,7 @@

{{ registrationData().description || 'project.registrations.card.noDescription' | translate }}

- @if (registrationData().status === RegistrationStatus.None) { + @if (isDraft()) { (click)="deleteDraft.emit(registrationData().id)" > } @else { - + @if (registrationData().status === RegistrationStatus.InProgress) { } @@ -90,34 +95,20 @@

- + }
} diff --git a/src/app/shared/components/registration-card/registration-card.component.ts b/src/app/shared/components/registration-card/registration-card.component.ts index 50215f611..da9d97996 100644 --- a/src/app/shared/components/registration-card/registration-card.component.ts +++ b/src/app/shared/components/registration-card/registration-card.component.ts @@ -7,18 +7,23 @@ import { DatePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; import { RouterLink } from '@angular/router'; -import { RegistryStatus } from '@osf/shared/enums'; +import { RegistryStatus, RevisionReviewStates } from '@osf/shared/enums'; import { RegistrationCard } from '@osf/shared/models'; +import { DataResourcesComponent } from '../data-resources/data-resources.component'; +import { StatusBadgeComponent } from '../status-badge/status-badge.component'; + @Component({ selector: 'osf-registration-card', - imports: [Card, Button, TranslatePipe, DatePipe, RouterLink], + imports: [Card, Button, TranslatePipe, DatePipe, RouterLink, StatusBadgeComponent, DataResourcesComponent], templateUrl: './registration-card.component.html', styleUrl: './registration-card.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, }) export class RegistrationCardComponent { RegistrationStatus = RegistryStatus; + RevisionReviewStates = RevisionReviewStates; + readonly isDraft = input(false); readonly registrationData = input.required(); readonly deleteDraft = output(); } diff --git a/src/app/shared/components/status-badge/default-statuses.ts b/src/app/shared/components/status-badge/default-statuses.ts new file mode 100644 index 000000000..ac25845d7 --- /dev/null +++ b/src/app/shared/components/status-badge/default-statuses.ts @@ -0,0 +1,20 @@ +import { RegistryStatus } from '@osf/shared/enums'; +import { StatusInfo } from '@osf/shared/models'; + +export const RegistryStatusMap: Record = { + [RegistryStatus.None]: { label: '', severity: null }, + [RegistryStatus.PendingRegistrationApproval]: { label: 'Pending registration approval', severity: 'warn' }, + [RegistryStatus.PendingEmbargoApproval]: { label: 'Pending embargo approval', severity: 'warn' }, + [RegistryStatus.Pending]: { label: 'Pending', severity: 'info' }, + [RegistryStatus.Accepted]: { label: 'Accepted', severity: 'success' }, + [RegistryStatus.Embargo]: { label: 'Embargo', severity: 'info' }, + [RegistryStatus.PendingEmbargoTerminationApproval]: { + label: 'Pending embargo termination approval', + severity: 'warn', + }, + [RegistryStatus.PendingWithdrawRequest]: { label: 'Pending withdraw request', severity: 'info' }, + [RegistryStatus.PendingWithdraw]: { label: 'Pending withdrawal', severity: 'warn' }, + [RegistryStatus.Unapproved]: { label: 'Unapproved', severity: 'danger' }, + [RegistryStatus.InProgress]: { label: 'In progress', severity: 'info' }, + [RegistryStatus.PendingModeration]: { label: 'Pending moderation', severity: 'warn' }, +}; diff --git a/src/app/shared/components/status-badge/status-badge.component.html b/src/app/shared/components/status-badge/status-badge.component.html new file mode 100644 index 000000000..e53e9890d --- /dev/null +++ b/src/app/shared/components/status-badge/status-badge.component.html @@ -0,0 +1,3 @@ +@if (label) { + +} diff --git a/src/app/shared/components/status-badge/status-badge.component.scss b/src/app/shared/components/status-badge/status-badge.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/shared/components/status-badge/status-badge.component.spec.ts b/src/app/shared/components/status-badge/status-badge.component.spec.ts new file mode 100644 index 000000000..5a14abb64 --- /dev/null +++ b/src/app/shared/components/status-badge/status-badge.component.spec.ts @@ -0,0 +1,22 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { StatusBadgeComponent } from './status-badge.component'; + +describe('StatusBadgeComponent', () => { + let component: StatusBadgeComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [StatusBadgeComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(StatusBadgeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/shared/components/status-badge/status-badge.component.ts b/src/app/shared/components/status-badge/status-badge.component.ts new file mode 100644 index 000000000..bef599d8b --- /dev/null +++ b/src/app/shared/components/status-badge/status-badge.component.ts @@ -0,0 +1,25 @@ +import { Tag } from 'primeng/tag'; + +import { ChangeDetectionStrategy, Component, input } from '@angular/core'; + +import { RegistryStatus } from '@osf/shared/enums'; + +import { RegistryStatusMap } from './default-statuses'; + +@Component({ + selector: 'osf-status-badge', + imports: [Tag], + templateUrl: './status-badge.component.html', + styleUrl: './status-badge.component.scss', + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class StatusBadgeComponent { + status = input.required(); + get label(): string { + return RegistryStatusMap[this.status()]?.label ?? 'Unknown'; + } + + get severity(): 'info' | 'success' | 'warn' | 'danger' | null { + return RegistryStatusMap[this.status()]?.severity ?? null; + } +} diff --git a/src/app/shared/mappers/registration/registration.mapper.ts b/src/app/shared/mappers/registration/registration.mapper.ts index 8dc7ced0b..850f097ea 100644 --- a/src/app/shared/mappers/registration/registration.mapper.ts +++ b/src/app/shared/mappers/registration/registration.mapper.ts @@ -7,6 +7,8 @@ import { RegistrationModel, } from '@osf/shared/models'; +import { MapRegistryStatus } from '../registry'; + export class RegistrationMapper { static fromDraftRegistrationResponse(response: DraftRegistrationDataJsonApi): DraftRegistrationModel { return { @@ -30,11 +32,13 @@ export class RegistrationMapper { id: response.embeds.branched_from.data.id, title: response.embeds.branched_from.data.attributes.title, filesLink: response.embeds?.branched_from?.data.relationships?.files?.links?.related?.href, + type: response.embeds.branched_from.data.type, } : { id: response.relationships.branched_from?.data?.id || '', title: response.attributes.title, filesLink: response.relationships.branched_from?.links?.related.href + 'files/', + type: response.relationships.branched_from?.data?.type, }, providerId: response.relationships.provider?.data?.id || '', hasProject: !!response.attributes.has_project, @@ -59,6 +63,7 @@ export class RegistrationMapper { dateModified: registration.attributes.datetime_updated, registrationTemplate: registration.embeds?.registration_schema?.data?.attributes?.name || '', registry: registration.embeds?.provider?.data?.attributes?.name || '', + public: registration.attributes.public, contributors: registration.embeds?.bibliographic_contributors?.data.map((contributor) => ({ id: contributor.id, @@ -72,11 +77,14 @@ export class RegistrationMapper { id: registration.id, title: registration.attributes.title, description: registration.attributes.description || '', - status: RegistryStatus.InProgress, // [NM] TODO: map status accordingly + status: MapRegistryStatus(registration.attributes), dateCreated: registration.attributes.datetime_initiated, dateModified: registration.attributes.date_modified, registrationTemplate: registration.embeds?.registration_schema?.data?.attributes?.name || '', registry: registration.embeds?.provider?.data?.attributes?.name || '', + public: registration.attributes.public, + reviewsState: registration.attributes.review_state, + revisionState: registration.attributes.revision_state, contributors: registration.embeds?.bibliographic_contributors?.data.map((contributor) => ({ id: contributor.id, diff --git a/src/app/shared/mappers/registry/map-registry-status.mapper.ts b/src/app/shared/mappers/registry/map-registry-status.mapper.ts index d34b52371..7a91e2720 100644 --- a/src/app/shared/mappers/registry/map-registry-status.mapper.ts +++ b/src/app/shared/mappers/registry/map-registry-status.mapper.ts @@ -1,7 +1,10 @@ import { RegistryOverviewJsonApiAttributes } from '@osf/features/registry/models'; +import { RegistrationAttributesJsonApi } from '@osf/shared/models'; import { RegistrationReviewStates, RegistryStatus, RevisionReviewStates } from '@shared/enums'; -export function MapRegistryStatus(registry: RegistryOverviewJsonApiAttributes): RegistryStatus { +export function MapRegistryStatus( + registry: RegistryOverviewJsonApiAttributes | RegistrationAttributesJsonApi +): RegistryStatus { if (registry.pending_embargo_approval) { return RegistryStatus.PendingEmbargoApproval; } else if (registry.pending_embargo_termination_approval) { diff --git a/src/app/shared/models/index.ts b/src/app/shared/models/index.ts index e7574b81b..f27222a13 100644 --- a/src/app/shared/models/index.ts +++ b/src/app/shared/models/index.ts @@ -30,6 +30,7 @@ export * from './search'; export * from './select-option.model'; export * from './severity.type'; export * from './social-icon.model'; +export * from './status-info.model'; export * from './step-option.model'; export * from './store'; export * from './subject'; diff --git a/src/app/shared/models/registration/registration-card.model.ts b/src/app/shared/models/registration/registration-card.model.ts index 2e3c76f72..bc7bc269a 100644 --- a/src/app/shared/models/registration/registration-card.model.ts +++ b/src/app/shared/models/registration/registration-card.model.ts @@ -1,4 +1,4 @@ -import { RegistryStatus } from '@osf/shared/enums'; +import { RegistrationReviewStates, RegistryStatus, RevisionReviewStates } from '@osf/shared/enums'; import { ContributorModel } from '../contributors'; @@ -13,4 +13,12 @@ export interface RegistrationCard { registrationTemplate: string; registry: string; resources?: Record; + public: boolean | undefined; + reviewsState?: RegistrationReviewStates; + revisionState?: RevisionReviewStates; + hasData?: boolean; + hasAnalyticCode?: boolean; + hasMaterials?: boolean; + hasPapers?: boolean; + hasSupplements?: boolean; } diff --git a/src/app/shared/models/registration/registration-json-api.model.ts b/src/app/shared/models/registration/registration-json-api.model.ts index d9f45be9e..5c935c4a2 100644 --- a/src/app/shared/models/registration/registration-json-api.model.ts +++ b/src/app/shared/models/registration/registration-json-api.model.ts @@ -1,4 +1,5 @@ import { ApiData, MetaJsonApi, PaginationLinksJsonApi } from '@osf/core/models'; +import { RegistrationReviewStates, RevisionReviewStates } from '@osf/shared/enums'; import { LicenseRecordJsonApi } from '@osf/shared/models'; export interface DraftRegistrationResponseJsonApi { @@ -39,6 +40,7 @@ export interface DraftRegistrationAttributesJsonApi { registration_responses: Record; tags: string[]; title: string; + public?: boolean; } export interface RegistrationAttributesJsonApi { @@ -48,7 +50,13 @@ export interface RegistrationAttributesJsonApi { description: string; embargoed: boolean; archiving: boolean; + public: boolean; title: string; + revision_state: RevisionReviewStates; + review_state: RegistrationReviewStates; + pending_registration_approval: boolean; + pending_embargo_approval: boolean; + pending_embargo_termination_approval: boolean; } export interface DraftRegistrationRelationshipsJsonApi { diff --git a/src/app/shared/models/status-info.model.ts b/src/app/shared/models/status-info.model.ts new file mode 100644 index 000000000..e0d2640b4 --- /dev/null +++ b/src/app/shared/models/status-info.model.ts @@ -0,0 +1,4 @@ +export interface StatusInfo { + label: string; + severity: 'info' | 'success' | 'warn' | 'danger' | null; +} diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 50ea68b0b..7634d3bf2 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -2042,6 +2042,7 @@ }, "shared": { "resources": { + "title": "Open resources", "data": "Data", "analyticCode": "Analytic Code", "materials": "Materials", From e4451f9db371cdeb06b28b6a8be83ce3c93bde5e Mon Sep 17 00:00:00 2001 From: NazarMykhalkevych Date: Thu, 24 Jul 2025 10:26:56 +0300 Subject: [PATCH 2/3] feat(registration): resolve pr comments --- .../registration-card.component.html | 9 -------- .../status-badge/default-statuses.ts | 22 +++++++++---------- .../status-badge/status-badge.component.ts | 3 ++- src/app/shared/models/status-info.model.ts | 4 +++- src/assets/i18n/en.json | 13 +++++++++++ 5 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/app/shared/components/registration-card/registration-card.component.html b/src/app/shared/components/registration-card/registration-card.component.html index a0180acfa..093815d1a 100644 --- a/src/app/shared/components/registration-card/registration-card.component.html +++ b/src/app/shared/components/registration-card/registration-card.component.html @@ -11,15 +11,6 @@

{{ registrationData().title || 'project.registrations.card.noTitle' | translate }}

- @if (!isDraft()) { } diff --git a/src/app/shared/components/status-badge/default-statuses.ts b/src/app/shared/components/status-badge/default-statuses.ts index ac25845d7..d3a7ae59e 100644 --- a/src/app/shared/components/status-badge/default-statuses.ts +++ b/src/app/shared/components/status-badge/default-statuses.ts @@ -3,18 +3,18 @@ import { StatusInfo } from '@osf/shared/models'; export const RegistryStatusMap: Record = { [RegistryStatus.None]: { label: '', severity: null }, - [RegistryStatus.PendingRegistrationApproval]: { label: 'Pending registration approval', severity: 'warn' }, - [RegistryStatus.PendingEmbargoApproval]: { label: 'Pending embargo approval', severity: 'warn' }, - [RegistryStatus.Pending]: { label: 'Pending', severity: 'info' }, - [RegistryStatus.Accepted]: { label: 'Accepted', severity: 'success' }, - [RegistryStatus.Embargo]: { label: 'Embargo', severity: 'info' }, + [RegistryStatus.PendingRegistrationApproval]: { label: 'statuses.pendingRegistrationApproval', severity: 'warn' }, + [RegistryStatus.PendingEmbargoApproval]: { label: 'statuses.pendingEmbargoApproval', severity: 'warn' }, + [RegistryStatus.Pending]: { label: 'statuses.pending', severity: 'info' }, + [RegistryStatus.Accepted]: { label: 'statuses.accepted', severity: 'success' }, + [RegistryStatus.Embargo]: { label: 'statuses.embargo', severity: 'info' }, [RegistryStatus.PendingEmbargoTerminationApproval]: { - label: 'Pending embargo termination approval', + label: 'statuses.pendingEmbargoTerminationApproval', severity: 'warn', }, - [RegistryStatus.PendingWithdrawRequest]: { label: 'Pending withdraw request', severity: 'info' }, - [RegistryStatus.PendingWithdraw]: { label: 'Pending withdrawal', severity: 'warn' }, - [RegistryStatus.Unapproved]: { label: 'Unapproved', severity: 'danger' }, - [RegistryStatus.InProgress]: { label: 'In progress', severity: 'info' }, - [RegistryStatus.PendingModeration]: { label: 'Pending moderation', severity: 'warn' }, + [RegistryStatus.PendingWithdrawRequest]: { label: 'statuses.pendingWithdrawRequest', severity: 'info' }, + [RegistryStatus.PendingWithdraw]: { label: 'statuses.pendingWithdraw', severity: 'warn' }, + [RegistryStatus.Unapproved]: { label: 'statuses.unapproved', severity: 'danger' }, + [RegistryStatus.InProgress]: { label: 'statuses.inProgress', severity: 'info' }, + [RegistryStatus.PendingModeration]: { label: 'statuses.pendingModeration', severity: 'warn' }, }; diff --git a/src/app/shared/components/status-badge/status-badge.component.ts b/src/app/shared/components/status-badge/status-badge.component.ts index bef599d8b..0011e61e8 100644 --- a/src/app/shared/components/status-badge/status-badge.component.ts +++ b/src/app/shared/components/status-badge/status-badge.component.ts @@ -3,6 +3,7 @@ import { Tag } from 'primeng/tag'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; import { RegistryStatus } from '@osf/shared/enums'; +import { SeverityType } from '@osf/shared/models'; import { RegistryStatusMap } from './default-statuses'; @@ -19,7 +20,7 @@ export class StatusBadgeComponent { return RegistryStatusMap[this.status()]?.label ?? 'Unknown'; } - get severity(): 'info' | 'success' | 'warn' | 'danger' | null { + get severity(): SeverityType | null { return RegistryStatusMap[this.status()]?.severity ?? null; } } diff --git a/src/app/shared/models/status-info.model.ts b/src/app/shared/models/status-info.model.ts index e0d2640b4..2e38b4b2e 100644 --- a/src/app/shared/models/status-info.model.ts +++ b/src/app/shared/models/status-info.model.ts @@ -1,4 +1,6 @@ +import { SeverityType } from './severity.type'; + export interface StatusInfo { label: string; - severity: 'info' | 'success' | 'warn' | 'danger' | null; + severity: SeverityType | null; } diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 7634d3bf2..7fefa4efa 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -2068,6 +2068,19 @@ "files": { "limitText": "You may attach up to 5 file(s) to this question. Files cannot total over 5GB in size.", "description": "Uploaded files will automatically be archived in this registration. They will also be added to a related project that will be created for this registration." + }, + "statuses": { + "pendingRegistrationApproval": "Pending registration approval", + "pendingEmbargoApproval": "Pending embargo approval", + "pending": "Pending", + "accepted": "Accepted", + "embargo": "Embargo", + "pendingEmbargoTerminationApproval": "Pending embargo termination approval", + "pendingWithdrawRequest": "Pending withdraw request", + "pendingWithdraw": "Pending withdrawal", + "unapproved": "Unapproved", + "inProgress": "In progress", + "pendingModeration": "Pending moderation" } }, "resourceCard": { From c3ab445e83394c8edd96f18964960d37421e2c02 Mon Sep 17 00:00:00 2001 From: NazarMykhalkevych Date: Thu, 24 Jul 2025 10:49:30 +0300 Subject: [PATCH 3/3] feat(registration): update submit registration --- .../confirm-registration-dialog.component.ts | 2 +- src/app/shared/mappers/registration/registration.mapper.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/features/registries/components/confirm-registration-dialog/confirm-registration-dialog.component.ts b/src/app/features/registries/components/confirm-registration-dialog/confirm-registration-dialog.component.ts index f9989faba..59fcd1abf 100644 --- a/src/app/features/registries/components/confirm-registration-dialog/confirm-registration-dialog.component.ts +++ b/src/app/features/registries/components/confirm-registration-dialog/confirm-registration-dialog.component.ts @@ -61,7 +61,7 @@ export class ConfirmRegistrationDialogComponent { } submit(): void { - const embargoDate = new Date(this.form.value.embargoDate).toISOString(); + const embargoDate = this.form.value.embargoDate ? new Date(this.form.value.embargoDate)?.toISOString() : ''; this.actions .registerDraft( this.config.data.draftId, diff --git a/src/app/shared/mappers/registration/registration.mapper.ts b/src/app/shared/mappers/registration/registration.mapper.ts index 850f097ea..03db16567 100644 --- a/src/app/shared/mappers/registration/registration.mapper.ts +++ b/src/app/shared/mappers/registration/registration.mapper.ts @@ -104,7 +104,7 @@ export class RegistrationMapper { data: { type: 'registrations', attributes: { - embargo_end_date: embargoDate, + embargo_end_date: embargoDate || null, draft_registration: draftId, included_node_ids: components, },