Updated the process for retrieving records from CRMServiceRequests
This commit is contained in:
@@ -296,8 +296,8 @@ function createContentApplication(overrides = {}) {
|
||||
});
|
||||
const internalSrSession = createInternalSrSession({
|
||||
environment,
|
||||
query: async srId => {
|
||||
const result = await platformContentMessages.sendRuntimeMessage({ type: messageTypes.requestInternalServiceRequest, srId });
|
||||
query: async (srId, srNumber) => {
|
||||
const result = await platformContentMessages.sendRuntimeMessage({ type: messageTypes.requestInternalServiceRequest, srId, srNumber });
|
||||
debugContentLog.appendBackgroundRequestLog(result?.debugRequests || []);
|
||||
return result;
|
||||
}
|
||||
@@ -305,7 +305,7 @@ function createContentApplication(overrides = {}) {
|
||||
const crmSrPopover = createCrmSrPopover({
|
||||
openInternalSrForm: (parent, trigger) => internalSrForm.open(parent, trigger),
|
||||
formatDate: value => opportunitiesFormatters.formatOracleResponseDate(value),
|
||||
requestDetails: srId => internalSrSession.request(srId),
|
||||
requestDetails: (srId, srNumber) => internalSrSession.request(srId, srNumber),
|
||||
MODAL_ID: contracts.MODAL_ID,
|
||||
createCopyButton: (...args) => opportunitiesLinks.createCopyOpportunityButton(...args),
|
||||
createCloseIcon: (...args) => contentIcons.createCloseIcon(...args), environment
|
||||
@@ -364,7 +364,43 @@ function createContentApplication(overrides = {}) {
|
||||
requestCrmServiceRequest: (...args) => fusionCrmServiceRequests.requestCrmServiceRequest(...args),
|
||||
isCurrentPeriodRequest: (...args) => opportunitiesController.isCurrentPeriodRequest(...args), environment
|
||||
});
|
||||
const opportunitiesPrint = createOpportunitiesPrint({ environment, getSnapshot: () => {
|
||||
const state = opportunitiesTableState.opportunitiesTableState;
|
||||
const items = opportunitiesFilters.getSortedOpportunities();
|
||||
const filter = opportunitiesFilterState;
|
||||
const selectedLabels = (options, selected, allLabel) => {
|
||||
const matching = options.filter(option => selected.has(option.key));
|
||||
if (options.length && matching.length === options.length) return allLabel;
|
||||
return matching.map(option => option.label).join(", ") || "None";
|
||||
};
|
||||
const root = environment.document.getElementById(contracts.MODAL_ID);
|
||||
const filters = [
|
||||
["Reference", root?.querySelector(".opportunities-extension-form select")?.value || "-"],
|
||||
["Customer", selectedLabels(opportunitiesFormatters.getCustomerOptions(), filter.selectedCustomerKeys, "All customers")],
|
||||
["Owner", selectedLabels(opportunitiesFormatters.getOwnerOptions(), filter.selectedOwnerKeys, "All owners")],
|
||||
["Search", filter.tableSearch || "All"],
|
||||
["Status", [...filter.selectedStatuses].join(", ")],
|
||||
["Stage", [...filter.selectedStages].join(", ")],
|
||||
["Opportunity type", [...filter.selectedProductTypes].join(", ")]
|
||||
];
|
||||
for (const group of root?.querySelectorAll(".opportunities-extension-activity-filter-controls") || []) {
|
||||
filters.push([group.getAttribute("aria-label").replace(/^Filter by /, ""),
|
||||
[...group.querySelectorAll('[aria-pressed="true"]')].map(button => button.getAttribute("aria-label")).join("; ")]);
|
||||
}
|
||||
const totals = [{ label: "Total Opportunities", value: `${items.length}/${state.items.length}`, detail: "Filtered / total" }];
|
||||
for (const stage of contracts.STAGE_OPTIONS) {
|
||||
const stageItems = items.filter(item => item.ForecastGroup_c === stage);
|
||||
const amount = stageItems.reduce((total, item) => {
|
||||
const value = Number(item.PrimaryRevenue?.RevnAmount);
|
||||
return total + (Number.isFinite(value) ? value : 0);
|
||||
}, 0);
|
||||
totals.push({ label: stage, value: opportunitiesDashboard.createStageAmountFormatter(stageItems)(amount), detail: `${stageItems.length} opportunities` });
|
||||
}
|
||||
return { status: state.status, filters, totals, columns,
|
||||
rows: items.map(item => columns.map(column => opportunitiesFormatters.displayOpportunityValue(column, item))) };
|
||||
} });
|
||||
const opportunityCalendar = createOpportunityCalendar({
|
||||
createPrintButton: () => opportunitiesPrint.createButton(),
|
||||
productTypeSelection: opportunitiesFilterState.selectedProductTypes,
|
||||
onProductTypeChange: () => opportunitiesTable.renderOpportunitiesTable(),
|
||||
createViewIcon: view => contentIcons.createViewIcon(view),
|
||||
|
||||
Reference in New Issue
Block a user