diff --git a/src/app/record/components/work-modal/work-modal.component.html b/src/app/record/components/work-modal/work-modal.component.html index 536be11345..7cf762a86d 100644 --- a/src/app/record/components/work-modal/work-modal.component.html +++ b/src/app/record/components/work-modal/work-modal.component.html @@ -304,10 +304,10 @@ > Year - {{ year.value }} + {{ year}} @@ -324,10 +324,10 @@ > Month - {{ month.value }} + {{ month }} @@ -344,10 +344,10 @@ > Day - {{ day.value }} + {{ day }} diff --git a/src/app/record/components/work-modal/work-modal.component.ts b/src/app/record/components/work-modal/work-modal.component.ts index 0d2fd6f5cd..29659ccb13 100644 --- a/src/app/record/components/work-modal/work-modal.component.ts +++ b/src/app/record/components/work-modal/work-modal.component.ts @@ -1,14 +1,7 @@ import { Component, Inject, OnInit } from '@angular/core' -import { - AbstractControl, - AsyncValidatorFn, - FormArray, - FormBuilder, - FormGroup, - Validators, -} from '@angular/forms' +import { AbstractControl, AsyncValidatorFn, FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms' import { first, map, startWith } from 'rxjs/operators' -import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog' +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog' import { Observable } from 'rxjs' import { ModalComponent } from 'src/app/cdk/modal/modal/modal.component' import { PlatformInfo, PlatformInfoService } from 'src/app/cdk/platform-info' @@ -23,20 +16,17 @@ import { Work } from 'src/app/types/record-works.endpoint' import { UserRecord } from 'src/app/types/record.local' import { CitationTypes, - DayOption, LanguageMap, - MonthOption, WorkCategories, - WorksTitleName, WorkConferenceTypes, WorkIdType, WorkIntellectualPropertyTypes, WorkOtherOutputTypes, WorkPublicationTypes, WorkRelationships, + WorksTitleName, WorkTypesByCategory, WorkTypesTitle, - YearOption, } from 'src/app/types/works.endpoint' @Component({ @@ -57,9 +47,20 @@ export class WorkModalComponent implements OnInit { languageMap = LanguageMap workCategories = WorkCategories - yearOptions = YearOption - monthOptions = MonthOption - dayOptions = DayOption + yearOptions = Array(110) + .fill(0) + .map((i, idx) => idx + new Date().getFullYear() - 109) + .reverse() + yearsEndDate = Array(120) + .fill(0) + .map((i, idx) => idx + new Date().getFullYear() - 109) + .reverse() + monthOptions = Array(12) + .fill(0) + .map((i, idx) => idx + 1) + dayOptions = Array(31) + .fill(0) + .map((i, idx) => idx + 1) citationTypes = CitationTypes workRelationships: WorkRelationships[] = Object.keys( diff --git a/src/app/types/works.endpoint.ts b/src/app/types/works.endpoint.ts index dda3d16c12..52c5237418 100644 --- a/src/app/types/works.endpoint.ts +++ b/src/app/types/works.endpoint.ts @@ -407,176 +407,6 @@ export const LanguageMap = { Yoruba: 'yo', } -export const YearOption = { - 2031: '2031', - 2030: '2030', - 2029: '2029', - 2028: '2028', - 2027: '2027', - 2026: '2026', - 2025: '2025', - 2024: '2024', - 2023: '2023', - 2022: '2022', - 2021: '2021', - 2020: '2020', - 2019: '2019', - 2018: '2018', - 2017: '2017', - 2016: '2016', - 2015: '2015', - 2014: '2014', - 2013: '2013', - 2012: '2012', - 2011: '2011', - 2010: '2010', - 2009: '2009', - 2008: '2008', - 2007: '2007', - 2006: '2006', - 2005: '2005', - 2004: '2004', - 2003: '2003', - 2002: '2002', - 2001: '2001', - 2000: '2000', - 1999: '1999', - 1998: '1998', - 1997: '1997', - 1996: '1996', - 1995: '1995', - 1994: '1994', - 1993: '1993', - 1992: '1992', - 1991: '1991', - 1990: '1990', - 1989: '1989', - 1988: '1988', - 1987: '1987', - 1986: '1986', - 1985: '1985', - 1984: '1984', - 1983: '1983', - 1982: '1982', - 1981: '1981', - 1980: '1980', - 1979: '1979', - 1978: '1978', - 1977: '1977', - 1976: '1976', - 1975: '1975', - 1974: '1974', - 1973: '1973', - 1972: '1972', - 1971: '1971', - 1970: '1970', - 1969: '1969', - 1968: '1968', - 1967: '1967', - 1966: '1966', - 1965: '1965', - 1964: '1964', - 1963: '1963', - 1962: '1962', - 1961: '1961', - 1960: '1960', - 1959: '1959', - 1958: '1958', - 1957: '1957', - 1956: '1956', - 1955: '1955', - 1954: '1954', - 1953: '1953', - 1952: '1952', - 1951: '1951', - 1950: '1950', - 1949: '1949', - 1948: '1948', - 1947: '1947', - 1946: '1946', - 1945: '1945', - 1944: '1944', - 1943: '1943', - 1942: '1942', - 1941: '1941', - 1940: '1940', - 1939: '1939', - 1938: '1938', - 1937: '1937', - 1936: '1936', - 1935: '1935', - 1934: '1934', - 1933: '1933', - 1932: '1932', - 1931: '1931', - 1930: '1930', - 1929: '1929', - 1928: '1928', - 1927: '1927', - 1926: '1926', - 1925: '1925', - 1924: '1924', - 1923: '1923', - 1922: '1922', - 1921: '1921', - 1920: '1920', - 1919: '1919', - 1918: '1918', - 1917: '1917', - 1916: '1916', - 1915: '1915', - 1914: '1914', - 1913: '1913', -} -export const MonthOption = { - '01': '01', - '02': '02', - '03': '03', - '04': '04', - '05': '05', - '06': '06', - '07': '07', - '08': '08', - '09': '09', - 10: '10', - 11: '11', - 12: '12', -} - -export const DayOption = { - '01': '01', - '02': '02', - '03': '03', - '04': '04', - '05': '05', - '06': '06', - '07': '07', - '08': '08', - '09': '09', - 10: '10', - 11: '11', - 12: '12', - 13: '13', - 14: '14', - 15: '15', - 16: '16', - 17: '17', - 18: '18', - 19: '19', - 20: '20', - 21: '21', - 22: '22', - 23: '23', - 24: '24', - 25: '25', - 26: '26', - 27: '27', - 28: '28', - 29: '29', - 30: '30', - 31: '31', -} - export const CitationTypes = { 'formatted-apa': 'APA', bibtex: 'BIBTEX',