Fixed the date ranges for the Reference options
This commit is contained in:
@@ -89,8 +89,7 @@ function createContentContracts() {
|
||||
"Next Quarter",
|
||||
"Previous Quarter",
|
||||
"Current Fiscal Year",
|
||||
"4 Rolling Quarters (CQ + 3)",
|
||||
"RENEWALS (Current + Past Due)"
|
||||
"4 Rolling Quarters (CQ + 3)"
|
||||
];
|
||||
const ALLOWED_PATHS = [
|
||||
"/hcmUI/faces/FuseWelcome",
|
||||
|
||||
@@ -212,75 +212,6 @@ function createCrmSrForm({ MODAL_ID, allowsCrmActivities, isMissing, getOpportun
|
||||
active = view;
|
||||
const current = () => active === view && allowsCrmActivities();
|
||||
function updateSave() { save.disabled = loadingFields.size > 0 || availableFields.size < 4 || Boolean(view.saving); }
|
||||
function confirmPayload(payload, requestHeaders = {}) {
|
||||
return new Promise(resolve => {
|
||||
const overlay = node("section", "opportunities-extension-action-form-modal opportunities-extension-sr-confirmation");
|
||||
overlay.setAttribute("role", "dialog");
|
||||
overlay.setAttribute("aria-modal", "true");
|
||||
overlay.setAttribute("aria-labelledby", "opportunities-extension-sr-confirm-title");
|
||||
const panel = node("div", "opportunities-extension-action-form-dialog opportunities-extension-sr-confirm-dialog");
|
||||
const heading = node("header", "opportunities-extension-account-plans-header");
|
||||
const title = node("h2", "", "Confirm Service Request");
|
||||
title.id = "opportunities-extension-sr-confirm-title";
|
||||
heading.append(title);
|
||||
const body = node("div", "opportunities-extension-sr-confirm-body");
|
||||
const label = node("p", "", "requestPostServiceRequest");
|
||||
label.id = "opportunities-extension-sr-confirm-payload-label";
|
||||
const preview = node("pre", "opportunities-extension-sr-confirm-payload", JSON.stringify(payload, null, 2));
|
||||
preview.tabIndex = 0;
|
||||
preview.setAttribute("aria-labelledby", label.id);
|
||||
body.append(label, preview);
|
||||
const headerPreviews = [];
|
||||
for (const name of ["requestSrTokenCatalog", "requestPostServiceRequest"]) {
|
||||
if (!requestHeaders[name]) continue;
|
||||
const headerLabel = node("p", "", `${name} - Headers`);
|
||||
headerLabel.id = `opportunities-extension-sr-confirm-${name}-headers`;
|
||||
const headerPreview = node("pre", "opportunities-extension-sr-confirm-payload", JSON.stringify(requestHeaders[name], null, 2));
|
||||
headerPreview.tabIndex = 0;
|
||||
headerPreview.setAttribute("aria-labelledby", headerLabel.id);
|
||||
headerPreviews.push(headerPreview);
|
||||
body.append(headerLabel, headerPreview);
|
||||
if (name === "requestSrTokenCatalog" && !requestHeaders[name]["x-appbuilder-client-id"]) {
|
||||
body.append(node("p", "opportunities-extension-action-form-status", "x-appbuilder-client-id: not yet observed in SeaaS requests."));
|
||||
}
|
||||
}
|
||||
const footer = node("footer", "opportunities-extension-action-form-footer");
|
||||
const cancel = node("button", "", "Cancel");
|
||||
const confirm = node("button", "", "Confirm Save");
|
||||
cancel.type = confirm.type = "button";
|
||||
footer.append(cancel, confirm);
|
||||
panel.append(heading, body, footer);
|
||||
overlay.append(panel);
|
||||
dialog.inert = true;
|
||||
dialog.setAttribute("aria-hidden", "true");
|
||||
modal.setAttribute("aria-modal", "false");
|
||||
modal.append(overlay);
|
||||
let settled = false;
|
||||
function finish(confirmed) {
|
||||
if (settled) return;
|
||||
settled = true;
|
||||
overlay.remove();
|
||||
dialog.inert = false;
|
||||
dialog.setAttribute("aria-hidden", "false");
|
||||
modal.setAttribute("aria-modal", "true");
|
||||
resolve(confirmed);
|
||||
}
|
||||
cancel.addEventListener("click", () => finish(false));
|
||||
confirm.addEventListener("click", () => finish(true));
|
||||
overlay.addEventListener("keydown", event => {
|
||||
event.stopPropagation();
|
||||
if (event.key === "Escape") { event.preventDefault(); finish(false); }
|
||||
if (event.key === "Tab") {
|
||||
const controls = [preview, ...headerPreviews, cancel, confirm];
|
||||
const index = controls.indexOf(document.activeElement);
|
||||
if (index < 0 || (event.shiftKey ? index === 0 : index === controls.length - 1)) {
|
||||
event.preventDefault(); controls[event.shiftKey ? controls.length - 1 : 0].focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
cancel.focus();
|
||||
});
|
||||
}
|
||||
form.addEventListener("submit", async event => {
|
||||
event.preventDefault();
|
||||
if (!current() || view.saving || save.disabled) return;
|
||||
@@ -331,7 +262,7 @@ function createCrmSrForm({ MODAL_ID, allowsCrmActivities, isMissing, getOpportun
|
||||
status.hidden = true;
|
||||
try {
|
||||
const prepared = await requestSave({ phase: "prepare", payload });
|
||||
if (!current() || host.hidden || !await confirmPayload(prepared.payload, prepared.headers)) return;
|
||||
if (!current() || host.hidden) return;
|
||||
save.textContent = "Saving...";
|
||||
await requestSave({ phase: "confirm", payload: prepared.payload });
|
||||
view.saving = false;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
function createOpportunitiesFiscalPeriods() {
|
||||
// Oracle fiscal years start on June 1; each range ends at the next period's start.
|
||||
const FISCAL_START_MONTH = 5;
|
||||
|
||||
function getFiscalPeriodRange(period, currentDate) {
|
||||
const currentYear = currentDate.getFullYear();
|
||||
const currentMonth = currentDate.getMonth();
|
||||
const fiscalStartYear = currentMonth >= 5 ? currentYear : currentYear - 1;
|
||||
const currentQuarterIndex = Math.floor(((currentMonth - 5 + 12) % 12) / 3);
|
||||
const fiscalStartYear = currentMonth >= FISCAL_START_MONTH ? currentYear : currentYear - 1;
|
||||
const currentQuarterIndex = Math.floor(((currentMonth - FISCAL_START_MONTH + 12) % 12) / 3);
|
||||
|
||||
if (period === "Current Fiscal Year") {
|
||||
const isBeforeFiscalYearStart = currentMonth < 5;
|
||||
const startYear = isBeforeFiscalYearStart ? currentYear - 1 : currentYear;
|
||||
const endYear = isBeforeFiscalYearStart ? currentYear : currentYear + 1;
|
||||
return createDateRange(startYear, 5, endYear, 4);
|
||||
return createDateRange(fiscalStartYear, FISCAL_START_MONTH, fiscalStartYear + 1, FISCAL_START_MONTH);
|
||||
}
|
||||
|
||||
let quarterOffset;
|
||||
@@ -28,19 +28,14 @@ function createOpportunitiesFiscalPeriods() {
|
||||
return null;
|
||||
}
|
||||
|
||||
const start = new Date(fiscalStartYear, 5 + (quarterOffset * 3), 1);
|
||||
const end = new Date(start.getFullYear(), start.getMonth() + (numberOfQuarters * 3), 0);
|
||||
|
||||
return {
|
||||
startCloseDate: formatOracleDate(start),
|
||||
endCloseDate: formatOracleDate(end)
|
||||
};
|
||||
const startMonth = FISCAL_START_MONTH + (quarterOffset * 3);
|
||||
return createDateRange(fiscalStartYear, startMonth, fiscalStartYear, startMonth + (numberOfQuarters * 3));
|
||||
}
|
||||
|
||||
function createDateRange(startYear, startMonth, endYear, endMonth) {
|
||||
return {
|
||||
startCloseDate: formatOracleDate(new Date(startYear, startMonth, 1)),
|
||||
endCloseDate: formatOracleDate(new Date(endYear, endMonth + 1, 0))
|
||||
endCloseDate: formatOracleDate(new Date(endYear, endMonth, 1))
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -310,17 +310,6 @@
|
||||
.opportunities-extension-action-form-field select { height: 38px; }
|
||||
.opportunities-extension-action-form-field select[hidden] { display: none; }
|
||||
.opportunities-extension-sr-form-dialog { width: min(900px, 100%); }
|
||||
.opportunities-extension-sr-confirmation { z-index: 6; }
|
||||
.opportunities-extension-sr-confirm-dialog { width: min(800px, 100%); display: flex; flex-direction: column; overflow: hidden; }
|
||||
.opportunities-extension-sr-confirm-dialog > header,
|
||||
.opportunities-extension-sr-confirm-dialog > footer { flex-shrink: 0; }
|
||||
.opportunities-extension-sr-confirm-dialog > footer { padding: 16px 20px; }
|
||||
.opportunities-extension-sr-confirm-body { min-height: 0; overflow: auto; padding: 0 20px; }
|
||||
.opportunities-extension-sr-confirm-body > p { font-size: 13px; font-weight: 600; }
|
||||
.opportunities-extension-sr-confirm-payload { margin: 0; padding: 16px; border: 1px solid #b9b4ae; border-radius: 4px; background: #f6f5f4; color: #312d2a; font: 13px/1.6 Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||
.opportunities-extension-sr-confirmation :focus-visible { outline: 2px solid #00758f; outline-offset: 2px; }
|
||||
.opportunities-extension-modal[data-theme="dark"] .opportunities-extension-sr-confirm-payload { background: #211f1d; color: #eeeae6; border-color: #756f68; }
|
||||
.opportunities-extension-modal[data-theme="dark"] .opportunities-extension-sr-confirmation :focus-visible { outline-color: #80d6e8; }
|
||||
.opportunities-extension-sr-form-dialog > .opportunities-extension-account-plans-header { padding: 20px 24px; }
|
||||
.opportunities-extension-sr-form-dialog > .opportunities-extension-action-form { gap: 20px 24px; padding: 24px; align-items: start; }
|
||||
.opportunities-extension-sr-form-dialog .opportunities-extension-action-form-field { gap: 8px; }
|
||||
|
||||
@@ -102,19 +102,21 @@ function createFusionOpportunities({
|
||||
op: "$and",
|
||||
criteria: [
|
||||
{
|
||||
op: "$or",
|
||||
criteria: Array.from(getOpportunityTypeValues(), (value) => ({
|
||||
op: "$eq",
|
||||
attribute: "RecordSet",
|
||||
value
|
||||
}))
|
||||
op: "$and",
|
||||
criteria: [{
|
||||
op: "$or",
|
||||
criteria: Array.from(getOpportunityTypeValues(), (value) => ({
|
||||
op: "$eq",
|
||||
attribute: "RecordSet",
|
||||
value
|
||||
}))
|
||||
}]
|
||||
},
|
||||
{
|
||||
op: "$wi",
|
||||
attribute: "EffectiveDate",
|
||||
value1: dateRange.startCloseDate,
|
||||
value2: dateRange.endCloseDate,
|
||||
dynamicDate: false
|
||||
value1: new Date(dateRange.startCloseDate).toISOString().replace(/Z$/, "+0000"),
|
||||
value2: new Date(dateRange.endCloseDate).toISOString().replace(/Z$/, "+0000")
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -154,7 +156,7 @@ function createFusionOpportunities({
|
||||
"CustomerAccount.Region_c",
|
||||
"CustomerAccount.PrimaryAddress.CountryCode"
|
||||
],
|
||||
sort: [],
|
||||
sort: null,
|
||||
language: "en",
|
||||
skipInValidFields: true,
|
||||
skipHiddenFromUIFields: true,
|
||||
|
||||
Reference in New Issue
Block a user