Skip to content

Commit

Permalink
PER-8903
Browse files Browse the repository at this point in the history
Removed duplicate group entry + changed from family to group when creating a new archive
  • Loading branch information
crisnicandrei committed Feb 29, 2024
1 parent b5a463f commit f7073e6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export class PublicSettingsComponent implements OnInit {

public archiveTypes: { value: string; name: string }[] = [
{ value: 'type.archive.group', name: 'Group' },
{ value: 'type.archive.family', name: 'Group' },
{
value: 'type.archive.organization',
name: 'Organization',
Expand Down
23 changes: 4 additions & 19 deletions src/app/onboarding/shared/onboarding-screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,33 +110,18 @@ export const archiveOptions = [
text: 'An individual',
type: OnboardingTypes.individual,
},
// {
// value: 'type.archive.group',
// text: 'My family in the present',
// type: OnboardingTypes.family,
// },
// {
// value: 'type.archive.group',
// text: "My family's history",
// type: OnboardingTypes.famhist,
// },
// {
// value: 'type.archive.group',
// text: "A community I'm part of",
// type: OnboardingTypes.community,
// },
{
value: 'type.archive.family',
{
value: 'type.archive.group',
text: 'My family in the present',
type: OnboardingTypes.family,
},
{
value: 'type.archive.family',
value: 'type.archive.group',
text: "My family's history",
type: OnboardingTypes.famhist,
},
{
value: 'type.archive.family',
value: 'type.archive.group',
text: "A community I'm part of",
type: OnboardingTypes.community,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
import {
Component,
ElementRef,
EventEmitter,
Input,
OnInit,
Output,
ViewChild,
} from '@angular/core';
import { ArchiveVO, ArchiveType } from '@models/archive-vo';
import { ApiService } from '@shared/services/api/api.service';
import { RELATION_OPTIONS } from '@shared/services/prompt/prompt.service';
Expand All @@ -9,29 +17,25 @@ export interface ArchiveFormData {
relationType?: string;
}

const ARCHIVE_TYPES: { text: string, value: ArchiveType }[] = [
const ARCHIVE_TYPES: { text: string; value: ArchiveType }[] = [
{
text: 'Person',
value: 'type.archive.person'
value: 'type.archive.person',
},
// {
// text: 'Group',
// value: 'type.archive.group'
// },
{
text: 'Group',
value: 'type.archive.family'
value: 'type.archive.group',
},
{
text: 'Organization',
value: 'type.archive.organization'
value: 'type.archive.organization',
},
];

@Component({
selector: 'pr-new-archive-form',
templateUrl: './new-archive-form.component.html',
styleUrls: ['./new-archive-form.component.scss']
styleUrls: ['./new-archive-form.component.scss'],
})
export class NewArchiveFormComponent implements OnInit {
@Input() showRelations: boolean = false;
Expand All @@ -43,21 +47,21 @@ export class NewArchiveFormComponent implements OnInit {
public waiting: boolean = false;
public formData: ArchiveFormData;

constructor(
private api: ApiService,
) {
constructor(private api: ApiService) {
this.formData = {
fullName: '',
type: null,
relationType: null,
};
}

ngOnInit(): void {
}
ngOnInit(): void {}

public isFormValid() {
return this.fullNameRef?.nativeElement.validity.valid && this.formData.type !== null;
return (
this.fullNameRef?.nativeElement.validity.valid &&
this.formData.type !== null
);
}

public async onSubmit() {
Expand All @@ -66,7 +70,9 @@ export class NewArchiveFormComponent implements OnInit {
}
try {
this.waiting = true;
const response = await this.api.archive.create(new ArchiveVO(this.formData));
const response = await this.api.archive.create(
new ArchiveVO(this.formData)
);
const newArchive = response.getArchiveVO();
this.success.emit(newArchive);
} catch (err) {
Expand All @@ -75,5 +81,4 @@ export class NewArchiveFormComponent implements OnInit {
this.waiting = false;
}
}

}

0 comments on commit f7073e6

Please sign in to comment.