web: EntryProposal form implementation.

This commit is contained in:
2021-10-26 01:46:59 -05:00
parent e055bee0f3
commit 3675c6054a
32 changed files with 705 additions and 203 deletions

View File

@ -0,0 +1,46 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { default as dayjs } from 'dayjs';
interface MutableEventProposalModel {
name: string;
description: string;
purpose: string;
department: string;
location: string;
owner: string;
date: Date;
budgetInDollars: number;
}
interface MutableEventProposalConfig {
departments: Array<{
value: string;
color: string;
}>;
}
export type EventProposalModel = Readonly<MutableEventProposalModel>;
export type EventProposalConfig = Readonly<MutableEventProposalConfig>;
// eslint-disable-next-line
export function eventProposalConfigFromDTO(dto: any): EventProposalConfig {
const { departments } = dto;
return { departments };
}
export function eventProposalModelToDTO(ep: EventProposalModel): any {
return { ...ep, date: dayjs(ep.date).format() };
}
export function newEventProposal(): EventProposalModel {
return {
name: '',
description: '',
purpose: '',
department: '',
location: '',
owner: '',
date: new Date(),
budgetInDollars: 0,
};
}