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

Merge branch 'HideFinalizeIterationBtns' into 'dev'

Buttons hidden when project is finalized

See merge request !238
parents 20996efe 763525ff
No related branches found
No related tags found
1 merge request!238Buttons hidden when project is finalized
Pipeline #113197 passed
...@@ -104,10 +104,6 @@ ...@@ -104,10 +104,6 @@
<h1>Sista steget</h1> <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> <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> </article>
<button id="toCurrentProjects" data-project-id="${this.id}" class="btn btn-secondary" role="button">Avsluta förbättringsarbete</button>
<button id="toCurrentProjects" data-project-id="${this.id}" class="btn btn-secondary" role="button">En till iteration</button>
</div> </div>
<div style="width: 25%;"> <div style="width: 25%;">
<div class="sideTitle">Dokument</div> <div class="sideTitle">Dokument</div>
......
...@@ -47,9 +47,7 @@ export async function loadPage (projectId : string) { ...@@ -47,9 +47,7 @@ export async function loadPage (projectId : string) {
const target = event.target as HTMLElement; // Type assertion const target = event.target as HTMLElement; // Type assertion
const pdfInput = document.getElementById('pdfInput') as HTMLInputElement; const pdfInput = document.getElementById('pdfInput') as HTMLInputElement;
const pdfLinkContainer = document.getElementById('pdfLink'); const pdfLinkContainer = document.getElementById('pdfLink');
if (target.id === 'toCurrentProjects') { if(target.id === 'nolansToP'){
checkInputFields(projectId, "formPageA");
} else if(target.id === 'nolansToP'){
loadProjectPageP(projectId); loadProjectPageP(projectId);
} else if(target.id === 'nolansToG'){ } else if(target.id === 'nolansToG'){
loadProjectPageG(projectId); loadProjectPageG(projectId);
...@@ -139,6 +137,7 @@ async function loadImprovementWorkDataPageA(projectId:string) { ...@@ -139,6 +137,7 @@ async function loadImprovementWorkDataPageA(projectId:string) {
} }
} }
loadProjectHeader(improvementWork); loadProjectHeader(improvementWork);
loadInitiateAndFinalizeBtn(projectId, improvementWork.completed);
} }
...@@ -187,4 +186,35 @@ async function checkInputFields(projectId: string, formId: string) { ...@@ -187,4 +186,35 @@ async function checkInputFields(projectId: string, formId: string) {
} }
} }
function loadInitiateAndFinalizeBtn(projectId : string, completed : boolean) {
alert("hej");
if(!completed) {
alert("not completed");
const nolanModelElement = document.getElementById("projectPageNolandsModel") as HTMLElement;
//Creates buttons with classname, id, attribute and text
const finalizeButton = document.createElement("button");
const iterationButton = document.createElement("button");
if (nolanModelElement) {
alert("finds element");
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.
Finish editing this message first!
Please register or to comment