Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
ColsPresent = List.Intersect({TwoOptionCols, Table.ColumnNames(Prev)}),
Transformers = List.Transform(ColsPresent, each {_, each NormalizeTwoOption(_), Int64.Type}),
FixedBools = Table.TransformColumns(Prev, Transformers),
WithAdminTask = Table.AddColumn(FixedBools, "cr69a_admingovernancetasklist", each 971270009, Int64.Type),
WithAdminTask = Table.AddColumn(FixedBools, "new_admingovernanceprocessstep", each 971270009, Int64.Type),
// Normalize Yes/No to logical true/false (nullable)
NormalizeYesNo = (v as any) as nullable logical =>
if Value.Is(v, type logical) then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down Expand Up @@ -26,7 +26,8 @@
font-weight: 400;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.15s ease-in-out,
transition:
background-color 0.15s ease-in-out,
border-color 0.15s ease-in-out;
}
.btn-primary:hover {
Expand Down Expand Up @@ -84,6 +85,9 @@
const DRAFT_STATE = 971270000;
const REQUEST_STATUS = "cr69a_status";

const ADMIN_GOV_TASK_LIST_STEP_FIELD = "new_admingovernanceprocessstep";
const INTAKE_REQUEST_REVIEW = 971270000;

function shouldShowSuccessOnLoad() {
const form = getParentForm();
if (!form) return false;
Expand All @@ -99,7 +103,7 @@
function initBannerFromFields() {
if (shouldShowSuccessOnLoad()) {
showSuccess(
"System Intake Draft successfully submitted. Waiting for feedback."
"System Intake Draft successfully submitted. Waiting for feedback.",
);
}
}
Expand All @@ -120,6 +124,13 @@
}
statusAttr.setValue(971270002);

const taskListStep = getAttr(form, ADMIN_GOV_TASK_LIST_STEP_FIELD);
if (!taskListStep) {
console.error("Could not access Form Status field.");
return;
}
taskListStep.setValue(INTAKE_REQUEST_REVIEW);

// 2) Set Ready For Review
const rfr = form.getAttribute("cr69a_readyforreview");
if (!rfr) {
Expand All @@ -135,20 +146,21 @@
parent.lockAllFields(form);
} else {
console.warn(
"lockAllFields function not found on parent window"
"lockAllFields function not found on parent window",
);
}
taskListStep.fireOnChange();
// notify("System Intake Form successfully submitted.", "success");
showSuccess(
"System Intake Draft successfully submitted. Waiting for feedback."
"System Intake Draft successfully submitted. Waiting for feedback.",
);
},
function (err) {
console.error(
"Save failed:",
err && err.message ? err.message : err
err && err.message ? err.message : err,
);
}
},
);
} catch (e) {
console.error("Unexpected error during submit:", e);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand All @@ -23,7 +23,8 @@
font-weight: 400;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.15s ease-in-out,
transition:
background-color 0.15s ease-in-out,
border-color 0.15s ease-in-out;
}
.get-started-button {
Expand All @@ -39,7 +40,7 @@
};

const FIELD_HIDE_GOV_PROCESS = "cr69a_hidegovernanceprocess";
const ADMIN_GOV_TASK_LIST_STEP_FIELD = "cr69a_admingovernancetasklist";
const ADMIN_GOV_TASK_LIST_STEP_FIELD = "new_admingovernanceprocessstep";

function showError(message) {
if (parent?.Xrm?.Navigation) {
Expand All @@ -58,22 +59,22 @@

const hideField = formContext.getAttribute(FIELD_HIDE_GOV_PROCESS);
const stepField = formContext.getAttribute(
ADMIN_GOV_TASK_LIST_STEP_FIELD
ADMIN_GOV_TASK_LIST_STEP_FIELD,
);

if (!hideField)
return showError(
`Field not found on form: ${FIELD_HIDE_GOV_PROCESS}`
`Field not found on form: ${FIELD_HIDE_GOV_PROCESS}`,
);
if (!stepField)
return showError(
`Field not found on form: ${ADMIN_GOV_TASK_LIST_STEP_FIELD}`
`Field not found on form: ${ADMIN_GOV_TASK_LIST_STEP_FIELD}`,
);

hideField.setValue(true);
stepField.setValue(BPF_STAGES.DRAFT);
stepField.fireOnChange();
} catch (err) {
console.error("Error: ", err);
showError(err?.message || String(err));
}
}
Expand Down
166 changes: 166 additions & 0 deletions apps/it-governance/web-resources/html/intake-upload-files.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Upload Documents</title>
<style>
/* Base */
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
font-size: 14px;
line-height: 1.428571429;
color: #323130;
background-color: #faf9f8;
margin: 0;
padding: 20px;
}

/* Upload container */
.upload-container {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
padding: 20px;
background-color: #ffffff;
border: 2px dashed #d2d0ce;
border-radius: 8px;
transition: border-color 0.2s ease;
}

.upload-container:hover {
border-color: #0078d4;
}

/* Upload icon */
.upload-icon {
width: 48px;
height: 48px;
margin-bottom: 16px;
opacity: 0.7;
}

/* Upload text */
.upload-text {
margin-bottom: 20px;
color: #605e5c;
font-size: 16px;
}

/* Primary button */
.btn-primary {
background-color: #0078d4;
border: 1px solid #0078d4;
color: #ffffff;
padding: 12px 24px;
border-radius: 4px;
cursor: pointer;
transition: all 0.15s ease-in-out;
min-width: 140px;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
}

.btn-primary:hover {
background-color: #106ebe;
border-color: #106ebe;
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(0, 120, 212, 0.2);
}

.btn-primary:active {
transform: translateY(0);
box-shadow: 0 2px 4px rgba(0, 120, 212, 0.2);
}

.btn-primary:focus {
outline: 2px solid #ffffff;
outline-offset: 2px;
box-shadow: 0 0 0 4px rgba(0, 120, 212, 0.3);
}

/* Button icon */
.btn-icon {
width: 16px;
height: 16px;
}
</style>
<script>
function getParentForm() {
return parent && parent.Xrm && parent.Xrm.Page ? parent.Xrm.Page : null;
}

function uploadFiles() {
try {
const form = getParentForm();
if (!form) {
console.error("Could not access parent form context.");
return;
}

// TODO: Call your command bar function
console.log("Open the Custom Upload app!");

// Example of calling command bar function:
// if (parent.openDocumentUpload) {
// parent.openDocumentUpload(form);
// }
} catch (e) {
console.error("Unexpected error during upload:", e);
}
}
</script>
</head>
<body>
<div class="upload-container">
<!-- Upload Icon (Cloud Upload SVG) -->
<svg
class="upload-icon"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M12 15L12 2M12 2L9 5M12 2L15 5"
stroke="#0078d4"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M7 8C4.79086 8 3 9.79086 3 12C3 14.2091 4.79086 16 7 16H8"
stroke="#605e5c"
stroke-width="1.5"
stroke-linecap="round"
/>
<path
d="M17 8C19.2091 8 21 9.79086 21 12C21 14.2091 19.2091 16 17 16H16"
stroke="#605e5c"
stroke-width="1.5"
stroke-linecap="round"
/>
<path
d="M8 22H16C18.2091 22 20 20.2091 20 18"
stroke="#605e5c"
stroke-width="1.5"
stroke-linecap="round"
/>
<path
d="M4 18C4 20.2091 5.79086 22 8 22"
stroke="#605e5c"
stroke-width="1.5"
stroke-linecap="round"
/>
</svg>

<div class="upload-text">
Upload documents to attach them to this record
</div>

<button class="btn-primary" onclick="uploadFiles()">Upload Files</button>
</div>
</body>
</html>
13 changes: 7 additions & 6 deletions apps/it-governance/web-resources/html/request-type.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down Expand Up @@ -134,7 +134,8 @@
font-weight: 400;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.15s ease-in-out,
transition:
background-color 0.15s ease-in-out,
border-color 0.15s ease-in-out;
}

Expand Down Expand Up @@ -333,7 +334,7 @@ <h2>Major changes to a system, service, or project</h2>

<script>
const REQUEST_TYPE_FIELD = "cr69a_requesttype";
const ADMIN_GOV_TASK_LIST_FIELD = "cr69a_admingovernancetasklist";
const ADMIN_GOV_TASK_LIST_FIELD = "new_admingovernanceprocessstep";

const REQUEST_TYPES = {
ADD: 971270000,
Expand Down Expand Up @@ -391,14 +392,14 @@ <h2>Major changes to a system, service, or project</h2>
requestTypeField.setValue(optionValue);

const adminGovTaskListField = parentForm.getAttribute(
ADMIN_GOV_TASK_LIST_FIELD
ADMIN_GOV_TASK_LIST_FIELD,
);
if (!adminGovTaskListField)
return showError(`Field not found: ${ADMIN_GOV_TASK_LIST_FIELD}`);

if (optionValue === REQUEST_TYPES.ADD) {
adminGovTaskListField.setValue(
BPF_STAGES["GOVERNANCE_PROCESS_STEPS"]
BPF_STAGES["GOVERNANCE_PROCESS_STEPS"],
);
} else {
adminGovTaskListField.setValue(BPF_STAGES["DRAFT"]);
Expand Down Expand Up @@ -445,7 +446,7 @@ <h2>Major changes to a system, service, or project</h2>
// Start buttons
document.querySelectorAll("button.btn-primary").forEach((btn) => {
btn.addEventListener("click", () =>
startRequest(btn.getAttribute("data-type"))
startRequest(btn.getAttribute("data-type")),
);
});

Expand Down
Loading