Skip to content

Commit

Permalink
Eindklant functioneel.
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHub committed Dec 26, 2024
1 parent 867c72b commit 4800d64
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
16 changes: 12 additions & 4 deletions frontend/src/components/project/EditProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {StickyFooter} from '../controls/other/StickyFooter';
import {BusyButton} from '../controls/form-controls/BusyButton';
import {IProjectModel, ProjectClientInvoiceLine} from './models/IProjectModel';
import {projectFormConfig} from './models/ProjectFormConfig';
import {getNewProject} from './models/getNewProject';
import {getNewProject, getNewProjectEndCustomer} from './models/getNewProject';
import {ConfacState} from '../../reducers/app-state';
import {getDefaultProjectMonthConfig} from './models/ProjectMonthModel';
import {useDocumentTitle} from '../hooks/useDocumentTitle';
Expand Down Expand Up @@ -83,10 +83,18 @@ export const EditProject = () => {
setProject(newProject);
}



const setProjectInterceptor = (value: IProjectModel) => {

const newProject = {...project, ...value};

if(!newProject.forEndCustomer && newProject.endCustomer) {
newProject.endCustomer = null;
}

if(newProject.forEndCustomer && !newProject.endCustomer) {
newProject.endCustomer = getNewProjectEndCustomer();
}

setProject(newProject);

// Set a flag to update fields that receive default values from the
Expand Down Expand Up @@ -120,7 +128,7 @@ export const EditProject = () => {
</Col>
</Row>
<Form>
<Row>
<Row>
<ArrayInput
config={projectFormConfig}
model={project}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ const endCustomerConfig: FullFormConfig = [
];

export const EditProjectEndCustomer = ({value, onChange} : EditProjectEndCustomerProps ) => {
const projectEndCustomer : ProjectEndCustomerModel = value || getNewProjectEndCustomer();
console.log("loading cmp");
const projectEndCustomer : ProjectEndCustomerModel | undefined | null = value;

if(!projectEndCustomer){
return null;
}

return <ArrayInput config={endCustomerConfig} model={projectEndCustomer} onChange={onChange} tPrefix="project.endCustomer." />;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const projectFormConfig: FullFormConfig = [
{key: 'projectMonthConfig.inboundInvoice', component: 'switch'},
{key: 'projectMonthConfig.changingOrderNr', component: 'switch'},
{key: 'client.advancedInvoicing', component: 'switch'},
{key: 'projectMonthConfig.forEndCustomer', component: 'switch'},
{key: 'forEndCustomer', component: 'switch'},

{title: 'client.notes'},
{key: 'notes', label: '', component: 'TextEditor', cols: 12},
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/trans.en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ export const trans = {
consultantType: 'Type',
startDate: 'Start date',
endDate: 'End date',
forEndCustomer: 'Project is at end customer',
deleteConfirm: {
title: 'Delete project',
content: 'Project will be permanently deleted.',
Expand Down Expand Up @@ -483,8 +484,7 @@ export const trans = {
titleConfig: 'Monthly invoicing',
timesheetCheck: 'Timesheets: Check report',
inboundInvoice: 'Has inbound invoice',
changingOrderNr: 'Order nr changes for each invocie',
forEndCustomer: 'Project is at end customer'
changingOrderNr: 'Order nr changes for each invocie'
},
copy: {
buttonText: 'Verlenging',
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/trans.nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ export const trans = {
consultantType: 'Type',
startDate: 'Start datum',
endDate: 'Eind datum',
forEndCustomer: 'Project is bij eindklant',
deleteConfirm: {
title: 'Project verwijderen',
content: 'Project wordt definitief verwijderd.',
Expand Down Expand Up @@ -483,8 +484,7 @@ export const trans = {
titleConfig: 'Maandelijkse facturatie',
timesheetCheck: 'Timesheets: SDWorx rapport check',
inboundInvoice: 'Heeft inkomende factuur',
changingOrderNr: 'Het bestelbon nr wijzigt voor elke factuur',
forEndCustomer: 'Project is bij eindklant'
changingOrderNr: 'Het bestelbon nr wijzigt voor elke factuur'
},
copy: {
buttonText: 'Verlenging',
Expand Down

0 comments on commit 4800d64

Please sign in to comment.