2020-04-20 11:14:46 +02:00
|
|
|
import { TaskCategory, CategoryID } from "./task";
|
2020-04-21 18:44:10 +02:00
|
|
|
import { Project } from "./project";
|
2020-04-20 11:14:46 +02:00
|
|
|
|
|
|
|
export interface TaskCategoriesIndex {
|
|
|
|
[id: string]: TaskCategory
|
|
|
|
}
|
|
|
|
|
2020-04-21 18:44:10 +02:00
|
|
|
export interface TimeUnit {
|
|
|
|
label: string
|
|
|
|
acronym: string
|
|
|
|
}
|
|
|
|
|
2020-04-20 11:14:46 +02:00
|
|
|
export interface Params {
|
|
|
|
taskCategories: TaskCategoriesIndex
|
2020-04-21 18:44:10 +02:00
|
|
|
timeUnit: TimeUnit
|
|
|
|
currency: string
|
|
|
|
roundUpEstimations: boolean
|
2020-04-20 11:14:46 +02:00
|
|
|
}
|
|
|
|
|
2020-04-21 18:44:10 +02:00
|
|
|
export const defaults = {
|
|
|
|
taskCategories: {
|
|
|
|
"7e92266f-0a7b-4728-8322-5fe05ff3b929": {
|
|
|
|
id: "7e92266f-0a7b-4728-8322-5fe05ff3b929",
|
|
|
|
label: "Développement",
|
|
|
|
costPerTimeUnit: 500,
|
|
|
|
},
|
|
|
|
"508a0925-a664-4426-8d40-6974156f0f00": {
|
|
|
|
id: "508a0925-a664-4426-8d40-6974156f0f00",
|
|
|
|
label: "Conduite de projet",
|
|
|
|
costPerTimeUnit: 500,
|
|
|
|
},
|
|
|
|
"7aab4d66-072e-4cc8-aae8-b62edd3237a8": {
|
|
|
|
id: "7aab4d66-072e-4cc8-aae8-b62edd3237a8",
|
|
|
|
label: "Recette",
|
|
|
|
costPerTimeUnit: 500,
|
|
|
|
},
|
2020-04-20 11:14:46 +02:00
|
|
|
},
|
2020-04-21 18:44:10 +02:00
|
|
|
timeUnit: {
|
|
|
|
label: "jour/homme",
|
|
|
|
acronym: "j/h",
|
2020-04-20 11:14:46 +02:00
|
|
|
},
|
2020-04-21 18:44:10 +02:00
|
|
|
roundUpEstimations: true,
|
|
|
|
currency: "€ H.T.",
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getTimeUnit(project: Project): TimeUnit {
|
|
|
|
return project.params.timeUnit ? project.params.timeUnit : defaults.timeUnit;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getRoundUpEstimations(project: Project): boolean {
|
|
|
|
return project.params.hasOwnProperty("roundUpEstimations") ? project.params.roundUpEstimations : defaults.roundUpEstimations;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getCurrency(project: Project): string {
|
|
|
|
return project.params.currency ? project.params.currency : defaults.currency;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getTaskCategories(project: Project): TaskCategoriesIndex {
|
|
|
|
return project.params.taskCategories ? project.params.taskCategories : defaults.taskCategories;
|
|
|
|
}
|