From dff7e07b1c8a68796d606c938bc1ba70d61b4f73 Mon Sep 17 00:00:00 2001 From: Ben De Meurichy Date: Tue, 21 May 2024 21:21:48 +0200 Subject: [PATCH] alles addchange assignment pagina aangepast + restrictie ui duidelijker gemaakt --- .../frontend/src/components/WarningPopup.tsx | 14 +- frontend/frontend/src/i18n/en.ts | 12 +- frontend/frontend/src/i18n/nl.ts | 12 +- .../AddChangeAssignmentPage.tsx | 191 +++++++++------ .../AddRestrictionButton.tsx | 30 +-- .../RestrictionTemplateUI.tsx | 19 +- .../RestrictionsDialog.tsx | 228 ++++++++++++++---- 7 files changed, 353 insertions(+), 153 deletions(-) diff --git a/frontend/frontend/src/components/WarningPopup.tsx b/frontend/frontend/src/components/WarningPopup.tsx index a173b971..cd55c52d 100644 --- a/frontend/frontend/src/components/WarningPopup.tsx +++ b/frontend/frontend/src/components/WarningPopup.tsx @@ -1,4 +1,4 @@ -import { Button } from './CustomComponents' +import { Button, SecondaryButton } from './CustomComponents' import { DialogActions, DialogContent, @@ -43,12 +43,18 @@ export default function WarningPopup({ <> {/* Warning popup dialog */} - {title} + + {title} + - {content} + + {content} + - + + {t('cancel')} + {/* Action button */} + + + + + + { + const response = await instance.get( + `/templates/${template.template_id}/template/?content=true` + ) + // This textFieldContent will be used when a template is opened in textmode + setTextFieldContent( + response.data.content + ) + + // The code will be used when a template is opened in the UI + setCode(response.data.content) + + const templatename = + template.bestand + .replace(/^.*[\\/]/, '') + .split('.')[0] + const templateextension = + '.' + + template.bestand.split('.')[1] + setRestrictionName(templatename) + setRestrictionType( + templateextension as restrictionExtension + ) + handleClickOpenTemplateInterface() + }} + > + + + + + { + const response = await instance.get( + `/templates/${template.template_id}/template/?content=true` + ) + // This textFieldContent will be used when a template is opened in textmode + setTextFieldContent( + response.data.content + ) + + // The code will be used when a template is opened in the UI + setCode(response.data.content) + + const templatename = + template.bestand + .replace(/^.*[\\/]/, '') + .split('.')[0] + const templateextension = + '.' + + template.bestand.split('.')[1] + setRestrictionName(templatename) + setRestrictionType( + templateextension as restrictionExtension + ) + handleClickOpenTextEditor() + }} + > + + + + ))} - + - - {/* This box will contain the templates */} - - {t('open_with_ui') + ':'} - - setOpenTemplateInUI(!openTemplateInUI)} - /> - {/* This is the template interface. */} + + {saveAlert && ( + + + {t('template_saved_successfully')} + + + )} + + {saveErrorAlert && ( + + + {t('error') + ' ' + t('try_again')} + + + )} +