From a8e0e77affe7fdbfb5782c92752c020908e7d1f8 Mon Sep 17 00:00:00 2001 From: Paulo Porto Date: Tue, 5 May 2026 01:27:07 -0300 Subject: [PATCH] =?UTF-8?q?Implementa=C3=A7=C3=A3o=20das=20a=C3=A7=C3=B5es?= =?UTF-8?q?=20incluir,=20atualizar=20e=20remover=20apontamentos=20de=20hor?= =?UTF-8?q?as?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- background.js | 27 +- content-script.js | 901 ++++++++++++++++++++++++++++++++++++++++++++-- manifest.json | 12 +- 3 files changed, 899 insertions(+), 41 deletions(-) diff --git a/background.js b/background.js index a571f9c..5ff62a3 100644 --- a/background.js +++ b/background.js @@ -966,9 +966,14 @@ async function executeComcipFetch(tabId, requestUrl, method, payload, headers, r headers: requestHeaders, }; - if (normalizedMethod !== "GET" && normalizedMethod !== "HEAD") { + if ( + normalizedMethod !== "GET" && + normalizedMethod !== "HEAD" && + requestPayload !== undefined && + requestPayload !== null + ) { requestHeaders["content-type"] = "application/json"; - fetchOptions.body = JSON.stringify(requestPayload || {}); + fetchOptions.body = JSON.stringify(requestPayload); } const response = await fetch(requestUrl, { @@ -1130,9 +1135,14 @@ async function executeComcipFetchFromFrame( headers: requestHeaders, }; - if (normalizedMethod !== "GET" && normalizedMethod !== "HEAD") { + if ( + normalizedMethod !== "GET" && + normalizedMethod !== "HEAD" && + requestPayload !== undefined && + requestPayload !== null + ) { requestHeaders["content-type"] = "application/json"; - fetchOptions.body = JSON.stringify(requestPayload || {}); + fetchOptions.body = JSON.stringify(requestPayload); } const response = await fetch(requestUrl, fetchOptions); @@ -1264,9 +1274,14 @@ async function executeComcipDirectFetch( headers: requestHeaders, }; - if (normalizedMethod !== "GET" && normalizedMethod !== "HEAD") { + if ( + normalizedMethod !== "GET" && + normalizedMethod !== "HEAD" && + payload !== undefined && + payload !== null + ) { requestHeaders["content-type"] = "application/json"; - fetchOptions.body = JSON.stringify(payload || {}); + fetchOptions.body = JSON.stringify(payload); } const response = await fetch(requestUrl, fetchOptions); diff --git a/content-script.js b/content-script.js index f27c296..99538d2 100644 --- a/content-script.js +++ b/content-script.js @@ -39,6 +39,7 @@ theme: "arch-panel-extension-theme", sidebarCollapsed: "arch-panel-extension-sidebar-collapsed", calendarView: "arch-panel-extension-calendar-view", + timeManagementSelectedDate: "arch-panel-extension-time-management-selected-date", }; const CACHE = { @@ -222,6 +223,8 @@ taskTypeCache: { promise: null, }, + timeManagementActivityCache: new Map(), + pendingTimeManagementHighlightRowId: "", timeManagementDatePicker: { isOpen: false, year: new Date().getFullYear(), @@ -725,6 +728,11 @@ return; } + if (action === "time-management-save") { + void saveTimeManagementChanges(); + return; + } + if (action === "time-management-remove-row") { removeTimeManagementEntryRow(actionElement.getAttribute("data-row-id")); return; @@ -1061,9 +1069,31 @@ } appState.pendingFocusSelector = ""; + scrollPendingTimeManagementHighlightIntoView(overlay); }); } + function scrollPendingTimeManagementHighlightIntoView(overlay) { + const rowId = cleanString(appState.pendingTimeManagementHighlightRowId); + + if (!rowId) { + return; + } + + appState.pendingTimeManagementHighlightRowId = ""; + const row = overlay.querySelector( + `.arch-panel-extension-time-management-entry-row[data-row-id="${cssEscape(rowId)}"]` + ); + + if (row instanceof HTMLElement) { + row.scrollIntoView({ + behavior: "smooth", + block: "center", + inline: "nearest", + }); + } + } + function captureModalScrollState(overlay) { const mainShell = overlay.querySelector(".arch-panel-extension-main-shell"); const shellBody = overlay.querySelector(".arch-panel-extension-shell-body"); @@ -2396,6 +2426,9 @@ } const selectedDate = modal.selectedDate || getDateInputValue(new Date()); + const selectedDateLabel = formatDateInputDisplay(selectedDate); + const canSaveTimeManagement = isTimeManagementSaveEnabled(modal); + const isSavingTimeManagement = Boolean(modal.isSaving); return `
@@ -2434,7 +2467,7 @@ @@ -2452,6 +2485,7 @@ + ${renderTimeManagementHourIndicators(modal)}
${renderTimeManagementBody(modal)} @@ -2472,7 +2506,20 @@ > Add (Non-service) + + ${ + modal.saveErrorMessage + ? `

${escapeHtml(modal.saveErrorMessage)}

` + : "" + }