Skip to content
Snippets Groups Projects
Commit 0768e8e4 authored by Niklas Knagenhielm-Karlsson's avatar Niklas Knagenhielm-Karlsson
Browse files

Buttons are hidden when avslutade. Not unit tested

parent 02db9f9d
1 merge request!238Buttons hidden when project is finalized
......@@ -103,10 +103,6 @@
<h1>Sista steget</h1>
<p>Agera-steget är det sista steget i modellen. Du kan nu avsluta projektet eller låta förbättringsarbetet gå ienom en till iteration avd PGDA.</p>
</article>
<button id="toCurrentProjects" data-project-id="${this.id}" class="btn btn-primary" role="button">Avsluta förbättringsarbete</button>
<button id="toCurrentProjects" data-project-id="${this.id}" class="btn btn-primary" role="button">En till iteration</button>
</div>
<div style="width: 25%;">
<div class="sideTitle">Dokument</div>
......
......@@ -47,9 +47,7 @@ export async function loadPage (projectId : string) {
const target = event.target as HTMLElement; // Type assertion
const pdfInput = document.getElementById('pdfInput') as HTMLInputElement;
const pdfLinkContainer = document.getElementById('pdfLink');
if (target.id === 'toCurrentProjects') {
checkInputFields(projectId, "formPageA");
} else if(target.id === 'nolansToP'){
if(target.id === 'nolansToP'){
loadProjectPageP(projectId);
} else if(target.id === 'nolansToG'){
loadProjectPageG(projectId);
......@@ -139,6 +137,7 @@ async function loadImprovementWorkDataPageA(projectId:string) {
}
}
loadProjectHeader(improvementWork);
loadInitiateAndFinalizeBtn(projectId, improvementWork.completed);
}
......@@ -187,4 +186,30 @@ async function checkInputFields(projectId: string, formId: string) {
}
}
function loadInitiateAndFinalizeBtn(projectId : string, completed : boolean) {
const nolanModelElement = document.getElementById("NolansModel") as HTMLElement;
//Creates buttons with classname, id, attribute and text
const finalizeButton = document.createElement("button");
const iterationButton = document.createElement("button");
if (nolanModelElement) {
finalizeButton.id = "toCurrentProjects";
iterationButton.id = "toCurrentProjects";
finalizeButton.classList.add("btn", "btn-primary");
iterationButton.classList.add("btn", "btn-primary");
iterationButton.setAttribute('role', 'button');
finalizeButton.setAttribute('role', 'button');
finalizeButton.textContent = 'Avsluta Förbättringsarbete';
iterationButton.textContent = 'En till iteration';
}
//Append buttons to html
nolanModelElement.append(iterationButton);
nolanModelElement.append(finalizeButton);
//Eventlistener for button
finalizeButton.addEventListener('click', function() {
checkInputFields(projectId, "formPageA");;
});
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment