Session: 4d748577-cdf0-4173-88eb-5694502e05c8
Coverage
5
Selected
5
Completed
0
Reused
0
Failed
0
Waived
Token Usage
8.3M
Prompt Tokens
132.13K
Completion Tokens
8.43M
Total Tokens
126
LLM Requests
7.35M
Cache Read
0
Cache Write
File breakdown 2 files
| File | Prompt | Completion | Cache Read | Cache Write | Total |
|---|---|---|---|---|---|
| public/js/ssma/action_plan_panel.js,src/Controller/SsmaContr… | 8.3M | 131.91K | 7.35M | 0 | 8.43M |
| File Grouping | 369 | 213 | 0 | 0 | 582 |
Files Reviewed 5 files
- src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php
- public/js/ssma/action_plan_panel.js
- templates/ssma/action_plan/partials/_action_plan_overflow_menu.html.twig
- templates/ssma/action_plan/tabs/_tab_painel.html.twig
- src/Controller/SsmaController.php
Session Tasks 1 tasks
File Grouping 1 requests
grouping_task
Request #1
deepseek-v4-flash
P:369 C:213
2309ms
Reasoning
We need answer JSON array grouping. Need reason. Need label short theme. Files all ssma action plan panel. Need group maybe one group? Could be controller, service, js, templates all feature. But need every one. Maybe separate? Let's inspect names. SsmaController, ActionPlan service, twig partials, js action plan panel. Likely one coherent feature. Use 1 group label "SSMA action plan panel updates". JSON only.
[
{
"label": "SSMA action plan panel",
"files": [
"public/js/ssma/action_plan_panel.js",
"src/Controller/SsmaController.php",
"src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php",
"templates/ssma/action_plan/partials/_action_plan_overflow_menu.html.twig",
"templates/ssma/action_plan/tabs/_tab_painel.html.twig"
]
}
]
Conversations 1 files
public/js/ssma/action_plan_panel.js,src/Controller/SsmaController.php,src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php,templates/ssma/action_plan/partials/_action_plan_overflow_menu.html.twig,templates/ssma/action_plan/tabs/_tab_painel.html.twig 125 requests
plan_task
Request #1
deepseek-v4-flash
P:20.08K C:16.4K CR:1.41K CW:0
146462ms
Reasoning
The user wants me to analyze code changes and produce a structured review plan in Portuguese (pt-BR). I need to identify risk points in the changed code and plan tool-calling strategies for each risk point.
Let me analyze each file's changes:
### 1. `public/js/ssma/action_plan_panel.js`
Changes:
- Added `mine: false` to panel state
- Added `origin` param to query params when panelState.origin is set (pendencias view)
- Added `mine=1` param when panelState.mine is true
- Added `formatPeopleNames(people)` function
- `buildPendenciasTableRowHtml` reworked:
- Uses `row.executors || row.responsible`
- New validators column
- Origin button/link
- data attributes added for offcanvas
- `syncPendenciasFilterState` now captures `origin` and `mine`
- Event binding now includes `#ap_painel_filter_origem`
- `openActionViewOffcanvas(btn)` new function
- `bindTableViewButtons` now calls `openActionViewOffcanvas`
Potential issues:
- XSS: The originUrl is inserted into `href` attribute using `escapeHtml(originUrl)` — need to check escapeHtml implementation handles quotes. Actually, for URL in href attribute, escaping HTML entities may suffice for attribute context if it escapes quotes. But `javascript:` URLs would still be a concern — server-side origin_url is constructed from internal route paths so probably safe, but general practice... The server builds the URL so it's not user-controlled; likely safe. But wait, attr values with escapeHtml — let me check whether escapeHtml escapes `"`. Typically yes.
- `formatPeopleNames`: uses `person.name || person.initials` — if `person.name` is empty string and initials empty, handles fine. The map callback with arrow function returning empty string filtered out — fine.
- The offcanvas uses `data-action-description` etc. inserted as data attributes with `escapeHtml`, then retrieved with `getAttribute` and set via `textContent` — safe.
- In `openActionViewOffcanvas`, sets `textContent` — safe against XSS.
- `originLink.href = originUrl` — If originUrl is server-provided, probably safe. But if it starts with `javascript:` — server constructs from own routes, safe.
- Potential bug: In `buildPendenciasTableRowHtml`, the view button data attributes include `data-action-description` — escapeHtml of description could be a long multiline text... but attribute context OK.
- One issue: `panelState.origin = getSelectValue('ap_painel_filter_origem');` does not clamp the select. And filtering may break if origin value mismatch between JS and server option keys — need to verify front-end keys in template match the options in service:
- Template TWIG default options keys: '', 'accident_personal', 'accident_material', 'near_miss', 'ros', 'inspection', 'approach'
- Service `buildFilterOptions` 'origin': same keys. OK.
- Overview origins list in service: missing 'accident' generic but has new split. Note the twig template also references `panel_filters.origin` — need to check that.
- Note: **Overview_origins options changed**: previously 'accident' (Acidente) now' accident_personal'. If existing code elsewhere (visao_geral charts) still uses 'accident' as key, there's a contract mismatch. Search for 'accident' references to check. In the service, chart seed now uses accident_personal etc. The `resolveOriginLabel` keeps 'accident' as fallback mapping to 'Acidente pessoal', and icons keep 'accident' key. But origin filter options dropped 'accident' and 'refusal'. If the Visão Geral origin filter was using `overview_origins`, and previously there was an accident option, a stored/query URL param origin=accident would now be invalid but fallback labels still handle. Need to check JS for `overview_origins`/visao_geral filters — the diff only modified pendencias area for origin. Also note JS earlier sets `params.set('origin', panelState.origin)` only in pendencias view block. Then the generic `if (panelState.mine) params.set('mine','1')` is fine.
Actually wait, there might be a real issue with origin URL param: On the pendencias branch, `params.set('origin', panelState.origin)` but this origin filter param... beyond that, the generic `mine` param. Looks fine.
Another JS issue: In `buildPendenciasTableRowHtml`, header count changed from 8 to 9 columns in JS table body? The twig updated table headers adding "Quem valida" column. In JS, table row previously had: title sub-title, origin icon, management, priority, responsible, deadline, pending, actions = 8 columns. Now it adds validators column = 9 columns. Need to make sure the header count in the table dynamic (JS builds header?) Actually twig table head updated with 9 headers. JS row adds 9 cells — consistent. But `updatePendenciasTable` might also build header... can't know.
- `mine` filter and `checkbox` filter `#ap_painel_filter_mine` uses a change listener rather than delegated on document — fine.
- `panelState.origin` value always set — but when the table is shown for pendencias via AJAX trigger, the `origin` param only added if truthy. Fine.
- Potential issue: In the pendencias params build, `origin` params and `mine` are placed after branching and applied to all param building? Let me re-read: In `buildPanelParams`:
- if pendencias: set axis, and now origin.
- else if visao_geral: set period/page.
- then maybe team filters etc...
- after that: `if (panelState.mine) params.set('mine','1');`
So `mine` applies to all views (pendencias AND visao_geral, since it's unconditional at end). Is that intended? The mine checkbox is only in pendencias filters subheader, and visao_geral branch resets params? Actually wait — for visao_geral, `params.set('period', ...)` and adds docs maybe. If mine is set for visao geral view, it would add `mine=1` param to overview requests. Would backend ignore it? Backend's ajax endpoint only applies mine filter in a specific branch? Let me look at Controller change: In the filter endpoint, code is added after some context; it gets request query 'origin' and conditionally `if ($request->query->getBoolean('mine'))` builds payload with mine ID. That appears to apply regardless of view? Actually the context at line 519 shows it is in a handler that builds payload for panel filter AJAX. So if mine=1 on visao_geral, it would silently filter members? Actually `[$mineId => true]` is a `$responsibleIds`-like argument (4th to last?). Need to see the function signature `buildFilterPayload($scopeCompanies, $dataCompany, $view, $period, $axis, $team, $vinculo, $actionTypeMetadata, [$mineId => true], $page, ...` Wait the parameter is passed as 9th argument. Let me count buildFilterPayload param order in service: In diff context, calls include ($scopeCompanies, $dataCompany, $view, $period, $axis, $team, $vinculo, metadata, ?memberIds, $page, $perPage, management, area, exec_responsible, val_responsible, origin). The `[$mineId => true]` is in position of...? We saw service has methods. The original call and mine branch call pass same args except the map param. So the param is likely `?array $memberFilterIds` or something; mine probably restricts to actions involving this member. Need to look at member scope logic. Anyway, front-end sending mine=1 on visao_geral when filter state was toggled in pendencias — could affect overview chart data incorrectly. This could be a real functional bug: the checkbox stays checked when switching to Visão Geral sub-aba and mine param would apply, changing what data overview shows. But maybe minimal. And on reset to pendencias it still applies, which is desired.
Also the "member sees only own actions automatically" business rule — need to verify backend handles default scope (the description says member/stakeholder sees only their actions automatically; supervisor sees team). Where is that enforced? Might already exist in buildFilterPayload when no filter applied for the pendencias view? Actually mine filter new. But requirement says "membro/stakeholder vê apenas suas ações (filtro automático)" — is that an existing default? The `mine` filter applies only when checkbox checked. Search needed.
- **Contract check `row.executors`**: Service updated presenter for dashboard list adding `executors` and `validators`, and origin_url, origin_label, description, origem_id. JS relies on those. But JS also has fallback for `row.responsible` (old format). For detail offcanvas (e.g., action from search/others?), the row uses origin_label. What about other sources calling `updatePendenciasTable`? fine.
Actually, wait: the service presenter adds 'executors' only in the map row for allActions presentation path changed (line ~710). But that presenter path might be used by Tab "Ações" too (table action plan), where columns might differ and now also refer to executors etc. Description says columns also on Ações tab. Fine.
Another area: **query param 'origin' ambiguous**: buildPanelParams for pendencias uses 'origin' param value of selected origin key (accident_personal etc.). But backend uses `origin` for... let me recheck controller diff context: `trim((string) $request->query->get('origin', ''))` was already being read as one of last args (origin param existed). The new mine branch reuses it. So origin param existed in schema? Actually the pre-existing call probably had origin as previously param value 'origin'. Hmm the context shows new filter added to JS; service had an $originFilter param already? In buildFilterPayload args, origin was in original call and new mine branch call — so 'origin' request param passed to payload become an input filter with resolveOriginKey equality... Wait, resolveOriginKey applied to origem values; if originFilter is e.g. 'accident_personal', matches only exact. Previously 'origin' was maybe the originKey like 'accident' that used to be used by table origin chart? So contract likely existed. Not much to flag.
Nonetheless, since view also is sent... wait what origin is filtered in the payload for chart? Need service context to confirm origin param semantics — the filter just added? Actually new code adds `if ($originFilter !== '') filter action origem key === originFilter` at line ~125. This filter seems applied only for pendencias list default. Previously if originFilter was passed and not handled, it would be ignored — now handled.
Potential issue in service: `filterPendenciasByOrigin` only applied when originFilter !== '' — filter uses `resolveOriginKey` with $origem and event_type. Value keys include 'accident' and 'refusal' and 'other'. If filter value 'accident' (old front-end persist e.g., overview URL), actions resolved as accident_personal would fail equality — but the select values changed; where would 'accident' come from in pendencias? The `overview_origins` select in Visão Geral might still be a separate select with values; the JS for overview branch doesn't send origin at all (only pendencias branch does). Good.
- **Labels for 'refusal' dropped**: the new 'origin' select omits 'refusal' (Direito de Recusa) and 'other'. But actions can have origem refusal and would just not be reachable via filter select; but label/icon keep `refusal`. Not a bug per se.
- The service's resolveOriginKey reclassifies QUASE_ACIDENTE events to near_miss, previously 'accident'. This changes existing chart data grouping in Visão Geral — near_miss now separate bar. Intended per requirement. But there is a subtle bug: `if (str_contains($event, 'ACIDENTE')) return 'accident_personal';` now placed BEFORE checking ROS etc. Actually inspection of new code order:
1. QUASE → near_miss
2. PESSOAL/PERSONAL → accident_personal
3. MATERIAL → accident_material
4. ACIDENTE → accident_personal
5. ROS → ros
What about TYPE_ROS event constant value like 'ACIDENTE'? If SsmaEvent::TYPE_ROS holds e.g. 'ROS' fine. If original ordering previously checked ROS before QUASE? New ordering: near first, then PESSOAL... What about event type values like "ACIDENTE COM QUASE"? no. Or "QUASE ACIDENTE" contains QUASE → near_miss. "ACIDENTE MATERIAL"/"ACIDENTE PESSOAL"? contains PESSOAL/MATERIAL before ACIDENTE check, correct order. ROS labels may include the word "ACIDENTE"? e.g., "ACIDENTE DE TRAJETO"? nothing to do with ROS. fine.
Also, the originate normalize fallback `ActionOrigemEnum::normalize($origem)` — unchanged. `'acidente'` now resolves to accident_personal (was accident). Keep mapping `'accident'` label fallback for older data: label map still has 'accident' => 'Acidente pessoal', icon map includes 'accident'. Good backward compat.
- `resolveOriginUrl`: for near_miss / ros / accident origins uses `/manager/ssma/ocorrencias/`. But is the origin 'approach' with origem_id pointing to the approach record but origem enum stored? The URL check uses origem_id for inspection/approach; then occurrence_id common; then origem_id; that's reasonable. Potential routing mismatch: keys 'accident_personal' etc. all are occurrences; using origem_id. If a origem_id references inspection when origem string vary... but inspection handled first. If action origem='outro' but occurrence_id set, fine.
- Another bigger service bug candidate: JS reads row.origin_label for data-action-origin, but if row origin_label missing falls to row.occurrence_title for **table rows built from different data source**; in table presenter 'origin_label' added? Yes for pendencias. Actually that's from action map in service at ~700 map. Wait 'origin_label' set as `$origemLabel`; should also check it is set in that same presentation. There could be other places buildPendenciasTableRowHtml used with tableData from `buildPendenciasTableData`? uncertain.
Now Controller changes:
### SsmaController.php
- In filter AJAX handler (line ~519), new `mine` support:
```php
if ($request->query->getBoolean('mine')) {
$user = $this->getUser();
$member = ($user instanceof User) ? $this->getCurrentCompanyMember($company, $user) : null;
$mineId = (int) ($member?->getId() ?? 0);
if ($mineId > 0) {
$payload = $this->ssmaActionPlanPanelService->buildFilterPayload(... [$mineId => true] ...);
}
}
```
Potential issues:
- If `mine` true but member not resolvable (e.g., user is not a member of the company), `$payload` is not refreshed and the *original* payload (all actions) is used while mine=1 param still indicates filtering. But template? The checkbox wouldn't exist if no member. Since a user on page is member, ok. Risky only if user not member. Also note: if member is null but mine=1, the filter should probably be empty list, not all (authorization). That could leak scope — but if user canAccessSurface given? They should be member then.
- Also this `$member?->getId()` member ID equals responsible_ids entries that are member IDs? In pendencias context, `responsible_ids` contain member IDs or user IDs? The mine filter presumably matches `executors`/`responsible_ids`/`validator_member_id` members. Need to see buildFilterPayload semantics of the `[$mineId=>true]` map arg to ensure it matches both executor (responsible_ids JSON) and validator (validator_member_id). Might be OK.
- The scope value `[$mineId => true]`... if a parameter expects map memberId => bool of *allowed responsible* filter? or is used as new "mine" by passing member IDs to include as exec or validator only among team? We need to view function to verify. Also permission model duplication: mine filter + existing member scope default might require this map's semantics known.
- Permission change:
- `canMutateSsmaActionPlan()`: returns false for `isSsmaViewer()` and tag names 'Supervisor de Equipe', 'Supervisor', area supervisor. Then falls back to `canManageSsmaOccurrences()`.
- Used in: create action endpoint (mode !== edit), canCurrentUserEditSsmaAction, right-menu at resolve? and `$ssmaCanCreateLinkedActions = $this->canMutateSsmaActionPlan();`
Concerns:
- Previously `$ssmaCanCreateLinkedActions = $ssmaCanManageOccurrences || $this->isSsmaViewer();` — viewers could create action linked to occurrence. Now blocked — intended per Brenda audio. But rule says "Supervisor ou viewer não criam; Gestor de Equipe/Área continua podendo mutar." The early manager override later sets `$ssmaCanCreateLinkedActions = true;` but the controller method `canMutateSsmaActionPlan()` doesn't implement that override for team/area managers unless those maps to `canManageSsmaOccurrences`. Is 'Gestor de Equipe' tag resolved to canManageSsmaOccurrences? The override in SQL sets `$ssmaCanCreateLinkedActions = true; $ssmaCanMutateActionPlan = true;` in the template context, but the controller-service-level canMutate method is used to authorize endpoints: canCurrentUserEditSsmaAction, create endpoint, resolve menu. The endpoint create gate previously used `canAccessSsmaSupervisorSurface()`; now canMutate. If Gestor de Equipe is a role with `canManageSsmaOccurrences()`=false and team manager tag not in forbidden list and not viewer then returns `canManageSsmaOccurrences()` — false. But requirement says "Gestor de Equipe/Área continua podendo mutar." So need verify how team manager / area manager are authorized in canManageSsmaOccurrences. The Twig code manually overrides flags (a red flag: template context and controller policy disagree: view for team gestor forces ability TRUE whereas backend canMutate would reject edit requests) — **this could be a real permission inconsistency bug between UI and endpoint** → team/area managers see action buttons but backend denies? OR backend grants while Twig won't show? Both bad.
Actually the presentation generation at ~12725 resets with team/area manager true, meaning the UI shows create/edit; but actual requests to create/edit endpoints use canMutate*. If canManagingSsmaOccurrences includes team manager... Need to check original canManageSsmaOccurrences implementation relative to these tags. That's the thing to verify with code_search.
- Another concern: Resolve/validate actions: `canCurrentUserResolveSsmaAction` uses canMutate for $canManage in one computation, while other validity checks still allow validator and responsible to resolve? The diff changes at lines ~16269 for this method? It changes only `$canManage = ...`. But importantly, `canCurrentUserResolveSsmaAction` earlier `$canEdit = $canEditByPolicy && ($isAdmin || $isResponsible)`. The `$canManage` changes there... The condition probably multiplies permission to "resolve" for managers; validators may still approve. Since supervisor can still be validator (their own validation queue)? Wait requirement: supervisor only view, presumably cannot resolve actions? Yet if supervisor is validator of an action, can_validate should probably still allow — canMutateSsmaActionPlan returns false for supervisors. Let's inspect resolve logic diff: line 16269 replaces canManage occurrences with canMutate in what condition? In context:
```
$canManage = $this->canMutateSsmaActionPlan();
$pendingValidation = ...;
$canEditByPolicy = ...;
$canEdit = $canEditByPolicy && ($isAdmin || $isResponsible);
```
Probably later uses `$canManage && ...` `$isValidator && ...`.
Since validation by validators is not derived from canManage (uses can_validate capability maybe from being the assigned validator), supervisors assigned as validators would still be able to validate? Possibly. But creating/editing blocked. If validators were previously allowed because of canManage? not necessarily.
Risk: the new rule might unintentionally block supervisors from resolving/concluding actions they were responsible for as executors. Wait requirement says 'Supervisor somente visualiza: não pode criar nem editar ações'. What about responsible action resolution? If action_item.can_edit/can_resolve flags rely on canManage for responsible supervisors, now blocked — intended? not clear. likely intended.
- Note create gate check changed from `!$this->canAccessSsmaSupervisorSurface()` to `!$this->canMutateSsmaActionPlan()` in edit-mode == create path (`$mode !== 'edit'`). Actually the snippet is from a save endpoint with `$mode`; using message 'Sem permissão para criar ação' but same method also handles editing (`mode == 'edit'`)? The original code was also only blocking on `$mode !== 'edit'`. In edit mode other separate checks? canCurrentUserEdit... used elsewhere. Probably fine.
- **God object** (user priority): SsmaController is huge; adding permission logic in the controller (e.g., canMutate private method embedded with policy for tags) expands that. This might be flagged, but it's pre-existing concentration. Yet user-specific priority says biggest: controller with thousands of lines mixing HTTP+business; each increase flagged. This diff does add business policy into controller. We should include an issue to that effect, maybe medium.
### Service issues
- 'validators' display built from validator_member_id only. If validation involves multiple members or historic validators? maybe fine per model.
- The validators display `resolveResponsibleDisplay` uses member names. If validator_member_id = 0 filter leftover '—'? If 0 removed by filter → names empty → show dash. Good.
- origin filtering and table: `$this->resolveOriginLabel` etc.
- Also line 710 mapping with array key collisions maybe? The snippet shows array map entries with `'responsible'` and `'executors'` using same IDs; then others. fine.
- Wait: add condition filter for pendencias: `$originFilter !== ''`; but origin param may be 'accident' from visao select no... only pendencias. The options list in Overview currently retains 'ros' and removed 'refusal': but `overview_origins` array changed values from 'accident' to accident_personal etc. Check other consumers of overview_origins — the Visão Geral origin filter select in twig, and JS uses select `#...` maybe. But Visão Geral previously had options from service used in that page. The change of a previously used value `accident` in that select might break an existing "select default/persist value accident" if any persisted selection uses stored value 'accident'. Review: The old text 'Acidente' value 'accident'; new one name 'Acidente pessoal' value accident_personal. Edge: Users with saved default? Not likely.
- **resolveOriginKey near_miss icon/tool** etc fine.
- **filter duplication and order**: In buildFilterOptions, both 'overview_origins' and 'origin' options are new list with removed 'refusal' — if tabela actions originating from refusal (Direito de Recusa) existed, filter select won't have option... not critical.
- origin URL risk: resolveOriginUrl constructing strings with path concatenation of IDs numeric. Safe.
- The origin filter compares resolved key to requested value, but requested value like 'accident' from old params can't match now; getOriginKey can return 'accident' anywhere? match default? not per listed returns. fallback 'other' only. `resolveOriginKey` returns 'inspection','approach','near_miss','accident_material','accident_personal','ros','refusal','other' — wait normalize default may return orig? then matches; else 'other'. Review mapping 'refusal' leftover. Since options list for Pendencias omits 'refusal', any Origin filter from stale UI? no.
### Twig
- `_action_plan_overflow_menu.html.twig`: replaces `ssmaCanManageOccurrences` default with `ssmaCanMutateActionPlan|default(...)`, subtle. If the global twig var is not set in some contexts (partial used also in other tabs, e.g., actions tab template), fallback to old behavior via default(ssmaCanManageOccurrences) — good compat. But: are those js template variables? Controller that renders action plan overflow pages setting ssmaCanMutateActionPlan only in painel context? We saw it's in SQL presentation twig array. Yet partial may render under other routes (editing occurrences list). Since fallback exists OK. But when calling action_plan overflow partial from within ajax-rendered action plan table, new var needed.
- Permission: Twig uses `ssmaCanMutateActionPlan` but also manipulates create action button separate? Requirement tab hides create/edit for Supervisor. If routes for creation previously guarded by canAccessSsmaSupervisorSurface for supervisors allowed create — those endpoints now guarded by canMutate; update consistent. Menu overrides for team/area manager to true again may contradict backend (above). Need verifying `canManageSsmaOccurrences` covered team manager previously — original line allowed when canManageSsmaOccurrences OR viewer and twig; since before code creation was allowed to supervisors intended, guard previously was `canAccessSsmaSupervisorSurface` = manage occurrences || viewer... so team manager probably counted by one of the earlier flag canManage? Twig has special code at line 12725: legacy where if `$ssmaIsTagTeamGestor || $ssmaIsTagAreaGestor` then force create true. If those manager tags are not in canManageSsmaOccurrences set, twig forces UI true while actual backend canMutate returns false → **real mismatch**. Must verify.
- `_tab_painel.html.twig` uses inline style `style="gap:6px;"` within JS string for action group; it's a JS inline style, not Twig. Also uses `d-inline-flex`. Minor style.
- New select markup replicates custom select include with id origin; fine.
- `ap_painel_filter_mine` uses custom bootstrap switch markup; consistent.
Consider escaping in JS row builder: it builds `data-action-origin-url='...'` inside single-quoted attribute? They used double quotes for HTML attributes: `href="' + escapeHtml(originUrl) + '"`. If escapeHtml escapes double quotes → safe. Check typical escapeHtml implementation: In many codebases escapes & < > " '. need verify code_search for escapeHtml. High value.
Now, the twig escaped output for `selected_value: ''` etc fine.
### Cross-file checks to plan in review:
Given output format instructions, produce Summary and Issues list; each issue with severity and lines of plan with tool pointer (`→ code_search`, `→ file_read...`). Tools are references only — indicate desired call w/ arguments.
Let me list candidate issues with severity ordering:
**High candidate 1: Permission divergence between UI flags and backend policy for Gestor de Equipe/Área (and tag-based).**
In template code ~12725 (in same controller build context), `if ($ssmaIsTagTeamGestor || $ssmaIsTagAreaGestor) { $ssmaCanCreateLinkedActions = true; $ssmaCanMutateActionPlan = true; }`, but backend `canMutateSsmaActionPlan()` returns `canManageSsmaOccurrences()` when tags not among the forbidden list. If these manager tags are not covered by `canManageSsmaOccurrences`, the UI shows create/edit buttons (and overflow menu enabling edit) while controller endpoint rejects with 403 → functional break; conversely if canManage covers them there is no mismatch. So tool plan: verify canManageSsmaOccurrences implementation and team/area manager tags; inspect SQL context variable resolutions.
Actually the requirement explicitly says Gestor de Equipe/Área continues able to mutate — so mismatch is a conditional risk to verify. Mark as high/medium as "verify". In review-plan issue descriptors include the reason to invoke tools.
**High 2: mine=1 sent on Visão Geral too (JS param unconditional) — overview endpoint?** Wait we saw mine branch in controller near payload building for filter endpoint (probably generic for both views). If user checks "Minhas ações" in pendências view and switches to Visão Geral, the mine param persists (or is it cleaned in the visao_geral params branch by not including it, but the unconditional later if adds). The controller mine handling will apply the filter regardless of view? The fetch of data by buildFilterPayload (mine map) could filter responsible/validator. This might be desired (only own actions across graphs?) But requirement says chart axes... maybe yes "Minhas ações" is in the pendencias filter bar only. Actually requirement scope said the JS filter list area is per sub-aba; when switching to visão geral, does panelState reset? Not sure. If the overview AJAX respects mine, the charts would change unexpectedly. Low/medium; verify.
Also similar `origin` is only set on pendencias good.
**Medium: mine filter does not guard empty member (null member) => all actions returned.**
If request mine=1 but getCurrentCompanyMember returns null (e.g., user belongs to different company) then `$mineId = 0`, no payload overwrite, response contains all actions – effectively an authorization bypass exposing data from other areas/whole payload; also inconsistent; ideally zero results. Check scope guard. Need controller context of payload building and whether member null possible. Could flag medium/high — but is it realistic on this endpoint, which maybe already limited by team scope? Yes, potential scope leak. But not necessarily a vulnerability if payload later filtered; safer call: reporting as issue: filter inconsistency — when mine is requested but member cannot be resolved, result falls back to unfiltered payload instead of empty/min restricted. Might be highish but member null not reachable given access checks. Medium.
**High/Medium: `canMutateSsmaActionPlan` blocks supervisors but resolver/validator path for supervisors who are validators/responsible.** Need look at resolver use of `$canManage` for validation actions may block supervisor assigned as validator ending validation? Actually canManage used for e.g., 'resolver' as manager override and for cancel while assigned user still allowed. If `canEdit = policy && (isAdmin||isResponsible)` independent of canManage. Resolve similar maybe "canManage OR validator". Requires verifying the surrounding method after change. We can mention low/med: verify. This is uncertain, but report requires stable issues: mention with action to verify.
**Medium/High: origin filter and/or charts reclassification could orphan previously grouped 'accident' data in Visão Geral seed?** seed for chart expected counts keyed accident_personal etc. The originCount presumably uses resolveOriginKey returns consistent keys; seed matches. Older actions still normalize to near_miss/personal/material each — fine. But any event with label 'ACIDENTE'? personal default. So accident label never used, seed deleted key accident — consistent. A regression: 'refusal' (Direito de Recusa) chart bar removed from seed! Previously seed included refusal; new seed list removes refusal. If there were refusal actions (from old data), this group disappears from chart because seed doesn't include and originCount not seeded — possibly whole group missing; though adding unknown key? The foreach pushes only if isset seed. It creates `'outros'`? Possibly not. Could be a regression: actions of origin Direito de Recusa no longer displayed in Origin chart in Visão Geral nor selectable in Pendências filter. This is legit potential regression due to removing refusal from options and chart seed. We need to confirm whether origin chart is built from seed (Yes presentSeededOriginChart seeds). If refusal actions exist, their "count" loop `if (isset($seed[$key]))` drop — and no driver merging (unknown keys discarded). Then they'd disappear from chart completely. That's a functional/data visualization regression. Report medium (data visibility, not loss). However, maybe originCount pre-aggregated counts include only known keys with something else for others. Need verify where $originCount is built (resolveOriginCount?). It's served to front by presenter? 'outros' keys 'other' also not seeded. Was there 'other'? no. Existing behavior: unknown origins not counted anyway? Unknown previously used 'other'? not seeded either. So this may mirror existing behavior for unknown. But refusal WAS shown & seeded before; now removed → regression if refusal data exists. Medium.
**JS escaping check for url/javascript:** server origin URLs are generated from numeric ids and internal paths, so safe; but keep note about use of escapeHtml and confirm implementation escapes quotes (medium/low).
**Mine filter & PHP `$member?->getId()` and map key `[$mineId => true]`: is `responsible_ids` person members or users?** Actually Pendencias mine should match if user is executor or validator. What does buildFilterPayload do with that param-array — maybe it's `$membersById` filter to filter actions where responsible in a set of member ids, including validator separately? Need to inspect that 9th param name and behavior. If filter only looks at responsible_ids (executors) and not validator_member_id, then a validator-only user with mine=1 would see empty results while the requirement says both executor and validator should see. The items table presenter already has separate executors and validators fields. The mine filter should consider validator_member_id too. Need to verify service code.
**Escaping in the data attributes with apostrophes inside single-quoted HTML attr?** They build with double quotes; escapeHtml likely handles double quote. Verify.
**formatPeopleNames + escape uses of data*/title text: fine.**
Potential **CSS/UX specific**, no.
**The prompt asks to produce review plan where each issue about risk + tool planning lines. We shouldn't call tools for real. Just list issues with severity and `→ code_search` etc.** In a plan there may be multiple tool suggestion lines per issue (one or more).
Since instructions: "Issues must be numbered and sorted by severity desc. `high`... Each issue covers problem location, nature, impact. Each `→` line per tool guidance." Also required: they want plan not result; analysis-only. So mention targeted things to verify.
**Order sorted by severity** and also I should keep summary line.
Let me carefully order issues:
Potentially (high):
1. Divergence between `canMutateSsmaActionPlan()` (backend) and Twig/context override for Gestor de Equipe/Área; if that override doesn't appear in the backend capability, UI/backend permission mismatch → supervisor blocked same as before but team/area managers 403. Need inspect canManageSsmaOccurrences and tags definitions (e.g., prevent false claims), and routes using canCurrentUserEditSsmaAction... Wait, canCurrentUserEditSsmaAction used later? The template flags only; need actual check where the render values. Plan tools: code_search canManageSsmaOccurrences, SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA constants, and check create/update endpoint guard.
This is the crux of permission feature. Severity high though might be "possível inconsistência" requires verification. But any permission regression risky. We'll phrase problem: "Regra de permissão criada está duplicada/divergente..."
2. `mine` param fallback when member not resolved returns full unfiltered payload instead of restricting (possibly scope leak). Medium.
3. Mine filter semantics with validator_member_id: verify map param semantics; if not covering validators it violates requirement "executor ou validador". Also is it in controller, business rule in controller not service.
Also "escopo por perfil" member automatic scope? none changed...
Medium:
4. JS `panelState.mine` (and origin) persist when switching to visão geral; `params.set('mine')` is unconditional → mine filter applied for overview (and other sub-abas?) if backend honors it. Confirm range endpoints in controller apply mine on all payload types. Might be intended; verify.
5. Service origin classification/chart seeds: removal of 'refusal' from seed list and select options removes origin Direito de Recusa grouping from Visão Geral and prevents filtering by it in Pendências; regression risk for previously created actions and charts; verify counts build (originCount derived by resolveOriginKey may get 'refusal' then seed skip → disappear). Medium.
6. Controller god object / policy added (PHP user rule #1) — SsmaController already large (line numbers >16k!). The permission helper and mine branch embedded within controller grow responsibilities. Suggest extraction. medium. Mixed with #? separate issue maybe low severity because it's more architecture. Priority stated the highest for controller. I'll include a medium that suggests extraction could be separate.
JS contract with backend: data-action attributes require new fields (origin_label, description, deadline, pending, executors etc.) from updated service; fallback used for older rows? also the field origin_label only set in service presenter for pendencias path? fine. is contract okay?
7. Low issues:
- inline style gap:6px in JS HTML (style guideline) minor & could use existing utility spacing classes per code quality.
- `openActionViewOffcanvas` fallback with raw fallback DOM ids, jQuery modal triggers; check wrapper exists; if no canvas found returns silently. minor.
- description inserted into data attribute could be huge or contain newline; set via textcontent later safe; low.
Twig low: overflow partial: duplicated permission var with default — if variable not passed yet using old permission in some context means supervisors could still see edit? but default canvas? partial contexts places are only where variable passed? Indeed if some page uses partial and doesn't define new variable, fallback uses old logic canManageOccurrences||can_edit => menu shows edit buttons assuming occurrence manage. Supervisors with viewer previously could edit; with fallback, they keep seeing edit affordances→ backend 403 upon click—but if the partial is rendered from server main context has canMutate false. For contexts missing var line action table of Ações tab maybe on it uses variable. If a supervisor page renders partial without new var, old var comes default false? Actually default(ssmaCanManageOccurrences|default(false)) means if neither passed false → no edit. If new var absent but ssmaCanManageOccurrences true (new code sets both) OK. So fallback behaves like old only on pages where old var still true; new endpoing deny if not set? whatever.
Maybe keep 8 issues total max? Let's prioritize the meat:
Final issues (about 7-8):
1. high — Backend x UI permission divergence: Twig forces permissão true para Gestor de Equipe/Área ("$ssmaCanMutateActionPlan = true") sem equivalente no método canMutateSsmaActionPlan usado que decide os endpoints save/edit; canManageSsmaOccurrences pode não incluir esses gestores → botões aparecem mas backend responde 403 (ou vice-versa). Tools: code_search canManageSsmaOccurrences / 'TAG_TEAM' etc; file_read controller parts around canMutate method and context flags building at ~12725 to map tag names and existing manager capability. Also search templates using ssmaCanMutateActionPlan to check flag set on all routes that render menus, and "canMutateSsmaActionPlan" callers.
2. high/med — Mine sem membro da empresa retorna payload sem filtro; o filtro não é aplicado e o AJAX devolve o conjunto padrão — tratamento errado do "negar por padrão". Need controller context: verify the sequence (payload null when no member) and possibilities of different universe (company member mapping null). Medium–high. I'll rate high as authorization "nega por padrão" violation? But only if member not found; although if member not found, actions don't belong to him anyway but page data still all; user logged but no member record... it already may show data due to earlier logic, uncertain. Medium.
3. high — mine semantics: map [$mineId=>true] param semantics must include validators, since validator_member_id isn't part of responsible_ids; if service filter only uses executor/responsible map it breaks the "executor ou validador" requirement and also possible perm. Also mine logic being in controller not service can expose. Tools inspect buildFilterPayload signature/docs and place filtering action; check validator handled.
Hmm, to combine #2 with #3? maybe separate both under "controller mine path". Keep as separate issues, #2 medium, #3 high with verification. But to be careful: if the map param is generic "members scope" likely also applies validator in same array? not know. plan -> tools verify.
4. medium — Visão Geral/outros contextos sendo afetados por mine (and maybe origin?): builder unconditionally adds mine param regardless do view; service filter then applies to buildFilterPayload of overview AJAX and can narrow 'charter members periodic' etc; confirm route guard of mine only applies when pendencias? Could be acceptable but verify.
5. medium — Direito de Recusa/refusal removido do chart seed and filter dropdowns; dados novos/antigos dessa origem somem da contagem do gráfico/conferência de origem no painel; verify where originCount built (resolve/presentOrigin?) values & seeded usage; if 'refusal' values continue being emitted by resolveOriginKey and by existing enum, then they got dropped from viz without data migration.
6. medium — Controller concentra política de permissão nova e filtro mine; método canMutate + tag magic strings; arquivo já gigante/misto; extrair service. Also duplicated rule of permission between controller method and template flags appears twice (same as issue 1 in a sense). This may be included in issue1? Rules prefer separate but number duplicates... It says each issue a specific risk point. We can include as medium "arquitetura/god object e lógica duplicada de permissão" referencing both places, but issue 1 already flags same divergence.
7. medium — JS escaping & offcanvas. xss? origin url inserted into href may open untrusted? Actually all URL routes are produced from numeric ids... no user text. The escaped data attributes. We can instead raise a lower issue verifying escapeHtml escaping quotes.
Actually an interesting issue: `openActionViewOffcanvas` uses title data set into bootstrap modal 'ssmaApActionView' maybe this markup is on page (action). Ok.
8. low — inline style to space buttons vs existing classes, plus column 'Pendência' uses row.pending may be missing for some rows? fallback already.
Probably choose around 6-7 issues with 1-3 tool lines each. Also note that I must produce conclusions matter-of-fact in portuguese.
Additionally, ensure "Issues" heading then numbered items 1.., sort desc severity. Use "(none)" if none — not our case.
Also each issue line first includes severity like:
`1. [alta] ...` Use required labels: `[high]`, `[medium]`, `[low]`. They also demanded in Portuguese but severity tokens are standard given example [high]. Let me use exactly lower tokens `[high]`, `[medium]`, `[low]`.
Also mention line/file locations precisely for focus.
Summary line for the change: e.g., "Adiciona filtros de Origem e Minhas ações no painel de pendências do Plano de Ação SSMA, com offcanvas de visualização, colunas quem executa/valida e link de origem, e restringe criação/edição de ações para gestores/administradores (supervisor somente visualiza), ajustando service e templates..."
Tool guidance text in Portuguese after em dash. Examples include e.g.:
`→ code_search canManageSsmaOccurrences em src/Controller/SsmaController.php — verificar se Gestor de Equipe/Área satisfaz essa capacidade antes de concluir sobre o descompasso`.
For searching across.
We can also verify names: canMutateSsmaActionPlan appears in controller; tags come from `SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA`.
Let's detail numbering:
1. [high] Divergence in new permission rule between canMutate and template override for team/area manager.
Location describe: `canMutateSsmaActionPlan()` final `return $this->canManageSsmaOccurrences();` v.a. linhas ~12776/12778 e `_action_plan_overflow_menu` using `ssmaCanMutateActionPlan`.
Impact: UI libera Criar/Editar para um perfil que backend nega (403) ou vice-versa. Risk: boss gestor bloqueado etc. Because UI forcing true while backend denies means main negative; if canManage covers these tags no error. Need verify.
→ code_search 'function canManageSsmaOccurrences' and its body.
→ code_search 'ssmaCanMutateActionPlan' all code to identify all contexts and where variable computed.
→ file_read SsmaController linha≈12716-12745 to compare tags variables (ssmaIsTagTeamGestor etc.) and where these tag names come from.
2. [high] only possible after verification claim? Maybe set high only with check request. Alternatively set 'Pendência de verificação' and severity assess after tool? We produce plan w/ severity; describe potentially high.
2. [high] Filtro mine no AJAX não considera validadores...? Not verified yet... Hmm can I put [high] if we can't confirm? Actually could infer from argument semantics but not known. Provide medium for that then? It's central role. Let's assign med/high? I'd choose medium since requires validation.
Wait but requirement itself: filter mine for executor or validator. If service filter passed map doesn't know validator ids... The row validators come from service with validator member id and responsible_ids. The mine filter param as "only include actions that have one of those members as responsible or validator"? To satisfy, lookup must include validator in WHERE; the controller passes map toward param that is actually present in original call presumably a "member"/responsible restriction? Let me phrase risk: "O `[$mineId => true]` é inserido na mesma posição de um parâmetro que hoje restringe por responsável/... sem garantia de considerar validador..." requires search.
→ code_search buildFilterPayload signature call.
Use high severity? The actual bug if true is functional. Mark medium, but can be high after verifying? In plan, mark [high] when confidence? Format requires fixed severity. We'll call high if impact clearly from rule. But without code, mis-severity maybe judged? We decide [medium] (possible edge).
3. [medium] Authorização do "mine": caso usuário logado não resolva membro atual da empresa ($member null / mineId 0) cai no payload sem filtro (escopo cheio) em vez de resultar em lista vazia. That's a "nega por padrão" issue - authorization; mark high? It can leak scope only when user is not member of company but can open panel or if mapping fails. Context probably page only allowed when member; user considered member. Should be medium. Nonetheless, treat context test: look at start of AJAX action scope guard with company (getCurrentCompanyMember). might be always non-null. Let's classify medium.
→ file_read controller around lines 470-550 to understand member resolution and access guard/returns for `$member null`.
4. [medium] Origin filter param lost for "Visão Geral", plus chart labels changed & broken persisted? Also, mine param follows all vies. Actually maybe mine param issue ties to #4 as overviews.
define: `params.set('mine','1')` is executed regardless of sub-aba; after user mark in Pendências switches to Visão Geral, same request with mine=1 can be sent to overview endpoint; verify intended & charted summary filtered, perhaps ok.
Also origin filter parameter only for Pendências; if filter was selected and user navigates to another view, the state retains but no effect. Fine - not harmful.
Level: low/medium. medium? Simply behavior unknown maybe low. We may include as low and mention whether intended. Hmm rules are about risk point... Ux bug random. Probably include as low.
→ file_read js para track parameters functions + controller endpoint for visao_geral get handling.
5. [medium] Refusal removed/Acidente split refactor from chart seeds and origin select may drop old 'refusal' origins from counting in Visão Geral & filtro; verify originCount aggregation can emit refusal plus defaults. could result there are missing chart groups after PR. Keep medium.
→ code_search resolveOriginCount ... else just section chart data building in service file.
→ code_search 'refusal|Direito de Recusa' across service to see if some legacy labels drop or keep.
6. [medium] Controller "god object"/policy mixing big concern per user's controller rule #1: new private helper and tags string list and AJAX mine inside; suggest move to service; plus duplicated permission boolean in Twig generation & backend as separate source of truth → high enough shared.
Actually combine #1 and #6? #1 already discussed duplicated but diff focuses. But #1 & #7? I can present #6 as architecture/duplication separate low or medium.
7. [low] Inline style used for gap button and one CSS custom-class maybe prefer margin class; code style.
8. [low] openActionViewOffcanvas silent fallback: if canvas absent there is no user notice and function `window.openOffcanvasssmaApActionView` optional not defined return - require markup presence. medium? not.
Maybe also check XSS: data attributes collected from server data; all escaped; but double-check `escapeHtml` escapes quotes. also the `origin_url` attr building is before escape. Add [low]. But not necessary.
Possibly even more central: The new `#ap_painel_filter_origem` value select keys and server options only in template fallback not using `panel_filters.origin` if controller not updated? service updated adding 'origin' plus 'overview_origins'; Template default list matches service (five values plus All). fine.
One more possible high issue: The select origin filter is attached in Pendências state sync and added to API params `origin` — while in **Visão Geral AJAX** there is a preexisting param `origin` (generic payload argument), but not set from this panel? Not necessarily.
Now let's consider service action filter uniqueness: The origin filter array_filter then array_values reindexes; but after that other code continues (deadline...). line ~125 yes filter applied inside default pendencias block after deadline filter before axes; that's fine. But then further at line ~? there may be other scoped filters for team etc. no issue.
Potential bug: In resolveOriginKey event detection order places `str_contains($event,'ACIDENTE')` before checking ROS? The new order handles ACIDENTE before ROS because ROS event type constants may contain word 'ACIDENTE'? unlikely. What about `QUASE ACIDENTE` caught near; 'ACIDENTE MATERIAL' caught; 'ACIDENTE' caught personal default. If a event acronym equals 'ACIDENTE COM AFASTAMENTO'... still personal. OK.
But what about order: code tests `PESSOAL` before `MATERIAL`; a record containing "ACIDENTE PESSOAL MATERIAL"? rare. fine.
Yet one subtle data behavior: The old mapping reported near_miss as accident. Now chart split changes historical counts placing near_miss under own group; new columns need legend text updated on front; charts seeds label changed; good. no.
Output format exactly:
Summary: ...
Issues
1. [high] (...)
→ code_search ... — ...
→ file_read ... — ...
2. [medium] ...
Need ensure tool call "arguments" in text in parentheses maybe. Provide parameters recognizable: because output isn't actually invoking them, e.g. `→ code_search canManageSsmaOccurrences (src/Controller/SsmaController.php)` — should model actual JSON? We can write e.g. `→ code_search canMutateSsmaActionPlan em src/Controller/SsmaController.php — ...`. Keep one line each.
Issue descriptions length moderate.
Now craft them in pt-BR consistent with commented style:
Summaries and issues write with first sentence simple description, then why, what to do.
Potential severity labels: include as first bracketed token: `1. [high] ...`.
Final list chosen:
1. [high] Divergence permissão Backend x UI/template para Gestor de Equipe/Área por causa da duplicação da regra na montagem dos flags do Twig (`$ssmaCanMutateActionPlan = true` in controller SQL/template context at ~12776) e método canMutate retornando somente canManage + exceção de supervisores; se canManage não cobre o gestor de equipe/área então vê botões mas recebe 403 ao salvar/criar (ou botões sumidos quando deveria poder). Ferramentas verificar definição exata dos tags e do canManage, e onde cada endpoint guarda criação/edição.
2. [high] Filtro AJAX "Minhas ações" implementado no controller com mapa [$mineId=>true] inserido antes de buildFilterPayload *só após* payload default já montado — além disso quando membro não resolvido nenhuma restrição — não queda zero. natureza authorization. Already #3 overlap; maybe keep #1 (perm) only and second high cannot be strong unless verify. Let me assign:
Actually maybe #3(buildFilterPayload) as high? Without code, mark high to convey need on key function path.
3. [medium] Not really; combinar map+null result as one permission robustness issue, mark high/med => choose high? In a review plan, severity expectation unspecified — many candidates are unverifiable. Since plan says possible problems and tools to confirm; but severity should still indicate expected. For an issue that, if true, leaks data, must be high. #1 is high. To not inflate, medium.
Let's final label:
1. [high] divergência permissão backend vs template (Gestor Equipe/Área).
2. [medium] mine resolve membro null = payload sem filtro (segue com dados gerais). Actually if no member to begin with, may already not be a panel user. neutral medium.
3. [medium] mine igual validadores? Esse precisa de verificação; mas impact if wrong is feature broken (validator's own not show) - feature correctness, medium.
4. [medium] 'refusal' fora do seed and list options of new origin select – regressão visual/filtro.
5. [medium] duplicidade responsabilidade do canMutate em controller e flags de template (flag re-calculada com critério distinto) mais god-object growth. overlaps #1; re phrase as "regra de permissão recalculada com critério diferente" ... but #1 exactly difference criteria. Merging better into one issue. so issue 1 should cover both divergence + fragmented.
6. [medium] mine/origin params leak to visão geral override where they shouldn't? I still flag low:
`mine` é anexado em todas as abas/contextos no `buildPanelParams`; se a sub-aba Visão Geral não deve ser limitada, gráficos mudarão; confirmar intenção. low.
7. [low] JS inline styles + built string attributes, plus verify escape of quote in escapeHtml for data-action-* (XSS sanitized). low.
8. [low?] Column pendência data.
Maybe 6 issues is good, considering high 1.
Wait important candidate: **"Overflow menu partial uses `ssmaCanMutateActionPlan` default old for contexts missing... the Twig fallback etc."?** not needed.
Another important bug could be the `$mode == 'edit'` path not covered by new create-gate: In method edit action? Original create gate applied when $mode !== 'edit', same before/after; fine.
One more candidate: In `canMutateSsmaActionPlan()` calls `$this->ssmaCurrentMemberPermissionTag()?->getName()`. is `isSsmaViewer()` include a member whose tag is "Supervisor"? Notice duplicate exclusion 'Supervisor de Equipe' and 'Supervisor' and area scope. Is SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA same as 'Supervisor'? Possibly duplicates harmless.
But consider **Equipe/Área manager tag 'Supervisor de Equipe'?** team manager has area scope? If a "Supervisor de Equipe" is indeed "Gestor de Equipe"? The string match maybe intended.
Need search tags; plan suggests verify with code_search `'Supervisor de Equipe'` & SsmaAreaLimitationScope constants and how canManage combines.
There is also global security rule: an authorization helper in Controller with tag-name string list is a risk if new tag labels are introduced and not covered - suggest extract dedicated capability. fold.
Let's draft.
Descriptions in Portuguese:
---
Summary: Painel de Plano de Ação SSMA ganha filtro de origem e "Minhas ações", colunas executor/validador, offcanvas somente leitura e link para a origem; no backend o painel AJAX passa a filtrar por origem e por membro, e a permissão de criar/editar ação deixa de valer para supervisor/viewer (passa a exigir gestão), com ajustes nos templates de menu e filtros.
Issues
1. [high] A nova regra que libera Criar/Editar para Gestor de Equipe/Área existe em dois lugares com critérios diferentes: ... `canMutateSsmaActionPlan()` decide os endpoints (criar/editar/resolver) e devolve `canManageSsmaOccurrences()`; o flag renderizado ("$ssmaCanMutateActionPlan = true") é forçado true pela condição ... Se `canManageSsmaOccurrences()` não enxergar o tag de Gestor de Equipe/Área, a tela mostra os botões/menu, mas o AJAX de salvar recebe 403; se enxergar, o ajuste de template é redundante e diverge do método. ... run tools verifying:
→ code_search `function canManageSsmaOccurrences` maybe need full path src/Controller/SsmaController.php.
→ code_search `TAG_SUPERVISOR_AREA|Supervisor de Equipe|ssmaIsTagTeamGestor|ssmaIsTagAreaGestor` controller/dependências.
→ file_read context lines 12560–12790 for flag definitions to see tags and logic.
→ code_search `canMutateSsmaActionPlan` para mapear endpoints protegidos + partial.
2. [medium] "Minhas ações" resultado vira lista completa sem filtro quando usuário logado não é membro da empresa (member null/0): o payload default foi montado antes do `if (mine)` e só é substituído se `mineId > 0`; a resposta mantém todas as ações, numa situação de "negar por padrão" deveria vir vazio. ver tools: file_read around 500-560, plus `getCurrentCompanyMember` behavior.
3. [medium] Filtro para validadores provavelmente não coberto: O mapa [$mineId => true] é passado por parâmetro na mesma posição usada p/ responsáveis/executores; o validador mora em validator_member_id separado; exigência: mine deve pegar quem é executor ou validador. Se não, validator não vê; services.
4. [medium] regressão de origem Direito de Recusa: select novo de origem remove valor 'refusal' e `presentSeededOriginChart` retira seed 'refusal'; dados antigos com origem recusa deixam de aparecer no gráfico Origem e não são selecionáveis; se resolveOriginKey can still emit refusal and rows exist, sumem do total. is that intended? no.
5. [low] "Minhas ações" é anexada ao request em todas as sub-abas/view: like overview; maintain and check with back: mine=1 applied? if not intended charts now filtered. Confirm intended behavior.
6. [low] Offcanvas fallbacks + data attributes: new modal markup assumption likely located in partial template of panel; verify exists and escapeHtml escaping quotes (XSS safety).
7. maybe low about controller god object; incorporate in 1.
Should I include low about escaping quote in dataset? as a low issue:
`escapeHtml` no JS must escape `"` para garantir o atributo... The implementation likely escapes; we can fold into issue 6 as small low.
Need check expected exactly 1... and ordering.
Now, though, several proposed calls duplicate (code_search same term from multiple lines) — ok.
Also should we mention tests? In issue maybe mention tests to cover the permission logic — under service rule, change in authorization without test coverage critical—actually user controller rules say "Mudança de comportamento sem teste automatizado ... fluxo de autorização, dinheiro, exclusão ou estado é Crítico." Great: another concrete issue from their rules:
Add a high/medium? "Novo fluxo de autorização (canMutate/canCreate) além dos guards altera comportamento sem nenhum teste automatizado cobrindo; supervisor/team manager scenario." This is more like a test gap - rules treat as critical for authorization flows. Severity could be medium? Rules say Autorização muda sem teste = Critical. Reviewer user explicitly rules: "Mudança de comportamento sem teste automatizado cobrindo o fluxo real ... em fluxo de autorização ... é Crítico." So produce a medium/high issue (because code review would flag). Could include [medium] or [high] separate: perhaps [high]? To balance, include [?] If they consider flag; include this issue: author should add test to admin/supervisor; severity high because authorization flow. We can position after #1.. maybe. Let's incorporate in #1 by listing a tool? Because #1 itself about code, test-gap separate risk; but list continuous.
Let's estimate final 7 issues ordered:
1. [high] divergência permission rule (UI/back)
2. [medium] regressão/divergência dados or... maybe permission mapping/high res? #2 changed previously permitted supervisor create/ edit? intentional. not bug.
2. Maybe "autór. sem teste automatizado" high? The current changes didn't add test while tests folder maybe nonexistent. User specific priority 3 says "Mudança de comportamento sem teste" at controller section: Critical. We can include a high? There could be existing helper tests. Need tools file_find tests around controllers/services to verify. But issue in plan list, with description to tests coverage; severity medium because code may already have tests elsewhere. Maybe do medium.
Let's set order:
1. [high] Permissões divergentes gestor de equipe/área UI ↔ backend.
2. [medium] Backup mine sem membro retorna lista completa...
3. [medium] mine não cobre validador if param targets responsible_ids.
4. [medium] recusa removida do gráfico/filtro (regressão de classificação).
5. [medium] sem teste automatizado para os caras...
6. [low] mine enviado também para visão geral...
7. [low] offcanvas + dados: verificar escape & markup.
That's 7. Is "medium" 4 heavy? fine.
Maybe also inline `var`? Original file uses var everywhere, existing patterns; skip.
For issue relationship to "priority" maybe #5 can be medium not high, since not proven test absence.
Now write tool intent lines each:
1:
→ code_search `function canManageSsmaOccurrences` (src/Controller/SsmaController.php) — para...
→ code_search `TAG_SUPERVISOR_AREA|TAG_TEAM_GESTOR|ssmaIsTagTeamGestor` ... — confirm membership.
→ file_read SsmaController.php (~12700-12790) — comparar... (args need path?) file_read requires paths list, optional line? no line support? but to describe.
Since file_read tool only paths no ranges described, but planner description 'região entre linhas 12700..'.
2:
→ file_read SsmaController.php region 470-560; search getBoolean('mine'), getCurrentCompanyMember.
→ file_read SsmaActionPlanPanelService.php signature buildFilterPayload — context.
3:
→ code_search `buildFilterPayload(` src + Service...
→ code_search `responsible_ids|validator_member_id` service lines.
→ file_read panelservice.
4:
→ code_search `refusal|Direito de Recusa` in service/twig.
→ file_read chart assembly present/ origin count.
5:
→ file_find ActionPlanPanel*Test? tests dir.
→ code_search 'canMutateSsmaActionPlan' in tests maybe none, to gauge coverage.
6:
→ file_read js area ~380-420.
→ code_search mine query in controller - handle overview; plus service mine usage…
7:
→ code_search escapeHtml in public/js/ssma/action_plan_panel.js; file_read top function definition.
→ file_find offcanvas ssma view files.
Now the summary line + Issues.
Need not mention every heuristic possibly; it's plan. Ensure natural PT consistent.
Let’s compose final.
Summary: O painel de Plano de Ação SSMA ganha filtros de Origem e "Minhas ações" na sub-aba Pendências, colunas "Quem executa/Quem valida", link "Ir para origem" e um offcanvas de leitura para visualizar a ação; no backend, o endpoint AJAX passa a aceitar os filtros `origin` e `mine`, e a permissão de criar/editar/resolver ação deixa de valer para supervisores/viewers, passando a exigir perfil de gestão. Os templates e o service foram ajustados para alimentar a nova tabela, os filtros e os menus.
Issues
1. [high] A regra de permissão para Gestor de Equipe/Área ficou duplicada com critérios possivelmente divergentes: o método `canMutateSsmaActionPlan()` decide os endpoints de criar/editar/resolver e retorna apenas `canManageSsmaOccurrences()` quando o usuário não é viewer/supervisor, enquanto a montagem dos flags do Twig força `$ssmaCanMutateActionPlan = true` sempre que `$ssmaIsTagTeamGestor || $ssmaIsTagAreaGestor`. Se `canManageSsmaOccurrences()` não reconhecer esses tags, o Gestor de Equipe/Área verá os botões de criar/editar no painel e no menu, mas o backend responderá 403 ao salvar (ou, no sentido inverso, a tela esconderá ações que o backend aceitaria). Isso também fragiliza a manutenção futura porque a política de autorização passa a viver em dois pontos com fontes de verdade diferentes.
→ code_search function canManageSsmaOccurrences em src/Controller/SsmaController.php — confirmar se a capacidade já engloba Gestor de Equipe/Área ou se é independente dos tags.
→ code_search TAG_SUPERVISOR_AREA|ssmaIsTagTeamGestor|ssmaIsTagAreaGestor — mapear os nomes de tags envolvidos e como cada flag é calculada.
→ file_read src/Controller/SsmaController.php (região das linhas 12560–12790) — comparar o método `canMutateSsmaActionPlan()` com a lógica de flags fornecida ao Twig.
→ code_search canMutateSsmaActionPlan — levantar todos os endpoints e pontos do template que passam a depender dessa nova política.
2. [medium] No filtro "Minhas ações", quando o usuário logado não resolve um membro da empresa (`$member` nulo ou `mineId = 0`), o payload padrão montado antes do `if ($request->query->getBoolean('mine'))` não é substituído e a resposta devolve o conjunto completo de ações, em vez de uma lista vazia. Numa regra de "negar por padrão", o correto seria devolver vazio ou 403; do jeito atual, o parâmetro `mine` pode silenciosamente não filtrar nada e expor escopo que a marcação prometeu restringir.
→ file_read src/Controller/SsmaController.php (região das linhas 470–560) — ver como o membro é resolvido e se há guarda que garanta membro não nulo antes desse trecho.
→ code_search getCurrentCompanyMember — conferir condições em que retorna null para um usuário autenticado que acessa o painel.
3. [medium] O filtro "Minhas ações" precisa, pela regra de negócio, retornar ações em que o usuário é executor **ou validador**, mas o mapa `[$mineId => true]` é passado na mesma posição de um argumento que historicamente lida com responsáveis/executores (`responsible_ids`), enquanto o validador está em `validator_member_id`, coluna separada na consulta. Se o `buildFilterPayload` só casar com `responsible_ids`, um usuário que é apenas validador não verá as próprias ações e a feature ficará incompleta.
→ code_search function buildFilterPayload em src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php — entender o significado exato do parâmetro que recebe `[$mineId => true]`.
→ code_search responsible_ids|validator_member_id em src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php — verificar se o filtro por membro considera também `validator_member_id`.
4. [medium] A reclassificação de origens remove "Direito de Recusa" do seletor de origem e do seed do gráfico `presentSeededOriginChart()`: ações antigas com origem `refusal` continuam existindo e o `resolveOriginKey()` ainda é capaz de retornar `refusal`, mas elas deixam de ser contabilizadas no gráfico de origem da Visão Geral e não aparecem como opção selecionável no filtro novo. Na prática é uma regressão de visibilidade de dado já gravado, não apenas de label.
→ code_search refusal|Direito de Recusa em src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php — confirmar se a chave ainda é produzida em algum caminho e onde deixa de ser exibida.
→ code_search presentSeededOriginChart|originCount|overview_origins — verificar como a contagem é agregada e se origens fora do seed são preservadas ou descartadas.
5. [medium] A mudança mexe num fluxo de autorização sensível (quem pode criar/editar/resolver ação, com bloqueio explícito de supervisor/viewer) sem que o diff traga teste automatizado cobrindo os cenários reais: supervisor não pode, gestor/equipe pode, membro comum não pode. Como é política de permissão, a ausência de teste é um risco de regressão silenciosa em PRs futuras.
→ file_find SsmaControllerTest|ActionPlan*Test — localizar a suíte existente do controller/serviço para ver se há cobertura de permissão.
→ code_search canMutateSsmaActionPlan|canAccessSsmaSupervisorSurface em tests/ — confirmar se os novos cenários foram ou não cobertos.
6. [low] O parâmetro `mine` é adicionado no `buildPanelParams()` fora do branch de Pendências, ou seja, ele vale para qualquer sub-aba/visão ativa no momento (inclusive Visão Geral), e o backend aplica o filtro no payload independentemente da visão. Se a intenção era restringir "Minhas ações" apenas à tabela de Pendências, os gráficos da Visão Geral passarão a ser filtrados sem indicação visual clara; se a intenção é global, falta garantir que o estado do checkbox seja consistente ao trocar de sub-aba.
→ file_read public/js/ssma/action_plan_panel.js (região das linhas 370–430) — confirmar em quais fluxos o `mine` é anexado e quando o estado é limpo.
→ code_search getBoolean\('mine'\) em src/Controller/SsmaController.php — ver se o tratamento no backend distingue a visão antes de filtrar.
7. [low] O offcanvas novo lê vários `data-action-*` montados como string HTML no `buildPendenciasTableRowHtml()`; a segurança depende de `escapeHtml()` escapar aspas duplas corretamente, e a abertura depende de um wrapper/offcanvas existir na página. Vale confirmar o escape e o markup, e também preferir classes utilitárias existentes no lugar do `style="gap:6px;"` inline na célula de ações.
→ code_search function escapeHtml em public/js/ssma/action_plan_panel.js — conferir se a implementação escapa aspas e `<`, `>` para o contexto de atributo.
→ file_find ssmaApActionView|ssma-ap-action-view — localizar no template o offcanvas que recebe os dados e validar que os ids usados no JS existem.
main_task
Request #1
deepseek-v4-flash
P:23.18K C:392 CR:2.82K CW:0
3467ms
Reasoning
Let me start by understanding the changes and verifying the issues raised in the review plan.
Let me look at the files and gather context.
First, let me examine the JS file, the controller, the service, and templates. Let me start by reading relevant code sections.
Let me start with the review plan's investigation items.
1. The permission rule duplicated for `canMutateSsmaActionPlan()` vs `$ssmaCanMutateActionPlan` flags. Need to check `canManageSsmaOccurrences()` and how tags map.
2. `mine` filter when member not resolved returns full payload.
3. "Minhas ações" filter matching only responsible_ids not validator_member_id.
4. Refusal classification regression.
5. Missing tests.
6. `mine` param added outside Pendencias branch.
7. Offcanvas data attributes, escapeHtml, existing wrapper.
Let me gather context with tool calls. Let me start with reading the SsmaController relevant regions and searching.
Tool Calls (3)
file_read
Show Details
Arguments
{"file_path": "src/Controller/SsmaController.php", "start_line": 460, "end_line": 560}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 460-560
460|
461| $viewData = $this->buildSsmaViewData();
462| $company = $this->getSsmaCompany();
463| if ($company instanceof Company) {
464| $this->syncSsmaLinkedProjectMembersForCompany($company);
465| }
466|
467| return $this->render('ssma/action_plan/index.html.twig', array_merge($viewData, [
468| 'ssmaPlanoAcaoActiveTab' => 'tab_plano_painel',
469| 'action_plan_panel_data' => $this->buildActionPlanPanelViewData($request),
470| ]));
471| }
472|
473| public function planoAcaoPanelFilter(Request $request): JsonResponse
474| {
475| if (!$this->canAccessSsmaActionPlanHub()) {
476| return new JsonResponse(['success' => false, 'message' => 'Sem permissão.'], 403);
477| }
478|
479| $company = $this->getSsmaCompany();
480| if (!$company instanceof Company) {
481| $emptyPanel = $this->actionPlanPanelPresenter->presentFilterResponse([
482| 'view' => 'pendencias',
483| 'panel_data' => $this->buildEmptyActionPlanPanelData(),
484| ], []);
485|
486| return new JsonResponse(array_merge(['success' => true], $emptyPanel));
487| }
488|
489| $view = (string) $request->query->get('view', 'pendencias');
490| $period = (string) $request->query->get('period', $view === 'pendencias' ? 'next_month' : 'last_3_months');
491| $axis = (string) $request->query->get('axis', '');
492| $team = trim((string) $request->query->get('team', ''));
493| $vinculo = strtoupper(trim((string) $request->query->get('vinculo', '')));
494| $page = max(1, (int) $request->query->get('page', 1));
495| $perPage = max(1, min(100, (int) $request->query->get('per_page', 10)));
496|
497| $unidadeScope = $this->resolveSsmaUnidadeFilterScope($company, $request);
498| $scopeCompanies = $view === 'comparativo'
499| ? $this->resolveSsmaNetworkSubsidiaries($company)
500| : $unidadeScope['companies'];
501| $dataCompany = $unidadeScope['data_company'];
502|
503| $payload = $this->ssmaActionPlanPanelService->buildFilterPayload(
504| $scopeCompanies,
505| $dataCompany,
506| $view,
507| $period,
508| $axis,
509| $team,
510| $vinculo,
511| $this->getActionTypeMetadata(),
512| $this->resolveActionPlanPanelMemberScope($company),
513| $page,
514| $perPage,
515| trim((string) $request->query->get('management', '')),
516| trim((string) $request->query->get('area', '')),
517| trim((string) $request->query->get('exec_responsible', '')),
518| trim((string) $request->query->get('val_responsible', '')),
519| trim((string) $request->query->get('origin', '')),
520| );
521|
522| if ($request->query->getBoolean('mine')) {
523| $user = $this->getUser();
524| $member = ($user instanceof User) ? $this->getCurrentCompanyMember($company, $user) : null;
525| $mineId = (int) ($member?->getId() ?? 0);
526| if ($mineId > 0) {
527| $payload = $this->ssmaActionPlanPanelService->buildFilterPayload(
528| $scopeCompanies,
529| $dataCompany,
530| $view,
531| $period,
532| $axis,
533| $team,
534| $vinculo,
535| $this->getActionTypeMetadata(),
536| [$mineId => true],
537| $page,
538| $perPage,
539| trim((string) $request->query->get('management', '')),
540| trim((string) $request->query->get('area', '')),
541| trim((string) $request->query->get('exec_responsible', '')),
542| trim((string) $request->query->get('val_responsible', '')),
543| trim((string) $request->query->get('origin', '')),
544| );
545| }
546| }
547|
548| $filterOptions = $this->ssmaActionPlanPanelService->buildFilterOptions($dataCompany);
549| $presented = $this->actionPlanPanelPresenter->presentFilterResponse($payload, $filterOptions);
550|
551| return $this->ssmaJsonResponse(array_merge(['success' => true], $presented));
552| }
553|
554| /** @return array<string, mixed> */
555| private function buildActionPlanPanelViewData(Request $request): array
556| {
557| $company = $this->getSsmaCompany();
558| if (!$company instanceof Company) {
559| return $this->actionPlanPanelPresenter->presentDashboard(
560| ['panel_data' => $this->buildEmptyActionPlanPanelData()],
code_search
Show Details
Arguments
{"search_text": "function canManageSsmaOccurrences", "file_patterns": ["src/Controller/SsmaController.php"]}
Result
File: src/Controller/SsmaController.php Match lines: 1 11339| private function canManageSsmaOccurrences(): bool
code_search
Show Details
Arguments
{"search_text": "canMutateSsmaActionPlan"}
Result
File: src/Controller/SsmaController.php
Match lines: 5
7981| if ($mode !== 'edit' && !$this->canMutateSsmaActionPlan()) {
11467| private function canMutateSsmaActionPlan(): bool
12612| $ssmaCanCreateLinkedActions = $this->canMutateSsmaActionPlan();
16141| return $this->canMutateSsmaActionPlan();
16272| $canManage = $this->canMutateSsmaActionPlan();
Request #2
deepseek-v4-flash
P:25.07K C:190 CR:23.55K CW:0
1970ms
Reasoning
Let me read the `canManageSsmaOccurrences` and `canMutateSsmaActionPlan` methods and surrounding code.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 11380, "file_path": "src/Controller/SsmaController.php", "start_line": 11320}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 11320-11380
11320| }
11321|
11322| if ($status === \App\Service\Ssma\SsmaOccurrenceApprovalService::STATUS_REJECTED) {
11323| return;
11324| }
11325|
11326| $this->ssmaOccurrenceApprovalService->markPending($event, false);
11327| $this->ssmaNotificationService->notifyOccurrenceValidationApprovers($company, $event, $sender, false);
11328| }
11329|
11330| private function notifyOccurrenceRegistrantOnReject(
11331| SsmaEvent $event,
11332| Company $company,
11333| User $sender,
11334| string $note
11335| ): void {
11336| $this->ssmaNotificationService->notifyOccurrenceRegistrantOnReject($event, $sender, $note);
11337| }
11338|
11339| private function canManageSsmaOccurrences(): bool
11340| {
11341| $user = $this->getUser();
11342| $company = $this->getSsmaCompany() ?? ($user instanceof User ? $user->getCompany() : null);
11343| if ($user instanceof User && $company instanceof Company
11344| && $this->shouldStripSsmaManagementUiForUser($company, $user)) {
11345| return false;
11346| }
11347|
11348| if (
11349| $this->isGranted('ROLE_SUPER_ADMIN')
11350| || $this->isGranted('ROLE_MANAGER')
11351| || $this->isGranted('ROLE_MANAGER_GESTOR')
11352| || $this->isGranted('ROLE_TENANT')
11353| ) {
11354| return true;
11355| }
11356|
11357| $member = null;
11358| if ($user instanceof User) {
11359| $company = $this->getSsmaCompany() ?? $user->getCompany();
11360| if ($company instanceof Company) {
11361| $member = $this->getCurrentCompanyMember($company, $user);
11362| }
11363| }
11364| if ($this->memberIsSsmaGestorAdministrador($member)) {
11365| return true;
11366| }
11367|
11368| $tag = $this->ssmaCurrentMemberPermissionTag();
11369|
11370| $request = $this->requestStack->getCurrentRequest();
11371| if ($request && (
11372| (bool) $request->attributes->get('can_create', false)
11373| || (bool) $request->attributes->get('can_edit', false)
11374| || (bool) $request->attributes->get('can_delete', false)
11375| )) {
11376| return true;
11377| }
11378|
11379| if (!$tag) {
11380| return false;
file_read
Show Details
Arguments
{"end_line": 11500, "file_path": "src/Controller/SsmaController.php", "start_line": 11440}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 11440-11500
11440|
11441| $member = $this->getCurrentCompanyMember($company, $user);
11442|
11443| return $this->ssmaOccurrenceCreatePermissionService->canCreateOccurrenceType(
11444| $member,
11445| $user,
11446| $company,
11447| $typeKey,
11448| $this->canManageSsmaOccurrences(),
11449| );
11450| }
11451|
11452| private function canManageSsmaPermissions(): bool
11453| {
11454| return $this->isGranted('ROLE_SUPER_ADMIN') || $this->isGranted('ROLE_MANAGER');
11455| }
11456|
11457| private function canAccessSsmaSupervisorSurface(): bool
11458| {
11459| return $this->canManageSsmaOccurrences() || $this->isSsmaViewer();
11460| }
11461|
11462| /**
11463| * Criar/editar Plano de Ação: gestor/admin.
11464| * Supervisor (viewer ou tag Supervisor*) só visualiza dash/painel — Brenda áudio 6.
11465| * Gestor de Equipe/Área continua podendo mutar.
11466| */
11467| private function canMutateSsmaActionPlan(): bool
11468| {
11469| if ($this->isSsmaViewer()) {
11470| return false;
11471| }
11472|
11473| $tagName = $this->ssmaCurrentMemberPermissionTag()?->getName();
11474| if (in_array($tagName, [
11475| 'Supervisor de Equipe',
11476| 'Supervisor',
11477| SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA,
11478| ], true)) {
11479| return false;
11480| }
11481|
11482| return $this->canManageSsmaOccurrences();
11483| }
11484|
11485| /**
11486| * Abas "Painel" e "Metas" em Prevenção Ativa: apenas perfis de supervisão/gestão na empresa.
11487| * Não usar {@see canAccessSsmaSupervisorSurface()} aqui: ele inclui Membro com can_create na tag
11488| * ssma-prevention (para registrar inspeção/abordagem), e na planilha Membro não acessa Painel/Metas.
11489| */
11490| private function canAccessPreventionDashboardAndMetasTabs(): bool
11491| {
11492| return $this->isGranted('ROLE_SUPER_ADMIN')
11493| || $this->isGranted('ROLE_MANAGER')
11494| || $this->isGranted('ROLE_MANAGER_GESTOR')
11495| || $this->isSsmaViewer();
11496| }
11497|
11498| /**
11499| * Palloma: ROLE_USER + tag Membro/Inspetor → strip de gestão (mesmo com ROLE_MANAGER de plataforma).
11500| * Aura: ROLE_MANAGER sem ROLE_USER + tag Membro → mantém gestão (retorna false aqui).
Request #3
deepseek-v4-flash
P:26.81K C:197 CR:25.22K CW:0
1660ms
Reasoning
Let me continue reading `canManageSsmaOccurrences` to see its full body, and read the section around 12560-12800 to see flags computation.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 11420, "file_path": "src/Controller/SsmaController.php", "start_line": 11380}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 11380-11420
11380| return false;
11381| }
11382|
11383| return (bool) ($tag->getCanCreate() ?? false)
11384| || (bool) ($tag->getCanEdit() ?? false)
11385| || (bool) ($tag->getCanDelete() ?? false);
11386| }
11387|
11388| /**
11389| * Edição no detalhe (UI + API legada createOccurrence edit + updateEvent).
11390| * Tenant/super admin e admin de aprofundamento (Gestor Administrador) editam tudo.
11391| */
11392| private function canEditSsmaOccurrenceDetail(): bool
11393| {
11394| $user = $this->getUser();
11395| $company = $user instanceof User ? $user->getCompany() : null;
11396| if ($user instanceof User && $this->isSsmaAprofundamentoAdmin($company, $user)) {
11397| return true;
11398| }
11399|
11400| return SsmaOccurrenceCreatePermissionService::canEditOccurrenceDetail(
11401| $this->isGranted('ROLE_SUPER_ADMIN'),
11402| $this->isGranted('ROLE_TENANT'),
11403| );
11404| }
11405|
11406| /**
11407| * Permissão padrão do Membro: registrar a PRÓPRIA ocorrência.
11408| *
11409| * Diferente de canManageSsmaOccurrences() (que também habilita editar/excluir/resolver),
11410| * esta capacidade libera apenas a CRIAÇÃO para o membro comum da empresa que tem acesso
11411| * à área de ocorrências. Supervisores (somente leitura) ficam de fora; gestores/admins
11412| * já são cobertos por canManageSsmaOccurrences().
11413| */
11414| private function canMemberRegisterOwnOccurrence(?Company $company, ?User $user): bool
11415| {
11416| if (!$company || !$user) {
11417| return false;
11418| }
11419|
11420| if ($this->canManageSsmaOccurrences()) {
file_read
Show Details
Arguments
{"end_line": 12790, "file_path": "src/Controller/SsmaController.php", "start_line": 12550}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 12550-12790
12550| } else {
12551| $occurrences = $company ? $this->loadOccurrences($company, $allMembers, $teams) : [];
12552| }
12553| if ($occurrences !== []) {
12554| // Sempre anexa cause_tree_id na página atual (UX: botão Causa aparece no SSR).
12555| // Painel/inspeções/horas continuam deferred; só o mapa de árvores volta no hub.
12556| if ($company instanceof Company) {
12557| $itemsForTrees = [];
12558| foreach ($occurrences as $occRow) {
12559| $entityId = (int) ($occRow['id'] ?? 0);
12560| if ($entityId <= 0) {
12561| continue;
12562| }
12563| $itemsForTrees[] = [
12564| 'id' => $entityId,
12565| 'is_ssma_event' => !empty($occRow['is_ssma_event']),
12566| ];
12567| }
12568| if ($itemsForTrees !== []) {
12569| $treeMeta = $this->ssmaCauseTreeService->resolveEntityTreeMetaBatch(
12570| (int) $company->getId(),
12571| $itemsForTrees
12572| );
12573| foreach ($occurrences as $idx => $occRow) {
12574| $entityId = (int) ($occRow['id'] ?? 0);
12575| $key = (!empty($occRow['is_ssma_event']) ? 'e:' : 'o:') . $entityId;
12576| $occurrences[$idx]['cause_tree_id'] = $treeMeta[$key]['cause_tree_id'] ?? null;
12577| }
12578| }
12579| }
12580| $occurrences = $this->enrichOccurrencesCommitteeTriggerFlags($occurrences, $company);
12581| $occurrences = $this->enrichOccurrencesGravityLabels($occurrences);
12582| }
12583| if ($deferOccurrenceHubHeavyData) {
12584| $actionsTaken = [];
12585| $inspections = [];
12586| $horasData = [];
12587| } else {
12588| $actionsTaken = $company ? $this->loadActions($company) : [];
12589| $inspections = $company ? $this->loadInspections($company, $allMembers, $teams) : [];
12590| $horasData = $company ? $this->loadHorasData($company) : [];
12591| }
12592| }
12593| if ($needsPreventionCollections) {
12594| $abordagens = $company ? $this->loadAbordagens($company) : [];
12595| }
12596| $occurrenceUiMeta = $this->getMockOccurrenceMetadata();
12597|
12598| $userTechnicalTypes = $company
12599| ? $this->resolveUserTechnicalTypes($company, $user, $companyMembers ?? [])
12600| : [];
12601| $ssmaCanManageOccurrences = $this->canManageSsmaOccurrences();
12602| $ssmaCanAccessSupervisorSurface = $this->canAccessSsmaSupervisorSurface();
12603| $ssmaCanAccessPreventionPanelAndMetas = $this->canAccessPreventionDashboardAndMetasTabs();
12604| $ssmaCanAccessOccurrencePanel = $ssmaCanManageOccurrences || $this->isSsmaViewer();
12605| // Supervisores veem a aba Automações mas não criam; o botão de criação usa ssmaCanManageOccurrences
12606| $ssmaCanAccessOccurrenceAutomations = $ssmaCanManageOccurrences || $this->isSsmaViewer();
12607| $ssmaCanManageConfig = $this->canManageSsmaConfig();
12608| $ssmaCanManagePermissions = $this->canManageSsmaPermissions();
12609| // ssmaCanCreateLinkedActions: botão "Criar ação" na aba Ocorrências e occurrence_view.
12610| // Brenda: Supervisor só visualiza (dash/painel). Criar/editar fica com gestor/admin
12611| // e Gestor de Equipe (override abaixo). Membro comum não cria.
12612| $ssmaCanCreateLinkedActions = $this->canMutateSsmaActionPlan();
12613| $ssmaCanMutateActionPlan = $ssmaCanCreateLinkedActions;
12614| // ssmaCanCreateCauseTree: Supervisor ?? SOMENTE LEITURA na Árvore de Causas (planilha).
12615| // NÃO incluir isSsmaViewer() aqui. Usa produto ssma-cause-tree (não can_create de ssma-occurrences).
12616| $ssmaCanCreateCauseTree = $this->canCreateSsmaCauseTree();
12617| $ssmaCanCreateAuthorization = $ssmaCanManageOccurrences;
12618| $ssmaCanEditHorasTrabalhadas = $this->canEditSsmaHorasTrabalhadas();
12619|
12620| // Tag SSMA do colaborador — sempre resolve (ROLE_MANAGER de plataforma ≠ perfil SSMA).
12621| $ssmaProductTagName = null;
12622| $memberForTagCheck = null;
12623| $ssmaPreventionProductTagName = null;
12624| if ($company && $user instanceof User) {
12625| $memberForTagCheck = $this->getCurrentCompanyMember($company, $user);
12626| if ($memberForTagCheck) {
12627| $resolvedTag = $this->resolveSsmaProductPermissionTagForMember($memberForTagCheck);
12628| if ($resolvedTag) {
12629| $ssmaProductTagName = $resolvedTag->getName();
12630| }
12631| if ($this->memberIsSsmaGestorAdministrador($memberForTagCheck)) {
12632| $ssmaProductTagName = 'Gestor Administrador';
12633| }
12634| $ssmaPreventionProductTagName = $this->ssmaPreventionHubAccessService
12635| ->resolvePreventionProductTagName($memberForTagCheck);
12636| }
12637| }
12638|
12639| // Membro/Inspetor: visão de pessoa física (matriz de tipos + registrar).
12640| // Só strip se tiver ROLE_USER (Palloma). Conta admin empresa sem ROLE_USER (Aura) mantém abas.
12641| // Tenant / SUPER_ADMIN mantêm abas mesmo com tag Membro (regressão Felipe).
12642| $ssmaIsPlainProductMemberUi = SsmaOccurrenceCreatePermissionService::shouldStripOccurrenceManagementTabsUi(
12643| $ssmaProductTagName,
12644| $this->isGranted('ROLE_SUPER_ADMIN'),
12645| $this->isGranted('ROLE_TENANT'),
12646| $user instanceof User && in_array('ROLE_USER', $user->getRoles(), true)
12647| );
12648| if ($ssmaIsPlainProductMemberUi && !$this->memberIsSsmaGestorAdministrador($memberForTagCheck)) {
12649| $ssmaCanManageOccurrences = false;
12650| $ssmaCanAccessSupervisorSurface = false;
12651| $ssmaCanAccessPreventionPanelAndMetas = false;
12652| $ssmaCanAccessOccurrencePanel = false;
12653| $ssmaCanAccessOccurrenceAutomations = false;
12654| $ssmaCanManageConfig = false;
12655| $ssmaCanManagePermissions = false;
12656| $ssmaCanCreateLinkedActions = false;
12657| $ssmaCanCreateAuthorization = false;
12658| }
12659|
12660| $loggedMemberForCauseTree = ($company && $user instanceof User)
12661| ? $this->getCurrentCompanyMember($company, $user)
12662| : null;
12663|
12664| // Especialistas técnicos (SsmaPermissionTagMember) e gestores/supervisores podem visualizar.
12665| // Membro/Inspetor com acesso só via mapa legado tipo/equipe NÃO recebem o botão na listagem.
12666| $ssmaCanViewCauseTree = $ssmaCanCreateCauseTree
12667| || $this->isSsmaViewer()
12668| || in_array($ssmaProductTagName, ['Gestor Administrador', 'Gestor de Equipe', 'Supervisor de Equipe', 'Supervisor'], true)
12669| || ($loggedMemberForCauseTree && $company && $this->hasSsmaTechnicalCauseTreeAccess($loggedMemberForCauseTree, $company));
12670|
12671| // Hub Ocorrências — botão "Registrar ocorrência" (empty state / FAB): Membro não cria (planilha),
12672| // mesmo com can_create na tag. Só roles de gestão na empresa ou tag Gestor de Equipe / G. Administrador com manage.
12673| // Reutiliza $ssmaProductTagName (já corrigido por memberIsSsmaGestorAdministrador).
12674| $ssmaProductTagNameForRegister = $ssmaProductTagName;
12675| $ssmaCanRegisterNewOccurrence = $this->isGranted('ROLE_SUPER_ADMIN')
12676| || $this->isGranted('ROLE_MANAGER')
12677| || $this->isGranted('ROLE_MANAGER_GESTOR')
12678| || \in_array($ssmaProductTagNameForRegister, ['Gestor de Equipe', 'Gestor Administrador'], true)
12679| // Permissão padrão do Membro: registrar a própria ocorrência.
12680| || $this->canMemberRegisterOwnOccurrence($company, $user);
12681|
12682| $loggedMemberForOccurrence = ($company && $user instanceof User)
12683| ? $this->getCurrentCompanyMember($company, $user)
12684| : null;
12685| $ssmaAllowedCreateTypes = ($company && $user instanceof User)
12686| ? $this->ssmaOccurrenceCreatePermissionService->resolveAllowedCreateTypes(
12687| $loggedMemberForOccurrence,
12688| $user,
12689| $company,
12690| $this->ssmaOccurrenceTypeConfig->getAllowedTypeKeys($company),
12691| $ssmaCanManageOccurrences,
12692| )
12693| : [];
12694| if (!$ssmaCanRegisterNewOccurrence && $ssmaAllowedCreateTypes !== []) {
12695| $ssmaCanRegisterNewOccurrence = true;
12696| }
12697|
12698| $occurrenceTeamFilterIds = $this->getSsmaOccurrenceDashboardTeamFilterIds($company, $user);
12699| $areaScope = $this->getSsmaPreventionAreaScope($company, $user);
12700| $occurrenceAreaFilterIds = $areaScope->isRestricted() ? $areaScope->areaIds() : null;
12701| $viewerTeamIds = $this->getSsmaViewerTeamIds();
12702|
12703| // ── Detecção de Supervisor/Gestor de Equipe via tag SSMA ──────────────────────────────
12704| // Usuários com ROLE_USER + tag SSMA (sem ROLE_MANAGER_VIEWER global) não são detectados pelas
12705| // funções baseadas em role. Identificamos o perfil pelo nome da tag para ajustar flags de UI.
12706| $ssmaIsTagTeamSupervisor = in_array($ssmaProductTagName, ['Supervisor de Equipe', 'Supervisor'], true);
12707| $ssmaIsTagTeamGestor = $ssmaProductTagName === 'Gestor de Equipe';
12708| $ssmaIsTagAreaSupervisor = $ssmaProductTagName === SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA;
12709| $ssmaIsTagAreaGestor = $ssmaProductTagName === SsmaAreaLimitationScope::TAG_GESTOR_AREA;
12710| $ssmaIsPreventionTagTeamSupervisor = in_array($ssmaPreventionProductTagName, ['Supervisor de Equipe', 'Supervisor'], true);
12711| $ssmaIsPreventionTagTeamGestor = $ssmaPreventionProductTagName === 'Gestor de Equipe';
12712|
12713| // Painel + Metas: libera para Sup/G. de Equipe/Área e Gestor Administrador (ocorrências + ssma-prevention)
12714| if (!$ssmaCanAccessPreventionPanelAndMetas
12715| && (
12716| $ssmaIsTagTeamSupervisor
12717| || $ssmaIsTagTeamGestor
12718| || $ssmaIsTagAreaSupervisor
12719| || $ssmaIsTagAreaGestor
12720| || $ssmaProductTagName === 'Gestor Administrador'
12721| || $ssmaIsPreventionTagTeamSupervisor
12722| || $ssmaIsPreventionTagTeamGestor
12723| || $ssmaPreventionProductTagName === 'Gestor Administrador'
12724| )
12725| ) {
12726| $ssmaCanAccessPreventionPanelAndMetas = true;
12727| }
12728|
12729| // Membro/Inspetor (pessoa física / Palloma): não acessa Painel nem Metas.
12730| // Conta admin empresa sem ROLE_USER (Aura), Tenant e SUPER_ADMIN mantêm — mesmo contrato das abas de Ocorrências.
12731| if (SsmaOccurrenceCreatePermissionService::shouldStripOccurrenceManagementTabsUi(
12732| $ssmaProductTagName,
12733| $this->isGranted('ROLE_SUPER_ADMIN'),
12734| $this->isGranted('ROLE_TENANT'),
12735| $user instanceof User && in_array('ROLE_USER', $user->getRoles(), true)
12736| )) {
12737| $ssmaCanAccessPreventionPanelAndMetas = false;
12738| }
12739|
12740| // Modal + Evento: título/status ocultos na criação para todos os perfis (Figma Etapa 0).
12741| // Na edição o JS (evApplyAuraTitleStatusVisibility) reexibe conforme o modo.
12742| $ssmaHideEventTitleStatusOnCreate = true;
12743|
12744| // ssmaIsTeamViewer: true quando o usuário opera com escopo de equipe (via role SSMA OU via tag SSMA)
12745| // Usado para sinalizar ao template que os dados estáo limitados ?? equipe.
12746| $ssmaIsTeamViewerFlag = $viewerTeamIds !== null || $ssmaIsTagTeamSupervisor || $ssmaIsTagTeamGestor
12747| || $ssmaIsTagAreaSupervisor || $ssmaIsTagAreaGestor;
12748|
12749| // ssmaCanCreatePreventionItems: Gestor de Equipe/Área e Gestor Administrador via tag SSMA
12750| // também podem registrar inspeções/abordagens (ssmaCanManageOccurrences = true via tag).
12751| $ssmaCanCreatePreventionItems = (
12752| $this->isGranted('ROLE_SUPER_ADMIN')
12753| || $this->isGranted('ROLE_MANAGER')
12754| || $this->isGranted('ROLE_MANAGER_GESTOR')
12755| || (
12756| $ssmaCanManageOccurrences
12757| && ($ssmaIsTagTeamGestor || $ssmaIsTagAreaGestor || $ssmaProductTagName === 'Gestor Administrador')
12758| )
12759| );
12760|
12761| // ssmaCanEditPreventionContent: controla botões Editar/Finalizar/Deletar em inspeções e abordagens
12762| // e o botão "Configuração" na aba Metas.
12763| // Supervisor registra/edita o próprio conteúdo (can_mutate por item); gestão edita todos.
12764| $ssmaCanEditPreventionContent = $ssmaCanManageOccurrences
12765| && !$this->isSsmaViewer()
12766| && !$ssmaIsTagTeamSupervisor
12767| && !$ssmaIsTagAreaSupervisor;
12768| $ssmaPreventionMutateOwnOnly = false;
12769|
12770| // Configurações da aba Prevenção Ativa: Sup/Gestor de Equipe ou Área não acessam (planilha: "Não acessa")
12771| if ($ssmaIsTagTeamSupervisor || $ssmaIsTagTeamGestor || $ssmaIsTagAreaSupervisor || $ssmaIsTagAreaGestor) {
12772| $ssmaCanManageConfig = false;
12773| }
12774|
12775| // G. Equipe via tag SSMA pode criar ação (Plano de Ação).
12776| // Árvore de causas: {@see canCreateSsmaCauseTree()} já cobre Gestor de Equipe.
12777| if ($ssmaIsTagTeamGestor || $ssmaIsTagAreaGestor) {
12778| $ssmaCanCreateLinkedActions = true;
12779| $ssmaCanMutateActionPlan = true;
12780| }
12781|
12782| // Tabela de metas por pessoa (aba Metas): edição global só para gestão; membro com can_create não gere metas alheias.
12783| $ssmaCanEditPreventionMetasTable = $company && $user instanceof User
12784| && $this->canEditPreventionMetasTableForCurrentUser($company, $user);
12785|
12786| // ssmaPreventionCanCreateLinkedActions: botão "Criar ação" em Inspeções e Abordagem.
12787| // Alinhado com ssmaCanCreateLinkedActions (Plano de Ações): quem não pode criar
12788| // ação no Plano de Ações também não pode criar em inspeção/abordagem/árvore.
12789| $ssmaPreventionCanCreateLinkedActions = $ssmaCanCreateLinkedActions;
12790|
Request #4
deepseek-v4-flash
P:31.99K C:2.12K CR:27.01K CW:0
14887ms
Reasoning
Now, let's analyze issue 1 more carefully.
`canMutateSsmaActionPlan()`:
- If viewer → false
- If tag name in ['Supervisor de Equipe', 'Supervisor', TAG_SUPERVISOR_AREA] → false
- Else return `canManageSsmaOccurrences()`
`canManageSsmaOccurrences()` (from the code read):
- Checks roles SUPER_ADMIN/MANAGER/MANAGER_GESTOR/TENANT → true
- Checks memberIsSsmaGestorAdministrador($member)
- Checks request attributes can_create/can_edit/can_delete
- Checks tag canCreate/canEdit/canDelete
Hmm, but `canManageSsmaOccurrences` is role-based + tag-based. It does NOT check tag name 'Gestor de Equipe'. It checks request attributes and tag can_create/can_edit/can_delete.
But wait — in the Twig flag building, `$ssmaCanMutateActionPlan` starts with `canMutateSsmaActionPlan()` value, and later forced true if `$ssmaIsTagTeamGestor || $ssmaIsTagAreaGestor`.
The question in issue 1: does `canManageSsmaOccurrences()` recognize Gestor de Equipe/Área tags? `ssmaCurrentMemberPermissionTag()` returns the tag; `canManageSsmaOccurrences` checks `$tag->getCanCreate()` etc. If the "Gestor de Equipe" tag has can_create true, then canManageSsmaOccurrences would return true. Also, request attributes can_create can also make it true.
But actually, more important issue: the server-side `canMutateSsmaActionPlan()` and the Twig flag computation use DIFFERENT criteria. The Twig override `$ssmaCanMutateActionPlan = true` for Gestor de Equipe/Área may not be reflected on server side. But wait — would Gestor de Equipe pass `canMutateSsmaActionPlan()` anyway? If Gestor de Equipe tag's can_create is set (likely), canManageSsmaOccurrences would return true already. If the tags have can_create=false, then server would reject.
Hmm, let me examine more carefully. The risk: if Gestor de Equipe tag has can_create=true, then canMutate returns true anyway and no duplication issue arises. But consider the reverse case: A tag 'Gestor de Equipe' likely has can_create set, so the override is redundant. But consider a scenario where the tag is checked with `memberIsSsmaGestorAdministrador`... Actually, `canManageSsmaOccurrences()` uses `$this->ssmaCurrentMemberPermissionTag()` and checks `getCanCreate()`. So "Gestor de Equipe" is covered only if the tag's can_create is true. The flags in Twig force true regardless. So the duplication exists and criteria could diverge. But do we have concrete evidence that they diverge?
Look at code line 12612-12613: `$ssmaCanCreateLinkedActions = $this->canMutateSsmaActionPlan(); $ssmaCanMutateActionPlan = $ssmaCanCreateLinkedActions;`. And then line 12777-12780 forces `$ssmaCanCreateLinkedActions = true; $ssmaCanMutateActionPlan = true;` when TeamGestor or AreaGestor. So there IS a forced override for these two tags. Meaning: the author decided `canMutateSsmaActionPlan()` is NOT enough for Team/Area Gestor — they override in Twig. That implies on the server side `canMutateSsmaActionPlan()` may return false for those tags (if canManageSsmaOccurrences doesn't recognize them), which would produce a mismatch: the UI shows create buttons (since flags true), but the backend endpoint returns 403.
Wait but the server endpoint uses canMutateSsmaActionPlan(). If Gestor de Equipe tag does have can_create → canManageSsmaOccurrences → true → no mismatch. If not, mismatch. Let me investigate how tags are typically defined. Let me look at `memberIsSsmaGestorAdministrador`, `ssmaCurrentMemberPermissionTag`, `resolveSsmaProductPermissionTagForMember`.
Actually there's another subtlety: The endpoint for create action is at line 7981 `if ($mode !== 'edit' && !$this->canMutateSsmaActionPlan())`. Also for edit there's `canCurrentUserEditSsmaAction` → canMutateSsmaActionPlan. So server-side policy for Gestor de Equipe/Área is now `canMutateSsmaActionPlan()` which does NOT have the Team/Area Gestor override that exists in the Twig. This is a genuine inconsistency IF those tags aren't covered by canManageSsmaOccurrences. We need to check the tag configuration. Actually canManageSsmaOccurrences checks request attributes can_create/can_edit/can_delete, tag can_create/can_edit/can_delete. Let's check what tags are and whether Gestor de Equipe tag typically has can_create.
Let me search for the tag entity/creation to understand.
But maybe the more concrete issue: The Twig override forces true for Gestor de Equipe/Área even when `isSsmaViewer()` is false and these tags are not in the supervisor list. On server, `canMutateSsmaActionPlan()` first checks viewer and supervisor tags then returns canManageSsmaOccurrences. Now, consider a user who is Gestor de Equipe AND has can_create on tag = false? Hmm.
Let me check how the tag permission tags are set up in DB — e.g., SsmaPermissionTag with name 'Gestor de Equipe'. Let me search for tag definitions with can_create.
Actually, let me evaluate this: `canManageSsmaOccurrences()` may also return true when request attributes has can_create. But for the AJAX endpoint there might not be a request attribute. Let's think of the previous behavior: previously, `$ssmaCanCreateLinkedActions = $ssmaCanManageOccurrences || $this->isSsmaViewer();` and the Twig then forced `$ssmaCanCreateLinkedActions = true` for Gestor de Equipe/Area gestor. But server-side create endpoint previously used `canAccessSsmaSupervisorSurface()` which is `canManageSsmaOccurrences() || isSsmaViewer()`. Since the Twig also had Gestor override, there could already have been mismatch for Gestor if not covered by canManageSsmaOccurrences. Now `canMutateSsmaActionPlan()` excludes supervisors & viewers but Gestor tags remain to be covered by canManageSsmaOccurrences.
So the real question: does `canManageSsmaOccurrences()` return true for Gestor de Equipe/Área Gestor tags? canManageSsmaOccurrences checks tag's can_create etc. and roles, plus `memberIsSsmaGestorAdministrador`. Let me check `memberIsSsmaGestorAdministrador`.
Let me search these methods.
Now for issue 2 & 3: The `mine` filter. When mine=1 and member resolved, payload passed with `[$mineId => true]`. What does buildFilterPayload parameter mean? Let me examine the service's buildFilterPayload signature. In the diff we see the signature args: ..., $actionTypeMetadata, [member scope], $page, $perPage, management, area, exec_responsible, val_responsible, origin. The 9th arg (before page) is what historically is `$memberIds` scope used to restrict scope by team/member. In `buildActionPlanPanelViewData`, `resolveActionPlanPanelMemberScope($company)` is used to auto-scope members (stakeholder sees own actions). So passing `[$mineId => true]` replaces the member scope. Let's see how buildFilterPayload filters by member scope, and whether it includes validator_member_id.
Let me read the service method buildFilterPayload and related filtering code.
Issue 2: When member is null (user not member of company) and mine=1, no filter is applied and full payload returned (the default payload computed without mine, using `resolveActionPlanPanelMemberScope($company)`). If member scope resolution returns null (no scope), full data returned. Given the endpoint requires canAccessSsmaActionPlanHub, probably member scope could be null for admins (role-based). So if a manager/tenant (who may not have member record) checks "Minhas ações", the member is null → full payload → "Minhas ações" shows everything. This contradicts "minhas ações". Should return empty list. Medium.
Also issue 3: filter only matches responsible? Let's verify how the member scope filters actions. Let's read buildFilterPayload in the service.
Let me search.
Tool Calls (3)
code_search
Show Details
Arguments
{"file_patterns": ["src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php"], "search_text": "function buildFilterPayload"}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php Match lines: 1 36| public function buildFilterPayload(
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "function resolveActionPlanPanelMemberScope"}
Result
File: src/Controller/SsmaController.php Match lines: 1 611| private function resolveActionPlanPanelMemberScope(Company $company): ?array
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "function getCurrentCompanyMember"}
Result
File: src/Controller/SsmaController.php Match lines: 1 11600| private function getCurrentCompanyMember(?Company $company, ?User $user): ?CompanyMembers
Request #5
deepseek-v4-flash
P:34.25K C:167 CR:34.05K CW:0
1744ms
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 200, "file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 30}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648)
IS_TRUNCATED: false
LINE_RANGE: 30-200
30| * @param list<Company> $scopeCompanies
31| * @param array<string, mixed> $actionTypeMeta
32| * @param array<int, true>|null $memberScopeIds null = sem restrição por membro
33| *
34| * @return array<string, mixed>
35| */
36| public function buildFilterPayload(
37| array $scopeCompanies,
38| Company $dataCompany,
39| string $view,
40| string $period,
41| string $axis,
42| string $team,
43| string $vinculo,
44| array $actionTypeMeta,
45| ?array $memberScopeIds,
46| int $page = 1,
47| int $perPage = 10,
48| string $management = '',
49| string $area = '',
50| string $execResponsible = '',
51| string $valResponsible = '',
52| string $originFilter = '',
53| ): array {
54| $today = new \DateTimeImmutable('today');
55| $meta = $this->loadPanelMeta($dataCompany);
56| $allActions = $this->loadActionsForCompanies($scopeCompanies);
57|
58| if ($memberScopeIds !== null) {
59| $allActions = $this->filterByMemberScope($allActions, $memberScopeIds);
60| }
61|
62| $allActions = $this->filterByTeamAndVinculo($allActions, $team, $vinculo, $meta);
63|
64| if ($view === 'comparativo') {
65| return [
66| 'view' => 'comparativo',
67| 'panel_data' => $this->buildComparativoData($scopeCompanies, $allActions, $period, $today),
68| 'filters' => $this->buildFilterOptions($dataCompany),
69| 'available_axes' => [],
70| 'active_axis' => '',
71| ];
72| }
73|
74| if ($view === 'visao_geral') {
75| [$fromStr, $toStr] = $this->resolveOverviewPeriodBounds($period, $today);
76| $filtered = $this->filterByCreatedAtRange($allActions, $fromStr, $toStr);
77| $filtered = $this->applyOverviewDimensionFilters(
78| $filtered,
79| $management,
80| $area,
81| $execResponsible,
82| $valResponsible,
83| $originFilter,
84| $meta
85| );
86|
87| [$prevFrom, $prevTo] = $fromStr !== null
88| ? $this->comparisonPeriodResolver->resolveYmd($fromStr, $toStr, fn (): int => count($filtered))
89| : [null, null];
90| $prevFiltered = ($prevFrom !== null && $prevTo !== null)
91| ? $this->filterByCreatedAtRange($allActions, $prevFrom, $prevTo)
92| : [];
93|
94| $availableAxes = $this->resolveAvailableAxes($view, $period);
95| if (!in_array($axis, $availableAxes, true)) {
96| $axis = $availableAxes[0];
97| }
98|
99| return [
100| 'view' => 'visao_geral',
101| 'panel_data' => [
102| 'overview' => $this->buildOverviewData(
103| $filtered,
104| $prevFiltered,
105| $allActions,
106| $actionTypeMeta,
107| $meta['members_by_id'],
108| $fromStr,
109| $toStr,
110| $axis,
111| $today,
112| $page,
113| $perPage
114| ),
115| ],
116| 'filters' => $this->buildFilterOptions($dataCompany),
117| 'available_axes' => $availableAxes,
118| 'active_axis' => $axis,
119| ];
120| }
121|
122| // pendencias (default)
123| [$deadlineFrom, $deadlineTo] = $this->resolvePendenciasDeadlineRange($period, $today);
124| $filtered = $this->filterPendenciasByDeadline($allActions, $deadlineFrom, $deadlineTo);
125| if ($originFilter !== '') {
126| $filtered = array_values(array_filter(
127| $filtered,
128| fn (array $action): bool => $this->resolveOriginKey(
129| (string) ($action['origem'] ?? ''),
130| (string) ($action['event_type'] ?? '')
131| ) === $originFilter
132| ));
133| }
134|
135| $availableAxes = $this->resolveAvailableAxes($view, $period);
136| if (!in_array($axis, $availableAxes, true)) {
137| $axis = $availableAxes[0];
138| }
139|
140| $panelData = $this->buildPendenciasData(
141| $filtered,
142| $allActions,
143| $actionTypeMeta,
144| $meta['members_by_id'],
145| $today,
146| $axis,
147| $period,
148| $deadlineTo
149| );
150| $panelData['available_axes'] = $availableAxes;
151| $panelData['active_axis'] = $axis;
152|
153| return [
154| 'view' => 'pendencias',
155| 'panel_data' => $panelData,
156| 'filters' => $this->buildFilterOptions($dataCompany),
157| ];
158| }
159|
160| /**
161| * @return array<string, mixed>
162| */
163| public function buildFilterOptions(Company $company): array
164| {
165| $meta = $this->loadPanelMeta($company);
166| $units = [['value' => '', 'text' => 'Unidade']];
167| $headOffice = $company->getHeadOffice() ?? $company;
168| $isHead = (int) $company->getId() === (int) $headOffice->getId();
169| if ($isHead) {
170| $units[] = ['value' => 'matriz', 'text' => 'Matriz'];
171| $subs = $this->entityManager->getRepository(Company::class)->findBy(['headOffice' => $headOffice]);
172| foreach ($subs as $sub) {
173| $units[] = [
174| 'value' => (string) $sub->getId(),
175| 'text' => $sub->getFantasyName() ?: $sub->getName() ?: ('Unidade #' . $sub->getId()),
176| ];
177| }
178| }
179|
180| $teamOptions = [['value' => '', 'text' => 'Equipe']];
181| foreach ($meta['teams'] as $team) {
182| $teamOptions[] = ['value' => (string) ($team['name'] ?? ''), 'text' => (string) ($team['name'] ?? '')];
183| }
184|
185| $memberOptions = [['value' => '', 'text' => 'Todos']];
186| foreach ($meta['members_by_id'] as $member) {
187| $memberOptions[] = ['value' => (string) $member['id'], 'text' => $member['name']];
188| }
189|
190| return [
191| 'period' => [
192| ['value' => 'next_month', 'text' => 'Próximo mês'],
193| ['value' => 'week', 'text' => 'Próxima semana'],
194| ['value' => 'fortnight', 'text' => 'Próximos 15 dias'],
195| ['value' => 'next_3_months', 'text' => 'Próximos 3 meses'],
196| ['value' => 'all_future', 'text' => 'Todo o futuro'],
197| ],
198| 'team' => $teamOptions,
199| 'bond' => [
200| ['value' => '', 'text' => 'Tipo de Vínculo'],
file_read
Show Details
Arguments
{"end_line": 680, "file_path": "src/Controller/SsmaController.php", "start_line": 600}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 600-680
600| $overviewPayload,
601| $filterOptions
602| );
603| }
604|
605| /**
606| * Restringe ações do painel para membro/stakeholder/supervisor de equipe.
607| * null = sem restrição (gestor/admin).
608| *
609| * @return array<int, true>|null
610| */
611| private function resolveActionPlanPanelMemberScope(Company $company): ?array
612| {
613| $user = $this->getUser();
614| if (!$user instanceof User) {
615| return [];
616| }
617|
618| if ($this->canManageSsmaOccurrences()) {
619| return null;
620| }
621|
622| $member = $this->getCurrentCompanyMember($company, $user);
623| if ($this->memberIsSsmaGestorAdministrador($member)) {
624| return null;
625| }
626|
627| $ssmaProductTagName = $this->ssmaCurrentMemberPermissionTag()?->getName();
628| if (in_array($ssmaProductTagName, ['Supervisor de Equipe', 'Supervisor', 'Gestor de Equipe'], true)) {
629| $teamIds = $this->getSsmaOccurrenceDashboardTeamFilterIds($company, $user);
630| if ($teamIds !== null && $teamIds !== []) {
631| return $this->collectCompanyMemberIdsBelongingToCompanyTeams($company, $teamIds);
632| }
633| }
634|
635| $memberId = (int) ($member?->getId() ?? 0);
636|
637| return $memberId > 0 ? [$memberId => true] : [];
638| }
639|
640| /** @return array<string, mixed> */
641| private function buildEmptyActionPlanPanelData(): array
642| {
643| return [
644| 'kpis' => [
645| 'open_actions' => 0,
646| 'created_in_period' => 0,
647| 'completed' => 0,
648| 'vencidas' => 0,
649| 'aguardando_validacao' => 0,
650| 'period_end' => '—',
651| 'proximo_prazo' => '—',
652| 'recommendation' => '',
653| ],
654| 'actions' => [],
655| 'deadline_chart' => ['labels' => [], 'execucao' => [], 'validacao' => []],
656| 'responsible_chart' => [],
657| 'origin_chart' => [],
658| 'type_chart' => [],
659| 'operational_summary' => [
660| 'rows' => [],
661| 'total' => ['label' => 'Total de pendências', 'value' => '0', 'percent' => 100],
662| ],
663| 'available_axes' => ['weekly'],
664| 'active_axis' => 'weekly',
665| ];
666| }
667|
668| public function direitoRecusaIndex(Request $request): Response
669| {
670| $viewData = $this->buildSsmaViewData(['module' => 'occurrence']);
671| $company = $this->getSsmaCompany();
672| /** @var User|null $user */
673| $user = $this->getUser();
674| $member = $this->getCurrentCompanyMember($company, $user instanceof User ? $user : null);
675|
676| $refusalConfig = ['flow_a_member_ids' => [], 'flow_b_member_ids' => []];
677| $flowAccess = ['can_flow_a' => true, 'can_flow_b' => false, 'preferred_flow' => 'A'];
678| $records = [];
679| $recordsPayload = [];
680|
Request #6
deepseek-v4-flash
P:37.36K C:195 CR:34.3K CW:0
2170ms
Reasoning
Now let's look at the filter functions: filterByMemberScope, applyOverviewDimensionFilters, and how the member scope applies to executor/validator. Also `filterByTeamAndVinculo`.
Tool Calls (2)
code_search
Show Details
Arguments
{"file_patterns": ["src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php"], "search_text": "function filterByMemberScope"}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php Match lines: 1 367| private function filterByMemberScope(array $actions, array $memberScopeIds): array
code_search
Show Details
Arguments
{"file_patterns": ["src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php"], "search_text": "function applyOverviewDimensionFilters"}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php Match lines: 1 499| private function applyOverviewDimensionFilters(
Request #7
deepseek-v4-flash
P:37.66K C:95 CR:37.5K CW:0
1710ms
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 540, "file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 340}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648)
IS_TRUNCATED: false
LINE_RANGE: 340-540
340| }
341|
342| return [
343| 'teams' => $teams,
344| 'members_by_id' => $membersById,
345| 'member_vinculo' => $memberVinculo,
346| ];
347| }
348|
349| private function resolveMemberVinculoCode(CompanyMembers $member): string
350| {
351| if ($member->isAssistant()) {
352| return PersonTypeEnum::TERCEIRO;
353| }
354| if ($member->getTreeType() === 'partner' || $member->isPartner()) {
355| return PersonTypeEnum::PRESTADOR;
356| }
357|
358| return PersonTypeEnum::COLABORADOR;
359| }
360|
361| /**
362| * @param list<array<string, mixed>> $actions
363| * @param array<int, true> $memberScopeIds
364| *
365| * @return list<array<string, mixed>>
366| */
367| private function filterByMemberScope(array $actions, array $memberScopeIds): array
368| {
369| if ($memberScopeIds === []) {
370| return [];
371| }
372|
373| return array_values(array_filter($actions, function (array $action) use ($memberScopeIds): bool {
374| $validatorId = (int) ($action['validator_member_id'] ?? 0);
375| if ($validatorId > 0 && isset($memberScopeIds[$validatorId])) {
376| return true;
377| }
378| foreach ((array) ($action['responsible_ids'] ?? []) as $id) {
379| if (isset($memberScopeIds[(int) $id])) {
380| return true;
381| }
382| }
383|
384| return false;
385| }));
386| }
387|
388| /**
389| * @param list<array<string, mixed>> $actions
390| * @param array{teams: list<array<string, mixed>>, member_vinculo: array<int, string>} $meta
391| *
392| * @return list<array<string, mixed>>
393| */
394| private function filterByTeamAndVinculo(array $actions, string $team, string $vinculo, array $meta): array
395| {
396| $teamMemberIds = null;
397| if ($team !== '') {
398| $teamMemberIds = [];
399| foreach ($meta['teams'] as $t) {
400| if (strcasecmp((string) ($t['name'] ?? ''), $team) === 0) {
401| foreach ($t['members'] ?? [] as $mid) {
402| $teamMemberIds[(int) $mid] = true;
403| }
404| break;
405| }
406| }
407| }
408|
409| return array_values(array_filter($actions, function (array $action) use ($teamMemberIds, $vinculo, $meta): bool {
410| $ids = array_values(array_filter(array_map('intval', (array) ($action['responsible_ids'] ?? []))));
411| $validatorId = (int) ($action['validator_member_id'] ?? 0);
412| if ($validatorId > 0) {
413| $ids[] = $validatorId;
414| }
415| if ($ids === []) {
416| $ids = [0];
417| }
418|
419| if ($teamMemberIds !== null) {
420| $ok = false;
421| foreach ($ids as $id) {
422| if (isset($teamMemberIds[$id])) {
423| $ok = true;
424| break;
425| }
426| }
427| if (!$ok) {
428| return false;
429| }
430| }
431|
432| if ($vinculo !== '') {
433| $ok = false;
434| foreach ($ids as $id) {
435| if (($meta['member_vinculo'][$id] ?? '') === $vinculo) {
436| $ok = true;
437| break;
438| }
439| }
440| if (!$ok) {
441| return false;
442| }
443| }
444|
445| return true;
446| }));
447| }
448|
449| /**
450| * @param list<array<string, mixed>> $actions
451| *
452| * @return list<array<string, mixed>>
453| */
454| private function filterPendenciasByDeadline(array $actions, ?string $from, ?string $to): array
455| {
456| // $from permanece na assinatura (início do datepicker); vencidas (deadline < $from) entram de propósito.
457| return array_values(array_filter($actions, static function (array $a) use ($to): bool {
458| if ((bool) ($a['solved'] ?? false)) {
459| return false;
460| }
461| $deadline = $a['deadline'] ?? null;
462| if ($deadline === null || $deadline === '') {
463| return true;
464| }
465| if ($to !== null && $deadline > $to) {
466| return false;
467| }
468|
469| return true;
470| }));
471| }
472|
473| /**
474| * @param list<array<string, mixed>> $actions
475| *
476| * @return list<array<string, mixed>>
477| */
478| private function filterByCreatedAtRange(array $actions, ?string $from, ?string $to): array
479| {
480| return array_values(array_filter($actions, static function (array $a) use ($from, $to): bool {
481| $createdAt = (string) ($a['created_at'] ?? '');
482| if ($from !== null && $from !== '' && ($createdAt === '' || $createdAt < $from)) {
483| return false;
484| }
485| if ($to !== null && $to !== '' && $createdAt > $to) {
486| return false;
487| }
488|
489| return true;
490| }));
491| }
492|
493| /**
494| * @param list<array<string, mixed>> $actions
495| * @param array{members_by_id: array<int, array{id: int, name: string, vinculo: string}>} $meta
496| *
497| * @return list<array<string, mixed>>
498| */
499| private function applyOverviewDimensionFilters(
500| array $actions,
501| string $management,
502| string $area,
503| string $execResponsible,
504| string $valResponsible,
505| string $originFilter,
506| array $meta
507| ): array {
508| return array_values(array_filter($actions, function (array $action) use ($execResponsible, $valResponsible, $originFilter): bool {
509| if ($originFilter !== '' && $this->resolveOriginKey((string) ($action['origem'] ?? ''), (string) ($action['event_type'] ?? '')) !== $originFilter) {
510| return false;
511| }
512| if ($execResponsible !== '') {
513| $execId = (int) $execResponsible;
514| $ids = array_map('intval', (array) ($action['responsible_ids'] ?? []));
515| if (!in_array($execId, $ids, true)) {
516| return false;
517| }
518| }
519| if ($valResponsible !== '') {
520| if ((int) ($action['validator_member_id'] ?? 0) !== (int) $valResponsible) {
521| return false;
522| }
523| }
524|
525| return true;
526| }));
527| }
528|
529| /**
530| * @return array{0: string|null, 1: string|null}
531| */
532| private function resolvePendenciasDeadlineRange(string $period, \DateTimeImmutable $today): array
533| {
534| $todayStr = $today->format('Y-m-d');
535| if (str_starts_with($period, 'pend:range:')) {
536| $parts = explode(':', $period);
537| $from = $parts[2] ?? $todayStr;
538| $to = $parts[3] ?? $todayStr;
539| if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $from) && preg_match('/^\d{4}-\d{2}-\d{2}$/', $to)) {
540| return $from <= $to ? [$from, $to] : [$to, $from];
Request #8
deepseek-v4-flash
P:39.87K C:2.32K CR:37.63K CW:0
17975ms
Reasoning
So `filterByMemberScope` DOES include validators and responsible ids. So issue 3 from the plan is not a real bug — `[$mineId => true]` is passed as member scope and filtered by `filterByMemberScope` which checks both validator and responsible ids. So issue 3 is resolved as a non-issue.
Wait, but there's a nuance: `buildFilterPayload` filters by member scope for ALL views (before branching to comparativo/visao_geral/pendencias). So `mine` filter works on the visão geral too. So issue 6 partially valid — mine applied to any view.
Now, for issue 2: When `mine=1` and `member` is null, `$mineId=0`, and `$payload` keeps the initial computation using `resolveActionPlanPanelMemberScope($company)`. For a manager/admin, that returns null → no restriction → full list returned. So a manager checking "Minhas ações" gets everything. That's issue 2 confirmed: silent failure of filter. Should at least return empty payload or handle gracefully. But wait — actually consider what "mine" semantically is for a manager without member record. The manager would presumably have a member record... Actually ROLE_MANAGER global may map to company member via getCurrentCompanyMember; but members may be null if user is company admin account without member record (Aura scenario mentioned in comments). So yes, it's a real gap but only for accounts without member record. Medium/low severity? Plan said medium. Hmm.
Actually, more importantly: the "mine" check uses `getCurrentCompanyMember($company, $user)` but `$scopeCompanies` can be multiple companies (subsidiaries in comparativo view). Not important.
Actually let me re-read. When mine flag is on and member resolved to company member of data company. If mineId = 0 → payload remains with no mine restriction. For managers: they don't have "minhas ações" concept but they check the checkbox → filter doesn't restrict. The business rule says "quando marcado, retorna apenas ações em que o usuário logado é executor ou validador". For users without a member record, the correct result is empty, not full list. Also, could this lead to a data leak? The manager already sees everything, so not a data leak. But the feature contract is silently violated. Medium severity, I'd say medium or low. Keep as medium.
Now let's consider issue 1 more: Are there real divergent behaviors?
Let's understand the actual permission tag setup. `canMutateSsmaActionPlan()` returns `canManageSsmaOccurrences()` for Gestor de Equipe/Área unless they have supervisor tags. `canManageSsmaOccurrences()` checks roles and tag can_create/can_edit/can_delete, plus request attributes. So if Gestor de Equipe tag has can_create = true → covered. If can_create false but the Twig override sets `$ssmaCanMutateActionPlan = true`, then the UI would show create/edit but server would 403.
Wait, actually, let's reconsider: Is Gestor de Equipe's can_create set? This depends on DB/tag seed. We can't be sure. Let's check how the tags are seeded. Let me search for "Gestor de Equipe" in code, e.g., migration or seed.
Actually more importantly, let me check the previous server-side guard before this PR for creation: `$this->canAccessSsmaSupervisorSurface()` = canManageSsmaOccurrences() || isSsmaViewer(). Wait, line 7981 previously `if ($mode !== 'edit' && !$this->canAccessSsmaSupervisorSurface())`. So previously viewers/supervisors could create actions via API. Now they can't. Now Gestor de Equipe was previously allowed to create only if canManageSsmaOccurrences() (since viewers allowed...). Hmm, wait: previously the guard was canAccessSsmaSupervisorSurface (which includes viewers). And Twig forced canCreate for Team/Area Gestor. So Gestor de Equipe with tag can_create true (covered by canManageSsmaOccurrences → true) worked. So now with canMutate, Team/Area gestor that is not viewer still passes if canManageSsmaOccurrences() true. Since in the past the Twig flags were computed from `$ssmaCanManageOccurrences` (canManageSsmaOccurrences) OR isSsmaViewer, then TeamGestor's flag being true came from... canManageSsmaOccurrences OR forced override. Since there was a forced override for TeamGestor, this suggests the original canManageSsmaOccurrences may NOT include Team Gestor by tag name. The tag "Gestor de Equipe" is likely not captured by canManageSsmaOccurrences via tag name but possibly via can_create field.
Wait — `ssmaCurrentMemberPermissionTag()` returns the current tag, and canManageSsmaOccurrences checks `$tag->getCanCreate() || ...`. The tags have permission config fields (can_create etc.). Presumably a "Gestor de Equipe" tag would have can_create/can_edit/can_delete enabled in config. Then canManageSsmaOccurrences returns true for them. Then the Twig override would be redundant but harmless. But maybe the tag doesn't map to ssma permission tag with can_create.
Hmm, let's check `ssmaCurrentMemberPermissionTag` and how tags map. Also, we can compare: if the Twig override at 12777-12780 was truly redundant, the author would not have needed it. Its presence strongly suggests that `canMutateSsmaActionPlan()` (and hence `$ssmaCanMutateActionPlan = $ssmaCanCreateLinkedActions`) does NOT return true for Gestor de Equipe/Área tags via canManageSsmaOccurrences — otherwise why force override? Actually, it could be defense in depth. But from a code review standpoint, having the server policy NOT match the UI policy is a genuine risk: server endpoint (create at 7981, edit at 16141, resolve at 16272) uses canMutateSsmaActionPlan() with no Gestor override; the UI shows create/edit buttons for Team/Area Gestor.
Wait — actually, this whole thing changed. Before this PR, the server side for the action plan create endpoint used `canAccessSsmaSupervisorSurface()`. That was the authorization used. And Twig override for Gestor de Equipe/Área existed before too (`$ssmaCanCreateLinkedActions = true`). So before, if Gestor de Equipe had can_create on tag, both would be true. The mismatch risk existed before as well.
The real new issue introduced by this PR is: the old server guard allowed supervisors/viewers to create/act (since canAccessSsmaSupervisorSurface = canManage || isViewer). Now it's blocked (Brenda áudio). But the Twig flag for create/action menu... wait. Actually, the flags changed too. `ssmaCanCreateLinkedActions` was `canManage || isViewer` — now `canMutate`. But that previously fed the "Criar ação" button on occurrences tab and occurrence_view. And for viewers/supervisors those buttons will now be hidden, aligned.
Now, the question: Does `canMutateSsmaActionPlan()` correctly exclude the tag 'Supervisor'? It checks tagName in ['Supervisor de Equipe', 'Supervisor', TAG_SUPERVISOR_AREA]. But what about a user who has ROLE_MANAGER (global platform manager) but also has tag 'Supervisor'? `ssmaCurrentMemberPermissionTag()` returns tag based on member, and isSsmaViewer? Actually viewers are ROLE_MANAGER_VIEWER or something. Let me examine.
Now, the important new risk to call out for issue 1: In `canMutateSsmaActionPlan`, first check isSsmaViewer → false; then supervisor tags → false; else return canManageSsmaOccurrences(). But consider a Gestor de Equipe who is ALSO a member with ROLE_MANAGER_VIEWER? unlikely.
Actually, let's focus. `canMutateSsmaActionPlan` doesn't include the Gestor override. The Twig does. Whether this is a mismatch depends on canManageSsmaOccurrences covering those tags. Let me look at `ssmaCurrentMemberPermissionTag` and whether canManageSsmaOccurrences covers Gestor de Equipe/Área by role or request attribute `can_create`. Let me search tag names config, e.g., seeds for the permission tags and their can_create.
Let me search for "Gestor de Equipe" within code and for TAG_GESTOR_AREA constant definition, plus where tags are seeded with can_create values. But this might be DB-seeded, not in repo.
Alternatively, consider request attributes can_create: In canManageSsmaOccurrences, there is a branch `if ($request && (can_create||can_edit||can_delete)) return true;`. This request attribute could be set by a route attribute like `#[IsGranted]`? Actually `$request->attributes->get('can_create')` - this is likely set by firewall/route options. Hmm, maybe not relevant.
Given the deep uncertainty, the safest review comment is: server-side policy (canMutateSsmaActionPlan) and UI flags ($ssmaCanMutateActionPlan) use different criteria — Gestor de Equipe/Área is allowed in Twig via forced override, but server endpoint relies only on canMutateSsmaActionPlan → mismatch possible. That's worth flagging as medium/high. Let me confirm the actual flow where create action endpoint validates.
Let's check line 7970-7990 in the controller for context about the create endpoint.
Tool Calls (3)
file_read
Show Details
Arguments
{"end_line": 8010, "file_path": "src/Controller/SsmaController.php", "start_line": 7950}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 7950-8010
7950| public function actionModalPartial(): Response
7951| {
7952| $viewData = $this->buildSsmaViewData();
7953| return new Response($this->renderView('ssma/partials/_modal_action.html.twig', [
7954| 'occurrences' => $viewData['occurrences'] ?? [],
7955| 'allMembers' => $viewData['allMembers'] ?? [],
7956| 'action_type_config' => $viewData['action_type_config'] ?? ['types' => []],
7957| ]));
7958| }
7959|
7960| // ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
7961|
7962| public function createAction(Request $request): JsonResponse
7963| {
7964| /** @var User|null $user */
7965| $user = $this->getUser();
7966| if (!$user) {
7967| return new JsonResponse(['success' => false, 'message' => 'Não autenticado.'], 401);
7968| }
7969|
7970| $company = $this->getSsmaCompany();
7971| if (!$company) {
7972| return new JsonResponse(['success' => false, 'message' => 'Empresa não encontrada.'], 400);
7973| }
7974|
7975| $data = json_decode($request->getContent(), true) ?? [];
7976| $mode = $data['mode'] ?? 'create';
7977| $title = trim((string) ($data['title'] ?? ''));
7978| $existingProject = null;
7979|
7980| // Criar: gestor/admin. Supervisor só visualiza — Brenda áudio 6.
7981| if ($mode !== 'edit' && !$this->canMutateSsmaActionPlan()) {
7982| return new JsonResponse(['success' => false, 'message' => 'Sem permissão para criar ação SSMA.'], 403);
7983| }
7984|
7985| $teamScopeError = $this->validateSsmaActionPayloadAgainstTeamScope($data, $company, $user);
7986| if ($teamScopeError !== null) {
7987| return new JsonResponse(['success' => false, 'message' => $teamScopeError], 422);
7988| }
7989|
7990| if ($title === '') {
7991| $title = 'Sem titulo';
7992| }
7993|
7994| if ($mode !== 'edit' && !empty($data['create_project_with_plan'])
7995| && empty($data['occurrence_id']) && empty($data['event_id'])
7996| && (string) ($data['related_event_type'] ?? '') !== ActionOrigemEnum::OUTRO) {
7997| return new JsonResponse(['success' => false, 'message' => 'Evento relacionado obrigatório ao criar novo plano.'], 422);
7998| }
7999|
8000| if ($mode !== 'edit' && !empty($data['existing_project_id'])) {
8001| $existingProject = $this->entityManager->find(Project::class, (int) $data['existing_project_id']);
8002| if (!$existingProject || $existingProject->getCompany()->getId() !== $company->getId()) {
8003| return new JsonResponse(['success' => false, 'message' => 'Plano existente não encontrado.'], 404);
8004| }
8005|
8006| // Regra: no plano existente, usar ocorrência raiz como padrão quando não informada.
8007| if (empty($data['occurrence_id'])) {
8008| $rootOccurrence = $this->findProjectRootOccurrence((int) $existingProject->getId(), $company);
8009| if (!empty($rootOccurrence['id'])) {
8010| $data['occurrence_id'] = (int) $rootOccurrence['id'];
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "function ssmaCurrentMemberPermissionTag"}
Result
File: src/Controller/SsmaController.php Match lines: 1 1401| private function ssmaCurrentMemberPermissionTag(): ?\App\Entity\PermissionTag
code_search
Show Details
Arguments
{"search_text": "TAG_SUPERVISOR_AREA|TAG_GESTOR_AREA"}
Result
No matches found
Request #9
deepseek-v4-flash
P:43.27K C:157 CR:42.11K CW:0
1700ms
Reasoning
TAG_SUPERVISOR_AREA / TAG_GESTOR_AREA are in `SsmaAreaLimitationScope`. Let me find that file.
Tool Calls (2)
code_search
Show Details
Arguments
{"search_text": "TAG_SUPERVISOR_AREA"}
Result
File: src/Controller/SsmaController.php
Match lines: 5
11477| SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA,
11588| if ($tagNameScoped === 'Supervisor de Equipe' || $tagNameScoped === SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA) {
12708| $ssmaIsTagAreaSupervisor = $ssmaProductTagName === SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA;
18767| SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA,
20094| && in_array($tag->getName(), ['Supervisor de Equipe', 'Supervisor', SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA], true);
File: src/Service/Ssma/SsmaAreaLimitationScope.php
Match lines: 2
15| public const TAG_SUPERVISOR_AREA = 'Supervisor de Área';
23| return [self::TAG_SUPERVISOR_AREA, self::TAG_GESTOR_AREA];
File: src/Service/Ssma/SsmaPreventionHubAccessService.php
Match lines: 1
34| SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA,
file_read
Show Details
Arguments
{"end_line": 1450, "file_path": "src/Controller/SsmaController.php", "start_line": 1390}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 1390-1450
1390| $company = $this->getSsmaCompany();
1391| $user = $this->getUser();
1392| if (!$company instanceof Company || !$user instanceof User) {
1393| return false;
1394| }
1395|
1396| $member = $this->getCurrentCompanyMember($company, $user);
1397|
1398| return $this->ssmaStakeholderActionPermissionService->hasStakeholderAccess($member, $company);
1399| }
1400|
1401| private function ssmaCurrentMemberPermissionTag(): ?\App\Entity\PermissionTag
1402| {
1403| $user = $this->getUser();
1404| if (!$user instanceof User) {
1405| return null;
1406| }
1407|
1408| $company = $this->getSsmaCompany() ?? $user->getCompany();
1409| if (!$company instanceof Company) {
1410| return null;
1411| }
1412|
1413| $member = $this->getCurrentCompanyMember($company, $user);
1414| if (!$member) {
1415| return null;
1416| }
1417|
1418| return $this->resolveSsmaProductPermissionTagForMember($member);
1419| }
1420|
1421| /**
1422| * Alterações na Árvore respeitam can_create / can_edit / can_delete do produto ssma-cause-tree
1423| * (rotas ssma_cause_tree_*), sem o bypass global de ROLE_MANAGER_GESTOR de {@see canManageSsmaOccurrences()}.
1424| * Gestor de Equipe (tag em ssma-occurrences) também pode criar — espelha o botão na listagem.
1425| */
1426| private function canMutateSsmaCauseTreeFromProductTag(): bool
1427| {
1428| return $this->canCreateSsmaCauseTree();
1429| }
1430|
1431| private function canMutateThisCauseTree(?Company $company, ?User $user, ?int $treeId): bool
1432| {
1433| if ($this->canMutateSsmaCauseTreeFromProductTag()) {
1434| return true;
1435| }
1436| if (!$company instanceof Company || !$user instanceof User || $treeId === null || $treeId <= 0) {
1437| return false;
1438| }
1439|
1440| return $this->isCauseTreeAnalystMember($company, $user, $treeId);
1441| }
1442|
1443| private function resolveOccurrenceCommitteeUseCase(\App\Entity\SsmaEvent $event): string
1444| {
1445| $type = strtoupper(trim((string) $event->getType()));
1446| if ($type === \App\Enum\Ssma\EventTypeEnum::ACIDENTE_PESSOAL) {
1447| return 'work_accident_dual';
1448| }
1449|
1450| return 'internal_investigation';
Request #10
deepseek-v4-flash
P:44.5K C:214 CR:43.39K CW:0
2196ms
Reasoning
Let me read lines 20070-20110 for context (around 20094) to understand what the tag filter at 20094 checks (that's likely a function that returns false for supervisor tags, e.g. `isSsmaViewer`?). Let me look at this function.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 20120, "file_path": "src/Controller/SsmaController.php", "start_line": 20060}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 20060-20120
20060| ) {
20061| return true;
20062| }
20063|
20064| $member = $this->getCurrentCompanyMember($company, $user);
20065| if (!$member instanceof CompanyMembers || !$this->canManageSsmaOccurrences()) {
20066| return false;
20067| }
20068|
20069| if ($this->memberIsSsmaGestorAdministrador($member)) {
20070| return true;
20071| }
20072|
20073| $tag = $this->resolveSsmaProductPermissionTagForMember($member);
20074|
20075| return $tag instanceof \App\Entity\PermissionTag
20076| && in_array($tag->getName(), ['Gestor de Equipe', SsmaAreaLimitationScope::TAG_GESTOR_AREA], true);
20077| }
20078|
20079| private function isSsmaPreventionSupervisorProfile(Company $company, User $user): bool
20080| {
20081| if (
20082| $this->isGranted('ROLE_MANAGER_VIEWER')
20083| && !$this->isGranted('ROLE_MANAGER')
20084| && !$this->isGranted('ROLE_MANAGER_GESTOR')
20085| && !$this->isGranted('ROLE_SUPER_ADMIN')
20086| ) {
20087| return true;
20088| }
20089|
20090| $member = $this->getCurrentCompanyMember($company, $user);
20091| $tag = $member ? $this->resolveSsmaProductPermissionTagForMember($member) : null;
20092|
20093| return $tag instanceof \App\Entity\PermissionTag
20094| && in_array($tag->getName(), ['Supervisor de Equipe', 'Supervisor', SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA], true);
20095| }
20096|
20097| /**
20098| * Pode criar/editar inspeção ou abordagem: gestão, supervisor (próprio registro)
20099| * ou colaborador com meta > 0 no kind — mesmo se a tag SSMA for só can_view.
20100| */
20101| private function canMutatePreventionContentForCurrentUser(Company $company, User $user, string $kind = 'inspecao'): bool
20102| {
20103| if ($this->canManageAllPreventionContentForCurrentUser($company, $user)) {
20104| return true;
20105| }
20106|
20107| if ($this->isSsmaPreventionSupervisorProfile($company, $user)) {
20108| return true;
20109| }
20110|
20111| return $this->memberHasActivePreventionMetaForKind($company, $user, $kind);
20112| }
20113|
20114| private function currentUserOwnsInspection(SsmaInspection $inspection, Company $company, User $user): bool
20115| {
20116| $member = $this->getCurrentCompanyMember($company, $user);
20117| $memberId = (int) ($member?->getId() ?? 0);
20118| if ($memberId <= 0) {
20119| return false;
20120| }
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "function memberIsSsmaGestorAdministrador"}
Result
File: src/Controller/SsmaController.php Match lines: 1 10667| private function memberIsSsmaGestorAdministrador(?CompanyMembers $member): bool
Request #11
deepseek-v4-flash
P:45.58K C:388 CR:44.67K CW:0
3494ms
Reasoning
Line 20060 area: `canManageAllPreventionContentForCurrentUser` — checks roles then canManageSsmaOccurrences, then returns true if tag name in ['Gestor de Equipe', TAG_GESTOR_AREA]. This shows a pattern where the code recognizes that Gestor de Equipe/Área needs explicit tag name checks beyond canManageSsmaOccurrences in a related area of the codebase.
Now, this is strong evidence that `canManageSsmaOccurrences()` alone does not identify Gestor de Equipe tags by name (it relies on can_create/can_edit flags of the tag). Since the same tag with can_create presumably true would then be caught. But `canManageAllPreventionContentForCurrentUser` still adds a name-based check after canManageSsmaOccurrences fails — implying Gestor de Equipe tags might not have can_create set, hence needing name checks.
Hmm — Actually wait: `canManageAllPreventionContentForCurrentUser` returns true only if canManageSsmaOccurrences() AND member exists. Then it explicitly adds 'Gestor de Equipe' by name. That implies the "Gestor de Equipe" tag may exist without can_create/can_edit? Unclear.
Let me look at resolveSsmaProductPermissionTagForMember and memberIsSsmaGestorAdministrador to understand tag can_create default. Let me read lines 10667+.
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 10740, "file_path": "src/Controller/SsmaController.php", "start_line": 10667}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 10667-10740
10667| private function memberIsSsmaGestorAdministrador(?CompanyMembers $member): bool
10668| {
10669| if (!$member instanceof CompanyMembers) {
10670| return false;
10671| }
10672|
10673| $memberId = (int) $member->getId();
10674| if ($memberId > 0 && array_key_exists($memberId, $this->memberIsSsmaGestorAdministradorCache)) {
10675| return $this->memberIsSsmaGestorAdministradorCache[$memberId];
10676| }
10677|
10678| $isGestorAdministrador = false;
10679| if ($this->isSsmaGestorAdministradorTag($this->resolveSsmaProductPermissionTagForMember($member))) {
10680| $isGestorAdministrador = true;
10681| } else {
10682| try {
10683| $occProduct = $this->resolveSsmaOccurrencesProductForPermission();
10684| if ($occProduct instanceof \App\Entity\Product) {
10685| $occTag = $this->permissionTagByMemberService->getPermissionTag($member, $occProduct);
10686| if ($this->isSsmaGestorAdministradorTag($occTag)) {
10687| $isGestorAdministrador = true;
10688| }
10689| }
10690| } catch (\Throwable) {
10691| }
10692| }
10693|
10694| if ($memberId > 0) {
10695| $this->memberIsSsmaGestorAdministradorCache[$memberId] = $isGestorAdministrador;
10696| }
10697|
10698| return $isGestorAdministrador;
10699| }
10700|
10701| private function resolveSsmaOccurrencesProductForPermission(): ?\App\Entity\Product
10702| {
10703| if ($this->ssmaOccurrencesProductForPermissionResolved) {
10704| return $this->ssmaOccurrencesProductForPermissionCache;
10705| }
10706|
10707| $this->ssmaOccurrencesProductForPermissionResolved = true;
10708|
10709| try {
10710| $product = $this->entityManager
10711| ->getRepository(\App\Entity\Product::class)
10712| ->findOneBy(['slug' => 'ssma-occurrences']);
10713| $this->ssmaOccurrencesProductForPermissionCache = $product instanceof \App\Entity\Product ? $product : null;
10714| } catch (\Throwable) {
10715| $this->ssmaOccurrencesProductForPermissionCache = null;
10716| }
10717|
10718| return $this->ssmaOccurrencesProductForPermissionCache;
10719| }
10720|
10721| private function resolveSsmaProductPermissionTagForMember(
10722| CompanyMembers $member,
10723| ?string $productSlug = null,
10724| ): ?\App\Entity\PermissionTag {
10725| try {
10726| $productSlug = $productSlug ?: $this->getCurrentSsmaPermissionProductSlug();
10727| $product = $this->entityManager
10728| ->getRepository(\App\Entity\Product::class)
10729| ->findOneBy(['slug' => $productSlug]);
10730|
10731| if (!$product && str_starts_with($productSlug, 'ssma-')) {
10732| $product = $this->entityManager
10733| ->getRepository(\App\Entity\Product::class)
10734| ->findOneBy(['slug' => $this->ssmaParentProductSlug]);
10735| }
10736|
10737| if (!$product) {
10738| return $member->getGlobalPermissionTag();
10739| }
10740|
Request #12
deepseek-v4-flash
P:46.91K C:2.17K CR:45.95K CW:0
16650ms
Reasoning
OK. I've gathered enough for issue 1. The divergence between server-side `canMutateSsmaActionPlan()` (no Gestor de Equipe/Área tag-name exception) and the UI flags (`$ssmaCanMutateActionPlan = true` forced for those tags) is a plausible mismatch, and given line 20076 shows a related method that explicitly adds Gestor de Equipe/Área tag names on top of canManageSsmaOccurrences (indicating those tags aren't necessarily captured by canManageSsmaOccurrences), there's real evidence that canMutate may return false for those tags at the server while the UI shows enabled buttons. This yields 403 on save.
Also note that this is a NEW server guard change: before, create endpoint allowed isSsmaViewer; now it blocks supervisors/viewers. `canManageSsmaOccurrences()` previously was not the sole decider because the Twig had the override for Gestor tags; but server create endpoint never had that override, and previously it used canAccessSsmaSupervisorSurface = canManage || isViewer. For Gestor de Equipe (tag) users: they were previously allowed if canManageSsmaOccurrences() returns true (request attribute can_create or tag can_create). Same as now, except now it's via canMutate which excludes viewers. Since Gestor de Equipe isn't a viewer, unchanged for them.
OK so the difference: Previously, Gestor de Equipe could create if canManageSsmaOccurrences() true. In the Twig flags, Gestor de Equipe forced can_create linked actions true even when canManageSsmaOccurrences false. So the mismatch between server and Twig for Gestor existed BEFORE this PR as well, for the create action endpoint (if canManageSsmaOccurrences false for Gestor de Equipe). So this might not be newly introduced — but the PR relies on this same mismatch being OK. Wait, but the PR is precisely about aligning permissions (Brenda). The new `canMutateSsmaActionPlan()` is documented "Gestor de Equipe/Área continua podendo mutar" in the docblock, but the implementation doesn't actually include an explicit Gestor exception — it depends entirely on canManageSsmaOccurrences() which does not name-check those tags. So the docblock claims Gestor can mutate, but the implementation may not guarantee it, and the UI force-overrides would still show buttons. This is a real bug in the new method relative to its own documented intent. I'll flag this as a genuine finding (high/medium).
Given canManageSsmaOccurrences has the request-attributes branch and tag can_create branch, "Gestor de Equipe" tag probably has can_create set... but for the AJAX create endpoint there may not be request attributes. And the tag-based branch covers any tag with can_create true. If the Gestor tag has can_create true, they're covered. But note the request attribute branch means on some routes a member could bypass supervisor restriction? No, canMutate checks isSsmaViewer and supervisor tags before.
Wait — actually there's an even more concrete divergence: `canMutateSsmaActionPlan()` returns canManageSsmaOccurrences() for members whose tag isn't supervisor. Consider a Membro comum (stakeholder) with can_create on their tag — canManageSsmaOccurrences would return true → canMutate true → they can create/act. But the business rule says "Membro comum não cria" per the Twig comment and the PR description: "Membro comum não cria" (line 12611). Yet canManageSsmaOccurrences can return true for any tag with can_create=true (a member with can_create on the tag). Wait — but canMemberRegisterOwnOccurrence note says can_create on tag only allows registering own occurrence... Actually canManageSsmaOccurrences returns true for tag can_create/can_edit/can_delete. So a Membro with a tag can_create = true would pass canMutateSsmaActionPlan. Hmm. Is that inconsistent with the docblock "Criar Plano de Ação: gestor/admin"? Possibly. The comment in Twig says "Membro comum não cria". But canMutate would return true for a Membro whose tag has can_create. That mismatch would be a real bug: UI hides buttons (ssmaCanMutateActionPlan false after the strip logic when ssmaIsPlainProductMemberUi...) Hmm, this gets complicated because the flags also strip.
Wait let's look at line 12642-12658: `$ssmaIsPlainProductMemberUi = shouldStripOccurrenceManagementTabsUi(...)`. If true and not GestorAdministrador, then `$ssmaCanCreateLinkedActions = false`. So UI for plain product member would hide the button. But the server endpoint uses `canMutateSsmaActionPlan()` → canManageSsmaOccurrences() → for member with can_create tag... wait, but shouldStripOccurrenceManagementTabsUi checks tag name in Membro/Inspetor? Let me examine `shouldStripOccurrenceManagementTabsUi` and whether the tag-can_create branch in canManageSsmaOccurrences is gated by that strip. Look at canManageSsmaOccurrences beginning: it strips UI management when `shouldStripSsmaManagementUiForUser($company, $user)` returns true. Then roles. Then memberIsSsmaGestorAdministrador. Then tag can_create/can_edit/can_delete. So canManageSsmaOccurrences could return true for a member with can_create tag but stripped by shouldStripSsmaManagementUiForUser? Let's check shouldStripSsmaManagementUiForUser.
This is getting deep. The point is that canMutateSsmaActionPlan's final line `return $this->canManageSsmaOccurrences();` delegates to a method whose semantics include "member can create own occurrence" (tag can_create). The PR description says "Membro comum não cria" for action plan. Potential authorization gap? But canManageSsmaOccurrences in the current code was historically used to decide management ability, and it also includes tag-based can_create. Actually the note at 11406-11413 says canManageSsmaOccurrences is "diferente de canMemberRegisterOwnOccurrence (que libera apenas a CRIAÇÃO para o membro comum da empresa que tem acesso)" — so canManageSsmaOccurrences INCLUDES management: editing/deleting/resolving for tag can_create members. Hmm.
This is too uncertain; canManageSsmaOccurrences may be the established authority for "can manage ssma occurrences" which includes tag-based can_create. So the real finding remains: two sources of truth (server method + Twig override), risk of divergence, and docblock intent not enforced. I'll consolidate to a medium/high maintainability + potential authorization mismatch finding. I'll base it on the concrete, verifiable inconsistency: the same PR both defines `canMutateSsmaActionPlan()` as the server policy AND force-overrides the flag in Twig for Gestor de Equipe/Área — a divergence that means either the UI or the server is wrong depending on the tag configuration; plus no test.
Actually — wait. Let me re-examine. Both `ssmaCanCreateLinkedActions` and `ssmaCanMutateActionPlan` are Twig flags. But the server-side endpoints use canMutateSsmaActionPlan (3 places). The Twig override is for display. If canMutate returns true for the Gestor (because canManageSsmaOccurrences true via tag can_create), override is consistent. If not, display vs server mismatch. Since this PR says "Gestor de Equipe continua podendo mutar" while server policy is canMutateSsmaActionPlan — but canMutate is exactly what the flags were derived from originally ($ssmaCanMutateActionPlan = $this->canMutateSsmaActionPlan(); line 12612-12613), then the override at 12777 forces true. This forced override indicates the author KNEW that canMutateSsmaActionPlan may return false for Gestor tags, OR the override is just carried over from legacy code as safety. Either way, the actual server endpoints (7981, 16141, 16272) do NOT have the Gestor override, so if the Twig needs the override for UI correctness, the server needs it too. This is a real inconsistency worth flagging.
Now, let me check the Twig `_action_plan_overflow_menu.html.twig` change more: it uses `ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false))`. If `ssmaCanMutateActionPlan` isn't passed to this template context, the fallback is used. Need to check where this template is included and whether `ssmaCanMutateActionPlan` variable is passed. Let's search for includes of _action_plan_overflow_menu and check the context.
Also check the offcanvas in the JS: the fallback in JS relies on `window.openOffcanvasssmaApActionView` and DOM ids (`ssma-ap-action-view-title`, etc.). Need to check whether those elements exist in template. Search for `ssmaApActionView` or `ssma-ap-action-view`.
Let me search the template files for these ids and includes.
Tool Calls (3)
code_search
Show Details
Arguments
{"search_text": "_action_plan_overflow_menu"}
Result
File: templates/ssma/action_plan/partials/_action_plan_table.html.twig
Match lines: 2
145| {% include 'ssma/action_plan/partials/_action_plan_overflow_menu.html.twig' with {
333| {% include 'ssma/action_plan/partials/_action_plan_overflow_menu.html.twig' with {
code_search
Show Details
Arguments
{"search_text": "ssma-ap-action-view|ssmaApActionView|openOffcanvasSsmaApActionView"}
Result
No matches found
code_search
Show Details
Arguments
{"search_text": "function escapeHtml", "file_patterns": ["public/js/ssma/action_plan_panel.js"]}
Result
File: public/js/ssma/action_plan_panel.js
Match lines: 1
78| function escapeHtml(value) {
Request #13
deepseek-v4-flash
P:49.23K C:228 CR:49.02K CW:0
2014ms
Reasoning
Interesting! The offcanvas DOM ids (`ssma-ap-action-view-title`, `ssmaApActionView`) don't exist anywhere in the templates. And `window.openOffcanvasssmaApActionView` is not defined anywhere. Let me search broader, maybe in other JS files. Search for "openOffcanvas" generally and "action-view".
Tool Calls (3)
code_search
Show Details
Arguments
{"search_text": "openOffcanvas"}
Result
Note: The results have been truncated. Only showing first 100 results.
File: docs/ChatPrincipal/meet/MAPEAMENTO_FLUXO_LIGACAO_ADMIN_YANN.md
Match lines: 2
30| - `openOffCanvasCall()` (em `chat-offcanvas-openers.js`) abre `#offCanvasCall` e chama `window.initializeCallUI(...)`.
51| - abre o offcanvas imediatamente (`openOffCanvasCall`);
File: public/assets/controllers/file-management/advanced-search.js
Match lines: 2
321| if (typeof window.openOffcanvasfmAdvancedSearchOffcanvas === 'function') {
322| window.openOffcanvasfmAdvancedSearchOffcanvas();
File: public/build/time_management.3cae872e.js
Match lines: 1
2|(self.webpackChunk=self.webpackChunk||[]).push([[550],{195(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>d});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23418),n(64346),n(23792),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(27495),n(38781),n(47764),n(23500),n(62953);var r=n(74848),a=n(96540);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){var t=e.isOpen,n=e.onClose,o=e.currentFilters,i=e.onApply,l=e.onClear,u=c((0,a.useState)(o),2),d=u[0],f=u[1];(0,a.useEffect)(function(){f(o)},[o]);return t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"modal-backdrop fade show",style:{zIndex:1040},onClick:function(e){e.stopPropagation(),n()}}),(0,r.jsx)("div",{className:"modal fade show d-block",style:{zIndex:1050},tabIndex:-1,onClick:function(e){e.target===e.currentTarget&&n()},children:(0,r.jsx)("div",{className:"modal-dialog modal-dialog-centered",style:{maxWidth:"400px"},children:(0,r.jsxs)("div",{className:"modal-content",onClick:function(e){return e.stopPropagation()},children:[(0,r.jsxs)("div",{className:"modal-header",children:[(0,r.jsx)("h5",{className:"modal-title",style:{fontFamily:"Inter",fontSize:"18px",fontWeight:600,color:"#5C5D5D"},children:"Filtros"}),(0,r.jsx)("button",{type:"button",className:"close",onClick:function(e){e.preventDefault(),e.stopPropagation(),n()},"aria-label":"Fechar",children:(0,r.jsx)("span",{"aria-hidden":"true",children:"×"})})]}),(0,r.jsxs)("div",{className:"modal-body",children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"recordType",className:"mb-2",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:400,color:"rgba(92, 93, 93, 0.60)"},children:"Tipo de Registro"}),(0,r.jsxs)("select",{id:"recordType",className:"form-control",value:d.recordType,onChange:function(e){return f(s(s({},d),{},{recordType:e.target.value}))},style:{fontFamily:"Inter",fontSize:"14px"},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"first_check_in",children:"Primeira Entrada"}),(0,r.jsx)("option",{value:"first_check_out",children:"Primeira Saída"}),(0,r.jsx)("option",{value:"second_check_in",children:"Segunda Entrada"}),(0,r.jsx)("option",{value:"second_check_out",children:"Segunda Saída"})]})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"validatedBy",className:"mb-2",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:400,color:"rgba(92, 93, 93, 0.60)"},children:"Tipo de Validação"}),(0,r.jsxs)("select",{id:"validatedBy",className:"form-control",value:d.validatedBy,onChange:function(e){return f(s(s({},d),{},{validatedBy:e.target.value}))},style:{fontFamily:"Inter",fontSize:"14px"},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"selfie",children:"Selfie"}),(0,r.jsx)("option",{value:"screenshot",children:"Screenshot"}),(0,r.jsx)("option",{value:"geolocation",children:"Geolocalização"}),(0,r.jsx)("option",{value:"manual",children:"Manual"})]})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"channel",className:"mb-2",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:400,color:"rgba(92, 93, 93, 0.60)"},children:"Canal"}),(0,r.jsxs)("select",{id:"channel",className:"form-control",value:d.channel,onChange:function(e){return f(s(s({},d),{},{channel:e.target.value}))},style:{fontFamily:"Inter",fontSize:"14px"},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"mobile",children:"App"}),(0,r.jsx)("option",{value:"web",children:"Navegador"}),(0,r.jsx)("option",{value:"sistema",children:"Sistema"})]})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"mode",className:"mb-2",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:400,color:"rgba(92, 93, 93, 0.60)"},children:"Modo"}),(0,r.jsxs)("select",{id:"mode",className:"form-control",value:d.mode,onChange:function(e){return f(s(s({},d),{},{mode:e.target.value}))},style:{fontFamily:"Inter",fontSize:"14px"},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"individual",children:"Individual"}),(0,r.jsx)("option",{value:"coletivo",children:"Coletivo"})]})]})]}),(0,r.jsxs)("div",{className:"modal-footer",children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel btn-sm",onClick:function(){f({recordType:"",validatedBy:"",channel:"",mode:""}),l(),n()},style:{fontFamily:"Inter"},children:"Limpar Filtros"}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary btn-sm",onClick:function(){i(d),n()},style:{fontFamily:"Inter",backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:"Aplicar"})]})]})})})]}):null}},1125(e,t,n){"use strict";n.d(t,{A:()=>a});var r=n(74848);function a(e){var t=e.message,n=void 0===t?"Carregando...":t;return(0,r.jsxs)("div",{className:"d-flex justify-content-center align-items-center",style:{padding:"40px"},children:[(0,r.jsx)("div",{className:"spinner-border text-primary",role:"status",children:(0,r.jsx)("span",{className:"sr-only",children:n})}),(0,r.jsx)("span",{style:{marginLeft:"10px",color:"#5C5D5D"},children:n})]})}},1806(e,t,n){"use strict";n.d(t,{A:()=>s,M:()=>l});var r=n(74848),a=n(96540),o=n(40961),i={sm:"modal-sm-custom",md:"",lg:"modal-lg",xl:"modal-xl"};function s(e){var t=e.show,n=e.onClose,s=e.title,l=e.children,c=e.footer,u=e.size,d=void 0===u?"md":u,f=e.className,m=void 0===f?"":f;if((0,a.useEffect)(function(){if(t)return document.body.classList.add("mhs-modal-open"),function(){document.body.classList.remove("mhs-modal-open")}},[t]),!t)return null;var p="sm"===d?"16px":"24px",h=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"modal fade show d-block mhs-modal-base",tabIndex:-1,role:"dialog","aria-modal":"true",onClick:n,children:(0,r.jsx)("div",{className:"modal-dialog modal-dialog-centered mhs-modal-dialog ".concat(i[d]),role:"document",onClick:function(e){return e.stopPropagation()},children:(0,r.jsxs)("div",{className:"modal-content mhs-modal-content ".concat(m),children:[(0,r.jsxs)("div",{className:"modal-header mhs-modal-header",style:{padding:p},children:[(0,r.jsx)("h4",{className:"modal-title mhs-modal-title",children:s}),(0,r.jsx)("button",{type:"button",className:"close mhs-modal-close","aria-label":"Close",onClick:n,children:(0,r.jsx)("span",{className:"mhs-modal-close-icon","aria-hidden":"true",children:"×"})})]}),(0,r.jsx)("div",{className:"modal-body mhs-modal-body",style:{padding:p},children:l}),c&&(0,r.jsx)("div",{className:"modal-footer mhs-modal-footer",style:{padding:"16px ".concat(p)},children:c})]})})}),(0,r.jsx)("div",{className:"modal-backdrop fade show mhs-modal-backdrop",onClick:n})]});return(0,o.createPortal)(h,document.body)}var l=function(e){var t=e.onCancel,n=e.onConfirm,a=e.cancelText,o=void 0===a?"Fechar":a,i=e.confirmText,s=void 0===i?"Confirmar":i,l=e.confirmDisabled,c=void 0!==l&&l;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mhs-btn-cancel",onClick:t,children:o}),(0,r.jsx)("button",{type:"button",className:"btn mhs-btn-primary",onClick:n,disabled:c,children:s})]})}},2698(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>l});n(52675),n(89463),n(2259),n(23418),n(74423),n(64346),n(23792),n(34782),n(23288),n(62010),n(9868),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(1806);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e){var t=e.isOpen,n=e.onUpload,s=e.onClose,l=i((0,a.useState)(null),2),c=l[0],u=l[1],d=i((0,a.useState)(null),2),f=d[0],m=d[1],p=i((0,a.useState)(null),2),h=p[0],v=p[1],b=i((0,a.useState)(!1),2),y=b[0],g=b[1],x=(0,a.useRef)(null),j=["image/png","image/jpeg","image/jpg"],w=function(e){var t=function(e){return j.includes(e.type)?e.size>5242880?"Arquivo muito grande. Máximo: 5MB.":null:"Formato inválido. Use PNG, JPG ou JPEG."}(e);if(t)v(t);else{v(null),u(e);var n=new FileReader;n.onload=function(e){var t;m(null===(t=e.target)||void 0===t?void 0:t.result)},n.readAsDataURL(e)}},S=function(){var e;null===(e=x.current)||void 0===e||e.click()},N=function(){u(null),m(null),v(null),x.current&&(x.current.value="")},k=function(){N(),s()};return t?(0,r.jsx)(o.A,{show:t,onClose:k,title:"Upload de Screenshot",size:"lg",footer:c?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:N,children:"Selecionar Outra"}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary",onClick:function(){c&&(n(c),N())},children:"Confirmar"})]}):(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:k,children:"Cancelar"}),children:(0,r.jsxs)("div",{style:{padding:"24px"},children:[h&&(0,r.jsxs)("div",{className:"alert d-flex align-items-center",style:{backgroundColor:"#E6F7F9",borderColor:"#17A2B8",color:"#0C5460",gap:"12px"},children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle",style:{color:"#17A2B8",fontSize:"24px"}}),(0,r.jsx)("div",{style:{flex:1},children:h})]}),c?(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsxs)("div",{className:"position-relative d-inline-block",children:[(0,r.jsx)("img",{src:f||"",alt:"Preview",className:"img-fluid rounded shadow",style:{maxHeight:"400px"}}),(0,r.jsx)("button",{type:"button",className:"btn btn-sm btn-danger position-absolute top-0 end-0 m-2",onClick:N,title:"Remover imagem",children:(0,r.jsx)("i",{className:"fas fa-times"})})]}),(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsx)("p",{className:"mb-1",children:(0,r.jsx)("strong",{children:c.name})}),(0,r.jsxs)("p",{className:"text-muted small",children:[(c.size/1024/1024).toFixed(2)," MB"]})]}),(0,r.jsx)("div",{className:"alert alert-success mt-3",children:"Imagem selecionada com sucesso!"})]}):(0,r.jsxs)("div",{className:"border border-2 rounded p-5 text-center ".concat(y?"border-primary bg-light":"border-dashed"),style:{borderStyle:"dashed",minHeight:"300px",display:"flex",flexDirection:"column",justifyContent:"center",cursor:"pointer"},onDragEnter:function(e){e.preventDefault(),e.stopPropagation(),g(!0)},onDragLeave:function(e){e.preventDefault(),e.stopPropagation(),g(!1)},onDragOver:function(e){e.preventDefault(),e.stopPropagation()},onDrop:function(e){e.preventDefault(),e.stopPropagation(),g(!1);var t=e.dataTransfer.files[0];t&&w(t)},onClick:S,children:[(0,r.jsx)("i",{className:"fas fa-cloud-upload-alt fa-4x mb-3 ".concat(y?"text-primary":"text-muted")}),(0,r.jsx)("h5",{className:"mb-2",children:y?"Solte a imagem aqui":"Arraste uma imagem ou clique para selecionar"}),(0,r.jsxs)("p",{className:"text-muted mb-3",children:["Formatos aceitos: PNG, JPG, JPEG",(0,r.jsx)("br",{}),"Tamanho máximo: 5MB"]}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary",onClick:function(e){e.stopPropagation(),S()},children:"Selecionar Arquivo"}),(0,r.jsx)("input",{ref:x,type:"file",accept:"image/png,image/jpeg,image/jpg",onChange:function(e){var t,n=null===(t=e.target.files)||void 0===t?void 0:t[0];n&&w(n)},style:{display:"none"}})]})]})}):null}},2799(e,t,n){"use strict";function r(){return null}n.r(t),n.d(t,{default:()=>r})},4818(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>c});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(48598),n(62062),n(34782),n(23288),n(62010),n(9868),n(26099),n(3362),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540);function o(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||s(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||s(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e){var t=e.projects,s=void 0===t?[]:t,l=i((0,a.useState)(null),2),c=l[0],u=l[1],d=i((0,a.useState)(0),2),f=d[0],m=d[1];(0,a.useEffect)(function(){"undefined"!=typeof window&&n.e(416).then(n.bind(n,59416)).then(function(e){u(function(){return e.default})}).catch(function(e){console.error("Erro ao carregar ApexCharts:",e)})},[]),(0,a.useEffect)(function(){s.length>0&&m(function(e){return e+1})},[s]);var p=(0,a.useMemo)(function(){return 0===s.length?[{name:"Sem dados",data:[[0,0,0]],color:"#E0E0E0"}]:s.map(function(e){return{name:e.name,data:e.data||[[0,0,0]],color:e.color||"#186073"}})},[s]),h=(0,a.useMemo)(function(){if(0===s.length)return{maxBudget:100,minBudget:0,yAxisMax:110,yAxisMin:0,yTickAmount:4,xAxisMax:100,xAxisMin:0,xTickAmount:10};var e=s.map(function(e){return e.budget}),t=Math.max.apply(Math,o(e)),n=Math.min.apply(Math,o(e)),r=Math.ceil(1.2*t),a=Math.max(0,Math.floor(.8*n)),i=.1*t;if(r-a<i){var l=(t+n)/2;a=Math.max(0,l-i/2),r=l+i/2}var c=r>1e3?5:4,u=s.map(function(e){return e.timeSpentPercent||0}),d=Math.max.apply(Math,o(u)),f=Math.min.apply(Math,o(u)),m=Math.min(100,Math.ceil(1.2*d)),p=Math.max(0,Math.floor(.8*f));if(m-p<5){var h=(d+f)/2;p=Math.max(0,h-2.5),m=Math.min(100,h+2.5)}var v=m-p;return{maxBudget:t,minBudget:n,yAxisMax:r,yAxisMin:a,yTickAmount:c,xAxisMax:m,xAxisMin:p,xTickAmount:v>50?10:v>20?5:v>5?4:3}},[s]),v=(h.maxBudget,h.minBudget,h.yAxisMax),b=h.yAxisMin,y=h.yTickAmount,g=h.xAxisMax,x=h.xAxisMin,j=h.xTickAmount,w=(0,a.useMemo)(function(){return{chart:{height:320,type:"bubble",toolbar:{show:!1},zoom:{enabled:!1},id:"project-budget-scatter-".concat(f),animations:{enabled:!0,easing:"easeinout",speed:800}},dataLabels:{enabled:!0,formatter:function(e,t){return t&&t.series&&t.series[t.seriesIndex]?t.series[t.seriesIndex].name:t&&t.w&&t.w.globals&&t.w.globals.seriesNames&&t.w.globals.seriesNames[t.seriesIndex]?t.w.globals.seriesNames[t.seriesIndex]:""},style:{fontSize:"12px",fontFamily:"Inter",fontWeight:500,colors:["#5C5D5D"]}},colors:p.map(function(e){return e.color||"#186073"}),xaxis:{title:{text:"Tempo Gasto (%)",offsetY:6,style:{color:"#5C5D5D",fontSize:"12px",fontFamily:"Inter",fontWeight:400}},min:x,max:g,tickAmount:j,labels:{style:{colors:"#5C5D5D",fontSize:"12px",fontFamily:"Inter"}},axisBorder:{show:!1},axisTicks:{show:!1}},yaxis:{title:{text:"Orçamento (R$)",rotate:-90,offsetX:0,style:{color:"#5C5D5D",fontSize:"12px",fontFamily:"Inter",fontWeight:400}},min:b,max:v,tickAmount:y,labels:{style:{colors:"#5C5D5D",fontSize:"12px",fontFamily:"Inter"},formatter:function(e){return e>=1e3?"".concat((e/1e3).toFixed(0),"k"):e.toFixed(0)}},axisBorder:{show:!1},axisTicks:{show:!1}},grid:{borderColor:"#E0E0E0",strokeDashArray:3,padding:{bottom:24},xaxis:{lines:{show:!0}},yaxis:{lines:{show:!0}}},tooltip:{enabled:!0,custom:function(e){var t=e.seriesIndex,n=e.dataPointIndex,r=e.w,a=r.globals.seriesNames[t],o=r.globals.initialSeries[t].data[n],i=o[0].toFixed(2),s=o[1],l=o[2],c=s.toLocaleString("pt-BR",{minimumFractionDigits:2,maximumFractionDigits:2});return'\n\t\t\t\t\t<div style="background: white; border: 1px solid #ccc; padding: 10px; border-radius: 4px; font-size: 12px;">\n\t\t\t\t\t\t<p style="margin: 0; font-weight: 600; color: '.concat(r.config.colors[t],';">').concat(a,'</p>\n\t\t\t\t\t\t<p style="margin: 4px 0 0 0; color: #5C5D5D;">Tempo Gasto: ').concat(i,'%</p>\n\t\t\t\t\t\t<p style="margin: 4px 0 0 0; color: #5C5D5D;">Orçamento: R$ ').concat(c,'</p>\n\t\t\t\t\t\t<p style="margin: 4px 0 0 0; color: #5C5D5D;">Membros: ').concat(l,"</p>\n\t\t\t\t\t</div>\n\t\t\t\t")}},legend:{show:!0,position:"bottom",horizontalAlign:"center",offsetY:14,fontSize:"12px",fontFamily:"Inter",fontWeight:400,labels:{colors:"#5C5D5D"},markers:{size:10,shape:"circle"},itemMargin:{horizontal:12,vertical:8}},plotOptions:{bubble:{minBubbleRadius:15,maxBubbleRadius:60,zScaling:!0}},fill:{opacity:.8}}},[p,v,b,y,g,x,j,f]);return c?(0,r.jsx)("div",{style:{width:"100%",marginTop:"10px"},children:(0,r.jsx)(c,{options:w,series:p,type:"bubble",height:320},"project-budget-".concat(f,"-").concat(s.length>0?s.map(function(e){return e.name}).join("-"):"empty"))}):(0,r.jsx)("div",{style:{width:"100%",height:"320px",display:"flex",alignItems:"center",justifyContent:"center",color:"#5C5D5D",fontFamily:"Inter",fontSize:"14px"},children:"Carregando gráfico..."})}},5380(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>d});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(62953),n(76031);var r=n(74848),a=n(96540),o=n(1806);function i(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var i=r&&r.prototype instanceof c?r:c,u=Object.create(i.prototype);return s(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(s(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,s(m,"constructor",d),s(d,"constructor",u),u.displayName="GeneratorFunction",s(d,a,"GeneratorFunction"),s(m),s(m,a,"Generator"),s(m,r,function(){return this}),s(m,"toString",function(){return"[object Generator]"}),(i=function(){return{w:o,m:p}})()}function s(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}s=function(e,t,n,r){function o(t,n){s(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},s(e,t,n,r)}function l(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){var t=e.isOpen,n=e.onConfirm,s=e.onClose,u=e.distanceToleranceKm,d=void 0===u?0:u,f=c((0,a.useState)(null),2),m=f[0],p=f[1],h=c((0,a.useState)(!1),2),v=h[0],b=h[1],y=c((0,a.useState)(null),2),g=y[0],x=y[1],j=(0,a.useRef)(null),w=(0,a.useRef)(null),S=(0,a.useRef)(null);(0,a.useEffect)(function(){t&&!m&&N()},[t]),(0,a.useEffect)(function(){if(m&&j.current){var e=function(){var e,n=(e=i().m(function e(){var n,r;return i().w(function(e){for(;;)switch(e.n){case 0:if(!window.L){e.n=1;break}return t(),e.a(2);case 1:(n=document.createElement("link")).rel="stylesheet",n.href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",n.integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=",n.crossOrigin="",document.head.appendChild(n),(r=document.createElement("script")).src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js",r.integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=",r.crossOrigin="",r.onload=function(){return t()},document.body.appendChild(r);case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){l(o,r,a,i,s,"next",e)}function s(e){l(o,r,a,i,s,"throw",e)}i(void 0)})});return function(){return n.apply(this,arguments)}}(),t=function(){var e=window.L;if(e&&j.current){w.current&&w.current.remove(),delete e.Icon.Default.prototype._getIconUrl,e.Icon.Default.mergeOptions({iconRetinaUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/images/marker-icon-2x.png",iconUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/images/marker-icon.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/images/marker-shadow.png"});var t=e.map(j.current).setView([m.lat,m.lng],16);w.current=t,e.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:"© OpenStreetMap contributors",maxZoom:19}).addTo(t),e.marker([m.lat,m.lng]).addTo(t),S.current&&t.removeLayer(S.current);var n=d>0?1e3*d:50,r=e.circle([m.lat,m.lng],{color:"#17A2B8",fillColor:"#17A2B8",fillOpacity:.2,radius:n}).addTo(t);S.current=r,t.fitBounds(r.getBounds(),{padding:[20,20]})}};return e(),function(){w.current&&(w.current.remove(),w.current=null)}}},[m,d]);var N=function(){if(navigator.geolocation){b(!0),x(null);var e=setTimeout(function(){b(!1),x("Tempo esgotado ao tentar obter localização. Tente novamente.")},5e3);navigator.geolocation.getCurrentPosition(function(t){clearTimeout(e);var n={lat:t.coords.latitude,lng:t.coords.longitude};p(n),b(!1)},function(t){switch(clearTimeout(e),b(!1),t.code){case t.PERMISSION_DENIED:x("Permissão de localização negada. Por favor, habilite nas configurações.");break;case t.POSITION_UNAVAILABLE:x("Informações de localização não disponíveis.");break;case t.TIMEOUT:x("Tempo esgotado ao tentar obter localização.");break;default:x("Erro desconhecido ao obter localização.")}},{enableHighAccuracy:!0,timeout:5e3,maximumAge:0})}else x("Geolocalização não é suportada pelo seu navegador.")},k=function(){p(null),x(null),N()},C=function(){p(null),x(null),s()};return t?(0,r.jsx)(o.A,{show:t,onClose:C,title:"Localização",size:"md",footer:g?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:C,children:"Cancelar"}),(0,r.jsxs)("button",{type:"button",className:"btn btn-primary",onClick:k,children:[(0,r.jsx)("i",{className:"fas fa-redo me-2"}),"Tentar Novamente"]})]}):m?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:k,children:"Capturar Novamente"}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary",style:{backgroundColor:"#17A2B8",borderColor:"#17A2B8"},onClick:function(){m&&(n(m),p(null))},children:"Confirmar"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:C,children:"Cancelar"}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary",onClick:N,disabled:v,style:{backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:"Capturar Localização"})]}),children:(0,r.jsxs)("div",{style:{padding:"24px"},children:[g&&(0,r.jsxs)("div",{className:"alert d-flex align-items-center",style:{backgroundColor:"#E6F7F9",borderColor:"#17A2B8",color:"#0C5460",gap:"12px"},children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle",style:{color:"#17A2B8",fontSize:"24px"}}),(0,r.jsx)("div",{style:{flex:1},children:g})]}),v&&!g&&(0,r.jsxs)("div",{className:"text-center py-5",children:[(0,r.jsx)("div",{className:"spinner-border text-primary mb-3"}),(0,r.jsx)("p",{className:"text-muted",children:"Obtendo sua localização..."}),(0,r.jsx)("small",{className:"text-muted",children:"Isso pode levar alguns segundos"})]}),m&&!g&&(0,r.jsx)("div",{className:"text-center",children:(0,r.jsx)("div",{ref:j,className:"border rounded mb-3",style:{height:"300px",width:"100%",zIndex:0}})}),!v&&!m&&!g&&(0,r.jsx)("div",{className:"text-center py-4",children:(0,r.jsx)("p",{className:"text-muted",children:'Clique em "Capturar Localização" para obter suas coordenadas GPS'})})]})}):null}},7440(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>x});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(58940),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(97665),o=n(33930),i=n(57097),s=(n(94170),n(59904),n(84185),n(40875),n(10287),n(3362),n(52354));function l(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return c(u,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var i={};function s(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(c(t={},r,function(){return this}),t),m=d.prototype=s.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,c(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,c(m,"constructor",d),c(d,"constructor",u),u.displayName="GeneratorFunction",c(d,a,"GeneratorFunction"),c(m),c(m,a,"Generator"),c(m,r,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),(l=function(){return{w:o,m:p}})()}function c(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}c=function(e,t,n,r){function o(t,n){c(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},c(e,t,n,r)}function u(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){u(o,r,a,i,s,"next",e)}function s(e){u(o,r,a,i,s,"throw",e)}i(void 0)})}}function f(){return m.apply(this,arguments)}function m(){return(m=d(l().m(function e(){var t,n;return l().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,s.F.get("/time-management/notification");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function p(){return(p=d(l().m(function e(t){var n,r;return l().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,s.F.put("/time-management/notification",t);case 1:return n=e.v,r=n.data,e.a(2,r.data)}},e)}))).apply(this,arguments)}var h=n(96540),v=n(76336);function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return y(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var g=["time-management","notification"];function x(){var e=(0,v.L)().canEdit,t=(0,a.jE)(),n=b((0,h.useState)(!1),2),s=n[0],l=n[1],c=b((0,h.useState)(!1),2),u=c[0],d=c[1],m=b((0,h.useState)(10),2),y=m[0],x=m[1],j=b((0,h.useState)(5),2),w=j[0],S=j[1],N=(0,o.I)({queryKey:g,queryFn:f}),k=N.data;N.isFetching;(0,h.useEffect)(function(){k&&(l(k.enableCheckIn),d(k.enableCheckOut),x(k.notificationCheckIn||10),S(k.notificationCheckOut||5))},[k]);var C=(0,i.n)({mutationFn:function(e){return function(e){return p.apply(this,arguments)}(e)},onSuccess:function(){t.invalidateQueries({queryKey:g})}}),O=function(){k&&C.mutate({enableCheckIn:s,enableCheckOut:u,notificationCheckIn:s?y:0,notificationCheckOut:u?w:0})};return(0,h.useEffect)(function(){k&&O()},[s,u]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-12 col-md-6 mb-3",children:(0,r.jsx)("div",{className:"card h-100 tm-card-mobile-auto ".concat(s?"border-primary bg-primary-soft":""),style:{border:"1px solid #e0e0e0",borderRadius:"8px"},children:(0,r.jsxs)("div",{className:"card-body d-flex flex-column",children:[(0,r.jsxs)("div",{className:"custom-control custom-checkbox mb-2",children:[(0,r.jsx)("input",{type:"checkbox",id:"notif-checkin",className:"custom-control-input",checked:s,onChange:function(e){return l(e.target.checked)},disabled:!e}),(0,r.jsxs)("label",{className:"custom-control-label ".concat(s?"text-primary":""),htmlFor:"notif-checkin",children:["Enviar notificação antes de",!e&&(0,r.jsx)("i",{className:"fas fa-lock ml-2 text-muted",style:{fontSize:"0.7rem"}})]})]}),(0,r.jsx)("small",{className:"text-muted d-block mb-2",style:{fontSize:"0.85rem"},children:"Defina com quantos minutos de antecedência o colaborador receberá uma notificação lembrando da hora de entrada."}),(0,r.jsxs)("div",{className:"input-group mt-auto",children:[(0,r.jsx)("input",{type:"number",className:"form-control",value:y,onChange:function(e){return x(parseInt(e.target.value)||0)},onBlur:O,disabled:!s||!e,min:"0"}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("span",{className:"input-group-text",children:"min"})})]})]})})}),(0,r.jsx)("div",{className:"col-12 col-md-6 mb-3",children:(0,r.jsx)("div",{className:"card h-100 tm-card-mobile-auto ".concat(u?"border-primary bg-primary-soft":""),style:{border:"1px solid #e0e0e0",borderRadius:"8px"},children:(0,r.jsxs)("div",{className:"card-body d-flex flex-column",children:[(0,r.jsxs)("div",{className:"custom-control custom-checkbox mb-2",children:[(0,r.jsx)("input",{type:"checkbox",id:"notif-checkout",className:"custom-control-input",checked:u,onChange:function(e){return d(e.target.checked)},disabled:!e}),(0,r.jsxs)("label",{className:"custom-control-label ".concat(u?"text-primary":""),htmlFor:"notif-checkout",children:["Enviar notificação antes de",!e&&(0,r.jsx)("i",{className:"fas fa-lock ml-2 text-muted",style:{fontSize:"0.7rem"}})]})]}),(0,r.jsx)("small",{className:"text-muted d-block mb-2",style:{fontSize:"0.85rem"},children:"Defina com quantos minutos de antecedência o colaborador receberá uma notificação lembrando da hora de saída."}),(0,r.jsxs)("div",{className:"input-group mt-auto",children:[(0,r.jsx)("input",{type:"number",className:"form-control",value:w,onChange:function(e){return S(parseInt(e.target.value)||0)},onBlur:O,disabled:!u||!e,min:"0"}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("span",{className:"input-group-text",children:"min"})})]})]})})})]}),C.isPending&&(0,r.jsxs)("div",{className:"text-muted mt-2",children:[(0,r.jsx)("i",{className:"fas fa-spinner fa-spin mr-2"}),"Salvando..."]})]})}},8596(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>i});n(64346);var r=n(74848),a=n(68925),o=n(13359);function i(e){var t=e.onRegister,n=e.availableOptions,i=e.onSelectOption,s=e.isNoneMode,l=e.disabled,c=e.shift,u=e.selectedDate,d=e.onDateChange,f=e.shiftError;return(0,r.jsx)("div",{className:"card app-card-surface mt-2",children:(0,r.jsx)("div",{className:"card-body p-0",children:(0,r.jsxs)("div",{className:"row g-0",children:[(0,r.jsx)("div",{className:"col-12 col-sm-6 col-md-5 col-lg-5 col-xl-3 col-xxl-3 ms-point-card-left",children:(0,r.jsx)("div",{className:"p-5 h-100",children:(0,r.jsx)(a.default,{onRegister:t,availableOptions:n,onSelectOption:i,isNoneMode:s,disabled:l})})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-md-7 col-lg-7 col-xl-9 col-xxl-9",children:(0,r.jsx)("div",{className:"p-2 h-100",children:f?(0,r.jsxs)("div",{className:"text-center text-danger py-4",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle me-2"}),"Erro ao carregar dados do turno"]}):c&&c.rows&&Array.isArray(c.rows)?(0,r.jsx)(o.default,{shift:c,selectedDate:u,onDateChange:d}):(0,r.jsxs)("div",{className:"text-center text-muted py-4",children:[(0,r.jsx)("i",{className:"fas fa-info-circle me-2"}),"Nenhum dado disponível para exibir"]})})})]})})})}},9504(e,t,n){"use strict";n.d(t,{vl:()=>c});n(52675),n(89463),n(28706),n(51629),n(74423),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(21699),n(23500),n(76031),n(74848);var r=n(20354),a=n.n(r);function o(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function s(n,r,a,o){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return i(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(i(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,i(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,i(m,"constructor",d),i(d,"constructor",u),u.displayName="GeneratorFunction",i(d,a,"GeneratorFunction"),i(m),i(m,a,"Generator"),i(m,r,function(){return this}),i(m,"toString",function(){return"[object Generator]"}),(o=function(){return{w:s,m:p}})()}function i(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}i=function(e,t,n,r){function o(t,n){i(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},i(e,t,n,r)}function s(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function l(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){s(o,r,a,i,l,"next",e)}function l(e){s(o,r,a,i,l,"throw",e)}i(void 0)})}}var c=function(){var e=l(o().m(function e(t){var n,r,i,s;return o().w(function(e){for(;;)switch(e.n){case 0:if(n=t.dashboardRef,r=t.dateRange,i=t.setIsExporting,n.current){e.n=1;break}return console.error("Elemento do dashboard não encontrado"),e.a(2);case 1:try{i(!0),(s=document.createElement("div")).style.position="fixed",s.style.top="0",s.style.left="0",s.style.width="100%",s.style.height="100%",s.style.backgroundColor="rgba(0,0,0,0.5)",s.style.display="flex",s.style.justifyContent="center",s.style.alignItems="center",s.style.zIndex="9999",s.innerHTML='<div style="background: white; padding: 20px; border-radius: 5px;">Gerando imagem do dashboard...</div>',document.body.appendChild(s),setTimeout(l(o().m(function e(){var t,l,c,u;return o().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,a()(n.current,{background:"#FFFFFF",logging:!0,useCORS:!0,allowTaint:!0,onclone:function(e){e.querySelectorAll("button").forEach(function(e){var t;null!==(t=e.textContent)&&void 0!==t&&t.includes("Exportar")&&(e.style.display="none")});var t=e.querySelector("section");t&&(t.style.backgroundColor="#FFFFFF"),e.querySelectorAll(".card").forEach(function(e){e.style.backgroundColor="#FFFFFF"}),e.querySelectorAll(".card-header").forEach(function(e){e.style.backgroundColor="#FFFFFF"}),e.querySelectorAll(".card-body").forEach(function(e){e.style.backgroundColor="#FFFFFF"}),e.querySelectorAll("svg").forEach(function(e){e.querySelectorAll('rect[fill="#F5F6FA"], rect[fill="#f5f6fa"], rect[fill="rgb(245, 246, 250)"]').forEach(function(e){e.setAttribute("fill","#FFFFFF")})}),e.querySelectorAll(".card-header button").forEach(function(e){e.querySelector(".fa-chevron-down")&&(e.style.backgroundColor="#FFFFFF")}),e.querySelectorAll('[style*="background"]').forEach(function(e){var t=e.style,n=t.background||t.backgroundColor;n&&(n.includes("#F5F6FA")||n.includes("#f5f6fa")||n.includes("rgb(245, 246, 250)")||n.includes("rgba(245, 246, 250"))&&(e.style.backgroundColor="#FFFFFF")})}});case 1:t=e.v,l=t.toDataURL("image/png"),(c=document.createElement("a")).href=l,c.download="dashboard-".concat(r.startDate,"-a-").concat(r.endDate,".png"),document.body.appendChild(c),c.click(),document.body.removeChild(c),console.log("Dashboard exportado com sucesso!"),e.n=3;break;case 2:e.p=2,u=e.v,console.error("Erro ao capturar screenshot:",u),alert("Erro ao exportar dashboard. Tente novamente.");case 3:return e.p=3,document.body.removeChild(s),i(!1),e.f(3);case 4:return e.a(2)}},e,null,[[0,2,3,4]])})),500)}catch(e){console.error("Erro ao iniciar exportação:",e),alert("Erro ao iniciar exportação. Tente novamente."),i(!1)}case 2:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}()},10280(e,t,n){"use strict";n.d(t,{A:()=>d});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(51629),n(23418),n(74423),n(64346),n(23792),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(58940),n(27495),n(38781),n(47764),n(23500),n(62953);var r=n(74848),a=n(96540);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){var t=e.value,n=e.label,o=e.variant,i=void 0===o?"white":o,l=e.iconClass,u=e.className,d=void 0===u?"":u,f=e.backgroundColor,m=e.isLoading,p=void 0!==m&&m,h=e.editable,v=void 0!==h&&h,b=e.onValueChange,y=e.isInteger,g=void 0!==y&&y,x=c((0,a.useState)(!1),2),j=x[0],w=x[1],S=c((0,a.useState)(String(t)),2),N=S[0],k=S[1],C=(0,a.useRef)(null),O=function(e){switch(e){case"green":return{boxClass:"bg-teal",textClass:"text-white",borderClass:"border-0"};case"blue":return{boxClass:"bg-info",textClass:"text-white",borderClass:"border-0"};case"red":return{boxClass:"bg-danger",textClass:"text-white",borderClass:"border-0"};case"white":return{boxClass:"bg-white",textClass:"text-muted",borderClass:"border"};case"blue-light":return{boxClass:"bg-success",textClass:"text-white",borderClass:"border"};case"gray":return{boxClass:"bg-light",textClass:"text-muted",borderClass:"border",extraStyle:{backgroundColor:"#898989"}};case"teal-dark":return{boxClass:"bg-primary",textClass:"text-white",borderClass:"border-0",extraStyle:{backgroundColor:"#186073"}};case"cyan":return{boxClass:"bg-info",textClass:"text-white",borderClass:"border-0",extraStyle:{backgroundColor:"#17A2B8"}};case"turquoise":return{boxClass:"bg-success",textClass:"text-white",borderClass:"border-0",extraStyle:{backgroundColor:"#02D6C7"}};case"salmon":return{boxClass:"bg-danger",textClass:"text-white",borderClass:"border-0",extraStyle:{backgroundColor:"#FF6D6D"}};case"dark-gray":return{boxClass:"bg-secondary",textClass:"text-white",borderClass:"border-0",extraStyle:{backgroundColor:"#5C5D5D"}};default:return{boxClass:"bg-light",textClass:"text-muted",borderClass:"border"}}}(i),A=O.boxClass,E=O.textClass,P=O.extraStyle,F=O.borderClass,T=f||["green","blue","red","white","gray","teal-dark","cyan","turquoise","salmon","dark-gray"].includes(i);(0,a.useEffect)(function(){k(String(t))},[t]),(0,a.useEffect)(function(){j&&C.current&&(C.current.focus(),C.current.select())},[j]);var D=function(){v&&!p&&w(!0)},_=function(){if(w(!1),b&&N!==String(t))if(g){var e=parseInt(N);!isNaN(e)&&e>=0?b(e):k(String(t))}else b(N)},I=function(e){"Enter"===e.key?_():"Escape"===e.key&&(k(String(t)),w(!1))},M=function(e){if(e.stopPropagation(),g&&b){var n="number"==typeof t?t:parseInt(String(t));isNaN(n)||b(n+1)}},R=function(e){if(e.stopPropagation(),g&&b){var n="number"==typeof t?t:parseInt(String(t));!isNaN(n)&&n>0&&b(n-1)}};if(T){var z=f?"":function(e){switch(e){case"green":default:return"ms-kpi-card-working";case"blue":return"ms-kpi-card-on-break";case"red":return"ms-kpi-card-absences";case"white":return"ms-kpi-card-license";case"gray":return"ms-kpi-card-pending";case"teal-dark":return"ms-kpi-card-teal-dark";case"cyan":return"ms-kpi-card-cyan";case"turquoise":return"ms-kpi-card-turquoise";case"salmon":return"ms-kpi-card-salmon";case"dark-gray":return"ms-kpi-card-dark-gray"}}(i),L=f||void 0;return(0,r.jsxs)("div",{className:"ms-kpi-card ".concat(z," ").concat(v&&!p?"ms-kpi-card-editing":""),style:L?{background:L}:void 0,children:[(0,r.jsxs)("div",{className:"ms-kpi-card-value-container",children:[j?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("input",{ref:C,type:"text",value:N,onChange:function(e){return k(e.target.value)},onBlur:_,onKeyDown:I,className:"ms-kpi-card-input"}),g&&(0,r.jsx)("span",{className:"ms-kpi-card-suffix",children:"h"})]}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("h1",{className:"ms-kpi-card-value",onClick:D,style:{cursor:v&&!p?"pointer":"default"},children:[p?"...":t,v&&g&&!p&&"h"]})}),v&&g&&!p&&!j&&(0,r.jsxs)("div",{className:"ms-kpi-card-controls",children:[(0,r.jsx)("button",{onClick:M,className:"ms-kpi-card-control-button",children:"▲"}),(0,r.jsx)("button",{onClick:R,className:"ms-kpi-card-control-button",children:"▼"})]})]}),(0,r.jsx)("p",{className:"ms-kpi-card-label",children:n})]})}return(0,r.jsxs)("div",{className:"small-box ".concat(A," ").concat(F," ").concat(d),style:s(s({},P),{},{cursor:v&&!p?"pointer":"default",position:"relative"}),children:[(0,r.jsxs)("div",{className:"inner",children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[j?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("input",{ref:C,type:"text",value:N,onChange:function(e){return k(e.target.value)},onBlur:_,onKeyDown:I,className:"form-control",style:{fontSize:"28px",fontWeight:"bold",padding:"0 8px",width:"auto",minWidth:"80px",height:"auto"}}),g&&(0,r.jsx)("span",{className:"mb-1 ".concat(E),style:{fontSize:"28px",fontWeight:"bold"},children:"h"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h3",{className:"mb-1 ".concat(E),onClick:D,style:{cursor:v&&!p?"pointer":"default"},children:p?"...":t}),v&&g&&!p&&(0,r.jsx)("span",{className:"mb-1 ".concat(E),style:{fontSize:"28px",fontWeight:"bold",cursor:"pointer"},onClick:D,children:"h"})]}),v&&g&&!p&&!j&&(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"4px",marginLeft:"4px"},children:[(0,r.jsx)("button",{onClick:M,className:"btn btn-xs",style:{padding:"2px 6px",fontSize:"10px",lineHeight:"1",background:"rgba(255, 255, 255, 0.3)",border:"1px solid rgba(255, 255, 255, 0.5)",color:"white"},children:"▲"}),(0,r.jsx)("button",{onClick:R,className:"btn btn-xs",style:{padding:"2px 6px",fontSize:"10px",lineHeight:"1",background:"rgba(255, 255, 255, 0.3)",border:"1px solid rgba(255, 255, 255, 0.5)",color:"white"},children:"▼"})]})]}),(0,r.jsx)("p",{className:"mb-0 ".concat(E),children:n})]}),l&&(0,r.jsx)("div",{className:"icon",children:(0,r.jsx)("i",{className:l})})]})}},12395(e,t,n){"use strict";n.d(t,{A:()=>o});var r=n(76314),a=n.n(r)()(function(e){return e[1]});a.push([e.id,".date-range-badge {\n\tposition: relative;\n\tdisplay: inline-block;\n}\n\n.date-range-badge__button {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 8px 16px;\n\tbackground: #fff;\n\tborder: 1px solid #d1d5db;\n\tborder-radius: 20px;\n\tfont-size: 14px;\n\tcolor: #5C5D5D;\n\tcursor: pointer;\n\ttransition: all 0.2s ease;\n\toutline: none;\n\twhite-space: nowrap;\n}\n\n.date-range-badge__button:hover {\n\tborder-color: #2196F3;\n\tbox-shadow: 0 2px 8px rgba(33, 150, 243, 0.15);\n}\n\n.date-range-badge__icon {\n\tcolor: #2196F3;\n\tfont-size: 14px;\n}\n\n.date-range-badge__text {\n\tfont-weight: 500;\n\tcolor: #333;\n}\n\n.date-range-badge__clear {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 18px;\n\theight: 18px;\n\tpadding: 0;\n\tmargin-left: 4px;\n\tbackground: #e5e7eb;\n\tborder: none;\n\tborder-radius: 50%;\n\tcolor: #6b7280;\n\tcursor: pointer;\n\ttransition: all 0.2s ease;\n\toutline: none;\n}\n\n.date-range-badge__clear:hover {\n\tbackground: #dc2626;\n\tcolor: #fff;\n}\n\n.date-range-badge__clear i {\n\tfont-size: 10px;\n}\n\n.date-range-badge__dropdown {\n\tposition: absolute;\n\ttop: calc(100% + 8px);\n\tright: 0;\n\tmin-width: 400px;\n\tbackground: #fff;\n\tborder: 1px solid #d1d5db;\n\tborder-radius: 8px;\n\tbox-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);\n\tz-index: 1000;\n\tanimation: fadeInDown 0.2s ease;\n}\n\n@keyframes fadeInDown {\n\tfrom {\n\t\topacity: 0;\n\t\ttransform: translateY(-10px);\n\t}\n\tto {\n\t\topacity: 1;\n\t\ttransform: translateY(0);\n\t}\n}\n\n.date-range-badge__dropdown-header {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 16px 20px;\n\tborder-bottom: 1px solid #e5e7eb;\n\tfont-weight: 600;\n\tfont-size: 15px;\n\tcolor: #333;\n}\n\n.date-range-badge__dropdown-close {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 24px;\n\theight: 24px;\n\tpadding: 0;\n\tbackground: none;\n\tborder: none;\n\tborder-radius: 4px;\n\tcolor: #9ca3af;\n\tcursor: pointer;\n\ttransition: all 0.2s ease;\n\toutline: none;\n}\n\n.date-range-badge__dropdown-close:hover {\n\tbackground: #f3f4f6;\n\tcolor: #ef4444;\n}\n\n.date-range-badge__dropdown-body {\n\tpadding: 20px;\n}\n\n/* Ajustar estilos do DateRangePicker dentro do dropdown */\n.date-range-badge__dropdown-body .date-range-picker__presets-dropdown {\n\tposition: fixed;\n\ttop: auto;\n\tright: auto;\n}\n\n/* Responsivo */\n@media (max-width: 768px) {\n\t.date-range-badge__dropdown {\n\t\tright: 0;\n\t\tleft: auto;\n\t\tmin-width: 320px;\n\t\tmax-width: calc(100vw - 32px);\n\t}\n\t\n\t.date-range-badge__button {\n\t\tfont-size: 13px;\n\t\tpadding: 6px 12px;\n\t}\n}\n\n/* Tema escuro */\n.dark-mode .date-range-badge__button {\n\tbackground-color: #1f2937;\n\tborder-color: #374151;\n\tcolor: #e5e7eb;\n}\n\n.dark-mode .date-range-badge__text {\n\tcolor: #e5e7eb;\n}\n\n.dark-mode .date-range-badge__dropdown {\n\tbackground-color: #1f2937;\n\tborder-color: #374151;\n}\n\n.dark-mode .date-range-badge__dropdown-header {\n\tborder-color: #374151;\n\tcolor: #e5e7eb;\n}\n\n",""]);const o=a},12921(e,t,n){"use strict";n.d(t,{A:()=>d});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(68156),n(62953);var r=n(74848),a=n(96540),o=n(85072),i=n.n(o),s=n(18438),l={insert:"head",singleton:!1};i()(s.A,l);s.A.locals;function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const d=function(e){var t=e.initialStartDate,n=e.initialEndDate,o=e.onChange,i=e.maxDays,s=void 0===i?365:i,l=e.className,u=void 0===l?"":l,d=e.defaultToLastMonth,f=void 0===d||d,m=c((0,a.useState)(t||""),2),p=m[0],h=m[1],v=c((0,a.useState)(n||""),2),b=v[0],y=v[1],g=c((0,a.useState)(""),2),x=g[0],j=g[1],w=c((0,a.useState)(!1),2),S=w[0],N=w[1];(0,a.useEffect)(function(){h(t||""),y(n||""),j("")},[t,n]),(0,a.useEffect)(function(){if(f&&(!t||!n)){var e=new Date,r=new Date;r.setDate(r.getDate()-30);var a=k(r),i=k(e);h(a),y(i),o({startDate:a,endDate:i})}},[]);var k=function(e){var t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(r)},C=function(e,t){if(!e||!t)return"Por favor, selecione ambas as datas";var n=new Date(e),r=new Date(t);if(n>r)return"A data inicial deve ser anterior ou igual à data final";var a=Math.abs(r.getTime()-n.getTime());return Math.ceil(a/864e5)>s?"O intervalo máximo permitido é de ".concat(s," dias"):null},O=[{label:"Última Semana",getValue:function(){var e=new Date,t=new Date;return t.setDate(t.getDate()-7),{startDate:k(t),endDate:k(e)}}},{label:"Últimos 15 Dias",getValue:function(){var e=new Date,t=new Date;return t.setDate(t.getDate()-15),{startDate:k(t),endDate:k(e)}}},{label:"Último Mês",getValue:function(){var e=new Date,t=new Date;return t.setMonth(t.getMonth()-1),{startDate:k(t),endDate:k(e)}}},{label:"Últimos 3 Meses",getValue:function(){var e=new Date,t=new Date;return t.setMonth(t.getMonth()-3),{startDate:k(t),endDate:k(e)}}},{label:"Mês Atual",getValue:function(){var e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return{startDate:k(t),endDate:k(n)}}},{label:"Mês Anterior",getValue:function(){var e=new Date,t=new Date(e.getFullYear(),e.getMonth()-1,1),n=new Date(e.getFullYear(),e.getMonth(),0);return{startDate:k(t),endDate:k(n)}}},{label:"Ano Atual",getValue:function(){var e=new Date,t=new Date(e.getFullYear(),0,1),n=new Date(e.getFullYear(),11,31);return{startDate:k(t),endDate:k(n)}}}],A=function(){if(!p||!b)return 0;var e=new Date(p),t=new Date(b),n=Math.abs(t.getTime()-e.getTime());return Math.ceil(n/864e5)+1};return(0,r.jsxs)("div",{className:"date-range-picker ".concat(u),children:[(0,r.jsxs)("div",{className:"date-range-picker__dates-row",children:[(0,r.jsxs)("div",{className:"date-range-picker__field",children:[(0,r.jsx)("label",{htmlFor:"start-date",className:"date-range-picker__label",children:"Data inicial"}),(0,r.jsx)("input",{type:"date",id:"start-date",className:"date-range-picker__input",value:p,onChange:function(e){var t=e.target.value;h(t);var n=C(t,b);j(n||""),n||o({startDate:t,endDate:b})},max:b||void 0})]}),(0,r.jsxs)("div",{className:"date-range-picker__field",children:[(0,r.jsx)("label",{htmlFor:"end-date",className:"date-range-picker__label",children:"Data final"}),(0,r.jsx)("input",{type:"date",id:"end-date",className:"date-range-picker__input",value:b,onChange:function(e){var t=e.target.value;y(t);var n=C(p,t);j(n||""),n||o({startDate:p,endDate:t})},min:p||void 0})]})]}),(0,r.jsxs)("div",{className:"date-range-picker__bottom-row",children:[(0,r.jsx)("button",{type:"button",className:"date-range-picker__preset-btn",onClick:function(){return N(!S)},title:"Atalhos de período",children:(0,r.jsx)("i",{className:"fas fa-calendar-alt"})}),x?(0,r.jsxs)("div",{className:"date-range-picker__error",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle"}),(0,r.jsx)("span",{children:x})]}):p&&b?(0,r.jsxs)("div",{className:"date-range-picker__info",children:[(0,r.jsx)("i",{className:"fas fa-info-circle"}),(0,r.jsxs)("span",{children:["Período selecionado de ",A()," dia",A()>1?"s":"","."]})]}):null]}),S&&(0,r.jsxs)("div",{className:"date-range-picker__presets-dropdown",children:[(0,r.jsxs)("div",{className:"date-range-picker__presets-header",children:[(0,r.jsx)("span",{children:"Períodos Rápidos"}),(0,r.jsx)("button",{type:"button",className:"date-range-picker__presets-close",onClick:function(){return N(!1)},children:(0,r.jsx)("i",{className:"fas fa-times"})})]}),(0,r.jsx)("div",{className:"date-range-picker__presets-list",children:O.map(function(e,t){return(0,r.jsx)("button",{type:"button",className:"date-range-picker__preset-item",onClick:function(){return function(e){var t=e.getValue(),n=t.startDate,r=t.endDate;h(n),y(r),j(""),N(!1),o({startDate:n,endDate:r})}(e)},children:e.label},t)})})]})]})}},13359(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>f});n(64346),n(62010);var r=n(74848),a=n(88195),o=(n(52675),n(89463),n(2259),n(28706),n(23418),n(23792),n(34782),n(1688),n(23288),n(26099),n(27495),n(38781),n(47764),n(62953),n(76031),n(96540));function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e){if(!e)return"";var t=new Date(e+"T00:00:00"),n=["Dom.","Seg.","Ter.","Qua.","Qui.","Sex.","Sáb."][t.getDay()],r=t.getDate(),a=["Jan.","Fev.","Mar.","Abr.","Mai.","Jun.","Jul.","Ago.","Set.","Out.","Nov.","Dez."][t.getMonth()],o=t.getFullYear();return"".concat(n," ").concat(r," de ").concat(a," ").concat(o)}function c(e){var t=e.selectedDate,n=e.onDateChange,a=e.formatDate,s=void 0===a?l:a,c=e.className,u=void 0===c?"":c,d=i((0,o.useState)(!1),2),f=d[0],m=d[1],p=(0,o.useRef)(null),h=function(e){var r=new Date(t+"T00:00:00");r.setDate(r.getDate()+e);var a=r.toISOString().split("T")[0];n(a)};return(0,r.jsxs)("div",{className:"d-flex align-items-center position-relative ".concat(u),style:{gap:8},children:[(0,r.jsx)("button",{type:"button",className:"btn btn-link text-muted p-1",onClick:function(e){e.stopPropagation(),h(-1)},"aria-label":"Dia anterior",children:(0,r.jsx)("i",{className:"fas fa-chevron-left"})}),(0,r.jsx)("div",{className:"tm-date-trigger",style:{fontFamily:"Inter, sans-serif",fontSize:"14px",fontWeight:400,color:"#186073",userSelect:"none",cursor:"pointer"},onClick:function(){m(!f),setTimeout(function(){var e,t;p.current&&(p.current.focus(),null===(e=(t=p.current).showPicker)||void 0===e||e.call(t))},10)},title:"Clique para selecionar data",children:s(t)}),(0,r.jsx)("button",{type:"button",className:"btn btn-link text-muted p-1",onClick:function(e){e.stopPropagation(),h(1)},"aria-label":"Próximo dia",children:(0,r.jsx)("i",{className:"fas fa-chevron-right"})}),(0,r.jsx)("input",{ref:p,type:"date",value:t,onChange:function(e){var t=e.target.value;t&&(n(t),m(!1))},onBlur:function(){return m(!1)},style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:f?"auto":"none"}})]})}function u(e){var t=e.color;return(0,r.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("circle",{cx:"9",cy:"5",r:"3",stroke:t,strokeWidth:"1.5",fill:"none"}),(0,r.jsx)("path",{d:"M5 16C5 13.7909 6.79086 12 9 12C11.2091 12 13 13.7909 13 16V19H5V16Z",stroke:t,strokeWidth:"1.5",fill:"none"}),(0,r.jsx)("path",{d:"M15 12L19 12M19 12L17 10M19 12L17 14",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function d(e){var t=e.color;return(0,r.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("rect",{x:"3",y:"5",width:"12",height:"10",rx:"1",stroke:t,strokeWidth:"1.5",fill:"none"}),(0,r.jsx)("path",{d:"M6 15L6 17L12 17L12 15",stroke:t,strokeWidth:"1.5",strokeLinecap:"round"}),(0,r.jsx)("path",{d:"M16 10L20 10M20 10L18 8M20 10L18 12",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function f(e){var t=e.shift,n=e.selectedDate,o=e.onDateChange;if(!t||!t.rows||!Array.isArray(t.rows))return(0,r.jsxs)("div",{className:"text-center text-muted py-4",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle me-2"}),"Dados do turno não disponíveis"]});return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between mb-3",children:[(0,r.jsxs)("span",{children:[(0,r.jsx)("strong",{children:"Turno:"})," ",t.name]}),(0,r.jsx)(c,{selectedDate:n,onDateChange:o})]}),(0,r.jsx)(a.A,{columns:[{key:"icon",label:"",width:"50px",align:"center"},{key:"horario",label:"Horário",width:"auto",align:"left"},{key:"dispositivo",label:"Dispositivo",width:"auto",align:"left"},{key:"canal",label:"Canal",width:"100px",align:"center"}],data:t.rows,emptyMessage:"Nenhum registro encontrado",renderRow:function(e,t){var n=t%2==0,a=e.muted?"#9ca3af":"#000000";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"ms-table-cell-center align-middle",children:n?(0,r.jsx)(u,{color:a}):(0,r.jsx)(d,{color:a})}),(0,r.jsx)("td",{className:"ms-table-cell ".concat(e.muted?"text-muted":""),children:e.label}),(0,r.jsx)("td",{className:"ms-table-cell ".concat(e.muted?"text-muted":""),style:{textTransform:"capitalize"},children:e.device||(0,r.jsx)("span",{className:"text-muted",children:"—"})}),(0,r.jsx)("td",{className:"ms-table-cell-center ".concat(e.muted?"text-muted":""),style:{textTransform:"capitalize"},children:e.mode||(0,r.jsx)("span",{className:"text-muted",children:"—"})})]})}})]})}},14011(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>u});n(52675),n(89463),n(2259),n(28706),n(2008),n(51629),n(23418),n(74423),n(64346),n(23792),n(62062),n(34782),n(26910),n(23288),n(62010),n(26099),n(58940),n(27495),n(38781),n(31415),n(21699),n(47764),n(25440),n(42762),n(23500),n(62953);var r=n(74848),a=n(96540),o=n(33930),i=n(14305),s=n(1806);function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e){var t=e.isOpen,n=e.onClose,c=e.workShift,u=e.onSave,d=e.isSaving,f=void 0!==d&&d,m=l((0,a.useState)(""),2),p=m[0],h=m[1],v=l((0,a.useState)(""),2),b=v[0],y=v[1],g=l((0,a.useState)(new Set),2),x=g[0],j=g[1],w=l((0,a.useState)(!1),2),S=(w[0],w[1]),N=l((0,a.useState)(!1),2),k=N[0],C=N[1],O=(0,a.useRef)(null),A=(0,o.I)({queryKey:["time-management","members-with-shifts"],queryFn:i.bM,staleTime:0,enabled:t}),E=A.data,P=void 0===E?[]:E,F=A.isFetching,T=A.refetch;(0,a.useEffect)(function(){t&&null!=c&&c.id&&T()},[t,null==c?void 0:c.id,T]),(0,a.useEffect)(function(){if(t&&null!=c&&c.id&&0!==P.length){var e=P.filter(function(e){return e.workShiftId===c.id}).map(function(e){return String(e.id)});j(new Set(e)),S(!0)}},[t,null==c?void 0:c.id,P]),(0,a.useEffect)(function(){t||(S(!1),h(""),y(""),C(!1))},[t]),(0,a.useEffect)(function(){t&&null!=c&&c.id&&(S(!1),C(!1))},[null==c?void 0:c.id]);var D=(0,a.useMemo)(function(){return P.filter(function(e){if(e.isRemoved||!e.enabled)return!1;var t=e.workShiftId===(null==c?void 0:c.id);if(!(null===e.workShiftId)&&!t)return!1;var n="".concat(e.firstName||""," ").concat(e.lastName||"").trim().toLowerCase(),r=!p||n.includes(p.toLowerCase()),a=e.teams?e.teams.split(",").map(function(e){return e.trim()}):[],o=!b||a.includes(b);return r&&o})},[P,p,b,null==c?void 0:c.id]),_=(0,a.useMemo)(function(){var e=new Set;return P.forEach(function(t){t.teams&&t.teams.split(",").forEach(function(t){var n=t.trim();n&&e.add(n)})}),Array.from(e).sort()},[P]),I=function(e){C(!0);var t=String(e),n=new Set(x);n.has(t)?n.delete(t):n.add(t),j(n)},M=k&&D.length>0&&x.size>0&&x.size===D.length,R=k&&x.size>0&&x.size<D.length;(0,a.useEffect)(function(){O.current&&(O.current.indeterminate=R)},[R]);var z=function(){h(""),y(""),j(new Set),S(!1),C(!1),n()},L=["#17A2B8","#28A745","#FFC107","#DC3545","#6C757D","#007BFF"];return t?(0,r.jsxs)(s.A,{show:t,onClose:z,title:"".concat((null==c?void 0:c.name)||"Turno"," - Selecionar Membros"),size:"md",className:"assign-members-modal",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:z,disabled:f,style:{fontFamily:"Inter",fontSize:"14px"},children:"Voltar"}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary",onClick:function(){u(Array.from(x)),z()},disabled:0===x.size||f,style:{fontFamily:"Inter",fontSize:"14px",backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:f?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("i",{className:"fas fa-spinner fa-spin mr-1"}),"Atribuindo..."]}):"Atribuir Membro"})]}),children:[(0,r.jsx)("style",{children:"\n\t\t\t\t.assign-members-modal {\n\t\t\t\t\tborder-radius: 8px;\n\t\t\t\t}\n\t\t\t\t.assign-members-modal .table {\n\t\t\t\t\tborder-collapse: collapse;\n\t\t\t\t\tborder-spacing: 0;\n\t\t\t\t}\n\t\t\t\t.assign-members-modal .table thead tr th {\n\t\t\t\t\tpadding: 8px 8px 1px 8px !important;\n\t\t\t\t\tmargin: 0 !important;\n\t\t\t\t\tborder-bottom: 1px solid #dee2e6;\n\t\t\t\t}\n\t\t\t\t.assign-members-modal .table tbody tr td {\n\t\t\t\t\tpadding: 8px !important;\n\t\t\t\t\tmargin: 0 !important;\n\t\t\t\t}\n\t\t\t\t.assign-members-modal .table tbody tr:first-child td {\n\t\t\t\t\tpadding-top: 1px !important;\n\t\t\t\t}\n\t\t\t\t.custom-control-input:checked ~ .custom-control-label::before {\n\t\t\t\t\tbackground-color: #17A2B8;\n\t\t\t\t\tborder-color: #17A2B8;\n\t\t\t\t}\n\t\t\t\t.custom-control-input:checked ~ .custom-control-label::after {\n\t\t\t\t\tbackground-image: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3e%3c/svg%3e\");\n\t\t\t\t}\n\t\t\t\t.custom-control-input:indeterminate ~ .custom-control-label::before {\n\t\t\t\t\tbackground-color: #17A2B8;\n\t\t\t\t\tborder-color: #17A2B8;\n\t\t\t\t}\n\t\t\t\t.custom-control-input:indeterminate ~ .custom-control-label::after {\n\t\t\t\t\tbackground-image: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 4'%3e%3cpath stroke='%23fff' d='M 0 2 L 4 2'/%3e%3c/svg%3e\");\n\t\t\t\t}\n\t\t\t"}),(0,r.jsx)("div",{style:{padding:"24px",overflowX:"hidden"},children:(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsx)("h6",{style:{fontFamily:"Inter",fontSize:"16px",fontWeight:600,color:"#5C5D5D",marginBottom:"8px"},children:"Atribuir Membros"}),(0,r.jsx)("p",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:400,color:"#6c757d",marginBottom:"16px"},children:"Adicione os membros que utilizarão esse turno como referência para bater o ponto."}),(0,r.jsxs)("div",{className:"row",style:{marginBottom:"20px"},children:[(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"input-group",children:[(0,r.jsx)("div",{className:"input-group-prepend",children:(0,r.jsx)("span",{className:"input-group-text",children:(0,r.jsx)("i",{className:"fas fa-search"})})}),(0,r.jsx)("input",{type:"text",className:"form-control",placeholder:"Buscar por Nome",value:p,onChange:function(e){return h(e.target.value)},style:{fontFamily:"Inter",fontSize:"14px"}})]})}),(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("select",{className:"form-control",value:b,onChange:function(e){return y(e.target.value)},style:{fontFamily:"Inter",fontSize:"14px"},children:[(0,r.jsx)("option",{value:"",children:"Filtrar por Equipe"}),_.map(function(e){return(0,r.jsx)("option",{value:e,children:e},e)})]})})]}),(0,r.jsx)("div",{style:{maxHeight:"350px",overflowY:"auto",overflowX:"hidden",border:"1px solid #dee2e6",borderRadius:"4px",marginTop:0},children:(0,r.jsxs)("table",{className:"table table-hover mb-0",style:{tableLayout:"fixed",width:"100%",marginBottom:0},children:[(0,r.jsx)("thead",{style:{position:"sticky",top:0,backgroundColor:"#f8f9fa",zIndex:1},children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{style:{width:"50px",fontFamily:"Inter",fontSize:"14px",textAlign:"center",verticalAlign:"middle",padding:"8px",margin:0},children:(0,r.jsxs)("div",{className:"custom-control custom-checkbox",style:{display:"inline-block"},children:[(0,r.jsx)("input",{type:"checkbox",className:"custom-control-input",id:"select-all-members",checked:M,ref:O,onChange:function(){if(C(!0),x.size===D.length)j(new Set);else{var e=D.map(function(e){return String(e.id)});j(new Set(e))}}}),(0,r.jsx)("label",{className:"custom-control-label",htmlFor:"select-all-members"})]})}),(0,r.jsx)("th",{style:{width:"55%",fontFamily:"Inter",fontSize:"14px",fontWeight:600,color:"#5C5D5D",marginBottom:1},children:"Membro"}),(0,r.jsx)("th",{style:{width:"40%",fontFamily:"Inter",fontSize:"14px",fontWeight:600,color:"#5C5D5D",marginBottom:1},children:"Equipe"})]})}),(0,r.jsx)("tbody",{style:{margin:0,padding:0},children:F?(0,r.jsx)("tr",{children:(0,r.jsxs)("td",{colSpan:3,className:"text-center py-4",style:{padding:"8px"},children:[(0,r.jsx)("i",{className:"fas fa-spinner fa-spin mr-2"}),"Carregando membros..."]})}):0===D.length?(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:3,className:"text-center py-4 text-muted",children:"Nenhum membro encontrado"})}):D.map(function(e){var t,n,a,o=String(e.id),i=x.has(o),s="".concat(e.firstName||""," ").concat(e.lastName||"").trim(),l=e.email||"",c=(t=e.firstName,n=e.lastName,t&&t.length>0?t[0].toUpperCase():n&&n.length>0?n[0].toUpperCase():"U"),u=(a=parseInt(o.replace(/\D/g,""))%L.length,L[a]);return(0,r.jsxs)("tr",{style:{cursor:"pointer"},onClick:function(){return I(o)},children:[(0,r.jsx)("td",{onClick:function(e){return e.stopPropagation()},style:{textAlign:"center",verticalAlign:"middle",margin:0},children:(0,r.jsxs)("div",{className:"custom-control custom-checkbox",style:{display:"inline-block"},children:[(0,r.jsx)("input",{type:"checkbox",className:"custom-control-input",id:"member-".concat(o),checked:i,onChange:function(){return I(o)}}),(0,r.jsx)("label",{className:"custom-control-label",htmlFor:"member-".concat(o)})]})}),(0,r.jsx)("td",{style:{overflow:"hidden",padding:"8px",margin:0},children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsxs)("div",{style:{position:"relative",marginRight:"12px",flexShrink:0},children:[e.hasCrown&&(0,r.jsx)("img",{src:"/images/employee-advocacy/image.png",alt:"Crown",style:{position:"absolute",top:"-9px",left:"50%",transform:"translateX(-50%)",width:"13px",height:"13px",zIndex:2}}),(0,r.jsx)("div",{className:"rounded-circle d-flex align-items-center justify-content-center text-white",style:{width:"30px",height:"30px",backgroundColor:u,fontSize:"12px",fontWeight:600,border:e.hasCrown?"2px solid #FFD700":"none",boxShadow:e.hasCrown?"0 0 6px rgba(255, 215, 0, 0.5)":"none"},children:c})]}),(0,r.jsxs)("div",{style:{overflow:"hidden",minWidth:0},children:[(0,r.jsx)("div",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:500,color:"#5C5D5D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s||"Sem nome"}),l&&(0,r.jsx)("div",{style:{fontFamily:"Inter",fontSize:"12px",color:"#6c757d",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l})]})]})}),(0,r.jsx)("td",{style:{overflow:"hidden",padding:"8px",margin:0},children:(0,r.jsx)("div",{className:"d-flex flex-wrap",style:{maxWidth:"100%"},children:e.teams?e.teams.split(",").map(function(e,t){return(0,r.jsx)("span",{className:"badge badge-info mr-1 mb-1",style:{fontFamily:"Inter",fontSize:"11px",fontWeight:500,backgroundColor:"#17A2B8",padding:"4px 8px"},children:e.trim()},t)}):null})})]},e.id)})})]})})]})})]}):null}},14305(e,t,n){"use strict";n.d(t,{LW:()=>v,Nq:()=>y,ZD:()=>p,bM:()=>f,iT:()=>u});n(52675),n(89463),n(25276),n(23792),n(23288),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(38781),n(47764),n(42762),n(62953),n(48408);var r=n(52354),a=["hitTheSpotId"];function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function i(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var i=r&&r.prototype instanceof c?r:c,u=Object.create(i.prototype);return s(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(s(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,s(m,"constructor",d),s(d,"constructor",u),u.displayName="GeneratorFunction",s(d,a,"GeneratorFunction"),s(m),s(m,a,"Generator"),s(m,r,function(){return this}),s(m,"toString",function(){return"[object Generator]"}),(i=function(){return{w:o,m:p}})()}function s(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}s=function(e,t,n,r){function o(t,n){s(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},s(e,t,n,r)}function l(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function c(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){l(o,r,a,i,s,"next",e)}function s(e){l(o,r,a,i,s,"throw",e)}i(void 0)})}}function u(e){return d.apply(this,arguments)}function d(){return(d=c(i().m(function e(t){var n,a,o,s,l,c;return i().w(function(e){for(;;)switch(e.n){case 0:return n=new URLSearchParams,a=t&&""!==String(t).trim()?String(t):"0",n.append("work_shift_id",a),o=n.toString(),s="/time-management/members/company".concat(o?"?".concat(o):""),e.n=1,r.F.get(s);case 1:return l=e.v,c=l.data,e.a(2,c.data)}},e)}))).apply(this,arguments)}function f(){return m.apply(this,arguments)}function m(){return(m=c(i().m(function e(){var t,n;return i().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/members/with-shifts");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function p(e){return h.apply(this,arguments)}function h(){return(h=c(i().m(function e(t){var n,a,o,s,l;return i().w(function(e){for(;;)switch(e.n){case 0:return n=new URLSearchParams,null!=t&&t.start_date&&""!==t.start_date.trim()&&n.append("start_date",t.start_date),null!=t&&t.end_date&&""!==t.end_date.trim()&&n.append("end_date",t.end_date),null!=t&&t.work_shift_id&&""!==t.work_shift_id.trim()&&n.append("work_shift_id",t.work_shift_id),null!=t&&t.member_name&&""!==t.member_name.trim()&&n.append("member_name",t.member_name),null!=t&&t.status&&""!==t.status.trim()&&n.append("status",t.status),null!=t&&t.page&&t.page>0&&n.append("page",t.page.toString()),null!=t&&t.limit&&t.limit>0&&n.append("limit",t.limit.toString()),a=n.toString(),o="/time-management/hit-spot-time/history".concat(a?"?".concat(a):""),e.n=1,r.F.get(o);case 1:return s=e.v,l=s.data,e.a(2,l)}},e)}))).apply(this,arguments)}function v(e){return b.apply(this,arguments)}function b(){return(b=c(i().m(function e(t){var n,a,o,s;return i().w(function(e){for(;;)switch(e.n){case 0:return n=new URLSearchParams,null!=t&&t.start_date&&""!==t.start_date.trim()&&n.append("start_date",t.start_date),null!=t&&t.end_date&&""!==t.end_date.trim()&&n.append("end_date",t.end_date),null!=t&&t.work_shift_id&&""!==t.work_shift_id.trim()&&n.append("work_shift_id",t.work_shift_id),null!=t&&t.member_name&&""!==t.member_name.trim()&&n.append("member_name",t.member_name),null!=t&&t.status&&""!==t.status.trim()&&n.append("status",t.status),a=n.toString(),o="/time-management/hit-spot-time/history/export".concat(a?"?".concat(a):""),e.n=1,r.F.get(o,{responseType:"blob",headers:{Accept:"text/csv"}});case 1:return s=e.v,e.a(2,s.data)}},e)}))).apply(this,arguments)}function y(e){return g.apply(this,arguments)}function g(){return(g=c(i().m(function e(t){var n,s,l,c;return i().w(function(e){for(;;)switch(e.n){case 0:return n=t.hitTheSpotId,s=o(t,a),e.n=1,r.F.put("/time-management/hit-the-spot/".concat(n,"/edit"),s);case 1:return l=e.v,c=l.data,e.a(2,c.data)}},e)}))).apply(this,arguments)}},14463(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>m});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(62010),n(2892),n(9868),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(78459),n(27495),n(38781),n(47764),n(23500),n(62953);var r=n(74848),a=n(96540),o=n(1806);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==i(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var f={formGroup:{marginBottom:"20px"},label:{display:"block",fontSize:"13px",fontWeight:600,color:"#5C5D5D",marginBottom:"8px"},input:{width:"100%",padding:"10px",border:"1px solid #D1D5DB",borderRadius:"5px",fontSize:"14px",color:"#5C5D5D"},inputGroup:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"15px"},textarea:{width:"100%",padding:"10px",border:"1px solid #D1D5DB",borderRadius:"5px",fontSize:"14px",color:"#5C5D5D",minHeight:"80px",resize:"vertical"},modeToggle:{display:"flex",gap:"10px",marginBottom:"20px"},modeButton:{flex:1,padding:"10px",border:"1px solid #D1D5DB",borderRadius:"5px",backgroundColor:"#FFF",fontSize:"14px",fontWeight:600,color:"#5C5D5D",cursor:"pointer",transition:"all 0.2s"},modeButtonActive:{backgroundColor:"#186073",color:"#FFF",borderColor:"#186073"},infoText:{fontSize:"12px",color:"#6B7280",marginTop:"5px"}};function m(e){var t=e.show,n=e.onClose,i=e.onSubmit,s=e.selectedProject,c=e.selectedActivity,d=e.selectedTask,m=void 0===d?"":d,p=e.workloadHours,h=void 0===p?8:p,v=e.prefilledData,b=void 0===v?null:v,y=e.isReadOnly,g=void 0!==y&&y,x=e.allowProjectSelection,j=void 0!==x&&x,w=e.projectOptions,S=void 0===w?[]:w,N=e.activityOptions,k=void 0===N?[]:N,C=e.selectedProjectId,O=void 0===C?null:C,A=e.selectedActivityId,E=void 0===A?null:A,P=e.suggestedProjectName,F=e.suggestedActivityName,T=e.onProjectChange,D=e.onActivityChange,_=e.alreadyRegisteredMinutes,I=void 0===_?0:_,M=e.dailyLimitHours,R=void 0===M?null:M,z=u((0,a.useState)("time"),2),L=z[0],q=z[1],B=u((0,a.useState)(""),2),G=B[0],H=B[1],W=u((0,a.useState)(""),2),U=W[0],V=W[1],Q=u((0,a.useState)(""),2),K=Q[0],$=Q[1],J=u((0,a.useState)(""),2),Y=J[0],Z=J[1],X=u((0,a.useState)(!1),2),ee=X[0],te=X[1];(0,a.useEffect)(function(){t&&b?(q("time"),H(b.startTime),V(b.endTime),$(b.percentage.toFixed(2)),Z(b.comment||"")):t||(q("time"),H(""),V(""),$(""),Z(""))},[t,b]);var ne=function(e,t){if(!e||!t)return 0;var n=u(e.split(":").map(Number),2),r=n[0],a=n[1],o=u(t.split(":").map(Number),2);return 60*o[0]+o[1]-(60*r+a)},re=function(e,t){var n=ne(e,t),r=60*h;return r>0?n/r*100:0},ae=function(e){return!!R&&I+e>60*R};(0,a.useEffect)(function(){if("time"===L&&G&&U){var e=ne(G,U);te(ae(e))}else if("percentage"===L&&K){var t=60*h,n=Math.round(parseFloat(K)/100*t);te(ae(n))}else te(!1)},[L,G,U,K,I,R]);var oe,ie,se,le;return(0,r.jsxs)(o.A,{show:t,onClose:n,title:g?"Finalizar Contador Automático":"Adicionar Tempo Manual",size:"md",footer:(0,r.jsx)(o.M,{onCancel:n,onConfirm:function(){if("time"===L){if(!G||!U)return void alert("Por favor, preencha horário de início e fim");var e=ne(G,U);if(e<=0)return void alert("Horário de término deve ser maior que horário de início");var t=re(G,U);i({startTime:G,endTime:U,percentage:t,duration:e,comment:Y})}else{if(!K||parseFloat(K)<=0)return void alert("Por favor, informe uma porcentagem válida");var n=parseFloat(K);if(n>100)return void alert("Porcentagem não pode ser maior que 100%");var r=60*h,a=Math.round(n/100*r);i({startTime:"00:00",endTime:"00:00",percentage:n,duration:a,comment:Y})}},cancelText:"Cancelar",confirmText:"Salvar"}),children:[(0,r.jsxs)("div",{style:l(l({},f.formGroup),{},{backgroundColor:"#F8F9FA",padding:"12px",borderRadius:"5px"}),children:[j?(0,r.jsxs)("div",{style:{marginBottom:"12px"},children:[(0,r.jsx)("label",{style:l(l({},f.label),{},{marginBottom:"6px"}),children:"Projeto"}),(0,r.jsxs)("select",{style:l(l({},f.input),{},{backgroundColor:"#FFF"}),value:null!=O?O:"",onChange:function(e){var t=e.target.value,n=t?Number(t):null;null==T||T(n)},disabled:g,children:[(0,r.jsx)("option",{value:"",children:"Selecione um projeto"}),S.map(function(e){return(0,r.jsx)("option",{value:e.id,children:e.name},e.id)})]}),P&&!O&&(0,r.jsxs)("p",{style:l(l({},f.infoText),{},{marginTop:"6px"}),children:["Sugestão original: ",(0,r.jsx)("strong",{children:P})]})]}):(0,r.jsxs)("div",{style:{marginBottom:"5px"},children:[(0,r.jsx)("strong",{style:{fontSize:"13px",color:"#5C5D5D"},children:"Projeto:"})," ",(0,r.jsx)("span",{style:{fontSize:"13px",color:"#5C5D5D"},children:s||"Nenhum"})]}),m&&(0,r.jsxs)("div",{style:{marginBottom:"5px"},children:[(0,r.jsx)("strong",{style:{fontSize:"13px",color:"#5C5D5D"},children:"Tarefa:"})," ",(0,r.jsx)("span",{style:{fontSize:"13px",color:"#5C5D5D"},children:m})]}),j?(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{style:l(l({},f.label),{},{marginBottom:"6px"}),children:"Atividade"}),(0,r.jsxs)("select",{style:l(l({},f.input),{},{backgroundColor:"#FFF"}),value:null!=E?E:"",onChange:function(e){var t=e.target.value,n=t?Number(t):null;null==D||D(n)},disabled:g,children:[(0,r.jsx)("option",{value:"",children:"Selecione uma atividade"}),k.map(function(e){return(0,r.jsx)("option",{value:e.id,children:e.name},e.id)})]}),F&&!E&&(0,r.jsxs)("p",{style:l(l({},f.infoText),{},{marginTop:"6px"}),children:["Sugestão original: ",(0,r.jsx)("strong",{children:F})]})]}):c&&(0,r.jsxs)("div",{children:[(0,r.jsx)("strong",{style:{fontSize:"13px",color:"#5C5D5D"},children:"Atividade:"})," ",(0,r.jsx)("span",{style:{fontSize:"13px",color:"#5C5D5D"},children:c})]})]}),!g&&(0,r.jsxs)("div",{style:f.modeToggle,children:[(0,r.jsx)("button",{type:"button",style:l(l({},f.modeButton),"time"===L?f.modeButtonActive:{}),onClick:function(){return q("time")},children:"Horário Início/Fim"}),(0,r.jsx)("button",{type:"button",style:l(l({},f.modeButton),"percentage"===L?f.modeButtonActive:{}),onClick:function(){return q("percentage")},children:"% do Dia"})]}),"time"===L?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{style:f.inputGroup,children:[(0,r.jsxs)("div",{style:f.formGroup,children:[(0,r.jsx)("label",{style:f.label,children:"Hora de Início"}),(0,r.jsx)("input",{type:"time",style:l(l({},f.input),g?{backgroundColor:"#F3F4F6",cursor:"not-allowed"}:{}),value:G,onChange:function(e){return H(e.target.value)},disabled:g})]}),(0,r.jsxs)("div",{style:f.formGroup,children:[(0,r.jsx)("label",{style:f.label,children:"Hora de Término"}),(0,r.jsx)("input",{type:"time",style:l(l({},f.input),g?{backgroundColor:"#F3F4F6",cursor:"not-allowed"}:{}),value:U,onChange:function(e){return V(e.target.value)},disabled:g})]})]}),G&&U&&ne(G,U)>0&&(0,r.jsxs)("div",{style:{marginTop:"15px",padding:"12px",backgroundColor:"#E8F4F8",borderRadius:"5px",borderLeft:"3px solid #186073"},children:[(0,r.jsx)("div",{style:{fontSize:"13px",color:"#5C5D5D",marginBottom:"5px"},children:(0,r.jsx)("strong",{children:"Resumo:"})}),(0,r.jsxs)("div",{style:{fontSize:"12px",color:"#5C5D5D",lineHeight:"1.6"},children:[(0,r.jsxs)("div",{children:["Duração: ",(0,r.jsxs)("strong",{children:[Math.floor(ne(G,U)/60),"h ",ne(G,U)%60,"min"]})]}),(0,r.jsxs)("div",{children:["Porcentagem: ",(0,r.jsxs)("strong",{children:[re(G,U).toFixed(2),"%"]})," do dia"]}),(0,r.jsxs)("div",{children:["Base: ",h,"h de carga horária"]})]})]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{style:f.formGroup,children:[(0,r.jsx)("label",{style:f.label,children:"Porcentagem do Dia (%)"}),(0,r.jsx)("input",{type:"number",style:l(l({},f.input),g?{backgroundColor:"#F3F4F6",cursor:"not-allowed"}:{}),value:K,onChange:function(e){return $(e.target.value)},placeholder:"Ex: 25",min:"0",max:"100",step:"0.01",disabled:g}),(0,r.jsxs)("p",{style:f.infoText,children:["Base: ",h,"h por dia (100% = ",60*h," minutos)"]})]}),K&&parseFloat(K)>0&&parseFloat(K)<=100&&(0,r.jsxs)("div",{style:{marginTop:"15px",padding:"12px",backgroundColor:"#E8F4F8",borderRadius:"5px",borderLeft:"3px solid #186073"},children:[(0,r.jsx)("div",{style:{fontSize:"13px",color:"#5C5D5D",marginBottom:"5px"},children:(0,r.jsx)("strong",{children:"Resumo:"})}),(0,r.jsx)("div",{style:{fontSize:"12px",color:"#5C5D5D",lineHeight:"1.6"},children:(oe=60*h,ie=Math.round(parseFloat(K)/100*oe),se=Math.floor(ie/60),le=ie%60,(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{children:["Porcentagem: ",(0,r.jsxs)("strong",{children:[parseFloat(K).toFixed(2),"%"]})," do dia"]}),(0,r.jsxs)("div",{children:["Duração: ",(0,r.jsxs)("strong",{children:[se,"h ",le,"min"]})," (",ie," minutos)"]}),(0,r.jsxs)("div",{children:["Base: ",h,"h de carga horária"]})]}))})]})]}),(0,r.jsxs)("div",{style:f.formGroup,children:[(0,r.jsx)("label",{style:f.label,children:"Comentário (opcional)"}),(0,r.jsx)("textarea",{style:f.textarea,value:Y,onChange:function(e){return Z(e.target.value)},placeholder:"Adicione observações sobre a atividade..."})]}),ee&&R&&function(){var e=0;if("time"===L&&G&&U)e=ne(G,U);else if("percentage"===L&&K){var t=60*h;e=Math.round(parseFloat(K)/100*t)}var n=I+e,a=function(e){var t=Math.floor(e/60),n=e%60;return n>0?"".concat(t,"h").concat(n,"min"):"".concat(t,"h")};return(0,r.jsx)("div",{className:"alert alert-danger",role:"alert",children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-triangle mr-2"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("strong",{children:"Atenção: Limite de horas excedido!"}),(0,r.jsxs)("div",{className:"mt-2",style:{fontSize:"0.95rem"},children:["• Já registrado hoje: ",(0,r.jsx)("strong",{children:a(I)}),(0,r.jsx)("br",{}),"• Tentando adicionar: ",(0,r.jsx)("strong",{children:a(e)}),(0,r.jsx)("br",{}),"• Total seria: ",(0,r.jsx)("strong",{children:a(n)}),(0,r.jsx)("br",{}),"• Limite diário: ",(0,r.jsxs)("strong",{children:[R,"h"]})]}),(0,r.jsxs)("div",{className:"mt-2 small text-danger",children:[(0,r.jsx)("i",{className:"fas fa-ban mr-1"}),"Esta atividade será bloqueada ao tentar salvar."]})]})]})})}()]})}},14785(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>U});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(68156),n(62953);var r=n(74848),a=n(96540),o=n(33930),i=n(10280);n(45700),n(2008),n(51629),n(89572),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(23500);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==s(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){var t=e.label,n=e.isActive,a=e.onClick,o=e.width,i=void 0===o?"80.56px":o,s=e.className,l=void 0===s?"":s;return(0,r.jsx)("button",{onClick:a,className:"btn ".concat(n?"text-white":"btn-outline-info"," ").concat(l),style:c({width:i},n?{backgroundColor:"rgb(23, 162, 184)"}:{}),children:t})}var f=n(30588),m=n(73236),p=(n(94170),n(59904),n(40875),n(10287),n(3362),n(52354));function h(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return v(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(v(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,v(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,v(d,"constructor",c),v(c,"constructor",l),l.displayName="GeneratorFunction",v(c,a,"GeneratorFunction"),v(d),v(d,a,"Generator"),v(d,r,function(){return this}),v(d,"toString",function(){return"[object Generator]"}),(h=function(){return{w:o,m:f}})()}function v(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}v=function(e,t,n,r){function o(t,n){v(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},v(e,t,n,r)}function b(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function y(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){b(o,r,a,i,s,"next",e)}function s(e){b(o,r,a,i,s,"throw",e)}i(void 0)})}}function g(){return(g=y(h().m(function e(t,n){var r,a,o;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/kpis?start_date=".concat(t,"&end_date=").concat(n));case 1:return r=e.v,a=r.data.data,e.a(2,{totalRegistered:{hours:a.total_registered_formatted||"0h",label:"Total de Horas Registradas",source:"timesheet"},dailyAverage:{hours:a.daily_average_formatted||"0h",label:"Média Diária",source:"timesheet"},extraHours:{count:a.extra_hours_formatted||"0h",label:"Total de Horas Extras",source:"timesheet"},missingHours:{hours:a.missing_hours_formatted||"0h",label:"Total de Horas Faltantes",source:"timesheet"}});case 2:return e.p=2,o=e.v,console.error("Erro ao buscar KPIs do Tenant:",o),e.a(2,{totalRegistered:{hours:"...",label:"Total de Horas Registradas",source:"timesheet"},dailyAverage:{hours:"...",label:"Média Diária",source:"timesheet"},extraHours:{count:"...",label:"Total de Horas Extras",source:"timesheet"},missingHours:{hours:"...",label:"Total de Horas Faltantes",source:"timesheet"}})}},e,null,[[0,2]])}))).apply(this,arguments)}function x(){return(x=y(h().m(function e(t,n){var r,a;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/weekly-hours?start_date=".concat(t,"&end_date=").concat(n));case 1:return r=e.v,e.a(2,r.data.data||{timesheet:[],attendance:[]});case 2:return e.p=2,a=e.v,console.error("Erro ao buscar Weekly Hours do Tenant:",a),e.a(2,{timesheet:[],attendance:[]})}},e,null,[[0,2]])}))).apply(this,arguments)}function j(){return(j=y(h().m(function e(t,n){var r,a;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/projects/distribution?start_date=".concat(t,"&end_date=").concat(n));case 1:return r=e.v,e.a(2,r.data.data||[]);case 2:return e.p=2,a=e.v,console.error("Erro ao buscar distribuição de projetos do Tenant:",a),e.a(2,[])}},e,null,[[0,2]])}))).apply(this,arguments)}function w(){return(w=y(h().m(function e(t,n,r,a){var o,i,s;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,o="team"===r?"team_id":"group_id",e.n=1,p.F.get("/api/timesheet-v2/tenant/projects/distribution-pie?start_date=".concat(t,"&end_date=").concat(n,"&").concat(o,"=").concat(a));case 1:return i=e.v,e.a(2,{data:i.data.data||[],filter:i.data.filter||{type:r,id:a,member_count:0}});case 2:return e.p=2,s=e.v,console.error("Erro ao buscar distribuição de projetos por equipe/time:",s),e.a(2,{data:[],filter:{type:r,id:String(a),member_count:0}})}},e,null,[[0,2]])}))).apply(this,arguments)}function S(){return N.apply(this,arguments)}function N(){return(N=y(h().m(function e(){var t,n;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/teams");case 1:return t=e.v,e.a(2,t.data.data||[]);case 2:return e.p=2,n=e.v,console.error("Erro ao buscar equipes:",n),e.a(2,[])}},e,null,[[0,2]])}))).apply(this,arguments)}function k(){return C.apply(this,arguments)}function C(){return(C=y(h().m(function e(){var t,n;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/groups");case 1:return t=e.v,e.a(2,t.data.data||[]);case 2:return e.p=2,n=e.v,console.error("Erro ao buscar times:",n),e.a(2,[])}},e,null,[[0,2]])}))).apply(this,arguments)}function O(){return(O=y(h().m(function e(t,n){var r,a;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/energy-peaks?start_date=".concat(t,"&end_date=").concat(n));case 1:return r=e.v,e.a(2,r.data.data||{timesheet:[],attendance:[]});case 2:return e.p=2,a=e.v,console.error("Erro ao buscar picos de energia do Tenant:",a),e.a(2,{timesheet:[],attendance:[]})}},e,null,[[0,2]])}))).apply(this,arguments)}function A(){return(A=y(h().m(function e(t,n){var r,a;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/projects/budget-map?start_date=".concat(t,"&end_date=").concat(n));case 1:return r=e.v,e.a(2,r.data.data||[]);case 2:return e.p=2,a=e.v,console.error("Erro ao buscar mapa de projetos:",a),e.a(2,[])}},e,null,[[0,2]])}))).apply(this,arguments)}function E(){return(E=y(h().m(function e(t,n,r){var a,o;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/teams/summary?start_date=".concat(t,"&end_date=").concat(n,"&type=").concat(r));case 1:return a=e.v,e.a(2,a.data.data||[]);case 2:return e.p=2,o=e.v,console.error("Erro ao buscar resumo de equipes:",o),e.a(2,[])}},e,null,[[0,2]])}))).apply(this,arguments)}function P(){return(P=y(h().m(function e(t,n,r,a){var o,i,s;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/teams/kpis?start_date=".concat(t,"&end_date=").concat(n,"&type=").concat(r,"&filter_id=").concat(a));case 1:if(o=e.v,!(i=o.data.data)||!("total_registered_formatted"in i)){e.n=2;break}return e.a(2,{totalHoursWorked:{hours:i.total_registered_hours||0,minutes:i.total_registered_minutes||0,formatted:i.total_registered_formatted||"0h00"},totalMissingHours:{hours:i.missing_hours_hours||0,minutes:i.missing_hours_minutes||0,formatted:i.missing_hours_formatted||"0h00"},totalExtraHours:{hours:i.extra_hours_hours||0,minutes:i.extra_hours_minutes||0,formatted:i.extra_hours_formatted||"0h"},workOverload:i.work_overload||0,memberCount:i.member_count||0});case 2:return e.a(2,i||{totalHoursWorked:{hours:0,minutes:0,formatted:"0h00"},totalMissingHours:{hours:0,minutes:0,formatted:"0h00"},totalExtraHours:{hours:0,minutes:0,formatted:"0h00"},workOverload:0,memberCount:0});case 3:return e.p=3,s=e.v,console.error("Erro ao buscar KPIs de equipe:",s),e.a(2,{totalHoursWorked:{hours:0,minutes:0,formatted:"0h00"},totalMissingHours:{hours:0,minutes:0,formatted:"0h00"},totalExtraHours:{hours:0,minutes:0,formatted:"0h00"},workOverload:0,memberCount:0})}},e,null,[[0,3]])}))).apply(this,arguments)}function F(){return(F=y(h().m(function e(t,n){var r,a;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/members/summary?start_date=".concat(t,"&end_date=").concat(n));case 1:return r=e.v,e.a(2,r.data.data||[]);case 2:return e.p=2,a=e.v,console.error("Erro ao buscar resumo de membros:",a),e.a(2,[])}},e,null,[[0,2]])}))).apply(this,arguments)}var T=n(71458),D=n(93628),_=n(80217),I=n(65207),M=n(42328),R=n(49299),z=n(4818),L=n(92801),q=n(72722),B=n(9504),G=n(50860);function H(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return W(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?W(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function W(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function U(){var e,t,n,s,l,c,u,p,h,v,b,y,N,C,W=H((0,a.useState)(function(){var e=new Date,t=new Date;t.setDate(t.getDate()-30);var n=function(e){var t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(r)};return{startDate:n(t),endDate:n(e)}}()),2),U=W[0],V=W[1],Q=H((0,a.useState)("times"),2),K=Q[0],$=Q[1],J=H((0,a.useState)("equipes"),2),Y=J[0],Z=J[1],X=H((0,a.useState)(["task","attendance"]),2),ee=X[0],te=X[1],ne=H((0,a.useState)(["timesheet","attendance"]),2),re=ne[0],ae=ne[1],oe=H((0,a.useState)(null),2),ie=oe[0],se=oe[1],le=(0,a.useRef)(null),ce=H((0,a.useState)(!1),2),ue=ce[0],de=ce[1],fe=(0,o.I)({queryKey:["time-management","teams"],queryFn:S,staleTime:3e5}).data,me=void 0===fe?[]:fe,pe=(0,o.I)({queryKey:["time-management","groups"],queryFn:k,staleTime:3e5}).data,he=void 0===pe?[]:pe,ve="equipes"===K?(null===(e=me[0])||void 0===e?void 0:e.id)||null:(null===(t=he[0])||void 0===t?void 0:t.id)||null,be="equipes"===Y?(null===(n=me[0])||void 0===n?void 0:n.id)||null:(null===(s=he[0])||void 0===s?void 0:s.id)||null,ye=(0,o.I)({queryKey:["time-management","timesheet","projects-distribution",U.startDate,U.endDate],queryFn:function(){return function(e,t){return j.apply(this,arguments)}(U.startDate,U.endDate)},staleTime:6e4,refetchOnWindowFocus:!1}),ge=ye.data,xe=(0,o.I)({queryKey:["time-management","timesheet","projects-distribution-pie",U.startDate,U.endDate,K,ve],queryFn:function(){return ve?function(e,t,n,r){return w.apply(this,arguments)}(U.startDate,U.endDate,"equipes"===K?"team":"group",ve):{data:[],filter:{type:K,id:"",member_count:0}}},enabled:!!ve,staleTime:6e4,refetchOnWindowFocus:!1}),je=xe.data,we=(0,o.I)({queryKey:["time-management","timesheet","weekly-hours",U.startDate,U.endDate],queryFn:function(){return function(e,t){return x.apply(this,arguments)}(U.startDate,U.endDate)},staleTime:6e4,refetchOnWindowFocus:!1}),Se=we.data,Ne=(0,o.I)({queryKey:["time-management","timesheet","energy-peaks",U.startDate,U.endDate],queryFn:function(){return function(e,t){return O.apply(this,arguments)}(U.startDate,U.endDate)},staleTime:6e4,refetchOnWindowFocus:!1}),ke=Ne.data,Ce=(0,o.I)({queryKey:["time-management","timesheet","projects-budget-map",U.startDate,U.endDate],queryFn:function(){return function(e,t){return A.apply(this,arguments)}(U.startDate,U.endDate)},staleTime:6e4,refetchOnWindowFocus:!1}),Oe=Ce.data,Ae=(0,o.I)({queryKey:["time-management","timesheet","teams-summary",U.startDate,U.endDate,Y],queryFn:function(){return function(e,t,n){return E.apply(this,arguments)}(U.startDate,U.endDate,"equipes"===Y?"team":"group")},staleTime:6e4,refetchOnWindowFocus:!1}),Ee=Ae.data,Pe=(0,o.I)({queryKey:["time-management","timesheet","general-kpis",U.startDate,U.endDate],queryFn:function(){return function(e,t){return g.apply(this,arguments)}(U.startDate,U.endDate)},staleTime:6e4,refetchOnWindowFocus:!1}),Fe=Pe.data,Te=(0,o.I)({queryKey:["time-management","timesheet","teams-kpis",U.startDate,U.endDate,Y,be],queryFn:function(){return be?function(e,t,n,r){return P.apply(this,arguments)}(U.startDate,U.endDate,"equipes"===Y?"team":"group",be):null},enabled:!!be,staleTime:6e4,refetchOnWindowFocus:!1}),De=Te.data,_e=(0,o.I)({queryKey:["time-management","timesheet","members-summary",U.startDate,U.endDate],queryFn:function(){return function(e,t){return F.apply(this,arguments)}(U.startDate,U.endDate)},staleTime:6e4,refetchOnWindowFocus:!1}),Ie=_e.data;return ie?(0,r.jsx)(L.A,{title:"Dashboard - ".concat(ie.name),subtitle:"Visão detalhada das horas trabalhadas e performance individual",showBackButton:!0,onBack:function(){return se(null)},showExportButton:!0,onExport:function(){return console.log("Exportar dashboard do colaborador")},userInfo:{name:ie.name,initials:ie.initials,avatarBg:ie.avatarBg},memberId:ie.id}):(0,r.jsxs)("section",{ref:le,className:"options-section-project",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between mb-4 mt-3",children:[(0,r.jsxs)("button",{onClick:function(){(0,B.vl)({dashboardRef:le,dateRange:U,setIsExporting:de})},disabled:ue,className:"btn ml-4",style:{backgroundColor:"#186073",color:"#fff",border:"none",borderRadius:"8px",padding:"10px 20px",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",cursor:ue?"not-allowed":"pointer",opacity:ue?.7:1,transition:"all 0.2s ease"},onMouseEnter:function(e){ue||(e.currentTarget.style.backgroundColor="#134A5A")},onMouseLeave:function(e){e.currentTarget.style.backgroundColor="#186073"},children:[(0,r.jsx)("i",{className:"fas fa-download"}),ue?"Exportando...":"Exportar"]}),(0,r.jsx)(f.A,{initialStartDate:U.startDate,initialEndDate:U.endDate,onChange:function(e){V(e)},maxDays:365,className:"mr-4"})]}),(0,r.jsxs)(G.A,{title:"",subtitle:"",children:[(0,r.jsxs)("div",{className:"row mb-4",children:[(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(i.A,{value:(null==Fe||null===(l=Fe.totalRegistered)||void 0===l?void 0:l.hours)||"",label:"Total de Horas Registradas",variant:"teal-dark",className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(i.A,{value:(null==Fe||null===(c=Fe.dailyAverage)||void 0===c?void 0:c.hours)||"",label:"Média Diária",variant:"cyan",className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(i.A,{value:(null==Fe||null===(u=Fe.extraHours)||void 0===u?void 0:u.count)||"",label:"Total de Horas Extras",variant:"turquoise",className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(i.A,{value:(null==Fe||null===(p=Fe.missingHours)||void 0===p?void 0:p.hours)||"",label:"Total de Horas Faltantes",variant:"salmon",className:"h-100"})})]}),(0,r.jsx)(m.A,{title:"Horas Trabalhadas na Semana",className:"mt-3",headerActions:(0,r.jsx)(q.A,{options:[{value:"task",label:"Referência Por Task"},{value:"attendance",label:"Referência Por Registro de Ponto"}],selectedValues:ee,onChange:te,placeholder:"Selecione os filtros",dropdownStyle:{right:0,left:"auto"}}),children:(0,r.jsx)(T.A,{selectedFilters:ee,weeklyData:(null==Se?void 0:Se.timesheet)||[],attendanceData:(null==Se?void 0:Se.attendance)||[]})}),(0,r.jsx)(m.A,{title:"Horas trabalhadas por projeto",className:"mt-3",children:(0,r.jsx)(D.A,{projects:ge||[]})}),(0,r.jsxs)("div",{className:"row mt-3",children:[(0,r.jsx)("div",{className:"col-12 col-lg-4 mb-3",children:(0,r.jsxs)(m.A,{title:"Distribuição de Horas por Projeto",className:"h-100",children:[(0,r.jsx)("div",{className:"mb-3 d-flex justify-content-end",children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)(d,{label:"Equipe",isActive:"equipes"===K,onClick:function(){return $("equipes")},width:"80.56px",className:"mr-2"}),(0,r.jsx)(d,{label:"Time",isActive:"times"===K,onClick:function(){return $("times")},width:"89.68px"})]})}),(0,r.jsx)(_.default,{viewMode:K,onViewModeChange:$,projects:(null==je?void 0:je.data)||[]})]})}),(0,r.jsx)("div",{className:"col-12 col-lg-8 mb-3",children:(0,r.jsx)(m.A,{title:"Picos de Energia - Horas Registradas por Dia",className:"h-100",headerActions:(0,r.jsx)(q.A,{options:[{value:"timesheet",label:"Por Timesheet"},{value:"attendance",label:"Por Registro de Ponto"}],selectedValues:re,onChange:ae,placeholder:"Selecione os filtros"}),children:(0,r.jsx)(M.A,{selectedFilters:re,timesheetData:(null==ke?void 0:ke.timesheet)||[],attendanceData:(null==ke?void 0:ke.attendance)||[]})})})]}),(0,r.jsx)("div",{className:"mt-4",children:(0,r.jsx)(m.A,{title:"Mapa de Projetos: Orçamento (R$) e Tempo Gasto (%)",children:(0,r.jsx)(z.default,{projects:Oe||[]})})}),(0,r.jsxs)("div",{className:"mt-4",children:[(0,r.jsx)("h3",{className:"tm-section-title mb-3",children:"Resumo de Horas Trabalhadas por Equipe & Times"}),(0,r.jsx)(m.A,{title:"Controle de Horas Trabalhadas",className:"",headerActions:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)(d,{label:"Equipe",isActive:"equipes"===Y,onClick:function(){return Z("equipes")},width:"80.56px",className:"mr-2"}),(0,r.jsx)(d,{label:"Time",isActive:"times"===Y,onClick:function(){return Z("times")},width:"89.68px"})]}),children:(0,r.jsx)(R.default,{teams:Ee||[]})})]}),(0,r.jsx)("div",{className:"mt-3",children:(0,r.jsx)(I.default,{onCollaboratorClick:se,kpis:De&&(((null===(h=De.totalHoursWorked)||void 0===h?void 0:h.hours)||0)>0||((null===(v=De.totalHoursWorked)||void 0===v?void 0:v.minutes)||0)>0||((null===(b=De.totalMissingHours)||void 0===b?void 0:b.hours)||0)>0||((null===(y=De.totalMissingHours)||void 0===y?void 0:y.minutes)||0)>0||((null===(N=De.totalExtraHours)||void 0===N?void 0:N.hours)||0)>0||((null===(C=De.totalExtraHours)||void 0===C?void 0:C.minutes)||0)>0)?De:Fe?{totalHoursWorked:{hours:0,minutes:0,formatted:Fe.totalRegistered.hours},totalMissingHours:{hours:0,minutes:0,formatted:Fe.missingHours.hours},totalExtraHours:{hours:0,minutes:0,formatted:Fe.extraHours.count},workOverload:0,memberCount:0}:void 0,members:Ie||[]})})]})]})}},15186(e,t,n){"use strict";n.r(t),n.d(t,{NoShiftAssigned:()=>a});var r=n(74848),a=function(){return(0,r.jsxs)("div",{className:"d-flex flex-column align-items-center justify-content-center",style:{minHeight:"500px",padding:"40px 20px"},children:[(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)("img",{src:"/images/time_management/clock.png",alt:"Relógio",style:{width:"120px",height:"120px",objectFit:"contain"}})}),(0,r.jsx)("h4",{style:{fontFamily:"Inter",fontSize:"20px",fontWeight:600,color:"#5C5D5D",marginBottom:"12px",textAlign:"center"},children:"Nenhum turno vinculado"}),(0,r.jsx)("p",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:400,color:"rgba(92, 93, 93, 0.70)",textAlign:"center",maxWidth:"450px",lineHeight:"1.5",margin:0},children:"Parece que você ainda não está associado a um turno. Procure seu gestor ou RH para habilitar o ponto."})]})}},17147(e,t,n){"use strict";n.r(t),n.d(t,{LocationSection:()=>v});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(26099),n(78459),n(27495),n(38781),n(47764),n(62953),n(76031);var r=n(74848),a=n(33930),o=n(97665),i=n(57097),s=n(55278),l=n(96540),c=n(30786),u=n(76336);function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var m=["time-management","location"],p=["time-management","can-view-maps"];function h(e){var t=e.location,n=(0,l.useRef)(null),a=(0,l.useRef)(null),o=d((0,l.useState)(!1),2),i=o[0],s=o[1];return(0,l.useEffect)(function(){if(n.current&&t.latitude&&t.longitude&&void 0!==window.google)try{var e=parseFloat(t.latitude),r=parseFloat(t.longitude);if(isNaN(e)||isNaN(r))return void console.error("Coordenadas inválidas:",t.latitude,t.longitude);var o={lat:e,lng:r},i=new window.google.maps.Map(n.current,{zoom:15,center:o,disableDefaultUI:!0,draggable:!1,scrollwheel:!1,disableDoubleClickZoom:!0,zoomControl:!1,mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!1,gestureHandling:"none"});new window.google.maps.Marker({position:o,map:i}),a.current=i,s(!0);var l=function(){a.current&&(window.google.maps.event.trigger(a.current,"resize"),a.current.setCenter(o))};return window.addEventListener("resize",l),function(){window.removeEventListener("resize",l)}}catch(e){console.error("Erro ao criar mapa:",e)}},[t]),t.latitude&&t.longitude?(0,r.jsxs)("div",{style:{width:"100%",height:"150px",position:"relative"},children:[!i&&(0,r.jsx)("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f5f5f5",borderRadius:"0 0 8px 8px",borderTop:"1px solid #e0e0e0"},children:(0,r.jsx)("i",{className:"fas fa-spinner fa-spin text-muted"})}),(0,r.jsx)("div",{ref:n,style:{width:"100%",height:"100%",borderRadius:"0 0 8px 8px",cursor:"pointer",borderTop:"1px solid #e0e0e0"},onClick:function(){return window.open(t.google_url,"_blank")},title:"Clique para abrir no Google Maps"})]}):(0,r.jsx)("div",{style:{width:"100%",height:"150px",borderRadius:"0 0 8px 8px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f5f5f5",borderTop:"1px solid #e0e0e0"},children:(0,r.jsx)("small",{className:"text-muted",children:"Sem coordenadas"})})}function v(){var e=(0,u.L)(),t=e.canCreate,n=e.canEdit,f=e.canDelete,v=d((0,l.useState)(!1),2),b=v[0],y=v[1],g=d((0,l.useState)(null),2),x=g[0],j=g[1],w=d((0,l.useState)(!1),2),S=w[0],N=w[1],k=(0,o.jE)(),C=(0,a.I)({queryKey:m,queryFn:s.Eq}),O=C.data,A=void 0===O?[]:O,E=C.isFetching,P=(0,a.I)({queryKey:p,queryFn:s.vD,staleTime:6e4,refetchOnWindowFocus:!1}).data,F=void 0!==P&&P;(0,l.useEffect)(function(){if(F)if(void 0===window.google){var e=window.GOOGLE_MAPS_API_KEY;if(e){if(document.querySelector('script[src*="maps.googleapis.com"]')){var t=setInterval(function(){void 0!==window.google&&(N(!0),clearInterval(t))},100);return function(){return clearInterval(t)}}var n=document.createElement("script");n.src="https://maps.googleapis.com/maps/api/js?key=".concat(e,"&libraries=places"),n.async=!0,n.onload=function(){return N(!0)},document.head.appendChild(n)}else console.error("Google Maps API key não encontrada")}else N(!0)},[F]);var T=(0,i.n)({mutationFn:s.zR,onSuccess:function(){k.invalidateQueries({queryKey:m})}}),D=(0,l.useMemo)(function(){return 0===A.length},[A]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("style",{children:"\n .location-list-scroll { overflow-x: visible !important; }\n .location-list-scroll .card { overflow: visible !important; }\n .location-list-scroll .card-body { overflow: visible !important; }\n .location-list-scroll .d-flex { overflow: visible !important; }\n .location-list-scroll::-webkit-scrollbar {\n width: 6px;\n }\n .location-list-scroll::-webkit-scrollbar-track {\n background: #f1f1f1;\n border-radius: 10px;\n }\n .location-list-scroll::-webkit-scrollbar-thumb {\n background: #888;\n border-radius: 10px;\n }\n .location-list-scroll::-webkit-scrollbar-thumb:hover {\n background: #555;\n }\n "}),!D&&(0,r.jsx)("div",{className:"mb-3 location-list-scroll",style:{maxHeight:"600px",overflowY:"auto",overflowX:"visible",paddingRight:"8px"},children:A.map(function(e){return(0,r.jsx)("div",{className:"card mb-3",style:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"visible"},children:(0,r.jsxs)("div",{className:"card-body py-3",style:{overflow:"visible"},children:[(0,r.jsxs)("div",{className:"row no-gutters align-items-center",style:{overflow:"visible"},children:[(0,r.jsx)("div",{className:"col-auto pr-2 d-flex align-items-center justify-content-center",children:(0,r.jsx)("div",{style:{width:40,height:40,backgroundColor:"rgba(23, 162, 184, 0.1)"},className:"d-flex align-items-center justify-content-center rounded",title:"Localização",children:(0,r.jsx)("i",{className:"fas fa-map-marker-alt",style:{fontSize:"1.2rem",color:"#17A2B8"}})})}),(0,r.jsx)("div",{className:"col-12 col-md-4 px-2 d-flex",style:{minWidth:0},children:(0,r.jsxs)("div",{className:"d-flex flex-column justify-content-center w-100",style:{minWidth:0},children:[(0,r.jsxs)("span",{className:"font-weight-bold text-truncate",style:{minWidth:0},children:[e.address,e.number&&", ".concat(e.number)]}),e.neighborhood&&(0,r.jsx)("span",{className:"text-muted text-truncate",style:{fontSize:"0.85rem",minWidth:0},children:e.neighborhood})]})}),(0,r.jsx)("div",{className:"col px-2 d-flex",style:{minWidth:0},children:(0,r.jsxs)("div",{className:"w-100 my-auto text-muted text-truncate text-center",style:{minWidth:0,fontSize:"0.9rem"},children:[e.city||"—",e.country&&", ".concat(e.country)]})}),(0,r.jsxs)("div",{className:"col-auto pl-2 dropdown ml-auto",style:{flexShrink:0,position:"static"},children:[(0,r.jsx)("button",{className:"btn btn-link text-muted p-0","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{fontSize:"1.2rem"},children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v"})}),(0,r.jsxs)("div",{className:"dropdown-menu dropdown-menu-right",children:[n&&(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(){return function(e){j(e),y(!0)}(e)},disabled:T.isPending,children:[(0,r.jsx)("i",{className:"far fa-edit mr-2"}),"Editar"]}),(0,r.jsxs)("a",{className:"dropdown-item",href:e.google_url,target:"_blank",rel:"noopener noreferrer",children:[(0,r.jsx)("i",{className:"fas fa-map-marked-alt mr-2"}),"Ver no Google Maps"]}),f&&(0,r.jsxs)("button",{className:"dropdown-item text-danger",onClick:function(){return function(e){window.confirm('Tem certeza que deseja excluir a localização "'.concat(e.address,'"?'))&&T.mutate(e.id)}(e)},disabled:T.isPending,children:[(0,r.jsx)("i",{className:"far fa-trash-alt mr-2"}),T.isPending?"Excluindo...":"Excluir"]})]})]})]}),F&&(0,r.jsx)("div",{className:"mt-3",style:{marginLeft:"-1.25rem",marginRight:"-1.25rem",marginBottom:"-1.25rem"},children:S?(0,r.jsx)(h,{location:e}):(0,r.jsx)("div",{style:{width:"100%",height:"150px",borderRadius:"0 0 8px 8px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f5f5f5"},children:(0,r.jsx)("i",{className:"fas fa-spinner fa-spin text-muted"})})})]})},e.id)})}),t&&(0,r.jsxs)("div",{className:"text-muted d-flex align-items-center",role:"button",onClick:function(){return y(!0)},style:{cursor:"pointer",fontSize:"0.95rem"},children:[(0,r.jsx)("i",{className:"fas fa-plus mr-2"})," Adicionar Localização",E&&(0,r.jsx)("i",{className:"fas fa-spinner fa-spin ml-2"})]}),b&&(0,r.jsx)(c.default,{show:b,onClose:function(){y(!1),j(null)},editData:x})]})}},17649(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>d});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(1806);function i(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var i=r&&r.prototype instanceof c?r:c,u=Object.create(i.prototype);return s(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(s(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,s(m,"constructor",d),s(d,"constructor",u),u.displayName="GeneratorFunction",s(d,a,"GeneratorFunction"),s(m),s(m,a,"Generator"),s(m,r,function(){return this}),s(m,"toString",function(){return"[object Generator]"}),(i=function(){return{w:o,m:p}})()}function s(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}s=function(e,t,n,r){function o(t,n){s(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},s(e,t,n,r)}function l(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){var t=e.show,n=e.onClose,s=e.hasExistingSatisfaction,u=e.initialSatisfaction,d=e.onConfirmFinalize,f=c((0,a.useState)(null),2),m=f[0],p=f[1],h=Array.from({length:5},function(e,t){return t+1});(0,a.useEffect)(function(){p(t?u:null)},[t,u]);var v=function(){var e,t=(e=i().m(function e(){var t;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,d(m);case 1:n(),e.n=3;break;case 2:e.p=2,t=e.v,console.error("Erro ao concluir finalização do dia:",t),alert("Não foi possível concluir a finalização do dia. Por favor, tente novamente.");case 3:return e.a(2)}},e,null,[[0,2]])}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){l(o,r,a,i,s,"next",e)}function s(e){l(o,r,a,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}(),b=!s&&null===m;return(0,r.jsx)(o.A,{show:t,onClose:n,title:"Satisfação com o Trabalho Realizado",size:"md",footer:(0,r.jsx)(o.M,{onCancel:n,onConfirm:v,cancelText:"Fechar",confirmText:"Finalizar Dia",confirmDisabled:b}),children:(0,r.jsxs)("div",{style:{textAlign:"center"},children:[(0,r.jsx)("p",{style:{marginBottom:"20px",color:"#5C5D5D"},children:"Selecione o ponto que melhor representa como você se sente em relação ao trabalho realizado."}),s&&(0,r.jsx)("p",{style:{marginBottom:"20px",color:"#8A8A8A",fontSize:"13px"},children:"A satisfação já foi registrada. Confirme para finalizar ou escolha um novo ponto para atualizar."}),(0,r.jsx)("div",{style:{position:"relative",margin:"30px 0"},children:(0,r.jsxs)("div",{style:{position:"relative",height:"28px",width:"100%",borderRadius:"6px",overflow:"hidden",boxShadow:"inset 0 0 6px rgba(0,0,0,0.2)",border:"1px solid #d9d9d9"},children:[(0,r.jsx)("div",{style:{position:"absolute",inset:0,background:"linear-gradient(to right, #FF4D4D 0%, #FF4D4D 20%, #FF8A65 20%, #FF8A65 40%, #FFCA28 40%, #FFCA28 60%, #8BC34A 60%, #8BC34A 80%, #4CAF50 80%, #4CAF50 100%)"}}),(0,r.jsx)("div",{style:{position:"absolute",inset:0,display:"flex",zIndex:1},children:h.map(function(e,t){var n=m===e;return(0,r.jsx)("button",{type:"button",onClick:function(){return function(e){p(e)}(e)},style:{flex:1,border:n?"2px dashed #ffffff":"1px solid transparent",backgroundColor:n?"rgba(255,255,255,0.16)":"transparent",cursor:"pointer",borderRight:n||t===h.length-1?"none":"1px solid rgba(255,255,255,0.4)",outline:"none",boxSizing:"border-box",borderRadius:0===t?"6px 0 0 6px":t===h.length-1?"0 6px 6px 0":0,transition:"background-color 0.2s ease, border 0.2s ease"},"aria-label":"Satisfação nível ".concat(e)},e)})}),null!==m&&(0,r.jsx)("div",{style:{position:"absolute",top:"-10px",left:"".concat((m-.5)/5*100,"%"),transform:"translateX(-50%)",width:0,height:0,borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:"10px solid #ffffff",zIndex:2}})]})})]})})}},18098(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>G});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(50113),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(94170),n(62010),n(2892),n(59904),n(67945),n(84185),n(83851),n(81278),n(40875),n(79432),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(68156),n(23500),n(62953);var r=n(74848),a=n(96540),o=n(97665),i=n(33930),s=n(57097),l=n(50860),c=n(8596),u=n(31475),d=n(69511),f=n(46550),m=n(25149),p=n(72810),h=n(15186),v=n(77770),b=n(5380),y=n(2698),g=n(39576),x=n(92454),j=n(67784),w=n(18752),S=n(85231);n(15086);function N(e){return e?"Nenhum canal de registro habilitado para o aplicativo.":"Registro via navegador não habilitado. Use o aplicativo."}var k=n(82942);n(74423),n(21699);function C(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return O(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function A(){var e=C((0,a.useState)(!1),2),t=e[0],n=e[1];return(0,a.useEffect)(function(){n(function(){if("undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().includes("metahuman-app"))return!0;if("undefined"!=typeof window&&window.__IS_APP__)return!0;if("undefined"!=typeof window){var e=!!window.Capacitor,t=!!window.cordova;if(e||t)return!0}return!1}())},[]),{isApp:t,isWeb:!t}}var E=n(47339);function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function F(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return T(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(T(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,T(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,T(d,"constructor",c),T(c,"constructor",l),l.displayName="GeneratorFunction",T(c,a,"GeneratorFunction"),T(d),T(d,a,"Generator"),T(d,r,function(){return this}),T(d,"toString",function(){return"[object Generator]"}),(F=function(){return{w:o,m:f}})()}function T(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}T=function(e,t,n,r){function o(t,n){T(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},T(e,t,n,r)}function D(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function _(e){return function(e){if(Array.isArray(e))return R(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||M(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||M(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){if(e){if("string"==typeof e)return R(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(e,t):void 0}}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z(Object(n),!0).forEach(function(t){q(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function q(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=P(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=P(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==P(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function B(e){var t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(r)}function G(){var e,t,n,C,O,P=I((0,a.useState)(B(new Date)),2),T=P[0],M=P[1],R=I((0,a.useState)(null),2),z=R[0],q=R[1],G=I((0,a.useState)(!1),2),H=G[0],W=G[1],U=I((0,a.useState)(!1),2),V=U[0],Q=U[1],K=I((0,a.useState)(null),2),$=K[0],J=K[1],Y=I((0,a.useState)("ponto"),2),Z=Y[0],X=Y[1],ee=I((0,a.useState)(!1),2),te=ee[0],ne=ee[1],re=I((0,a.useState)(!1),2),ae=re[0],oe=re[1],ie=(0,o.jE)();(0,a.useEffect)(function(){var e=function(){var e=window.innerWidth<=768;ne(e)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var se,le,ce,ue=A().isApp,de=(0,i.I)({queryKey:["professional","shift",T],queryFn:function(){return(0,S.Tp)(T)},staleTime:3e5}),fe=de.data,me=de.isLoading,pe=de.error,he=function(e,t){if(!e)return null;if(!e.rows||!Array.isArray(e.rows))return e;if(!e.clock_in_records||!e.clock_in_records[t])return e;var n=e.clock_in_records[t],r={first_check_in:0,first_check_out:1,second_check_in:2,second_check_out:3},a=e.rows.map(function(e,t){var a=Object.keys(r).find(function(e){return r[e]===t});return a&&n[a]?L(L({},e),{},{mode:n[a].mode}):e});return L(L({},e),{},{rows:a})}(fe,T),ve=fe&&null!==fe.name&&null!==fe.rows,be=(0,i.I)({queryKey:["professional","occurrences",T],queryFn:function(){return(0,S.xP)(T)},staleTime:12e4}),ye=be.data,ge=be.isLoading,xe=function(e,t){return!(!e||!Array.isArray(e)||0===e.length)&&(t?e.some(function(e){return"app"===e.type||"qr"===e.type}):e.some(function(e){return"web"===e.type}))}(null==he?void 0:he.channels,ue),je=((null==he||null===(e=he.rows)||void 0===e?void 0:e.filter(function(e){return!e.muted}).length)||0)>=4,we=(0,k.Q8)(null==he?void 0:he.validate_points,ue),Se=[].concat(_(we),["teste"]),Ne=((0,k.AD)(null==he?void 0:he.validate_points,ue),(0,s.n)({mutationFn:S.X3,onSuccess:function(e){ie.invalidateQueries({queryKey:["professional","shift"]}),ie.invalidateQueries({queryKey:["professional","occurrences"]}),q(null),E.A.success(e.message||"Ponto registrado com sucesso!")},onError:function(e){var t,n=null===(t=e.response)||void 0===t?void 0:t.data,r=(null==n?void 0:n.error)||"Erro ao registrar ponto",a=(null==n?void 0:n.details)||(null==n?void 0:n.message)||"Tente novamente.";E.A.error(a,r)}})),ke=(0,s.n)({mutationFn:function(e){var t=e.occurrenceId,n=e.justification;return(0,S.GB)(t,n)},onSuccess:function(e){ie.invalidateQueries({queryKey:["professional","occurrences"]}),W(!1),J(null);var t=(null==e?void 0:e.message)||"Justificativa adicionada com sucesso!";alert(t)},onError:function(e){var t,n,r;console.error("Erro ao adicionar justificativa - erro completo:",e),console.error("Erro response:",e.response),console.error("Erro response data:",null===(t=e.response)||void 0===t?void 0:t.data);var a=(null===(n=e.response)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.error)||(null===(r=e.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.message)||e.message||"Erro ao adicionar justificativa. Tente novamente.";alert(a)}}),Ce=(0,s.n)({mutationFn:function(e){var t=e.occurrenceId,n=e.time;return(0,S.bP)(t,n)},onSuccess:function(e){ie.invalidateQueries({queryKey:["professional","shift"]}),ie.invalidateQueries({queryKey:["professional","occurrences"]}),Q(!1),J(null);var t=(null==e?void 0:e.message)||"Horário editado com sucesso!";alert(t)},onError:function(e){var t,n,r;console.error("Erro ao editar horário - erro completo:",e),console.error("Erro response:",e.response),console.error("Erro response data:",null===(t=e.response)||void 0===t?void 0:t.data);var a=(null===(n=e.response)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.error)||(null===(r=e.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.message)||e.message||"Erro ao editar horário. Tente novamente.";alert(a)}}),Oe=function(){if(ue)return"mobile";var e=navigator.userAgent.toLowerCase(),t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(e),n=window.innerWidth<=768;return t||n?"mobile":"desktop"},Ae=function(){var e,t=(e=F().m(function e(){var t,n,r,a=arguments;return F().w(function(e){for(;;)switch(e.n){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:{},n=B(new Date),!(T<n)){e.n=1;break}return alert("Não é permitido registrar ponto em dias anteriores. Por favor, selecione a data de hoje."),e.a(2);case 1:if(!je){e.n=2;break}return alert("Você já registrou os 4 pontos do dia. Não é possível registrar mais pontos."),e.a(2);case 2:r=L({device:Oe(),mode:"individual"},t),Ne.mutate(r);case 3:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){D(o,r,a,i,s,"next",e)}function s(e){D(o,r,a,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}(),Ee=function(){Ae()},Pe=function(e){xe?"none"!==e?q(e):Ae():alert(N(ue))},Fe=function(e){q(null),Ae({selfie:e})},Te=function(e){q(null),Ae({location:e})},De=function(e){q(null),Ae({screenshot:e})},_e=function(e){q(null),Ae({qrcode:e})},Ie=function(e){q(null),Ae({testTime:e})},Me=function(){q(null)},Re=function(e){M(e)},ze=function(e){J(e),W(!0)},Le=function(e){null!=$&&$.id?ke.mutate({occurrenceId:$.id,justification:e}):alert("Erro: Ocorrência não selecionada")},qe=function(e){J(e),Q(!0)},Be=function(e){null!=$&&$.id?Ce.mutate({occurrenceId:$.id,time:e}):alert("Erro: Ocorrência não selecionada")};return te?me?(0,r.jsxs)("section",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",padding:"40px 20px"},children:[(0,r.jsx)("div",{className:"spinner-border text-info",role:"status"}),(0,r.jsx)("p",{style:{marginTop:"20px",color:"#5C5D5D",fontSize:"14px"},children:"Carregando..."})]}):(0,r.jsxs)("section",{style:{minHeight:"100vh",paddingBottom:"20px"},children:[(0,r.jsx)(d.default,{activeTab:Z,onTabChange:X,selectedDate:T,onDateChange:Re}),"ponto"===Z?(0,r.jsxs)(r.Fragment,{children:[pe?(0,r.jsxs)("div",{className:"p-3 text-center text-danger",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle me-2"}),"Erro ao carregar dados do turno"]}):ve?he&&he.rows?(0,r.jsx)(f.default,{rows:he.rows}):null:(0,r.jsx)(h.NoShiftAssigned,{}),ve&&(0,r.jsx)("div",{className:"p-3 mt-3",children:(0,r.jsxs)("button",{onClick:function(){Se.length>0?oe(!0):Ee()},disabled:T<B(new Date)||je||!xe,className:"btn btn-info btn-lg btn-block",children:[(0,r.jsx)("i",{className:"fas fa-clock mr-2"}),"Registrar Ponto"]})})]}):(0,r.jsx)(r.Fragment,{children:ve?ge?(0,r.jsxs)("div",{className:"py-4 px-3 text-center",children:[(0,r.jsx)("div",{className:"spinner-border spinner-border-sm me-2 text-info",role:"status"}),(0,r.jsx)("span",{children:"Carregando..."})]}):ye?(0,r.jsx)(m.default,{items:ye,editPointEnabled:(null==he||null===(se=he.policy)||void 0===se?void 0:se.editPoint)||!1,onAddJustification:ze,onEditPoint:qe}):(0,r.jsx)("div",{className:"py-4 px-3 text-center text-muted",children:"Erro ao carregar ocorrências"}):(0,r.jsx)(h.NoShiftAssigned,{})}),(0,r.jsx)(p.default,{isOpen:ae,onClose:function(){return oe(!1)},options:Se,onSelectOption:function(e){oe(!1),Pe(e)}}),(0,r.jsx)(v.default,{isOpen:"selfie"===z,onCapture:Fe,onClose:Me}),(0,r.jsx)(b.default,{isOpen:"geolocation"===z,onConfirm:Te,onClose:Me,distanceToleranceKm:null==he||null===(le=he.policy)||void 0===le?void 0:le.distanceToleranceKm}),(0,r.jsx)(y.default,{isOpen:"screenshot"===z,onUpload:De,onClose:Me}),(0,r.jsx)(g.default,{isOpen:"qrcode"===z,onScan:_e,onClose:Me,qrcodes:(null==he?void 0:he.qrcodes)||[]}),(0,r.jsx)(x.default,{isOpen:"teste"===z,onConfirm:Ie,onClose:Me}),(0,r.jsx)(j.default,{isOpen:H,onClose:function(){W(!1),J(null)},onSave:Le,occurrenceTitle:null==$?void 0:$.title,existingJustification:null==$?void 0:$.justify,isSaving:ke.isPending}),(0,r.jsx)(w.default,{isOpen:V,onClose:function(){Q(!1),J(null)},onSave:Be,occurrenceTitle:null==$?void 0:$.title,currentTime:null==$?void 0:$.time,pointType:(null==$||null===(ce=$.hitSpotTime)||void 0===ce?void 0:ce.type)||(null==$?void 0:$.type),isSaving:Ce.isPending})]}):me?(0,r.jsx)("section",{className:"content options-section-project",style:{minHeight:"80vh"},children:(0,r.jsxs)("div",{className:"d-flex flex-column align-items-center justify-content-center py-4",children:[(0,r.jsx)("div",{className:"spinner-border text-info",role:"status"}),(0,r.jsx)("p",{className:"mt-3 text-muted small",children:"Carregando..."})]})}):(0,r.jsxs)(l.A,{children:[ve&&!xe&&(0,r.jsxs)("div",{className:"alert alert-warning d-flex align-items-center mb-3",role:"alert",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-triangle me-2"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("strong",{children:"Atenção!"})," ",N(ue)]})]}),me||pe||ve?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.default,{onRegister:Ee,availableOptions:Se,onSelectOption:Pe,isNoneMode:"none"===(null==he||null===(t=he.validate_points)||void 0===t?void 0:t.mode)&&0===Se.length,disabled:T<B(new Date)||je,shift:he||void 0,selectedDate:T,onDateChange:Re,shiftError:!!pe}),z&&(0,r.jsx)("div",{className:"card app-card-surface mt-3",children:(0,r.jsx)("div",{className:"card-body",children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("i",{className:"".concat((0,k.JC)(z)," me-3"),style:{color:"#17A1B7",fontSize:"24px"}}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("h6",{className:"mb-0",children:["Coletando: ",(0,k.kC)(z)]}),(0,r.jsx)("small",{className:"text-muted",children:"Complete a validação para continuar"})]})]})})}),(0,r.jsxs)("div",{className:"card app-card-surface mt-4",children:[(0,r.jsx)("div",{className:"card-header d-flex align-items-center",children:(0,r.jsx)("h3",{className:"card-title mb-0",children:"Ocorrências"})}),(0,r.jsx)("div",{className:"card-body p-0",children:ge?(0,r.jsxs)("div",{className:"text-center py-4",children:[(0,r.jsx)("div",{className:"spinner-border spinner-border-sm me-2",role:"status"}),(0,r.jsx)("span",{children:"Carregando..."})]}):ye?(0,r.jsx)(u.default,{items:ye,editPointEnabled:(null==he||null===(n=he.policy)||void 0===n?void 0:n.editPoint)||!1,onAddJustification:ze,onEditPoint:qe}):(0,r.jsx)("div",{className:"text-center text-muted py-4",children:"Erro ao carregar ocorrências"})})]})]}):(0,r.jsx)(h.NoShiftAssigned,{}),(0,r.jsx)(v.default,{isOpen:"selfie"===z,onCapture:Fe,onClose:Me}),(0,r.jsx)(b.default,{isOpen:"geolocation"===z,onConfirm:Te,onClose:Me,distanceToleranceKm:null==he||null===(C=he.policy)||void 0===C?void 0:C.distanceToleranceKm}),(0,r.jsx)(y.default,{isOpen:"screenshot"===z,onUpload:De,onClose:Me}),(0,r.jsx)(g.default,{isOpen:"qrcode"===z,onScan:_e,onClose:Me,qrcodes:(null==he?void 0:he.qrcodes)||[]}),(0,r.jsx)(x.default,{isOpen:"teste"===z,onConfirm:Ie,onClose:Me}),(0,r.jsx)(j.default,{isOpen:H,onClose:function(){W(!1),J(null)},onSave:Le,occurrenceTitle:null==$?void 0:$.title,existingJustification:null==$?void 0:$.justify,isSaving:ke.isPending}),(0,r.jsx)(w.default,{isOpen:V,onClose:function(){Q(!1),J(null)},onSave:Be,occurrenceTitle:null==$?void 0:$.title,currentTime:null==$?void 0:$.time,pointType:(null==$||null===(O=$.hitSpotTime)||void 0===O?void 0:O.type)||(null==$?void 0:$.type),isSaving:Ce.isPending})]})}},18438(e,t,n){"use strict";n.d(t,{A:()=>o});var r=n(76314),a=n.n(r)()(function(e){return e[1]});a.push([e.id,".date-range-picker {\n\tposition: relative;\n\tfont-family: inherit;\n}\n\n/* Linha 1: Campos de Data */\n.date-range-picker__dates-row {\n\tdisplay: flex;\n\tgap: 12px;\n\tmargin-bottom: 12px;\n}\n\n.date-range-picker__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n\tflex: 1;\n\tmin-width: 160px;\n}\n\n/* Linha 2: Botão e Info/Erro */\n.date-range-picker__bottom-row {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 12px;\n}\n\n.date-range-picker__label {\n\tfont-size: 13px;\n\tfont-weight: 500;\n\tcolor: #555;\n\tmargin: 0;\n}\n\n.date-range-picker__input {\n\tpadding: 8px 12px;\n\tborder: 1px solid #d1d5db;\n\tborder-radius: 6px;\n\tfont-size: 14px;\n\tcolor: #333;\n\tbackground-color: #fff;\n\ttransition: all 0.2s ease;\n\toutline: none;\n\tcursor: pointer;\n}\n\n.date-range-picker__input:hover {\n\tborder-color: #2196F3;\n}\n\n.date-range-picker__input:focus {\n\tborder-color: #2196F3;\n\tbox-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);\n}\n\n.date-range-picker__preset-btn {\n\tpadding: 10px 14px;\n\tborder: 1px solid #d1d5db;\n\tborder-radius: 8px;\n\tbackground-color: #fff;\n\tcolor: #6b7280;\n\tfont-size: 16px;\n\tcursor: pointer;\n\ttransition: all 0.2s ease;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\toutline: none;\n\tflex-shrink: 0;\n\twidth: 40px;\n\theight: 40px;\n}\n\n.date-range-picker__preset-btn:hover {\n\tbackground-color: #f3f4f6;\n\tborder-color: #2196F3;\n\tcolor: #2196F3;\n}\n\n.date-range-picker__preset-btn:active {\n\ttransform: scale(0.98);\n}\n\n.date-range-picker__error {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 10px 16px;\n\tbackground-color: #fee2e2;\n\tborder: 1px solid #fecaca;\n\tborder-radius: 8px;\n\tfont-size: 14px;\n\tcolor: #dc2626;\n\tflex: 1;\n}\n\n.date-range-picker__error i {\n\tfont-size: 14px;\n\tflex-shrink: 0;\n}\n\n.date-range-picker__error span {\n\tfont-weight: 500;\n}\n\n.date-range-picker__info {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 10px 16px;\n\tbackground-color: #186073;\n\tborder: 1px solid #186073;\n\tborder-radius: 8px;\n\tfont-size: 14px;\n\tcolor: #ffffff;\n\tflex: 1;\n}\n\n.date-range-picker__info i {\n\tcolor: #ffffff;\n\tfont-size: 14px;\n\tflex-shrink: 0;\n}\n\n.date-range-picker__info span {\n\tfont-weight: 500;\n\tcolor: #ffffff;\n}\n\n.date-range-picker__presets-dropdown {\n\tposition: absolute;\n\ttop: calc(100% + 8px);\n\tright: 0;\n\tmin-width: 220px;\n\tbackground-color: #fff;\n\tborder: 1px solid #d1d5db;\n\tborder-radius: 8px;\n\tbox-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);\n\tz-index: 1000;\n\tanimation: fadeInDown 0.2s ease;\n}\n\n@keyframes fadeInDown {\n\tfrom {\n\t\topacity: 0;\n\t\ttransform: translateY(-10px);\n\t}\n\tto {\n\t\topacity: 1;\n\t\ttransform: translateY(0);\n\t}\n}\n\n.date-range-picker__presets-header {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 12px 16px;\n\tborder-bottom: 1px solid #e5e7eb;\n\tfont-weight: 600;\n\tfont-size: 14px;\n\tcolor: #333;\n}\n\n.date-range-picker__presets-close {\n\tpadding: 4px;\n\tborder: none;\n\tbackground: none;\n\tcolor: #9ca3af;\n\tcursor: pointer;\n\tfont-size: 14px;\n\ttransition: color 0.2s ease;\n\toutline: none;\n}\n\n.date-range-picker__presets-close:hover {\n\tcolor: #ef4444;\n}\n\n.date-range-picker__presets-list {\n\tpadding: 8px;\n}\n\n.date-range-picker__preset-item {\n\tdisplay: block;\n\twidth: 100%;\n\tpadding: 10px 12px;\n\tborder: none;\n\tbackground: none;\n\ttext-align: left;\n\tfont-size: 14px;\n\tcolor: #555;\n\tcursor: pointer;\n\tborder-radius: 6px;\n\ttransition: all 0.2s ease;\n\toutline: none;\n}\n\n.date-range-picker__preset-item:hover {\n\tbackground-color: #f3f4f6;\n\tcolor: #2196F3;\n}\n\n.date-range-picker__preset-item:active {\n\tbackground-color: #e5e7eb;\n}\n\n/* Responsivo */\n@media (max-width: 768px) {\n\t.date-range-picker__dates-row {\n\t\tflex-direction: column;\n\t\tgap: 12px;\n\t}\n\n\t.date-range-picker__field {\n\t\twidth: 100%;\n\t\tmin-width: auto;\n\t}\n\n\t.date-range-picker__bottom-row {\n\t\tflex-direction: column;\n\t\talign-items: stretch;\n\t\tgap: 12px;\n\t}\n\n\t.date-range-picker__preset-btn {\n\t\twidth: 100%;\n\t}\n\n\t.date-range-picker__presets-dropdown {\n\t\tright: 0;\n\t\tleft: 0;\n\t\tmin-width: auto;\n\t}\n}\n\n/* Tema Escuro (se necessário) */\n.dark-mode .date-range-picker__input,\n.dark-mode .date-range-picker__preset-btn {\n\tbackground-color: #1f2937;\n\tborder-color: #374151;\n\tcolor: #e5e7eb;\n}\n\n.dark-mode .date-range-picker__input:hover,\n.dark-mode .date-range-picker__preset-btn:hover {\n\tborder-color: #60a5fa;\n}\n\n.dark-mode .date-range-picker__label {\n\tcolor: #d1d5db;\n}\n\n.dark-mode .date-range-picker__presets-dropdown {\n\tbackground-color: #1f2937;\n\tborder-color: #374151;\n}\n\n.dark-mode .date-range-picker__presets-header {\n\tborder-color: #374151;\n\tcolor: #e5e7eb;\n}\n\n.dark-mode .date-range-picker__preset-item {\n\tcolor: #d1d5db;\n}\n\n.dark-mode .date-range-picker__preset-item:hover {\n\tbackground-color: #374151;\n\tcolor: #60a5fa;\n}\n\n.dark-mode .date-range-picker__info {\n\tbackground-color: #186073;\n\tborder-color: #186073;\n}\n\n",""]);const o=a},18752(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>l});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(58940),n(27495),n(38781),n(47764),n(68156),n(62953);var r=n(74848),a=n(96540),o=n(1806);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e){var t=e.isOpen,n=e.onClose,s=e.onSave,l=e.occurrenceTitle,c=void 0===l?"":l,u=e.currentTime,d=void 0===u?null:u,f=e.pointType,m=e.isSaving,p=void 0!==m&&m,h=i((0,a.useState)("00"),2),v=h[0],b=h[1],y=i((0,a.useState)("00"),2),g=y[0],x=y[1],j=i((0,a.useState)("00"),2),w=j[0],S=j[1];(0,a.useEffect)(function(){if(t&&d){var e=d.split(":");e.length>=2&&(b(e[0]||"00"),x(e[1]||"00"),S(e[2]||"00"))}},[t,d]);var N,k=function(){b("00"),x("00"),S("00"),n()};return t?(0,r.jsx)(o.A,{show:t,onClose:k,title:"Editando Ponto",size:"sm",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:k,disabled:p,children:"Fechar"}),(0,r.jsx)("button",{type:"button",className:"btn text-white",onClick:function(){var e=parseInt(v),t=parseInt(g),n=parseInt(w);if(isNaN(e)||e<0||e>23)alert("Hora inválida. Use valores entre 00 e 23.");else if(isNaN(t)||t<0||t>59)alert("Minuto inválido. Use valores entre 00 e 59.");else if(isNaN(n)||n<0||n>59)alert("Segundo inválido. Use valores entre 00 e 59.");else{var r="".concat(String(e).padStart(2,"0"),":").concat(String(t).padStart(2,"0"),":").concat(String(n).padStart(2,"0"));s(r)}},disabled:p,style:{backgroundColor:"rgb(23, 162, 184)"},children:p?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"spinner-border spinner-border-sm me-2"}),"Salvando..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("i",{className:"fas fa-check me-2"}),"Editar Ponto"]})})]}),children:(0,r.jsxs)("div",{style:{padding:"24px"},children:[f&&(0,r.jsxs)("div",{className:"alert alert-info mb-3",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:600,backgroundColor:"#d1ecf1",borderColor:"#bee5eb",color:"#0c5460"},children:[(0,r.jsx)("i",{className:"fas fa-info-circle me-2"}),"Editando: ",(0,r.jsx)("strong",{children:(N=f,{first_check_in:"Primeira Entrada",first_check_out:"Primeira Saída",second_check_in:"Segunda Entrada",second_check_out:"Segunda Saída"}[N||""]||N||"Ponto")})]}),c&&(0,r.jsxs)("p",{className:"text-muted mb-3",style:{fontFamily:"Inter",fontSize:"14px"},children:["Ocorrência: ",(0,r.jsx)("strong",{children:c})]}),(0,r.jsxs)("div",{className:"alert alert-warning mb-3",style:{fontFamily:"Inter",fontSize:"13px",backgroundColor:"#fff3cd",borderColor:"#ffeaa7",color:"#856404"},children:[(0,r.jsx)("i",{className:"fas fa-exclamation-triangle me-2"}),(0,r.jsx)("strong",{children:"Atenção:"})," Ao editar o ponto, a ocorrência será ",(0,r.jsx)("strong",{children:"removida automaticamente"}),"."]}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-4",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:500,color:"#5C5D5D",marginBottom:"8px"},children:"Horas"}),(0,r.jsx)("input",{type:"number",className:"form-control text-center",min:"0",max:"23",value:v,onChange:function(e){return b(e.target.value)},disabled:p,style:{fontFamily:"Inter",fontSize:"16px",fontWeight:600}})]})}),(0,r.jsx)("div",{className:"col-4",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:500,color:"#5C5D5D",marginBottom:"8px"},children:"Minutos"}),(0,r.jsx)("input",{type:"number",className:"form-control text-center",min:"0",max:"59",value:g,onChange:function(e){return x(e.target.value)},disabled:p,style:{fontFamily:"Inter",fontSize:"16px",fontWeight:600}})]})}),(0,r.jsx)("div",{className:"col-4",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:500,color:"#5C5D5D",marginBottom:"8px"},children:"Segundos"}),(0,r.jsx)("input",{type:"number",className:"form-control text-center",min:"0",max:"59",value:w,onChange:function(e){return S(e.target.value)},disabled:p,style:{fontFamily:"Inter",fontSize:"16px",fontWeight:600}})]})})]}),(0,r.jsxs)("div",{className:"text-center mt-3 mb-3",children:[(0,r.jsxs)("div",{style:{fontFamily:"Inter",fontSize:"24px",fontWeight:700,color:"#17A2B8"},children:[String(v).padStart(2,"0"),":",String(g).padStart(2,"0"),":",String(w).padStart(2,"0")]}),(0,r.jsx)("small",{className:"text-muted",children:"Horário que será registrado"})]})]})}):null}},18851(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>o});n(28706),n(68156);var r=n(74848);n(96540);function a(e){return String(e).padStart(2,"0")}function o(e){var t,n,o,i,s=e.title,l=e.seconds,c=e.running,u=e.active,d=e.theme,f=e.onStart,m=e.onPause,p="white"===d?"rgba(255,255,255,0.55)":"rgba(26,26,26,0.31)",h="white"===d?"#101828":"#F2F4F7",v="white"===d?"#344054":"rgba(255,255,255,0.85)";return(0,r.jsxs)("div",{className:"p-4",style:{minWidth:360,width:"100%",maxWidth:520,borderRadius:16,background:p,backdropFilter:"blur(72.95px)",WebkitBackdropFilter:"blur(72.95px)",border:u?"1px solid rgba(24,198,225,.75)":"1px solid rgba(255,255,255,0.18)",boxShadow:u?"0 12px 36px rgba(0,0,0,.28)":"0 8px 24px rgba(0,0,0,.18)",transition:"transform .2s ease, box-shadow .2s ease, border-color .2s ease",transform:u?"scale(1.02)":"scale(0.995)",color:h},children:[(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between mb-1",children:[(0,r.jsx)("div",{className:"font-weight-bold",style:{opacity:.9},children:s}),!u&&(0,r.jsx)("span",{className:"badge badge-light",style:{opacity:.7},children:"inativo"})]}),(0,r.jsxs)("div",{className:"text-center",style:{lineHeight:1.05},children:[(0,r.jsx)("div",{style:{fontWeight:700,fontSize:72,letterSpacing:1},children:(t=l,n=Math.floor(t/3600),o=Math.floor(t%3600/60),i=t%60,n>0?"".concat(a(n),":").concat(a(o),":").concat(a(i)):"".concat(a(o),":").concat(a(i)))}),(0,r.jsx)("div",{style:{color:v,fontSize:13},children:c&&u?"Contando…":u?"Pronto para iniciar":"Selecione para iniciar"})]}),(0,r.jsx)("div",{className:"d-flex align-items-center justify-content-center mt-4",children:u&&c?(0,r.jsxs)("button",{type:"button",className:"btn btn-light px-4",onClick:m,children:[(0,r.jsx)("i",{className:"fas fa-pause mr-2"})," Pausar"]}):(0,r.jsxs)("button",{type:"button",className:"btn btn-primary px-4",onClick:f,children:[(0,r.jsx)("i",{className:"fas fa-play mr-2"})," Iniciar"]})})]})}},19066(e,t,n){"use strict";n.r(t),n.d(t,{PermissionGuard:()=>o,usePermission:()=>i});n(34782);var r=n(74848),a=n(76336);function o(e){var t=e.children,n=e.require,o=e.fallback,i=(0,a.L)();return(0,a.v)()?(0,r.jsxs)("div",{className:"alert alert-danger m-3",role:"alert",children:[(0,r.jsxs)("h4",{className:"alert-heading",children:[(0,r.jsx)("i",{className:"fas fa-ban me-2"}),"Acesso Negado"]}),(0,r.jsx)("p",{children:"Você não tem permissão para visualizar este produto."})]}):n?{view:i.canView,edit:i.canEdit,create:i.canCreate,delete:i.canDelete}[n]?(0,r.jsx)(r.Fragment,{children:t}):o?(0,r.jsx)(r.Fragment,{children:o}):null:(0,r.jsx)(r.Fragment,{children:t})}function i(e){return(0,a.L)()["can".concat(e.charAt(0).toUpperCase()+e.slice(1))]}},19619(e,t,n){"use strict";n.d(t,{c:()=>a,w:()=>r});var r={sem:"none",flex:"flexible",qr:"qrcode",manual:"manual"},a={none:"sem",flexible:"flex",qrcode:"qr",manual:"manual"}},19782(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>C});n(52675),n(89463),n(2259),n(28706),n(2008),n(23418),n(64346),n(23792),n(62062),n(34782),n(15086),n(1688),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(31415),n(47764),n(62953);var r=n(74848),a=n(97665),o=n(33930),i=n(57097),s=n(96540),l=n(52354);function c(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return u(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(u(t={},r,function(){return this}),t),m=d.prototype=s.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,u(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return l.prototype=d,u(m,"constructor",d),u(d,"constructor",l),l.displayName="GeneratorFunction",u(d,a,"GeneratorFunction"),u(m),u(m,a,"Generator"),u(m,r,function(){return this}),u(m,"toString",function(){return"[object Generator]"}),(c=function(){return{w:o,m:p}})()}function u(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}u=function(e,t,n,r){function o(t,n){u(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},u(e,t,n,r)}function d(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function f(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){d(o,r,a,i,s,"next",e)}function s(e){d(o,r,a,i,s,"throw",e)}i(void 0)})}}function m(){return p.apply(this,arguments)}function p(){return(p=f(c().m(function e(){var t,n;return c().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,l.F.get("/time-management/channels");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function h(){return(h=f(c().m(function e(t){var n,r;return c().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,l.F.post("/time-management/channels",{type:t});case 1:return n=e.v,r=n.data,e.a(2,r.data)}},e)}))).apply(this,arguments)}function v(){return(v=f(c().m(function e(t){return c().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,l.F.delete("/time-management/channels/".concat(t));case 1:return e.a(2)}},e)}))).apply(this,arguments)}var b=n(76336);function y(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return g(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(g(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,g(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,g(d,"constructor",c),g(c,"constructor",l),l.displayName="GeneratorFunction",g(c,a,"GeneratorFunction"),g(d),g(d,a,"Generator"),g(d,r,function(){return this}),g(d,"toString",function(){return"[object Generator]"}),(y=function(){return{w:o,m:f}})()}function g(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}g=function(e,t,n,r){function o(t,n){g(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},g(e,t,n,r)}function x(e){return function(e){if(Array.isArray(e))return j(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return j(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?j(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function w(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function S(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){w(o,r,a,i,s,"next",e)}function s(e){w(o,r,a,i,s,"throw",e)}i(void 0)})}}var N=[{id:"app",icon:"fas fa-mobile-alt",label:"Aplicativo"},{id:"web",icon:"fas fa-globe",label:"Navegador Web"},{id:"qr",icon:"fas fa-qrcode",label:"QR Code/Link Gerado"}],k=["time-management","channels"];function C(){var e,t,n=(0,b.L)(),l=n.canEdit,c=(n.canCreate,n.canView,n.canDelete,(0,a.jE)()),u=(0,o.I)({queryKey:k,queryFn:m,staleTime:6e4,refetchOnWindowFocus:!1}),d=u.data,f=void 0===d?[]:d,p=u.isLoading,g=u.isFetching,j=(0,i.n)({mutationFn:function(e){return function(e){return h.apply(this,arguments)}(e)},onMutate:(e=S(y().m(function e(t){var n,r;return y().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,c.cancelQueries({queryKey:k});case 1:if(!(r=null!==(n=c.getQueryData(k))&&void 0!==n?n:[]).some(function(e){return e.type===t})){e.n=2;break}return e.a(2,{prev:r});case 2:return c.setQueryData(k,[].concat(x(r),[{id:"temp-".concat(t),settingManagementTimeId:"temp",type:t,createdAt:(new Date).toISOString(),updatedAt:(new Date).toISOString()}])),e.a(2,{prev:r})}},e)})),function(t){return e.apply(this,arguments)}),onError:function(e,t,n){null!=n&&n.prev&&c.setQueryData(k,n.prev)},onSuccess:function(e){c.setQueryData(k,function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(function(t){return t.type!==e.type});return[].concat(x(t),[e])})}}),w=(0,i.n)({mutationFn:function(e){return function(e){return v.apply(this,arguments)}(e)},onMutate:(t=S(y().m(function e(t){var n,r;return y().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,c.cancelQueries({queryKey:k});case 1:return r=null!==(n=c.getQueryData(k))&&void 0!==n?n:[],c.setQueryData(k,r.filter(function(e){return e.type!==t})),e.a(2,{prev:r})}},e)})),function(e){return t.apply(this,arguments)}),onError:function(e,t,n){null!=n&&n.prev&&c.setQueryData(k,n.prev)}}),C=(0,s.useMemo)(function(){return new Set(f.map(function(e){return e.type}))},[f]),O=p||g||j.isPending||w.isPending;return(0,r.jsx)("div",{className:"row",children:N.map(function(e){var t=C.has(e.id);return(0,r.jsx)("div",{className:"col-12 col-md-4 mb-2",children:(0,r.jsxs)("button",{type:"button",disabled:O||!l,onClick:function(){return t=e.id,void(l&&(C.has(t)?w.mutate(t):j.mutate(t)));var t},className:"btn btn-block text-left d-flex align-items-center ".concat(t?"border-primary text-primary bg-primary-soft":"border"),title:l?"":"Sem permissão para editar canais",children:[(0,r.jsx)("i",{className:"".concat(e.icon," mr-2 ").concat(t?"text-primary":"")}),e.label,O&&(0,r.jsx)("i",{className:"fas fa-spinner fa-spin ml-auto"}),!l&&(0,r.jsx)("i",{className:"fas fa-lock ml-auto text-muted",style:{fontSize:"0.8rem"}})]})},e.id)})})}},20826(e,t,n){"use strict";n.d(t,{A:()=>a});n(2008),n(74423),n(48598),n(26099),n(21699),n(11392);var r=n(74848);function a(e){var t=e.label,n=e.icon,a=e.variant,o=e.onClick,i=e.className,s=void 0===i?"":i,l=e.disabled,c=void 0!==l&&l,u=e.style,d=n&&(n.includes("/")||n.includes(".")),f=n&&(n.startsWith("fas ")||n.startsWith("far ")||n.startsWith("fab ")),m=["btn","tm-action-button","tm-action-button-".concat(a),n?"tm-action-button-icon":"",c?"disabled":"",s].filter(Boolean).join(" ");return(0,r.jsxs)("button",{onClick:o,className:m,disabled:c,style:u,children:[d?(0,r.jsx)("img",{src:n,alt:""}):f?(0,r.jsx)("i",{className:n}):null,(0,r.jsx)("span",{className:"tm-action-button-preview-text",style:{display:"block",visibility:"visible"},children:t})]})}},22956(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>h});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(5506),n(83851),n(81278),n(79432),n(26099),n(27495),n(38781),n(47764),n(23500),n(62953);var r=n(74848),a=n(49785),o=n(96540),i=n(84136);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==s(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||m(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||m(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){if(e){if("string"==typeof e)return p(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e){var t=e.isOpen,n=e.onClose,s=e.currentFilters,l=e.onApply,u=e.onClear,m=(0,a.mN)({defaultValues:s}),p=m.register,h=m.handleSubmit,v=m.reset;(0,o.useEffect)(function(){v(s)},[s,v]);if(!t)return null;var b=[{value:"",label:"Todos"}].concat(f(Object.entries(i.L).map(function(e){var t=d(e,2);return{value:t[0],label:t[1]}})));return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"modal-backdrop fade show",style:{zIndex:1040},onClick:function(e){e.stopPropagation(),n()}}),(0,r.jsx)("div",{className:"modal fade show d-block",style:{zIndex:1050},tabIndex:-1,onClick:function(e){e.target===e.currentTarget&&n()},children:(0,r.jsx)("div",{className:"modal-dialog modal-dialog-centered",style:{maxWidth:"500px"},children:(0,r.jsxs)("div",{className:"modal-content",onClick:function(e){return e.stopPropagation()},children:[(0,r.jsxs)("div",{className:"modal-header",children:[(0,r.jsx)("h5",{className:"modal-title",style:{fontFamily:"Inter",fontSize:"18px",fontWeight:600,color:"#5C5D5D"},children:"Filtrar Ocorrências"}),(0,r.jsx)("button",{type:"button",className:"close",onClick:function(e){e.preventDefault(),e.stopPropagation(),n()},"aria-label":"Fechar",children:(0,r.jsx)("span",{"aria-hidden":"true",children:"×"})})]}),(0,r.jsxs)("form",{onSubmit:h(function(e){l(e),n()}),children:[(0,r.jsxs)("div",{className:"modal-body",children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"mb-2",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:500,color:"#5C5D5D"},children:"Tipo de Ocorrência"}),(0,r.jsx)("select",c(c({},p("occurrenceType")),{},{className:"form-control",style:{fontFamily:"Inter",fontSize:"14px"},children:b.map(function(e){return(0,r.jsx)("option",{value:e.value,children:e.label},e.value)})}))]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"mb-2",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:500,color:"#5C5D5D"},children:"Horário do Ponto"}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{className:"col-6",children:[(0,r.jsx)("label",{className:"mb-1",style:{fontFamily:"Inter",fontSize:"12px",fontWeight:400,color:"rgba(92, 93, 93, 0.60)"},children:"Início"}),(0,r.jsx)("input",c(c({type:"time"},p("timeStart")),{},{className:"form-control",style:{fontFamily:"Inter",fontSize:"14px"}}))]}),(0,r.jsxs)("div",{className:"col-6",children:[(0,r.jsx)("label",{className:"mb-1",style:{fontFamily:"Inter",fontSize:"12px",fontWeight:400,color:"rgba(92, 93, 93, 0.60)"},children:"Fim"}),(0,r.jsx)("input",c(c({type:"time"},p("timeEnd")),{},{className:"form-control",style:{fontFamily:"Inter",fontSize:"14px"}}))]})]}),(0,r.jsx)("small",{className:"form-text text-muted",style:{fontFamily:"Inter",fontSize:"12px"},children:"Filtre por período de horário dos pontos registrados"})]}),(0,r.jsxs)("div",{className:"form-group mb-0",children:[(0,r.jsx)("label",{className:"mb-2",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:500,color:"#5C5D5D"},children:"Status da Ocorrência"}),(0,r.jsx)("select",c(c({},p("status")),{},{className:"form-control",style:{fontFamily:"Inter",fontSize:"14px"},children:[{value:"",label:"Todos"},{value:"pendente",label:"Pendente"},{value:"resolvido",label:"Resolvido"},{value:"justificado",label:"Justificado"}].map(function(e){return(0,r.jsx)("option",{value:e.value,children:e.label},e.value)})}))]})]}),(0,r.jsxs)("div",{className:"modal-footer",children:[(0,r.jsxs)("button",{type:"button",className:"btn mh-btn-cancel btn-sm",onClick:function(){v({occurrenceType:"",timeStart:"",timeEnd:"",status:""}),u(),n()},style:{fontFamily:"Inter"},children:[(0,r.jsx)("i",{className:"fas fa-times mr-1"}),"Limpar Filtros"]}),(0,r.jsxs)("button",{type:"submit",className:"btn btn-primary btn-sm",style:{fontFamily:"Inter",backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:[(0,r.jsx)("i",{className:"fas fa-check mr-1"}),"Aplicar"]})]})]})]})})})]})}},23696(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>A});n(52675),n(89463),n(2259),n(28706),n(2008),n(50113),n(23418),n(64346),n(23792),n(48598),n(62062),n(34782),n(15086),n(26910),n(1688),n(23288),n(94170),n(62010),n(36033),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(25440),n(90744),n(42762),n(62953),n(3296),n(27208),n(48408);var r=n(74848),a=n(33930),o=n(34559),i=(n(74423),n(21699),n(96540));function s(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){var t=e.options,n=e.value,a=e.onChange,o=e.placeholder,c=void 0===o?"Selecione...":o,u=e.disabled,d=void 0!==u&&u,f=e.maxHeight,m=void 0===f?300:f,p=l((0,i.useState)(!1),2),h=p[0],v=p[1],b=l((0,i.useState)(""),2),y=b[0],g=b[1],x=l((0,i.useState)(!1),2),j=(x[0],x[1]),w=(0,i.useRef)(null),S=(0,i.useRef)(null),N=(0,i.useMemo)(function(){if(!y.trim())return t;var e=y.toLowerCase().trim().normalize("NFD").replace(/[\u0300-\u036f]/g,"");return t.filter(function(t){return t.label.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").includes(e)})},[t,y]);(0,i.useMemo)(function(){return n.map(function(e){var n;return null===(n=t.find(function(t){return t.value===e}))||void 0===n?void 0:n.label}).filter(Boolean)},[n,t]);(0,i.useEffect)(function(){var e=function(e){w.current&&!w.current.contains(e.target)&&(v(!1),g(""),j(!1))};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]);return(0,r.jsxs)("div",{ref:w,className:"multi-select-container",style:{position:"relative",width:"100%"},children:[(0,r.jsxs)("div",{className:"input-group",children:[(0,r.jsx)("input",{ref:S,type:"text",className:"form-control",placeholder:n.length>0?"".concat(n.length," selecionado(s) - Digite para buscar"):c,value:y,onChange:function(e){g(e.target.value),h||v(!0)},onFocus:function(){d||(v(!0),j(!0))},disabled:d,autoComplete:"off",style:{cursor:d?"not-allowed":"text"}}),n.length>0&&(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("button",{type:"button",onClick:function(e){e.stopPropagation(),e.preventDefault(),a([]),g(""),S.current&&S.current.focus()},className:"btn btn-outline-secondary",style:{border:"1px solid #ced4da",borderLeft:"none",background:"transparent",color:"#6c757d",cursor:"pointer",padding:"0 12px",fontSize:"20px",lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center"},title:"Limpar todos",children:"x"})})]}),h&&(0,r.jsxs)("div",{className:"multi-select-dropdown",onClick:function(e){return e.stopPropagation()},style:{position:"absolute",top:"100%",left:0,right:0,zIndex:9999,backgroundColor:"white",border:"1px solid #ced4da",borderRadius:"4px",marginTop:"4px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",maxWidth:"100%"},children:[(0,r.jsx)("div",{style:{maxHeight:"".concat(m,"px"),overflowY:"auto"},children:N.length>0?N.map(function(e){var t=n.includes(e.value);return(0,r.jsx)("div",{className:"multi-select-option",onClick:function(t){var r;t.stopPropagation(),r=e.value,n.includes(r)?a(n.filter(function(e){return e!==r})):a([].concat(s(n),[r])),g("")},style:{padding:"10px 12px",cursor:"pointer",backgroundColor:t?"#e7f3ff":"white",borderBottom:"1px solid #f0f0f0",fontSize:"14px"},onMouseEnter:function(e){t||(e.currentTarget.style.backgroundColor="#f8f9fa")},onMouseLeave:function(e){t||(e.currentTarget.style.backgroundColor="white")},children:e.label},e.value)}):(0,r.jsx)("div",{style:{padding:"16px",textAlign:"center",color:"#6c757d",fontSize:"14px"},children:y.trim()?(0,r.jsxs)(r.Fragment,{children:['Nenhum resultado para "',(0,r.jsx)("strong",{children:y}),'"',(0,r.jsxs)("div",{style:{fontSize:"12px",marginTop:"8px"},children:["Total de membros disponíveis: ",t.length]})]}):"Nenhuma opção disponível"})}),n.length>0&&(0,r.jsxs)("div",{style:{padding:"8px 12px",borderTop:"1px solid #e9ecef",fontSize:"12px",color:"#6c757d",backgroundColor:"#f8f9fa"},children:[n.length," ",1===n.length?"selecionado":"selecionados"]})]})]})}var f=n(80596),m=n(90162),p=n(64466),h=n(96930),v=n(77332),b=n(14305),y=n(70038),g=n(50860),x=n(47339);function j(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return w(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(w(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,w(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,w(d,"constructor",c),w(c,"constructor",l),l.displayName="GeneratorFunction",w(c,a,"GeneratorFunction"),w(d),w(d,a,"Generator"),w(d,r,function(){return this}),w(d,"toString",function(){return"[object Generator]"}),(j=function(){return{w:o,m:f}})()}function w(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}w=function(e,t,n,r){function o(t,n){w(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},w(e,t,n,r)}function S(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function N(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){S(o,r,a,i,s,"next",e)}function s(e){S(o,r,a,i,s,"throw",e)}i(void 0)})}}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||C(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,t){if(e){if("string"==typeof e)return O(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(e,t):void 0}}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function A(){var e=(new Date).toISOString().split("T")[0],t=k((0,i.useState)([]),2),n=t[0],s=t[1],l=k((0,i.useState)(""),2),c=l[0],u=l[1],w=k((0,i.useState)(e),2),S=w[0],O=w[1],A=k((0,i.useState)(e),2),E=A[0],P=A[1],F=k((0,i.useState)(""),2),T=F[0],D=F[1],_=k((0,i.useState)(!1),2),I=_[0],M=_[1],R=k((0,i.useState)(!1),2),z=R[0],L=R[1],q=k((0,i.useState)(null),2),B=q[0],G=q[1],H=k((0,i.useState)(!1),2),W=H[0],U=H[1],V=k((0,i.useState)(null),2),Q=V[0],K=V[1],$=k((0,i.useState)(!1),2),J=$[0],Y=($[1],k((0,i.useState)(!1),2)),Z=Y[0],X=Y[1],ee=k((0,i.useState)(null),2),te=ee[0],ne=ee[1],re=k((0,i.useState)(!1),2),ae=re[0],oe=(re[1],k((0,i.useState)(!1),2)),ie=oe[0],se=oe[1],le=k((0,i.useState)(null),2),ce=le[0],ue=le[1],de=k((0,i.useState)(1),2),fe=de[0],me=de[1],pe=k((0,i.useState)(30),2),he=pe[0],ve=pe[1],be=k((0,i.useState)(!1),2),ye=be[0],ge=be[1],xe=(0,a.I)({queryKey:["time-management","members",c],queryFn:function(){return(0,b.iT)(c||void 0)},staleTime:6e4,refetchOnWindowFocus:!1}),je=xe.data,we=void 0===je?[]:je,Se=xe.isFetching,Ne=(0,a.I)({queryKey:["time-management","work-shifts"],queryFn:y.hY,staleTime:6e4,refetchOnWindowFocus:!1}),ke=Ne.data,Ce=void 0===ke?[]:ke,Oe=Ne.isFetching,Ae=(0,i.useMemo)(function(){if(0!==n.length)return n.map(function(e){var t=we.find(function(t){return String(t.id)===String(e)});return t?[t.firstName,t.lastName].filter(Boolean).join(" ").trim():null}).filter(Boolean).join(",")},[we,n]),Ee=(0,a.I)({queryKey:["time-management","hit-spot-time-history",{member_name:Ae,work_shift_id:c||void 0,start_date:S,end_date:E,status:T,page:fe,limit:he}],queryFn:function(){return(0,b.ZD)({member_name:Ae,work_shift_id:c?String(c):void 0,start_date:S,end_date:E,status:T||void 0,page:fe,limit:he})},staleTime:3e4,refetchOnWindowFocus:!1}),Pe=Ee.data,Fe=Ee.isFetching,Te=Ee.refetch;function De(e){var t,n=e.map(function(e){var t;if(!e.id)return null;if(!0===e.isRemoved||!1===e.enabled)return null;var n=[e.firstName,e.lastName].filter(Boolean).join(" ").trim(),r=(null!==(t=e.role)&&void 0!==t?t:"").trim(),a=n||r||"#".concat(e.id);return{value:e.id,label:a}}).filter(function(e){return!!e}),r=new Map,a=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=C(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw o}}}}(n);try{for(a.s();!(t=a.n()).done;){var o=t.value;r.set(o.value,o)}}catch(e){a.e(e)}finally{a.f()}return Array.from(r.values()).sort(function(e,t){return e.label.localeCompare(t.label)})}var _e=(0,i.useMemo)(function(){return De(we)},[we]);var Ie=(0,i.useMemo)(function(){return Ce.map(function(e){return{value:e.id,label:e.name}})},[Ce]),Me=(0,i.useMemo)(function(){return 0===n.length?[]:we.filter(function(e){var t=String(e.id);return n.some(function(e){return String(e)===t})})},[we,n]),Re=(0,i.useMemo)(function(){return null!=Pe&&Pe.data?Pe.data.map(function(e){var t,n;if(null==e||!e.id||null==e||!e.date)return console.warn("⚠️ Registro sem ID ou data:",e),null;var r=(null===(t=e.clockTimes)||void 0===t?void 0:t.length)>0?e.clockTimes.map(function(e){return(null==e?void 0:e.slice(0,5))||"--:--"}):["--:--","--:--","--:--","--:--"],a=(null===(n=e.shiftTimes)||void 0===n?void 0:n.length)>0?e.shiftTimes.join(" - "):"-- - -- - -- - --",o=e.date,i=e.workedHours||"00:00",s=e.justificationType,l="",c="secondary",u="secondary";if(s)switch(s){case"reason":l="Abonado",u="info";break;case"license":l="Licença",u="info";break;case"missing_hours":l="Devendo Horas",u="danger",c="danger";break;case"incomplete":l="Incompleto",u="danger",c="danger";break;case"overtime":l="Horas Extras",u="success",c="success";break;case"on_time":l="Em Dia",u="success";break;case"esquecimento":l="Editado - Esquecimento",u="info";break;case"registro_duplicado":l="Editado - Registro Duplicado",u="info";break;case"ajuste_solicitado":l="Editado - Ajuste Solicitado",u="info";break;default:l=s,u="secondary"}else l="-",u="secondary";return{id:e.id,data:o,memberName:e.memberName,registros:r,previstos:a,horas:i,horasColor:c,status:l,statusColor:u,justificationType:e.justificationType,justificationId:e.justificationId,justification:e.justification,expectedHours:e.expectedHours,hoursDifference:e.hoursDifference,isOvertime:e.isOvertime,isMissingHours:e.isMissingHours,delay:e.delay,missingClockIns:e.missingClockIns}}).filter(function(e){return null!==e}):[]},[Pe]),ze=function(e){s(e),me(1)},Le=function(){var e=N(j().m(function e(){var t,n,r,a,o,i,s;return j().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,M(!0),e.n=1,(0,b.LW)({member_name:Ae,work_shift_id:c?String(c):void 0,start_date:S||void 0,end_date:E||void 0,status:T||void 0});case 1:t=e.v,n=new Date,r=n.toISOString().split("T")[0],a=n.toTimeString().split(" ")[0].replace(/:/g,"-"),o="historico_pontos_".concat(r,"_").concat(a,".csv"),i=window.URL.createObjectURL(t),(s=document.createElement("a")).href=i,s.download=o,document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(i),e.n=3;break;case 2:e.p=2,e.v,x.A.error("Erro ao exportar arquivo. Por favor, tente novamente.","Erro na exportação");case 3:return e.p=3,M(!1),e.f(3);case 4:return e.a(2)}},e,null,[[0,2,3,4]])}));return function(){return e.apply(this,arguments)}}(),qe=function(){L(!1),G(null)},Be=function(){var e=N(j().m(function e(t){var n,r,a,o;return j().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,ge(!0),n={hitTheSpotId:B.id,motivo:t.motivo,primeiraEntradaData:t.primeiraEntradaData,primeiraEntradaHora:t.primeiraEntradaHora,primeiraSaidaData:t.primeiraSaidaData,primeiraSaidaHora:t.primeiraSaidaHora,segundaEntradaData:t.segundaEntradaData,segundaEntradaHora:t.segundaEntradaHora,saidaData:t.saidaData,saidaHora:t.saidaHora},e.n=1,(0,b.Nq)(n);case 1:return e.n=2,Te();case 2:qe(),e.n=4;break;case 3:e.p=3,o=e.v,a=(null==o||null===(r=o.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.error)||(null==o?void 0:o.message)||"Erro desconhecido ao salvar edição.",x.A.error(a,"Erro ao salvar edição");case 4:return e.p=4,ge(!1),e.f(4);case 5:return e.a(2)}},e,null,[[0,3,4,5]])}));return function(t){return e.apply(this,arguments)}}(),Ge=function(){var e=N(j().m(function e(t){return j().w(function(e){for(;;)switch(e.n){case 0:U(!1),K(null),Te();case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),He=function(){var e=N(j().m(function e(t){return j().w(function(e){for(;;)switch(e.n){case 0:X(!1),ne(null),Te();case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}();return(0,r.jsxs)(g.A,{children:[(0,r.jsx)("div",{className:"card app-card-surface mt-3",children:(0,r.jsx)("div",{className:"card-body",style:{overflow:"visible"},children:(0,r.jsxs)("div",{className:"form-row",children:[(0,r.jsxs)("div",{className:"form-group col-12 col-lg-4",style:{overflow:"visible"},children:[(0,r.jsx)("label",{className:"mb-1",children:"Turno"}),(0,r.jsx)(o.A,{options:Ie,value:c,placeholder:"Todos os Turnos",size:"md",onChange:function(e){u(e),s([]),me(1)},disabled:Oe,className:"custom-select"})]}),(0,r.jsxs)("div",{className:"form-group col-12 col-lg-4",children:[(0,r.jsx)("label",{className:"mb-1",children:"Membro"}),(0,r.jsx)("div",{className:"input-group",children:(0,r.jsx)(d,{options:_e,value:n,placeholder:"Buscar e Selecionar Membros",onChange:ze,disabled:Se})})]}),(0,r.jsxs)("div",{className:"form-group col-12 col-md-6 col-lg-2",children:[(0,r.jsx)("label",{className:"mb-1",children:"Data Início"}),(0,r.jsx)("input",{type:"date",className:"form-control",value:S,onChange:function(e){O(e.target.value),me(1)},placeholder:"dd/mm/aaaa"})]}),(0,r.jsxs)("div",{className:"form-group col-12 col-md-6 col-lg-2",children:[(0,r.jsx)("label",{className:"mb-1",children:"Data Fim"}),(0,r.jsx)("input",{type:"date",className:"form-control",value:E,onChange:function(e){P(e.target.value),me(1)},placeholder:"dd/mm/aaaa"})]})]})})}),n.length>0&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"mt-3",style:{display:"flex",flexWrap:"wrap",gap:"16px"},children:Me.length>0?Me.map(function(e){var t,a,o,i,s,l,c=[e.firstName,e.lastName].filter(Boolean).join(" ").trim()||"—",u=null!==(t=null!==(a=null!==(o=null==e?void 0:e.email)&&void 0!==o?o:null==e||null===(i=e.user)||void 0===i?void 0:i.email)&&void 0!==a?a:null==e?void 0:e.contactEmail)&&void 0!==t?t:"—",d=c.split(/\s+/).filter(Boolean),f=[null===(s=d[0])||void 0===s?void 0:s[0],null===(l=d[d.length-1])||void 0===l?void 0:l[0]].filter(Boolean).join("").toUpperCase()||"U",m=["#FF6B6B","#4ECDC4","#45B7D1","#FFA07A","#98D8C8","#F7DC6F","#BB8FCE","#85C1E2"],p=m[c.charCodeAt(0)%m.length];return(0,r.jsx)("div",{className:"card",style:{flex:"0 0 auto",minWidth:"300px",maxWidth:"400px",border:"1px solid #dee2e6",borderRadius:"8px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",position:"relative"},children:(0,r.jsx)("div",{className:"card-body p-3",children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsxs)("div",{style:{position:"relative",marginRight:"12px",flexShrink:0},children:[e.hasCrown&&(0,r.jsx)("img",{src:"/images/employee-advocacy/image.png",alt:"Crown",style:{position:"absolute",top:"-10px",left:"50%",transform:"translateX(-50%)",width:"15px",height:"15px",zIndex:2}}),(0,r.jsx)("div",{className:"rounded-circle d-flex align-items-center justify-content-center text-white",style:{width:48,height:48,backgroundColor:p,fontWeight:700,fontSize:"18px",border:e.hasCrown?"2px solid #FFD700":"none",boxShadow:e.hasCrown?"0 0 8px rgba(255, 215, 0, 0.5)":"none"},"aria-label":"Avatar de ".concat(c),title:c,children:f})]}),(0,r.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,r.jsx)("div",{className:"font-weight-bold text-dark",style:{fontSize:"15px",marginBottom:"2px"},children:c}),(0,r.jsx)("div",{className:"text-muted",style:{fontSize:"13px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u})]}),(0,r.jsx)("button",{type:"button",onClick:function(){return ze(n.filter(function(t){return String(t)!==String(e.id)}))},style:{position:"absolute",top:"8px",right:"8px",background:"transparent",border:"none",width:"24px",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:"#6c757d",fontSize:"20px",lineHeight:"1",padding:"0",transition:"color 0.2s"},onMouseEnter:function(e){e.currentTarget.style.color="#dc3545"},onMouseLeave:function(e){e.currentTarget.style.color="#6c757d"},title:"Remover ".concat(c),children:"x"})]})})},e.id)}):(0,r.jsx)("div",{className:"alert alert-info",style:{width:"100%"},children:"Nenhum membro encontrado para exibir."})})}),(0,r.jsx)(f.default,{data:Re,isLoading:Fe,pagination:null==Pe?void 0:Pe.pagination,onPageChange:function(e){me(e)},onItemsPerPageChange:function(e){ve(e),me(1)},onExportClick:Le,isExporting:I,onEditRecord:function(e){G(e),L(!0)},onAbonarRecord:function(e){K(e),U(!0)},onLicencaRecord:function(e){ne(e),X(!0)},onViewRecord:function(e){ue(e),se(!0)},selectedStatus:T,onStatusChange:function(e){D(e),me(1)}}),(0,r.jsx)(m.default,{isOpen:z,onClose:qe,record:B,onSave:Be,isSaving:ye}),(0,r.jsx)(p.default,{isOpen:W,onClose:function(){U(!1),K(null)},record:Q,onSave:Ge,isSaving:J}),(0,r.jsx)(h.default,{isOpen:Z,onClose:function(){X(!1),ne(null)},record:te,onSave:He,isSaving:ae}),(0,r.jsx)(v.default,{isOpen:ie,onClose:function(){se(!1),ue(null)},record:ce})]})}},25149(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>o});n(74423),n(62062),n(26099);var r=n(74848),a=function(e){switch(e){case"leve":return"#28A745";case"moderado":return"#FFC107";case"atencao":return"#17A2B8";case"grave":return"#DC3545";default:return"#6B7280"}};function o(e){var t=e.items,n=e.editPointEnabled,o=e.onAddJustification,i=e.onEditPoint;return t&&0!==t.length?(0,r.jsxs)("div",{style:{padding:"0 20px",paddingBottom:"100px"},children:[(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 70px 60px 80px",gap:"8px",padding:"12px 0",borderBottom:"1px solid #E5E7EB",fontSize:"13px",fontWeight:600,color:"#6B7280",fontFamily:"Inter"},children:[(0,r.jsx)("div",{children:"Ocorrências"}),(0,r.jsx)("div",{style:{textAlign:"center"},children:"Horário"}),(0,r.jsx)("div",{style:{textAlign:"center"},children:"Status"}),(0,r.jsx)("div",{style:{textAlign:"center"},children:"Ações"})]}),t.map(function(e,s){var l,c=n&&(!!(l=e.type)&&["ponto_dia_folga","ponto_duplicado"].includes(l));return(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 70px 60px 80px",gap:"8px",padding:"16px 0",borderBottom:s<t.length-1?"1px solid #F3F4F6":"none",alignItems:"center"},children:[(0,r.jsx)("div",{style:{fontSize:"14px",fontWeight:500,color:"#1F2937",fontFamily:"Inter"},children:e.title}),(0,r.jsx)("div",{style:{fontSize:"13px",color:"#6B7280",textAlign:"center",fontFamily:"Inter"},children:e.time}),(0,r.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:(0,r.jsx)("div",{style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:a(e.status)}})}),(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"center",gap:"8px"},children:[(0,r.jsx)("button",{onClick:function(){return o(e)},style:{padding:"6px 8px",border:"none",background:"none",cursor:"pointer",color:"#6B7280"},title:"Adicionar Justificativa",children:(0,r.jsx)("i",{className:"fas fa-comment",style:{fontSize:"14px"}})}),c&&(0,r.jsx)("button",{onClick:function(){return i(e)},style:{padding:"6px 8px",border:"none",background:"none",cursor:"pointer",color:"#6B7280"},title:"Editar Ponto",children:(0,r.jsx)("i",{className:"fas fa-pencil-alt",style:{fontSize:"14px"}})})]})]},e.id||s)})]}):(0,r.jsx)("div",{style:{padding:"40px 20px",textAlign:"center"},children:(0,r.jsx)("p",{style:{color:"#9CA3AF",fontSize:"14px",fontFamily:"Inter"},children:"Nenhuma ocorrência registrada"})})}},26071(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>b});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23418),n(64346),n(23792),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(58940),n(27495),n(38781),n(47764),n(23500),n(62953);var r=n(74848),a=n(33930),o=n(97665),i=n(57097),s=n(96339),l=n(96540),c=n(76336);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){m(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function m(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var v=["time-management","policy"];function b(){var e=(0,c.L)().canEdit,t=(0,o.jE)(),n=p((0,l.useState)(!1),2),u=n[0],d=n[1],m=p((0,l.useState)(8),2),h=m[0],b=m[1],y=(0,a.I)({queryKey:v,queryFn:s.Z}),g=y.data;y.isFetching;(0,l.useEffect)(function(){var e,t;g&&(d(null!==(e=g.blockOvertimeTimesheet)&&void 0!==e&&e),b(null!==(t=g.dailyHoursLimit)&&void 0!==t?t:8))},[g]);var x=(0,i.n)({mutationFn:function(e){return(0,s.E)(e)},onSuccess:function(){t.invalidateQueries({queryKey:v})}}),j=function(){g&&x.mutate(f(f({},g),{},{blockOvertimeTimesheet:u,dailyHoursLimit:u?h:8}))};return(0,l.useEffect)(function(){g&&j()},[u]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"row",children:(0,r.jsx)("div",{className:"col-12 col-md-6 col-xl-4 mb-3",children:(0,r.jsx)("div",{className:"card h-100 tm-card-mobile-auto ".concat(u?"border-primary bg-primary-soft":""),style:{border:"1px solid #e0e0e0",borderRadius:"8px"},children:(0,r.jsxs)("div",{className:"card-body d-flex flex-column",children:[(0,r.jsxs)("div",{className:"custom-control custom-checkbox mb-2",children:[(0,r.jsx)("input",{type:"checkbox",id:"timesheet-block",className:"custom-control-input",checked:u,onChange:function(e){return d(e.target.checked)},disabled:!e}),(0,r.jsxs)("label",{className:"custom-control-label ".concat(u?"text-primary":""),htmlFor:"timesheet-block",children:["Bloquear horas extras no timesheet",!e&&(0,r.jsx)("i",{className:"fas fa-lock ml-2 text-muted",style:{fontSize:"0.7rem"}})]})]}),(0,r.jsx)("small",{className:"text-muted d-block mb-2",style:{fontSize:"0.85rem"},children:"Quando ativado, o sistema impedirá que o membro registre no timesheet mais horas que o limite diário estabelecido. Use isso para controlar horas extras."}),(0,r.jsxs)("div",{className:"input-group mt-auto",children:[(0,r.jsx)("input",{type:"number",className:"form-control",value:h,onChange:function(e){return b(parseInt(e.target.value)||8)},onBlur:j,disabled:!u||!e,min:"1",max:"24"}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("span",{className:"input-group-text",children:"horas"})})]})]})})})}),x.isPending&&(0,r.jsxs)("div",{className:"text-muted mt-2",children:[(0,r.jsx)("i",{className:"fas fa-spinner fa-spin mr-2"}),"Salvando..."]})]})}},26723(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>c});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(62953),n(76031);var r=n(74848),a=n(96540),o=n(40961),i=n(18851);function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e){var t=e.open,n=e.onClose,l=(e.clock,e.background),c=e.workMinutes,u=e.breakMinutes,d=s(a.useState("focus"),2),f=d[0],m=d[1],p=s(a.useState(!1),2),h=p[0],v=p[1],b=s(a.useState(60*c),2),y=b[0],g=b[1],x=a.useRef(null);if(a.useEffect(function(){if(t){m("focus"),v(!1),g(60*c);var e=document.body.style.overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=e}}},[t,c,u]),a.useEffect(function(){if(t&&h)return x.current=window.setInterval(function(){g(function(e){if(e>0)return e-1;var t="focus"===f?"break":"focus";return m(t),60*("focus"===t?c:u)})},1e3),function(){x.current&&window.clearInterval(x.current)}},[t,h,f,c,u]),!t)return null;var j="blue"===l?"/images/tenant/blue_background.png":"white"===l?"/images/tenant/white_background.png":"/images/tenant/black_background.png",w="white"===l?"#0b1520":"#f2f4f7",S="focus"===f?"Foco":"Descanso curto",N=(0,r.jsxs)("div",{className:"position-fixed",style:{inset:0,zIndex:9999,backgroundImage:"url(".concat(j,")"),backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundColor:"#000",pointerEvents:"auto"},role:"dialog","aria-modal":"true",children:[(0,r.jsxs)("div",{style:{position:"fixed",top:12,right:12,display:"flex",gap:8,zIndex:1e4},children:[(0,r.jsx)("button",{type:"button",className:"btn btn-sm btn-light",onClick:function(){return v(function(e){return!e})},"aria-label":h?"Pausar":"Iniciar",children:h?(0,r.jsx)("i",{className:"fas fa-pause"}):(0,r.jsx)("i",{className:"fas fa-play"})}),(0,r.jsx)("button",{type:"button",className:"btn btn-sm btn-light",onClick:n,"aria-label":"Fechar modo foco",children:(0,r.jsx)("i",{className:"fas fa-times"})})]}),(0,r.jsx)("div",{className:"d-flex align-items-center justify-content-center text-center",style:{position:"absolute",inset:0,color:w,padding:16,textShadow:"white"===l?"none":"0 1px 12px rgba(0,0,0,.35)"},children:(0,r.jsxs)("div",{style:{maxWidth:560,width:"100%"},children:[(0,r.jsxs)("div",{className:"mb-2",style:{fontSize:18,opacity:.9},children:["Modo Foco ","break"===f?"– Em descanso":""]}),(0,r.jsx)(i.default,{title:S,seconds:y,running:h,active:!0,theme:l,onStart:function(){return v(!0)},onPause:function(){return v(!1)}})]})})]});return(0,o.createPortal)(N,document.body)}},30588(e,t,n){"use strict";n.d(t,{A:()=>f});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(12921),i=n(85072),s=n.n(i),l=n(12395),c={insert:"head",singleton:!1};s()(l.A,c);l.A.locals;function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const f=function(e){var t=e.initialStartDate,n=e.initialEndDate,i=e.onChange,s=e.maxDays,l=void 0===s?365:s,c=e.className,d=void 0===c?"":c,f=u((0,a.useState)({startDate:t||"",endDate:n||""}),2),m=f[0],p=f[1],h=u((0,a.useState)(!1),2),v=h[0],b=h[1],y=(0,a.useRef)(null),g=function(e){if(!e)return"";var t=new Date(e+"T00:00:00"),n=t.getDate(),r=["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"][t.getMonth()];return"".concat(n," de ").concat(r)};(0,a.useEffect)(function(){var e=function(e){y.current&&!y.current.contains(e.target)&&b(!1)};return v&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[v]);var x=m.startDate&&m.endDate?"".concat(g(m.startDate)," à ").concat(g(m.endDate)):"Selecionar período";return(0,r.jsxs)("div",{className:"date-range-badge ".concat(d),ref:y,children:[(0,r.jsxs)("button",{type:"button",className:"date-range-badge__button",onClick:function(){return b(!v)},children:[(0,r.jsx)("i",{className:"fas fa-calendar-alt date-range-badge__icon"}),(0,r.jsx)("span",{className:"date-range-badge__text",children:x})]}),v&&(0,r.jsxs)("div",{className:"date-range-badge__dropdown",children:[(0,r.jsxs)("div",{className:"date-range-badge__dropdown-header",children:[(0,r.jsx)("span",{children:"Selecionar Período"}),(0,r.jsx)("button",{type:"button",className:"date-range-badge__dropdown-close",onClick:function(){return b(!1)},children:(0,r.jsx)("i",{className:"fas fa-times"})})]}),(0,r.jsx)("div",{className:"date-range-badge__dropdown-body",children:(0,r.jsx)(o.A,{initialStartDate:m.startDate,initialEndDate:m.endDate,onChange:function(e){p(e),i(e)},maxDays:l})})]})]})}},30786(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>m});n(52675),n(89463),n(2259),n(28706),n(51629),n(23418),n(74423),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(78459),n(27495),n(38781),n(21699),n(47764),n(23500),n(62953),n(76031);var r=n(74848),a=n(97665),o=n(57097),i=n(49785),s=n(55278),l=n(96540),c=n(1806);function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var f=["time-management","location"];function m(e){var t=e.show,n=e.onClose,d=e.editData,m=(0,a.jE)(),p=!!d,h=(0,l.useRef)(null),v=u((0,l.useState)(null),2),b=v[0],y=v[1],g=u((0,l.useState)(null),2),x=g[0],j=g[1],w=u((0,l.useState)(null),2),S=(w[0],w[1]),N=(0,l.useRef)(null),k=(0,l.useRef)(null),C=(0,i.mN)({defaultValues:{address:"",neighborhood:"",number:"",complement:"",reference:"",city:"",country:"",latitude:"",longitude:""}}),O=(C.register,C.handleSubmit),A=C.watch,E=C.setValue,P=C.reset;C.formState.errors;(0,l.useEffect)(function(){d&&(E("address",d.address||""),E("neighborhood",d.neighborhood||""),E("number",d.number||""),E("complement",d.complement||""),E("reference",d.reference||""),E("city",d.city||""),E("country",d.country||""),E("latitude",d.latitude||""),E("longitude",d.longitude||""))},[d,E]);var F=(0,l.useCallback)(function(e){var t,n="",r="",a="",o="",i="";console.log("Address components:",e.address_components),null===(t=e.address_components)||void 0===t||t.forEach(function(e){var t=e.types;t.includes("street_number")&&(i=e.long_name),!n&&(t.includes("sublocality")||t.includes("neighborhood")||t.includes("sublocality_level_1"))&&(n=e.long_name),r||!t.includes("locality")&&!t.includes("administrative_area_level_2")||(r=e.long_name),t.includes("administrative_area_level_1")&&(a=e.short_name),t.includes("country")&&(o=e.long_name)}),!r&&a&&console.warn("Cidade não encontrada, usando estado:",a),console.log("Componentes extraídos:",{neighborhood:n,city:r,state:a,country:o,number:i}),E("neighborhood",n),E("city",r),E("country",o),i&&E("number",i)},[E]),T=(0,l.useCallback)(function(e,t){void 0!==window.google&&(new window.google.maps.Geocoder).geocode({location:{lat:e,lng:t}},function(n,r){"OK"===r&&n[0]&&(E("address",n[0].formatted_address),E("latitude",e.toString()),E("longitude",t.toString()),F(n[0]))})},[E,F]);(0,l.useEffect)(function(){if(t&&h.current){var e=function(){if(void 0!==window.google){var e=null!=d&&d.latitude?parseFloat(d.latitude):-23.5505,t=null!=d&&d.longitude?parseFloat(d.longitude):-46.6333,n=new window.google.maps.Map(h.current,{zoom:15,center:{lat:e,lng:t},mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!1}),r=new window.google.maps.Marker({map:n,draggable:!0,position:{lat:e,lng:t}});if(window.google.maps.event.addListener(r,"dragend",function(){var e=r.getPosition();T(e.lat(),e.lng())}),window.google.maps.event.addListener(n,"click",function(e){var t=e.latLng.lat(),n=e.latLng.lng();r.setPosition({lat:t,lng:n}),T(t,n)}),y(n),j(r),N.current){var a=new window.google.maps.places.Autocomplete(N.current,{types:["address"]});a.addListener("place_changed",function(){var e=a.getPlace();if(e.geometry&&e.geometry.location){var t=e.geometry.location;n.setCenter(t),r.setPosition(t),E("latitude",t.lat().toString()),E("longitude",t.lng().toString()),E("address",e.formatted_address||""),F(e)}}),S(a)}}else console.error("Google Maps não carregado")};if(void 0!==window.google)e();else{var n=window.GOOGLE_MAPS_API_KEY;if(!n)return void console.error("Google Maps API key não encontrada");var r=document.createElement("script");r.src="https://maps.googleapis.com/maps/api/js?key=".concat(n,"&libraries=places"),r.async=!0,r.onload=e,document.head.appendChild(r)}}},[t,d,T]);var D=A("address");(0,l.useEffect)(function(){if(D&&b&&x&&!(D.length<5))return k.current&&clearTimeout(k.current),k.current=setTimeout(function(){void 0!==window.google&&(new window.google.maps.Geocoder).geocode({address:D},function(e,t){if("OK"===t&&e[0]){var n=e[0].geometry.location;b.setCenter(n),x.setPosition(n),E("latitude",n.lat().toString()),E("longitude",n.lng().toString()),F(e[0])}})},1e3),function(){k.current&&clearTimeout(k.current)}},[D,b,x,E]);var _=(0,o.n)({mutationFn:function(e){var t={name:e.address,address:e.address,neighborhood:e.neighborhood||"",number:e.number||"",complement:e.complement||"",reference:e.reference||"",city:e.city,country:e.country,latitude:e.latitude,longitude:e.longitude,google_url:"https://www.google.com/maps?q=".concat(e.latitude,",").concat(e.longitude)};return p&&null!=d&&d.id?(0,s.Nt)(d.id,t):(0,s.yJ)(t)},onSuccess:function(){m.invalidateQueries({queryKey:f}),P(),n()}});return(0,r.jsx)(c.A,{show:t,onClose:n,title:p?"Editando Localização":"Cadastrar Localização",size:"md",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:n,children:"Cancelar"}),(0,r.jsx)("button",{type:"submit",form:"locationForm",className:"btn text-white px-4",style:{backgroundColor:"#17a2b8"},disabled:_.isPending||!D,children:_.isPending?(0,r.jsx)("i",{className:"fas fa-spinner fa-spin"}):p?"Salvar":"Adicionar Localização"})]}),children:(0,r.jsxs)("form",{id:"locationForm",onSubmit:O(function(e){_.mutate(e)}),children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Endereço da Localização"}),(0,r.jsx)("input",{ref:N,type:"text",className:"form-control",placeholder:"Rua Rosariio Sansalone, 285",value:A("address"),onChange:function(e){return E("address",e.target.value)}}),(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between mt-2",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("i",{className:"fas fa-search text-muted",style:{fontSize:"0.9rem"}}),(0,r.jsx)("small",{className:"text-muted ml-2",children:"Digite o endereço ou selecione no mapa"})]}),(0,r.jsxs)("small",{className:"text-info",children:[(0,r.jsx)("i",{className:"fas fa-info-circle mr-1"}),"Clique no mapa ou arraste o marcador"]})]})]}),(0,r.jsx)("div",{ref:h,style:{width:"100%",height:"300px",borderRadius:"8px",marginBottom:"20px",cursor:"crosshair",border:"2px solid #e0e0e0"}})]})})}},30970(e,t,n){"use strict";n.d(t,{A:()=>v});n(52675),n(89463),n(2259),n(45700),n(23792),n(89572),n(94170),n(2892),n(59904),n(84185),n(40875),n(10287),n(26099),n(60825),n(47764),n(62953);var r,a=n(96540),o=n(40961),i=n(52891);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==s(t)?t:t+""}function u(e,t,n){return t=f(t),function(e,t){if(t&&("object"==s(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,d()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}var p=o;r=p.createRoot,p.hydrateRoot;var h=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this.propsValue?this.propsValue:null;if(this.dispatchEvent("connect",{component:this.componentValue,props:e}),!this.componentValue)throw new Error("No component specified.");var t=window.resolveReactComponent(this.componentValue);this._renderReactElement(a.createElement(t,e,null)),this.dispatchEvent("mount",{componentName:this.componentValue,component:t,props:e})}},{key:"disconnect",value:function(){this.element.root.unmount(),this.dispatchEvent("unmount",{component:this.componentValue,props:this.propsValue?this.propsValue:null})}},{key:"_renderReactElement",value:function(e){var t=this.element;t.root||(t.root=r(this.element)),t.root.render(e)}},{key:"dispatchEvent",value:function(e,t){this.dispatch(e,{detail:t,prefix:"react"})}}])&&l(n.prototype,o),i&&l(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,i}(i.xI);h.values={component:String,props:Object};const v={"symfony--ux-react--react":h}},31475(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>i});n(74423),n(62062),n(26099);var r=n(74848);function a(e){return"leve"===e?"Leve":"moderado"===e?"Moderado":"atencao"===e?"Atenção":"Grave"}function o(e){if(!e)return!1;return["ponto_dia_folga","ponto_duplicado"].includes(e)}function i(e){var t=e.items,n=e.editPointEnabled,i=void 0!==n&&n,s=e.onAddJustification,l=e.onEditPoint;return(0,r.jsx)("div",{className:"ms-table-occurrences-wrapper",children:(0,r.jsxs)("table",{className:"ms-table-occurrences",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Ocorrências"}),(0,r.jsx)("th",{children:"Horário"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"ms-text-right",children:"Ações"})]})}),(0,r.jsx)("tbody",{children:0===t.length?(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:4,className:"ms-table-occurrences-empty",children:"Sem ocorrências"})}):t.map(function(e){return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:e.title}),(0,r.jsx)("td",{children:e.time}),(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"ms-table-occurrences-status",children:[(0,r.jsx)("span",{className:"ms-table-occurrences-status-dot",style:{backgroundColor:(t=e.status,"leve"===t?"#01D6C5":"moderado"===t?"#FFE524":"atencao"===t?"#17A2B8":"#DC3545")}}),(0,r.jsx)("span",{children:a(e.status)})]})}),(0,r.jsx)("td",{className:"ms-text-right",children:(0,r.jsxs)("div",{className:"btn-group",children:[(0,r.jsx)("button",{className:"ms-table-occurrences-action-button","data-toggle":"dropdown",type:"button",title:"Ações",children:(0,r.jsx)("i",{className:"fas fa-pencil-alt ms-table-occurrences-action-icon"})}),(0,r.jsxs)("div",{className:"dropdown-menu dropdown-menu-right",children:[(0,r.jsxs)("a",{className:"dropdown-item",href:"#",onClick:function(t){t.preventDefault(),null==s||s(e)},children:[(0,r.jsx)("i",{className:"far fa-comment-dots mr-2"})," Justificativa"]}),i&&o(e.type)&&(0,r.jsxs)("a",{className:"dropdown-item",href:"#",onClick:function(t){t.preventDefault(),null==l||l(e)},children:[(0,r.jsx)("i",{className:"far fa-edit mr-2"})," Editar Ponto"]})]})]})})]},e.id);var t})})]})})}},33384(e,t,n){"use strict";n.r(t),n.d(t,{extractPercentage:()=>d,findActivityByName:()=>p,findProjectByName:()=>m,normalizeName:()=>f,parseDurationToMinutes:()=>u,submitActivityFromCard:()=>h});n(52675),n(89463),n(2259),n(28706),n(50113),n(23418),n(74423),n(64346),n(23792),n(62062),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(78459),n(58940),n(3362),n(27495),n(38781),n(21699),n(47764),n(25440),n(42762),n(62953);var r=n(81623),a=n(47339);function o(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function s(n,r,a,o){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return i(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(i(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,i(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,i(m,"constructor",d),i(d,"constructor",u),u.displayName="GeneratorFunction",i(d,a,"GeneratorFunction"),i(m),i(m,a,"Generator"),i(m,r,function(){return this}),i(m,"toString",function(){return"[object Generator]"}),(o=function(){return{w:s,m:p}})()}function i(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}i=function(e,t,n,r){function o(t,n){i(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},i(e,t,n,r)}function s(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var u=function(e){if(!e)return 0;var t=l(e.split(":").map(function(e){return parseInt(e,10)||0}),2);return 60*t[0]+t[1]},d=function(e){return e&&parseFloat(e.replace("%",""))||0},f=function(e){return e?e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/\s+/g," ").trim():""},m=function(e,t){if(e){var n=f(e);if(n)return t.find(function(e){return f(e.name)===n})||t.find(function(e){return f(e.name).includes(n)})||t.find(function(e){return n.includes(f(e.name))})}},p=function(e,t){if(e){var n=f(e);if(n)return t.find(function(e){return f(e.name)===n})||t.find(function(e){return f(e.name).includes(n)})||t.find(function(e){return n.includes(f(e.name))})}},h=function(){var e,t=(e=o().m(function e(t,n,i,s,l,c,u,d,f,h,v){var b,y,g,x;return o().w(function(e){for(;;)switch(e.n){case 0:if(b=n&&d.find(function(e){return e.id===n})||s&&m(s,d)||c&&m(c,d)){e.n=1;break}throw a.o.error("Selecione um projeto válido para registrar a atividade."),new Error("Projeto não encontrado");case 1:if(y=i&&f.find(function(e){return e.id===i})||l&&p(l,f)||u&&p(u,f)){e.n=2;break}throw a.o.error("Selecione uma atividade válida para registrar."),new Error("Atividade não encontrada");case 2:return g=60*v,x={date:h,project_id:b.id,activity_template_id:y.id,start_time:t.startTime&&"00:00"!==t.startTime?"".concat(h," ").concat(t.startTime,":00"):void 0,end_time:t.endTime&&"00:00"!==t.endTime?"".concat(h," ").concat(t.endTime,":00"):void 0,percentage:t.percentage||void 0,duration:t.duration||0,comment:t.comment||"",activity_name_legacy:y.name,workload_minutes:g},e.n=3,r.Z4.createActivity(x);case 3:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){s(o,r,a,i,l,"next",e)}function l(e){s(o,r,a,i,l,"throw",e)}i(void 0)})});return function(e,n,r,a,o,i,s,l,c,u,d){return t.apply(this,arguments)}}()},34559(e,t,n){"use strict";n.d(t,{A:()=>a});n(28706),n(62062),n(2892),n(26099);var r=n(74848);function a(e){var t=e.options,n=e.value,a=e.placeholder,o=void 0===a?"Selecione uma opção":a,i=e.className,s=void 0===i?"":i,l=e.onChange,c=e.loading,u=void 0!==c&&c,d=e.disabled,f=void 0!==d&&d,m=e.size,p=void 0===m?"md":m,h="sm"===p?"form-control-sm":"lg"===p?"form-control-lg":"";return(0,r.jsxs)("select",{className:"form-control ".concat(h," ").concat(s),value:null!=n?n:"",onChange:function(e){var t=e.target.value;if(l)if(""===t)l("");else{var n=Number(t);l(isNaN(n)?t:n)}},disabled:f||u,children:[(0,r.jsx)("option",{value:"",children:u?"Carregando...":o}),t.map(function(e){return(0,r.jsx)("option",{value:e.value,disabled:e.disabled,children:e.label},e.value)})]})}},34595(e,t,n){"use strict";n.d(t,{Pg:()=>u,SP:()=>v,k1:()=>l,og:()=>f,uQ:()=>p});n(52675),n(89463),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362);var r=n(52354);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}function l(){return c.apply(this,arguments)}function c(){return(c=s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/generated-links");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function u(e){return d.apply(this,arguments)}function d(){return(d=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.post("/time-management/generated-links",t);case 1:return n=e.v,o=n.data,e.a(2,o.data)}},e)}))).apply(this,arguments)}function f(e,t){return m.apply(this,arguments)}function m(){return(m=s(a().m(function e(t,n){var o,i;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.put("/time-management/generated-links/".concat(t),n);case 1:return o=e.v,i=o.data,e.a(2,i.data)}},e)}))).apply(this,arguments)}function p(e){return h.apply(this,arguments)}function h(){return(h=s(a().m(function e(t){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.delete("/time-management/generated-links/".concat(t));case 1:return e.a(2)}},e)}))).apply(this,arguments)}function v(e){return b.apply(this,arguments)}function b(){return(b=s(a().m(function e(t){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.delete("/spaces-control/api/floors/qrcode/".concat(t));case 1:return e.a(2)}},e)}))).apply(this,arguments)}},34773(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>u});n(52675),n(89463),n(2259),n(45700),n(2008),n(50113),n(51629),n(23792),n(62062),n(89572),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(47764),n(23500),n(62953);var r=n(74848),a=n(49785),o=n(96540);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==i(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e){var t,n=e.isOpen,i=e.onClose,s=e.selectedStatus,c=e.onApply,u=e.onClear,d=(0,a.mN)({defaultValues:{status:s}}),f=d.register,m=d.handleSubmit,p=d.watch,h=d.reset;(0,o.useEffect)(function(){h({status:s})},[s,h]);var v=p("status");if(!n)return null;var b=[{value:"",label:"Todos"},{value:"overtime",label:"Horas Extras"},{value:"missing_hours",label:"Devendo Horas"},{value:"on_time",label:"Em Dia"},{value:"incomplete",label:"Incompleto"}],y={overtime:"#28A745",missing_hours:"#DC3545",on_time:"#17A2B8",incomplete:"#6C757D"};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"modal-backdrop fade show",style:{zIndex:1040},onClick:function(e){e.stopPropagation(),i()}}),(0,r.jsx)("div",{className:"modal fade show d-block",style:{zIndex:1050},tabIndex:-1,onClick:function(e){e.target===e.currentTarget&&i()},children:(0,r.jsx)("div",{className:"modal-dialog modal-dialog-centered",style:{maxWidth:"400px"},children:(0,r.jsxs)("div",{className:"modal-content",onClick:function(e){return e.stopPropagation()},children:[(0,r.jsxs)("div",{className:"modal-header",children:[(0,r.jsx)("h5",{className:"modal-title",style:{fontFamily:"Inter",fontSize:"18px",fontWeight:600,color:"#5C5D5D"},children:"Filtros"}),(0,r.jsx)("button",{type:"button",className:"close",onClick:function(e){e.preventDefault(),e.stopPropagation(),i()},"aria-label":"Fechar",children:(0,r.jsx)("span",{"aria-hidden":"true",children:"×"})})]}),(0,r.jsxs)("form",{onSubmit:m(function(e){c(e.status),i()}),children:[(0,r.jsx)("div",{className:"modal-body",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"mb-2",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:400,color:"rgba(92, 93, 93, 0.60)"},children:"Filtrar por Status"}),(0,r.jsx)("select",l(l({},f("status")),{},{className:"form-control",style:{fontFamily:"Inter",fontSize:"14px"},children:b.map(function(e){return(0,r.jsx)("option",{value:e.value,style:{color:e.value?y[e.value]:void 0},children:e.label},e.value)})})),v&&(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)("small",{className:"d-inline-block px-2 py-1 rounded",style:{backgroundColor:"".concat(y[v],"20"),color:y[v],fontFamily:"Inter",fontSize:"12px",fontWeight:500},children:null===(t=b.find(function(e){return e.value===v}))||void 0===t?void 0:t.label})})]})}),(0,r.jsxs)("div",{className:"modal-footer",children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel btn-sm",onClick:function(){h({status:""}),u(),i()},style:{fontFamily:"Inter"},children:"Limpar Filtros"}),(0,r.jsx)("button",{type:"submit",className:"btn btn-primary btn-sm",style:{fontFamily:"Inter",backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:"Aplicar"})]})]})]})})})]})}},36279(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>p});n(52675),n(89463),n(2259),n(50113),n(23418),n(64346),n(23792),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(88195),i=n(14463),s=n(47339),l=n(33384);function c(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return u(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(u(t={},r,function(){return this}),t),m=d.prototype=s.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,u(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return l.prototype=d,u(m,"constructor",d),u(d,"constructor",l),l.displayName="GeneratorFunction",u(d,a,"GeneratorFunction"),u(m),u(m,a,"Generator"),u(m,r,function(){return this}),u(m,"toString",function(){return"[object Generator]"}),(c=function(){return{w:o,m:p}})()}function u(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}u=function(e,t,n,r){function o(t,n){u(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},u(e,t,n,r)}function d(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function p(e){var t=e.activities,n=e.projetos,u=e.atividadesDisponiveis,m=e.currentDate,p=e.workloadHours,h=e.onActivityAdded,v=f((0,a.useState)(!1),2),b=v[0],y=v[1],g=f((0,a.useState)(null),2),x=g[0],j=g[1],w=f((0,a.useState)(null),2),S=w[0],N=w[1],k=f((0,a.useState)(null),2),C=k[0],O=k[1],A=f((0,a.useState)(""),2),E=A[0],P=A[1],F=f((0,a.useState)(""),2),T=F[0],D=F[1],_=f((0,a.useState)(""),2),I=_[0],M=_[1],R=f((0,a.useState)(""),2),z=R[0],L=R[1],q=function(){y(!1),j(null),N(null),O(null),P(""),D(""),M(""),L("")},B=function(){var e,t=(e=c().m(function e(t){var r,a,o,i;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,(0,l.submitActivityFromCard)(t,S,C,E,T,I,z,n,u,m,p);case 1:s.o.success("Atividade adicionada com sucesso!"),q(),h&&h(),e.n=3;break;case 2:e.p=2,i=e.v,console.error("Erro ao adicionar atividade a partir da atividade prevista:",i),o=(null==i||null===(r=i.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.message)||(null==i||null===(a=i.response)||void 0===a||null===(a=a.data)||void 0===a?void 0:a.error)||"Erro ao adicionar atividade",s.o.error(o);case 3:return e.a(2)}},e,null,[[0,2]])}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){d(o,r,a,i,s,"next",e)}function s(e){d(o,r,a,i,s,"throw",e)}i(void 0)})});return function(e){return t.apply(this,arguments)}}();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"card app-card-surface mt-3",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsx)("h5",{className:"tm-section-title mb-2",children:"Atividades Previstas"}),(0,r.jsx)(o.A,{columns:[{key:"projeto",label:"Projeto",width:"11%"},{key:"atividade",label:"Atividade",width:"11%"},{key:"inicio",label:"Início",width:"11%",align:"center"},{key:"fim",label:"Fim",width:"11%",align:"center"},{key:"percentDia",label:"% do dia",width:"11%",align:"center"},{key:"status",label:"Status",width:"11%",align:"center"},{key:"prioridade",label:"Prioridade",width:"11%",align:"center"},{key:"duracao",label:"Duração",width:"11%",align:"center"},{key:"acoes",label:"Ações",width:"11%",align:"center"}],data:t,renderRow:function(e){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"ms-table-cell",title:e.projeto,children:e.projeto}),(0,r.jsx)("td",{className:"ms-table-cell",title:e.atividade,children:e.atividade}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.inicio}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.fim}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.percentDia}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:(0,r.jsx)("span",{className:"ms-table-badge ".concat("Em Andamento"===e.status?"ms-table-badge-status-em-andamento":"ms-table-badge-status-a-fazer"),children:e.status})}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:(0,r.jsx)("span",{className:"ms-table-badge ".concat("Alta"===e.prioridade?"ms-table-badge-prioridade-alta":"Média"===e.prioridade?"ms-table-badge-prioridade-media":"ms-table-badge-prioridade-baixa"),children:e.prioridade})}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.duracao}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:(0,r.jsx)("button",{className:"app-icon-button",onClick:function(){return function(e){var t,r,a,o,i=(0,l.findProjectByName)(e.projeto,n),s=(0,l.findActivityByName)(e.atividade,u);M(e.projeto),L(e.atividade),N(null!==(t=null==i?void 0:i.id)&&void 0!==t?t:null),O(null!==(r=null==s?void 0:s.id)&&void 0!==r?r:null),P(null!==(a=null==i?void 0:i.name)&&void 0!==a?a:""),D(null!==(o=null==s?void 0:s.name)&&void 0!==o?o:"");var c={startTime:e.inicio||"00:00",endTime:e.fim||"00:00",percentage:(0,l.extractPercentage)(e.percentDia),duration:(0,l.parseDurationToMinutes)(e.duracao),comment:""};j(c),y(!0)}(e)},title:"Registrar atividade planejada",children:(0,r.jsx)("i",{className:"fas fa-check ms-table-action-icon","aria-hidden":"true"})})})]})},emptyMessage:"Nenhuma atividade prevista para hoje"})]})}),(0,r.jsx)(i.default,{show:b,onClose:q,onSubmit:B,selectedProject:E||I,selectedActivity:T||z,workloadHours:p,prefilledData:x,allowProjectSelection:!0,projectOptions:n,activityOptions:u,selectedProjectId:S,selectedActivityId:C,suggestedProjectName:I,suggestedActivityName:z,onProjectChange:function(e){var t,r;if(null===e)return N(null),void P("");var a=n.find(function(t){return t.id===e});N(null!==(t=null==a?void 0:a.id)&&void 0!==t?t:null),P(null!==(r=null==a?void 0:a.name)&&void 0!==r?r:"")},onActivityChange:function(e){var t,n;if(null===e)return O(null),void D("");var r=u.find(function(t){return t.id===e});O(null!==(t=null==r?void 0:r.id)&&void 0!==t?t:null),D(null!==(n=null==r?void 0:r.name)&&void 0!==n?n:"")}})]})}},39576(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>f});n(52675),n(89463),n(2259),n(28706),n(50113),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(71761),n(23500),n(62953);var r=n(74848),a=n(96540),o=n(62495),i=n(1806);function s(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return l(u,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var i={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(l(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,l(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,l(m,"constructor",d),l(d,"constructor",u),u.displayName="GeneratorFunction",l(d,a,"GeneratorFunction"),l(m),l(m,a,"Generator"),l(m,r,function(){return this}),l(m,"toString",function(){return"[object Generator]"}),(s=function(){return{w:o,m:p}})()}function l(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}l=function(e,t,n,r){function o(t,n){l(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},l(e,t,n,r)}function c(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e){var t=e.isOpen,n=e.onScan,l=e.onClose,d=e.qrcodes,f=void 0===d?[]:d,m=u((0,a.useState)(null),2),p=m[0],h=m[1],v=u((0,a.useState)(""),2),b=v[0],y=v[1],g=(0,a.useRef)(null),x=(0,a.useRef)(null),j=(0,a.useRef)(!1);(0,a.useEffect)(function(){return t?(w(),j.current=!1):S(),function(){S()}},[t]);var w=function(){var e,t=(e=s().m(function e(){var t,n,r;return s().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,console.log("[QRCodeModal] 🚀 Iniciando ZXing scanner..."),console.log("[QRCodeModal] QR Codes autorizados:",f.length),f.forEach(function(e,t){console.log("[QRCodeModal] ".concat(t+1,". ").concat(e.name," (ID: ").concat(e.id,")"))}),h(null),y(""),t=new o.BrowserQRCodeReader,x.current=t,e.n=1,t.decodeFromVideoDevice(null,g.current,function(e,t){if(e&&!j.current){var n=e.getText();console.log("[QRCodeModal] 🎉 QR CODE DETECTADO!"),console.log("[QRCodeModal] Dados:",n),y(n),N(n)}});case 1:console.log("[QRCodeModal] ✅ Scanner ativo e esperando QR Code!"),e.n=3;break;case 2:e.p=2,r=e.v,console.error("[QRCodeModal] ❌ Erro ao iniciar scanner:",r),n="Erro ao acessar câmera. Verifique as permissões.","NotAllowedError"===r.name||"PermissionDeniedError"===r.name?n="Permissão de acesso à câmera negada. Por favor, permita o acesso à câmera nas configurações do navegador e tente novamente.":"NotFoundError"===r.name?n="Nenhuma câmera foi encontrada no seu dispositivo.":"NotReadableError"===r.name?n="A câmera está em uso por outro aplicativo. Feche outros aplicativos e tente novamente.":r.message&&(n=r.message),h(n);case 3:return e.a(2)}},e,null,[[0,2]])}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){c(o,r,a,i,s,"next",e)}function s(e){c(o,r,a,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}(),S=function(){console.log("[QRCodeModal] Parando scanner..."),x.current&&(x.current.reset(),x.current=null),j.current=!1},N=function(e){if(j.current)console.log("[QRCodeModal] Já processado, ignorando...");else{j.current=!0,console.log("[QRCodeModal] ========================================"),console.log("[QRCodeModal] Processando QR Code detectado"),console.log("[QRCodeModal] Dados:",e);var t=k(e);if(console.log("[QRCodeModal] ID extraído:",t),!t)return console.error("[QRCodeModal] ❌ Falha ao extrair ID"),h("QR Code inválido. Formato não reconhecido."),void(j.current=!1);var r=f.find(function(e){return e.id===t});r?(console.log("[QRCodeModal] ✅ QR Code VÁLIDO!"),console.log("[QRCodeModal] Nome:",r.name),S(),n(t)):(console.error("[QRCodeModal] ❌ ID não autorizado!"),console.error("[QRCodeModal] ID lido:",t),console.error("[QRCodeModal] IDs autorizados:",f.map(function(e){return e.id})),h("ID ".concat(t.substring(0,8),"... não autorizado.")),j.current=!1)}},k=function(e){try{var t=e.match(/([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})/i);return t&&t[1]?t[1]:null}catch(e){return console.error("[extractQRCodeId] Erro:",e),null}},C=function(){S(),h(null),l()};return t?(0,r.jsx)(i.A,{show:t,onClose:C,title:"Ler QR Code",size:"md",footer:(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:C,children:"Cancelar"}),children:(0,r.jsxs)("div",{style:{padding:"24px"},children:[p&&(0,r.jsxs)("div",{className:"alert d-flex align-items-center mb-3",style:{backgroundColor:"#E6F7F9",borderColor:"#17A2B8",color:"#0C5460",gap:"12px"},children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle",style:{color:"#17A2B8",fontSize:"24px"}}),(0,r.jsx)("div",{style:{flex:1},children:p})]}),0===f.length?(0,r.jsxs)("div",{className:"text-center py-5",children:[(0,r.jsx)("i",{className:"fas fa-qrcode fa-4x text-muted mb-3"}),(0,r.jsx)("h5",{className:"text-muted",children:"Nenhum QR Code disponível"}),(0,r.jsx)("p",{className:"text-muted mb-0",children:"Não há QR Codes configurados para registro de ponto."})]}):(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("p",{style:{fontFamily:"Inter",fontSize:"14px",color:"#5C5D5D",marginBottom:"16px"},children:"Aponte a câmera para o QR Code"}),(0,r.jsx)("div",{style:{position:"relative",width:"100%",maxWidth:"500px",margin:"0 auto",borderRadius:"8px",overflow:"hidden",backgroundColor:"#000"},children:(0,r.jsx)("video",{ref:g,style:{width:"100%",height:"auto"}})}),(0,r.jsxs)("div",{className:"alert alert-info mt-3 mb-0",children:[(0,r.jsx)("div",{children:"Posicione o QR Code na frente da câmera"}),f.length>0&&(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsxs)("small",{className:"text-muted",children:[(0,r.jsx)("strong",{children:f.length})," QR Code(s) autorizado(s)"]})}),b&&(0,r.jsxs)("div",{className:"mt-2 p-2",style:{background:"#d4edda",border:"1px solid #28a745",borderRadius:"4px",fontSize:"11px",wordBreak:"break-all"},children:[(0,r.jsx)("strong",{style:{color:"#155724"},children:"✅ Detectado:"}),(0,r.jsx)("br",{}),(0,r.jsxs)("code",{style:{fontSize:"10px"},children:[b.substring(0,60),"..."]})]})]})]})]})}):null}},39618(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>i});var r=n(74848),a=n(1806),o={warningIcon:{fontSize:"56px",color:"#FF6D6D",textAlign:"center",marginBottom:"20px"},message:{fontSize:"16px",color:"#5C5D5D",textAlign:"center",marginBottom:"24px",lineHeight:"1.8"},warningText:{fontSize:"14px",fontWeight:600,color:"#DC2626",textAlign:"center",marginTop:"8px"},activityInfo:{backgroundColor:"#F8F9FA",padding:"16px",borderRadius:"8px",marginBottom:"16px",border:"1px solid #E5E7EB"},infoLabel:{fontSize:"13px",fontWeight:600,color:"#6B7280",marginBottom:"6px"},infoValue:{fontSize:"14px",fontWeight:500,color:"#1F2937"}};function i(e){var t=e.show,n=e.onClose,i=e.onConfirm,s=e.activityName,l=e.projectName;return(0,r.jsxs)(a.A,{show:t,onClose:n,title:"Confirmar Exclusão",size:"md",footer:(0,r.jsx)(a.M,{onCancel:n,onConfirm:i,cancelText:"Cancelar",confirmText:"Excluir"}),children:[(0,r.jsx)("div",{style:o.warningIcon,children:(0,r.jsx)("i",{className:"fas fa-exclamation-triangle"})}),(0,r.jsx)("div",{style:o.message,children:"Tem certeza que deseja excluir esta atividade?"}),(0,r.jsx)("div",{style:o.warningText,children:"⚠️ Esta ação não pode ser desfeita"}),(0,r.jsxs)("div",{style:o.activityInfo,children:[(0,r.jsxs)("div",{style:{marginBottom:"12px"},children:[(0,r.jsx)("div",{style:o.infoLabel,children:"Projeto"}),(0,r.jsx)("div",{style:o.infoValue,children:l})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{style:o.infoLabel,children:"Atividade"}),(0,r.jsx)("div",{style:o.infoValue,children:s})]})]})]})}},41081(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>p});n(52675),n(89463),n(2259),n(51629),n(23418),n(64346),n(23792),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(5506),n(40875),n(79432),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(42762),n(23500),n(62953),n(76031);var r=n(74848),a=n(96540),o=n(76336);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function s(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(i(e)+" is not iterable")}function l(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return c(u,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var i={};function s(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(c(t={},r,function(){return this}),t),m=d.prototype=s.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,c(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,c(m,"constructor",d),c(d,"constructor",u),u.displayName="GeneratorFunction",c(d,a,"GeneratorFunction"),c(m),c(m,a,"Generator"),c(m,r,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),(l=function(){return{w:o,m:p}})()}function c(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}c=function(e,t,n,r){function o(t,n){c(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},c(e,t,n,r)}function u(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(){var e,t=document.getElementById("time-management-permissions-template");return t instanceof HTMLTemplateElement?t.innerHTML.trim():(null===(e=document.getElementById("permissoes-content"))||void 0===e?void 0:e.innerHTML.trim())||""}function p(){var e=(0,a.useRef)(null),t=(0,o.L)(),n=(0,o.v)(),i=d((0,a.useState)(m),1)[0];return(0,a.useEffect)(function(){var e=[];return["/css/time-management/index.css","https://cdn.datatables.net/1.13.4/css/dataTables.dataTables.css","https://cdn.datatables.net/responsive/2.4.0/css/responsive.dataTables.css"].forEach(function(t){if(!document.querySelector('link[href="'.concat(t,'"]'))){var n=document.createElement("link");n.rel="stylesheet",n.href=t,document.head.appendChild(n),e.push(n)}}),function(){e.forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)})}},[]),(0,a.useEffect)(function(){var e=["https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js","https://cdn.datatables.net/responsive/2.4.0/js/dataTables.responsive.min.js"],t=[],n=function(){var n,r=(n=l().m(function n(){var r,a,o;return l().w(function(n){for(;;)switch(n.n){case 0:r=l().m(function e(){var n;return l().w(function(e){for(;;)switch(e.n){case 0:if(n=o[a],!document.querySelector('script[src="'.concat(n,'"]'))){e.n=1;break}return e.a(2,1);case 1:return e.n=2,new Promise(function(e,r){var a=document.createElement("script");a.src=n,a.async=!1,a.onload=function(){return e()},a.onerror=function(){return r(new Error("Erro ao carregar ".concat(n)))},document.head.appendChild(a),t.push(a)});case 2:return e.a(2)}},e)}),a=0,o=e;case 1:if(!(a<o.length)){n.n=4;break}return n.d(s(r()),2);case 2:if(!n.v){n.n=3;break}return n.a(3,3);case 3:a++,n.n=1;break;case 4:return n.a(2)}},n)}),function(){var e=this,t=arguments;return new Promise(function(r,a){var o=n.apply(e,t);function i(e){u(o,r,a,i,s,"next",e)}function s(e){u(o,r,a,i,s,"throw",e)}i(void 0)})});return function(){return r.apply(this,arguments)}}();return n().catch(function(e){console.error("Erro ao carregar scripts do DataTables:",e)}),function(){t.forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)})}},[]),(0,a.useEffect)(function(){if(i&&e.current){new Promise(function(e){var t=function(){void 0!==window.$&&void 0!==window.$.fn.DataTable?e():setTimeout(t,100)};t()}).then(function(){e.current&&(e.current.querySelectorAll("script").forEach(function(e){var t,n=document.createElement("script");Array.from(e.attributes).forEach(function(e){n.setAttribute(e.name,e.value)}),e.src?n.src=e.src:n.textContent=e.textContent,null===(t=e.parentNode)||void 0===t||t.replaceChild(n,e)}),window.setTimeout(function(){var e,t,n,r,a,o;null===(e=(t=window).initAllCustomSelectWrappers)||void 0===e||e.call(t),null===(n=(r=window).initCustomSelects)||void 0===n||n.call(r),null===(a=(o=window).setupDynamicTables)||void 0===a||a.call(o),document.dispatchEvent(new CustomEvent("tabShown"))},50),setTimeout(function(){var e=window.$;if(e&&e.fn.DataTable){var t=window.PRODUCT_SLUG||"time-management";fetch("/permission-tab/data/".concat(t)).then(function(e){return e.json()}).then(function(e){"success"===e.status&&(window.permissionTabMembers={},window.permissionTabTags=e.data.permissionTags,e.data.membersTag.forEach(function(e){window.permissionTabMembers[e.id]=e}))}).catch(function(e){console.error("Erro ao buscar dados de permissões:",e)});var n=setInterval(function(){var e=window.permissionTabMembers;(e?Object.keys(e).length:0)>0&&(clearInterval(n),r())},200);setTimeout(function(){clearInterval(n),r()},2e4)}function r(){document.querySelectorAll(".open-offcanvas-btn").forEach(function(e){var t,n=e.cloneNode(!0);null===(t=e.parentNode)||void 0===t||t.replaceChild(n,e),n.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation();var t=this.getAttribute("data-id");if(t){var n=window.permissionTabMembers;if(n&&n[t]){var r=document.getElementById("overlay"),a=document.getElementById("customOffcanvas");if(r&&a){var o=n[t],i=document.getElementById("offcanvasAvatar");if(i){var s=o.avatar?"/uploads/photos/".concat(o.avatar):"/images/user-default.png";i.style.backgroundImage="url(".concat(s,")")}var l=document.getElementById("offcanvasName"),c=document.getElementById("offcanvasEmail"),u=document.getElementById("offcanvasRole"),f=document.getElementById("offcanvasStatus"),m=document.getElementById("offcanvasIsRegistered");l&&(l.textContent=o.name||"Não informado"),c&&(c.textContent=o.email||"Não informado"),u&&(u.textContent=o.role||"Sem função atribuída"),f&&(f.className="status-indicator "+(o.active?"active":"inactive")),m&&(m.textContent=o.isRegistered?"Membro Registrado":"Membro Não Registrado");var p=document.getElementById("offcanvasTeams");if(p&&(p.innerHTML="",o.compiled_teams))for(var h=0,v=Object.entries(o.compiled_teams);h<v.length;h++){var b=d(v[h],2),y=(b[0],b[1]),g=document.createElement("span");g.className="team-tag",g.textContent=y,p.appendChild(g)}"function"==typeof window.renderGlobalPermission&&window.renderGlobalPermission(o),"function"==typeof window.renderCustomPermissions&&window.renderCustomPermissions(o),r.style.display="block",a.classList.add("open"),document.body.classList.add("no-scroll"),setTimeout(function(){!function(e){window.positionDropdown=function(e,t){if(e&&t)try{e.style.position="absolute",e.style.top="100%",e.style.right="0",e.style.left="auto",e.style.zIndex="2100",e.style.marginTop="5px"}catch(e){}},window.positionOffcanvasDropdown=function(e,t){if(e&&t)try{e.style.position="absolute",e.style.right="0",e.style.top="100%",e.style.left="auto",e.style.zIndex="2100",e.style.marginTop="5px"}catch(e){}},setTimeout(function(){var t=document.querySelector('#offcanvasGlobalTagPermission button[data-bs-toggle="dropdown"]');if(t||(t=document.querySelector("#offcanvasGlobalTagPermission .tag")),t){var n,r=t.cloneNode(!0);null===(n=t.parentNode)||void 0===n||n.replaceChild(r,t),r.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation();var n=this.nextElementSibling;if(n){var r=n.classList.contains("show");document.querySelectorAll("#customOffcanvas .permissions-dropdown-menu.show").forEach(function(e){e!==n&&e.classList.remove("show")}),n.classList.toggle("show"),n.style.position="absolute",n.style.right="0",n.style.top="100%",n.style.left="auto",n.style.zIndex="2100",n.style.display="block",r||setTimeout(function(){!function(e,t){var n=e.querySelectorAll(".change-permission-global, .dropdown-item");n.forEach(function(n){var r,a=n.cloneNode(!0);null===(r=n.parentNode)||void 0===r||r.replaceChild(a,n),a.addEventListener("click",function(n){var r;n.preventDefault(),n.stopPropagation();var a=this.getAttribute("data-member-id")||t.id,o=this.getAttribute("data-permission-id"),i=(null===(r=this.textContent)||void 0===r?void 0:r.trim())||this.getAttribute("data-permission-name"),s=this.getAttribute("data-permission-color")||this.style.backgroundColor,l=this.getAttribute("data-permission-letter-color")||this.style.color,c=e.previousElementSibling;"function"==typeof window.showSuccessConfirmationModal&&window.showSuccessConfirmationModal("Confirmação de Alteração da Tag de Permissão Global","Essa alteração será aplicada a todos os produtos associados.<br>Você tem certeza?","Confirmar",function(){"function"==typeof window.updateGlobalPermission&&c&&(window.updateGlobalPermission(a,o,c,i,s,l),setTimeout(function(){window.dispatchEvent(new CustomEvent("permissionUpdated"))},1e3))}),e.classList.remove("show")})})}(n,e)},50)}})}},200),setTimeout(function(){document.querySelectorAll("#customPermissionsList .dropdown-toggle").forEach(function(e){var t,n=e.cloneNode(!0);null===(t=e.parentNode)||void 0===t||t.replaceChild(n,e),n.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation();var t=this.nextElementSibling;if(t){t.classList.contains("show");document.querySelectorAll("#customOffcanvas .permissions-dropdown-menu.show").forEach(function(e){e!==t&&e.classList.remove("show")}),t.classList.toggle("show"),t.style.position="absolute",t.style.right="0",t.style.top="100%",t.style.left="auto",t.style.zIndex="2100"}})}),document.querySelectorAll("#customOffcanvas .change-permission").forEach(function(e){var t,n=e.cloneNode(!0);null===(t=e.parentNode)||void 0===t||t.replaceChild(n,e),n.addEventListener("click",function(e){var t;e.preventDefault(),e.stopPropagation();var n=this.getAttribute("data-member-id"),r=this.getAttribute("data-product-id"),a=this.getAttribute("data-permission-id"),o=this.getAttribute("data-permission-name"),i=this.getAttribute("data-permission-color"),s=this.getAttribute("data-permission-letter-color"),l=null===(t=this.closest(".dropdown"))||void 0===t?void 0:t.querySelector("button");l&&"function"==typeof window.updateCustomPermission&&(window.updateCustomPermission(n,r,a,l,o,i,s),setTimeout(function(){window.dispatchEvent(new CustomEvent("customPermissionUpdated"))},1e3));var c=this.closest(".permissions-dropdown-menu");c&&c.classList.remove("show")})})},100);var t=function(e){e.target.closest("#customOffcanvas .permissions-manager")||document.querySelectorAll("#customOffcanvas .permissions-dropdown-menu.show").forEach(function(e){e.classList.remove("show")})};document.removeEventListener("click",t),document.addEventListener("click",t)}(o)},300)}}else"function"==typeof window.loadGoalsPermissionData&&(window.loadGoalsPermissionData(),setTimeout(function(){var e,n,r;null!==(e=window.permissionTabMembers)&&void 0!==e&&e[t]&&(null===(n=(r=window).openOffcanvas)||void 0===n||n.call(r,t))},1500))}})});var e=document.getElementById("closeOffcanvas"),t=document.getElementById("overlay");if(e){var n,r=e.cloneNode(!0);null===(n=e.parentNode)||void 0===n||n.replaceChild(r,e),r.addEventListener("click",function(){var e=document.getElementById("customOffcanvas"),t=document.getElementById("overlay");e&&e.classList.remove("open"),t&&(t.style.display="none"),document.body.classList.remove("no-scroll")})}if(t){var a,o=t.cloneNode(!0);null===(a=t.parentNode)||void 0===a||a.replaceChild(o,t),o.addEventListener("click",function(){var e=document.getElementById("customOffcanvas");e&&e.classList.remove("open"),this.style.display="none",document.body.classList.remove("no-scroll")})}}},1e3))})}},[i]),n||!t.canView?(0,r.jsxs)("div",{className:"alert alert-danger m-3",role:"alert",children:[(0,r.jsxs)("h4",{className:"alert-heading",children:[(0,r.jsx)("i",{className:"fas fa-ban me-2"}),"Acesso Negado"]}),(0,r.jsx)("p",{children:"Você não tem permissão para visualizar as permissões deste produto."}),(0,r.jsx)("hr",{}),(0,r.jsxs)("p",{className:"mb-0",children:[(0,r.jsx)("strong",{children:"Permissões necessárias:"})," Visualizar"]})]}):i?(0,r.jsx)("div",{ref:e,dangerouslySetInnerHTML:{__html:i||""}}):(0,r.jsxs)("div",{className:"alert alert-danger m-3",role:"alert",children:[(0,r.jsxs)("h4",{className:"alert-heading",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-triangle me-2"}),"Erro ao renderizar permissões"]}),(0,r.jsx)("p",{className:"mb-0",children:"Conteúdo de permissões não encontrado no template da página."})]})}},42328(e,t,n){"use strict";n.d(t,{A:()=>h});n(52675),n(89463),n(2259),n(28706),n(50113),n(23418),n(74423),n(64346),n(23792),n(62062),n(34782),n(26910),n(23288),n(62010),n(9868),n(26099),n(27495),n(38781),n(31415),n(21699),n(47764),n(62953);var r=n(74848),a=n(8194),o=n(46539),i=n(28482),s=n(69107),l=n(69786),c=n(77984),u=n(23495),d=n(45721);function f(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var p=function(e){var t=e.active,n=e.payload,a=e.label;if(t&&n&&n.length){var o,i=null===(o=n[0])||void 0===o?void 0:o.payload,s=(null==i?void 0:i.label)||"Período ".concat(a);return(0,r.jsxs)("div",{style:{backgroundColor:"rgba(255, 255, 255, 0.95)",border:"1px solid #ccc",borderRadius:"6px",padding:"6px 10px",boxShadow:"0 1px 4px rgba(0,0,0,0.1)",fontSize:"11px",lineHeight:"1.4",minWidth:"auto",maxWidth:"180px"},children:[(0,r.jsx)("div",{style:{fontWeight:600,marginBottom:"3px",fontSize:"11px",color:"#333"},children:s}),n.map(function(e,t){var n;return(0,r.jsxs)("div",{style:{margin:"2px 0",color:e.color,fontSize:"10px"},children:[e.name,": ",(0,r.jsxs)("strong",{children:[null===(n=e.value)||void 0===n?void 0:n.toFixed(1),"h"]})]},t)})]})}return null};function h(e){var t,n,m=e.selectedFilters,h=e.timesheetData,v=e.attendanceData,b=m.includes("timesheet"),y=m.includes("attendance"),g="Período";switch((null===(t=h[0])||void 0===t?void 0:t.type)||(null===(n=v[0])||void 0===n?void 0:n.type)||"day"){case"day":g="Dia do Mês";break;case"week":g="Semana";break;case"month":g="Mês"}var x=[].concat(f(h.map(function(e){return e.period})),f(v.map(function(e){return e.period}))),j=Array.from(new Set(x)).sort(function(e,t){return e-t}).map(function(e){var t=h.find(function(t){return t.period===e}),n=v.find(function(t){return t.period===e}),r=(null==t?void 0:t.label)||(null==n?void 0:n.label)||"".concat(e);return{period:e,label:r,timesheetHours:t?t.hours:0,attendanceHours:n?n.hours:0}}),w=Math.max.apply(Math,f(j.map(function(e){return Math.max(e.timesheetHours,e.attendanceHours)})).concat([10])),S=[0,10*Math.ceil(w/10)],N=Array.from({length:4},function(e,t){return Math.round(S[1]/3*t)});return(0,r.jsx)("div",{style:{userSelect:"none",transform:"none",transition:"none"},children:(0,r.jsx)(i.u,{width:"100%",height:300,style:{transform:"none"},children:(0,r.jsxs)(d.b,{data:j,margin:{top:10,right:30,left:0,bottom:30},style:{cursor:"default"},onMouseMove:function(e){var t;return null==e||null===(t=e.stopPropagation)||void 0===t?void 0:t.call(e)},onMouseDown:function(e){var t;return null==e||null===(t=e.stopPropagation)||void 0===t?void 0:t.call(e)},onMouseUp:function(e){var t;return null==e||null===(t=e.stopPropagation)||void 0===t?void 0:t.call(e)},onClick:function(e){var t;return null==e||null===(t=e.stopPropagation)||void 0===t?void 0:t.call(e)},children:[(0,r.jsx)(s.d,{strokeDasharray:"3 3",stroke:"#E0E0E0"}),(0,r.jsx)(c.W,{dataKey:"label",axisLine:!1,tickLine:!1,tick:{fill:"#5C5D5D",fontSize:11},angle:j.length>15?-45:0,textAnchor:j.length>15?"end":"middle",height:j.length>15?60:40,interval:j.length>20?Math.floor(j.length/15):0,label:{value:g,position:"insideBottom",offset:j.length>15?-20:-5,style:{fill:"#5C5D5D",fontSize:12}}}),(0,r.jsx)(u.h,{ticks:N,domain:S,axisLine:!1,tickLine:!1,tick:{fill:"#5C5D5D",fontSize:12},tickFormatter:function(e){return"".concat(e,"h")},label:{value:"Horas Trabalhadas",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"#5C5D5D",fontSize:12,fontWeight:600}}}),(0,r.jsx)(o.m,{content:(0,r.jsx)(p,{})}),(0,r.jsx)(a.s,{verticalAlign:"bottom",height:36,iconType:"line",wrapperStyle:{paddingTop:"20px",fontSize:"12px"},formatter:function(e){return(0,r.jsx)("span",{style:{color:"#5C5D5D",fontSize:"12px"},children:e})}}),b&&(0,r.jsx)(l.N1,{type:"monotone",dataKey:"timesheetHours",name:"Por Timesheet",stroke:"#186073",strokeWidth:2,dot:{fill:"#FFFFFF",r:4,stroke:"#186073",strokeWidth:2},activeDot:{r:5,fill:"#FFFFFF",stroke:"#186073",strokeWidth:2},isAnimationActive:!1}),y&&(0,r.jsx)(l.N1,{type:"monotone",dataKey:"attendanceHours",name:"Por Registro de Ponto",stroke:"#17A1B7",strokeWidth:2,dot:{fill:"#FFFFFF",r:4,stroke:"#17A1B7",strokeWidth:2},activeDot:{r:5,fill:"#FFFFFF",stroke:"#17A1B7",strokeWidth:2},isAnimationActive:!1})]})})})}},42415(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>x});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23418),n(64346),n(23792),n(34782),n(89572),n(23288),n(94170),n(62010),n(2892),n(59904),n(67945),n(84185),n(83851),n(81278),n(40875),n(79432),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(23500),n(62953),n(76031),n(3296),n(27208),n(48408);var r=n(74848),a=n(97665),o=n(57097),i=n(49785),s=n(34595),l=n(96540),c=n(1806);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){m(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function m(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return h(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(h(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,h(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,h(d,"constructor",c),h(c,"constructor",l),l.displayName="GeneratorFunction",h(c,a,"GeneratorFunction"),h(d),h(d,a,"Generator"),h(d,r,function(){return this}),h(d,"toString",function(){return"[object Generator]"}),(p=function(){return{w:o,m:f}})()}function h(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}h=function(e,t,n,r){function o(t,n){h(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},h(e,t,n,r)}function v(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return y(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var g=["time-management","qrcodes"];function x(e){var t=e.show,u=e.onClose,d=e.editData,m=(0,a.jE)(),h=!!d,y=b((0,l.useState)(!1),2),x=y[0],j=y[1],w=b((0,l.useState)(null),2),S=w[0],N=w[1],k=(0,i.mN)({defaultValues:{name:"",description:"",type:"qrcode",temporary:!1,requireLogin:!1,startDate:"",startTime:"",endDate:"",endTime:""}}),C=k.register,O=k.handleSubmit,A=k.watch,E=k.setValue,P=k.reset;k.formState.errors;(0,l.useEffect)(function(){d&&(E("name",d.name),E("description",d.description||""),E("type",d.type),E("temporary",d.temporary),E("requireLogin",d.requireLogin),E("startDate",d.startDate||""),E("startTime",d.startTime||""),E("endDate",d.endDate||""),E("endTime",d.endTime||""))},[d,E]);var F=A("type"),T=A("name"),D=A("temporary"),_=(0,o.n)({mutationFn:function(e){var t={name:e.name,description:e.description||"",type:e.type,temporary:e.temporary,requireLogin:e.requireLogin,startDate:e.temporary?e.startDate:void 0,startTime:e.temporary?e.startTime:void 0,endDate:e.temporary?e.endDate:void 0,endTime:e.temporary?e.endTime:void 0};return h&&null!=d&&d.id?(0,s.og)(d.id,t):(0,s.Pg)(t)},onSuccess:function(e){m.invalidateQueries({queryKey:g}),N(e),j(!0)}}),I=function(){j(!1),N(null),P(),u()},M=function(){var e,t=(e=p().m(function e(){var t,r,a,o,i,s,l;return p().w(function(e){for(;;)switch(e.p=e.n){case 0:if(null==S||!S.url||"qrcode"!==S.type){e.n=8;break}return e.p=1,e.n=2,n.e(583).then(n.t.bind(n,87583,19));case 2:return t=e.v,e.n=3,t.toDataURL(S.url,{width:512,margin:2,color:{dark:"#000000",light:"#FFFFFF"},errorCorrectionLevel:"H"});case 3:return r=e.v,e.n=4,fetch(r);case 4:return a=e.v,e.n=5,a.blob();case 5:o=e.v,i=window.URL.createObjectURL(o),(s=document.createElement("a")).href=i,s.download="".concat(S.name||"qrcode",".png"),document.body.appendChild(s),s.click(),setTimeout(function(){document.body.removeChild(s),window.URL.revokeObjectURL(i)},100),e.n=7;break;case 6:e.p=6,l=e.v,console.error("Erro ao baixar QR Code:",l),alert("Erro ao gerar QR Code para download");case 7:e.n=9;break;case 8:null!=S&&S.url&&"link"===S.type&&(navigator.clipboard.writeText(S.url),alert("Link copiado para a área de transferência!"));case 9:return e.a(2)}},e,null,[[1,6]])}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){v(o,r,a,i,s,"next",e)}function s(e){v(o,r,a,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}();return x?(0,r.jsx)(c.A,{show:t,onClose:I,title:"Gerador",size:"md",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:I,children:"Cancelar"}),(0,r.jsx)("button",{type:"button",className:"btn text-white px-4",style:{backgroundColor:"#17a2b8"},onClick:I,children:"Feito"})]}),children:(0,r.jsxs)("div",{className:"text-center",style:{padding:"40px"},children:[(0,r.jsx)("h3",{className:"mb-4",style:{color:"#666",fontWeight:600},children:"Prontinho!"}),(0,r.jsxs)("div",{className:"p-5 mb-3",style:{border:"2px dashed #ddd",borderRadius:"12px",backgroundColor:"#fafafa",cursor:"pointer"},onClick:M,children:[(0,r.jsx)("i",{className:"fas fa-qrcode",style:{fontSize:"4rem",color:"#ccc",marginBottom:"20px"}}),(0,r.jsx)("h5",{className:"font-weight-bold mb-2",children:"qrcode"===F?"QR Code Gerado com Sucesso!":"Link Gerado com Sucesso!"}),(0,r.jsx)("p",{className:"text-muted mb-0",children:"Clique aqui para fazer o download"})]})]})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.A,{show:t,onClose:u,title:"Gerador",size:"md",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:u,children:"Cancelar"}),(0,r.jsx)("button",{type:"submit",form:"qrcodeForm",className:"btn text-white px-4",style:{backgroundColor:"#17a2b8"},disabled:_.isPending||!T,children:_.isPending?(0,r.jsx)("i",{className:"fas fa-spinner fa-spin"}):"Gerar ".concat("qrcode"===F?"QR Code":"Link")})]}),children:(0,r.jsxs)("form",{id:"qrcodeForm",onSubmit:O(function(e){_.mutate(e)}),children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark mb-3",children:"Gerar"}),(0,r.jsxs)("div",{className:"d-flex",children:[(0,r.jsxs)("div",{className:"form-check mr-4",children:[(0,r.jsx)("input",f(f({className:"form-check-input",type:"radio",value:"qrcode"},C("type",{required:!0})),{},{id:"typeQRCode"})),(0,r.jsx)("label",{className:"form-check-label",htmlFor:"typeQRCode",children:"QR Code"})]}),(0,r.jsxs)("div",{className:"form-check",children:[(0,r.jsx)("input",f(f({className:"form-check-input",type:"radio",value:"link"},C("type",{required:!0})),{},{id:"typeLink"})),(0,r.jsx)("label",{className:"form-check-label",htmlFor:"typeLink",children:"Link"})]})]})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsxs)("label",{className:"font-weight-normal text-dark",children:["Nome do ","qrcode"===F?"QR Code":"Link"]}),(0,r.jsx)("input",f({type:"text",className:"form-control",placeholder:"Digite o nome do ".concat("qrcode"===F?"QR Code":"Link")},C("name",{required:!0})))]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Descrição"}),(0,r.jsx)("textarea",f({className:"form-control",rows:3,placeholder:"Detalhe mais informações sobre esse ".concat("qrcode"===F?"QR Code":"Link")},C("description")))]}),(0,r.jsx)("hr",{className:"my-4"}),(0,r.jsx)("div",{className:"form-group",children:(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark mb-0",children:"Necessário login para validação?"}),(0,r.jsx)("i",{className:"far fa-question-circle ml-2 text-muted",style:{fontSize:"0.9rem"},"data-toggle":"tooltip","data-placement":"top",title:"Se ativado, o usuário precisará estar logado para bater ponto"})]}),(0,r.jsxs)("label",{className:"switch mb-0",children:[(0,r.jsx)("input",f({type:"checkbox"},C("requireLogin"))),(0,r.jsx)("span",{className:"slider round"})]})]})}),(0,r.jsx)("div",{className:"form-group",children:(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark mb-0",children:"Gerar Temporariamente?"}),(0,r.jsxs)("label",{className:"switch mb-0",children:[(0,r.jsx)("input",f({type:"checkbox"},C("temporary"))),(0,r.jsx)("span",{className:"slider round"})]})]})}),D&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Período de Início"}),(0,r.jsx)("input",f({type:"date",className:"form-control",placeholder:"dd/mm/aaaa"},C("startDate",{required:D})))]})}),(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:" "}),(0,r.jsx)("input",f({type:"time",className:"form-control",placeholder:"Horas"},C("startTime",{required:D})))]})})]}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Período de Finalização"}),(0,r.jsx)("input",f({type:"date",className:"form-control",placeholder:"dd/mm/aaaa"},C("endDate",{required:D})))]})}),(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:" "}),(0,r.jsx)("input",f({type:"time",className:"form-control",placeholder:"Horas"},C("endTime",{required:D})))]})})]})]})]})}),(0,r.jsx)("style",{children:'\n .switch {\n position: relative;\n display: inline-block;\n width: 50px;\n height: 24px;\n }\n\n .switch input {\n opacity: 0;\n width: 0;\n height: 0;\n }\n\n .slider {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: #ccc;\n transition: .4s;\n }\n\n .slider:before {\n position: absolute;\n content: "";\n height: 18px;\n width: 18px;\n left: 3px;\n bottom: 3px;\n background-color: white;\n transition: .4s;\n }\n\n input:checked + .slider {\n background-color: #17a2b8;\n }\n\n input:checked + .slider:before {\n transform: translateX(26px);\n }\n\n .slider.round {\n border-radius: 24px;\n }\n\n .slider.round:before {\n border-radius: 50%;\n }\n '})]})}},43432(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>w});n(23792),n(26099),n(31415),n(47764),n(62953);var r=n(74848),a=n(33930),o=n(97665),i=n(57097),s=n(96540),l=n(19782),c=n(7440),u=n(52798),d=n(26071),f=n(46265),m=n(93794),p=n(95226),h=n(47034),v=n(55801),b=n(19619),y=n(17147),g=n(70038),x=n(55278),j=n(50860);function w(){var e,t=(0,o.jE)(),n=(0,a.I)({queryKey:["time-management","validation"],queryFn:v.G8,staleTime:6e4,refetchOnWindowFocus:!1}).data,w=n?b.c[n.mode]:null,S=(0,s.useMemo)(function(){var e;return new Set(null!==(e=null==n?void 0:n.others)&&void 0!==e?e:[])},[n]),N="flex"===w||"manual"===w&&S.has("geolocation"),k="flex"===w||"qr"===w||"manual"===w&&S.has("qrcode"),C=(0,a.I)({queryKey:["time-management","work-shifts"],queryFn:g.hY,staleTime:6e4,refetchOnWindowFocus:!1}).data,O=void 0===C?[]:C,A=(e=null==O?void 0:O.length,(0,a.I)({queryKey:["time-management","can-view-maps"],queryFn:x.vD,staleTime:6e4,refetchOnWindowFocus:!1}).data),E=void 0!==A&&A,P=(0,i.n)({mutationFn:function(e){return(0,x.xD)(e)},onSuccess:function(e){t.setQueryData(["time-management","can-view-maps"],e)}});return(0,r.jsxs)(j.A,{children:[(0,r.jsx)(f.default,{title:"Canais",subtitle:"Selecione os possíveis canais para registro do ponto.",helpTemplate:'<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner canais-tooltip-inner"></div></div>',help:"<p><strong>Aplicativo Móvel</strong><br/>Os membros da equipe devem utilizar o aplicativo oficial MetaHuman para iOS ou Android para registrar seus pontos. O registro de entrada e saída não é permitido por navegador móvel.</p>\n<p><strong>Navegador Web</strong><br/>Os membros podem acessar a plataforma MetaHuman através de navegadores em dispositivos autorizados para registrar o ponto, utilizando o ambiente web da empresa.</p>\n<p><strong>Link ou QR Code Gerado</strong><br/>Os membros poderão registrar o ponto utilizando um link ou QR Code disponibilizado pela empresa. O link pode ser configurado como fixo ou temporário e o acesso pode exigir login para validação de identidade.</p>\n<p><strong>Print da Tela</strong><br/>Quando o ponto é registrado através do navegador web, pode ser exigida a captura automática de uma imagem (print da tela) no momento do registro.</p>",children:(0,r.jsx)(l.default,{})}),(0,r.jsx)(f.default,{title:"Validação de Ponto",subtitle:"Defina quais validações serão exigidas para registrar o ponto.",help:"<p>Configura os níveis de segurança exigidos para validar o registro de ponto.</p>\n<p>Você pode escolher entre opções pré-configuradas (Essencial, Balanceada, Completa) ou montar uma configuração personalizada</p>",children:(0,r.jsx)(m.default,{})}),(0,r.jsx)(f.default,{title:"Turnos de Trabalho",help:"<p>Configura os diferentes turnos que os colaboradores podem seguir (ex: comercial, noturno, revezamento). Cada turno tem um horário definido de entrada, saída e, opcionalmente, intervalo.</p>\n<p>Fundamental para cruzar com as marcações e identificar atrasos, horas extras ou faltas.</p>",children:(0,r.jsx)(p.default,{})}),N&&(0,r.jsx)(f.default,{title:"Cadastrar Localização",help:"<p>Permite definir endereços autorizados onde o colaborador poderá bater o ponto.</p>\n<p>O sistema usa geolocalização para validar se o registro foi feito dentro do local cadastrado. Exemplo: sede da empresa, filiais, postos de trabalho externos.</p>",right:(0,r.jsx)("button",{type:"button",className:"btn btn-link p-0",onClick:function(){P.mutate(!E)},disabled:P.isPending,title:E?"Ocultar mapas":"Mostrar mapas",style:{fontSize:"1.2rem",color:"#6c757d",transition:"transform 0.3s ease",transform:E?"rotate(90deg)":"rotate(0deg)"},children:P.isPending?(0,r.jsx)("i",{className:"fas fa-spinner fa-spin"}):(0,r.jsx)("i",{className:"fas fa-chevron-right"})}),children:(0,r.jsx)(y.LocationSection,{})}),k&&(0,r.jsx)(f.default,{title:"Cadastrar QR Code/Link",help:"<p>Permite criar QR Codes ou links para facilitar o registro de ponto em locais específicos. Ideal para times em campo, eventos, ou estações fixas.</p>",children:(0,r.jsx)(h.default,{})}),(0,r.jsx)(f.default,{title:"Política de Ponto",help:"<p>O sistema contabiliza o tempo de adiantamento ou atraso apenas após ultrapassado o tempo de tolerância definido.</p><p>Dentro do limite estabelecido, o registro é considerado normal, sem impactar o saldo de horas ou gerar ocorrências automáticas.</p>",children:(0,r.jsx)(u.default,{})}),(0,r.jsx)(f.default,{title:"Limite de Horas no Timesheet",help:"<p>Controla o limite de horas que podem ser registradas no timesheet por dia.</p><p>Quando ativado, o sistema impedirá que os colaboradores registrem mais horas que o limite estabelecido em uma única atividade diária.</p><p>Ideal para controlar horas extras e evitar registros excessivos.</p>",children:(0,r.jsx)(d.default,{})}),(0,r.jsx)(f.default,{title:"Notificações",help:"<p>Configura alertas automáticos enviados para o colaborador.</p>",children:(0,r.jsx)(c.default,{})})]})}},46265(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>l});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23792),n(89572),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(47764),n(23500),n(62953);var r=n(74848);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=a(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==a(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){var t=e.title,n=e.subtitle,a=e.help,o=e.helpTemplate,s=e.right,l=e.children;return(0,r.jsx)("div",{className:"card app-card-surface mt-3",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("h3",{className:"card-title mb-0",children:t}),a&&(0,r.jsx)("span",i(i({className:"text-muted ml-2","data-toggle":"tooltip","data-placement":"auto","data-html":"true",title:a},o?{"data-template":o}:{}),{},{children:(0,r.jsx)("i",{className:"far fa-question-circle"})}))]}),s&&(0,r.jsx)("div",{className:"ml-3",children:s})]}),n&&(0,r.jsx)("div",{className:"text-muted mt-1",children:n})]}),l]})})}},46550(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>i});n(28706),n(2008),n(62062),n(26099);var r=n(74848);function a(e){var t=e.color;return(0,r.jsxs)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("circle",{cx:"9",cy:"5",r:"3",stroke:t,strokeWidth:"1.5",fill:"none"}),(0,r.jsx)("path",{d:"M5 16C5 13.7909 6.79086 12 9 12C11.2091 12 13 13.7909 13 16V19H5V16Z",stroke:t,strokeWidth:"1.5",fill:"none"}),(0,r.jsx)("path",{d:"M15 12L19 12M19 12L17 10M19 12L17 14",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function o(e){var t=e.color;return(0,r.jsxs)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("rect",{x:"3",y:"5",width:"12",height:"10",rx:"1",stroke:t,strokeWidth:"1.5",fill:"none"}),(0,r.jsx)("path",{d:"M6 15L6 17L12 17L12 15",stroke:t,strokeWidth:"1.5",strokeLinecap:"round"}),(0,r.jsx)("path",{d:"M16 10L20 10M20 10L18 8M20 10L18 12",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function i(e){var t=e.rows,n=t.filter(function(e){return!e.muted}).length,i=t.length,s=n/i*100;return(0,r.jsxs)("div",{className:"mobile-timeline",style:{padding:"20px",position:"relative",minHeight:"400px"},children:[(0,r.jsx)("div",{style:{position:"absolute",left:"28px",top:"24px",width:"4px",height:"350px",backgroundColor:"#E5E7EB",borderRadius:"2px",zIndex:1}}),(0,r.jsx)("div",{style:{position:"absolute",left:"28px",top:"24px",width:"4px",height:"".concat(s/100*350,"px"),backgroundColor:"#17A2B8",borderRadius:"2px",zIndex:2,transition:"height 0.3s ease-in-out"}}),t.map(function(e,t){var n=!e.muted,a=24+t*(350/(i-1));return(0,r.jsx)("div",{style:{position:"absolute",left:"24px",top:"".concat(a-6,"px"),width:"12px",height:"12px",borderRadius:"50%",backgroundColor:n?"#17A2B8":"#E5E7EB",zIndex:3}},"bullet-".concat(t))}),t.map(function(e,n){var i=n%2==0,s=e.muted?"#9ca3af":"#5C5D5D",l=n===t.length-1;return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px",marginBottom:l?"0":"60px",position:"relative",paddingLeft:"48px"},children:[(0,r.jsx)("div",{style:{width:"28px",height:"28px",minWidth:"28px",display:"flex",alignItems:"center",justifyContent:"center"},children:i?(0,r.jsx)(a,{color:s}):(0,r.jsx)(o,{color:s})}),(0,r.jsxs)("div",{style:{flex:1,paddingTop:"2px"},children:[(0,r.jsx)("div",{style:{fontSize:"15px",fontWeight:e.muted?400:500,color:e.muted?"#9CA3AF":"#5C5D5D",fontFamily:"Inter",lineHeight:"1.5",marginBottom:"2px"},children:e.label}),!e.muted&&(e.device||e.mode)&&(0,r.jsx)("div",{style:{fontSize:"11px",color:"#9CA3AF",fontFamily:"Inter",fontWeight:400},children:e.device&&e.mode?"".concat(e.device.toLowerCase()," - ").concat(e.mode.toLowerCase()):(e.device||e.mode||"").toLowerCase()})]})]},n)})]})}},47034(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>b});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(25440),n(11392),n(62953),n(76031),n(3296),n(27208),n(48408);var r=n(74848),a=n(33930),o=n(97665),i=n(57097),s=n(34595),l=n(96540),c=n(42415),u=n(76336);function d(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return f(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(f(t={},r,function(){return this}),t),m=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,f(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return l.prototype=c,f(m,"constructor",c),f(c,"constructor",l),l.displayName="GeneratorFunction",f(c,a,"GeneratorFunction"),f(m),f(m,a,"Generator"),f(m,r,function(){return this}),f(m,"toString",function(){return"[object Generator]"}),(d=function(){return{w:o,m:p}})()}function f(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}f=function(e,t,n,r){function o(t,n){f(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},f(e,t,n,r)}function m(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var v=["time-management","qrcodes"];function b(){var e=(0,u.L)(),t=e.canCreate,f=e.canEdit,h=e.canDelete,b=p((0,l.useState)(!1),2),y=b[0],g=b[1],x=p((0,l.useState)(null),2),j=x[0],w=x[1],S=(0,o.jE)(),N=(0,l.useRef)(null),k=(0,l.useRef)(null),C=p((0,l.useState)(0),2),O=C[0],A=C[1],E=(0,a.I)({queryKey:v,queryFn:s.k1}),P=E.data,F=void 0===P?[]:P,T=E.isFetching,D=(0,i.n)({mutationFn:s.uQ,onSuccess:function(){S.invalidateQueries({queryKey:v})}}),_=(0,i.n)({mutationFn:s.SP,onSuccess:function(){S.invalidateQueries({queryKey:v})}}),I=function(){var e,t=(e=d().m(function e(t){var r,a,o,i,s,l,c,u;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!t.url||"qrcode"!==t.type){e.n=7;break}return e.p=1,e.n=2,n.e(583).then(n.t.bind(n,87583,19));case 2:return r=e.v,a=t.url.startsWith("/")?"".concat(window.location.origin).concat(t.url):t.url,e.n=3,r.toDataURL(a,{width:512,margin:2,color:{dark:"#000000",light:"#FFFFFF"},errorCorrectionLevel:"H"});case 3:return o=e.v,e.n=4,fetch(o);case 4:return i=e.v,e.n=5,i.blob();case 5:s=e.v,l=window.URL.createObjectURL(s),(c=document.createElement("a")).href=l,c.download="".concat(t.name||"qrcode",".png"),document.body.appendChild(c),c.click(),setTimeout(function(){document.body.removeChild(c),window.URL.revokeObjectURL(l)},100),e.n=7;break;case 6:e.p=6,u=e.v,console.error("Erro ao baixar QR Code:",u),alert("Erro ao gerar QR Code para download");case 7:return e.a(2)}},e,null,[[1,6]])}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){m(o,r,a,i,s,"next",e)}function s(e){m(o,r,a,i,s,"throw",e)}i(void 0)})});return function(e){return t.apply(this,arguments)}}(),M=(0,l.useMemo)(function(){return 0===F.length},[F]);(0,l.useEffect)(function(){var e=function(){if(N.current&&k.current){var e=N.current.getBoundingClientRect(),t=k.current.getBoundingClientRect();A(t.left-e.left+t.width/2)}};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[F]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("style",{children:"\n .qrcode-list-container { overflow: visible !important; overflow-x: visible !important; overflow-y: visible !important; }\n .qrcode-list-container .card { overflow: visible !important; }\n .qrcode-list-container .card-body { overflow: visible !important; }\n .qrcode-list-container .row { overflow: visible !important; }\n @media (max-width: 768px) {\n .qrcode-actions { position: absolute; top: 10px; right: 10px; }\n }\n "}),(0,r.jsx)("div",{className:"position-relative",children:!M&&(0,r.jsx)("div",{style:{position:"absolute",top:-28,left:O,transform:"translateX(-50%)"},className:"text-muted d-none d-md-block",children:"Status"})}),!M&&(0,r.jsx)("div",{className:"mb-3 qrcode-list-container",ref:N,style:{overflow:"visible"},children:F.map(function(e){var t=function(e){if(!e.temporary)return{label:"Ativo",color:"#28a745"};var t=e.endDate?new Date("".concat(e.endDate,"T").concat(e.endTime||"23:59",":00")):null;return t&&new Date>t?{label:"Encerrado",color:"#dc3545"}:{label:"Ativo",color:"#28a745"}}(e);return(0,r.jsx)("div",{className:"card mb-3",style:{border:"1px solid #e0e0e0",borderRadius:"8px",position:"relative",overflow:"visible"},children:(0,r.jsx)("div",{className:"card-body py-3",style:{overflow:"visible"},children:(0,r.jsxs)("div",{className:"row no-gutters align-items-center",style:{overflow:"visible"},children:[(0,r.jsx)("div",{className:"col-auto pr-2 d-flex align-items-center justify-content-center",style:{width:"40px",height:"40px"},children:(0,r.jsx)("div",{className:"d-flex align-items-center justify-content-center bg-primary-soft rounded",style:{width:"40px",height:"40px"},children:"link"===e.type?(0,r.jsx)("i",{className:"fas fa-link text-primary",style:{fontSize:"1.1rem"}}):(0,r.jsx)("i",{className:"fas fa-qrcode text-primary",style:{fontSize:"1.1rem"}})})}),(0,r.jsx)("div",{className:"col-12 col-md-3 px-2 d-flex",style:{minWidth:0},children:(0,r.jsxs)("div",{className:"d-flex flex-column w-100 my-auto",style:{minWidth:0},children:[(0,r.jsx)("span",{className:"font-weight-bold text-truncate",style:{minWidth:0},children:e.name}),"spaces_control"===e.source&&(0,r.jsxs)("small",{className:"text-info",style:{fontSize:"0.75rem"},children:[(0,r.jsx)("i",{className:"fas fa-building mr-1"}),e.buildingName," - ",e.floorName]})]})}),(0,r.jsx)("div",{className:"col-12 col-md-6 px-2 d-flex",style:{minWidth:0},children:(0,r.jsx)("div",{className:"w-100 my-auto text-muted text-truncate text-center",style:{minWidth:0},children:e.description||("spaces_control"===e.source?"QR Code do Controle de Espaços":"")})}),(0,r.jsx)("div",{ref:k,className:"col-auto px-2 d-flex align-items-center",style:{flexShrink:0},children:(0,r.jsx)("span",{className:"badge",style:{backgroundColor:"#f8f9fa",color:t.color,border:"1px solid ".concat(t.color),padding:"6px 10px"},children:t.label})}),(0,r.jsxs)("div",{className:"col-auto pl-2 dropdown qrcode-actions ml-auto",style:{flexShrink:0,position:"static"},children:[(0,r.jsx)("button",{className:"btn btn-link text-muted p-0","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{fontSize:"1.2rem"},children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v"})}),(0,r.jsxs)("div",{className:"dropdown-menu dropdown-menu-right",children:[f&&"spaces_control"!==e.source&&(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(){return function(e){"spaces_control"!==e.source?(w(e),g(!0)):alert("Este QR Code foi criado no Controle de Espaços. Para editá-lo, acesse o módulo de Controle de Espaços.")}(e)},disabled:D.isPending,children:[(0,r.jsx)("i",{className:"far fa-edit mr-2"}),"Editar"]}),"qrcode"===e.type&&(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(){return I(e)},children:[(0,r.jsx)("i",{className:"fas fa-download mr-2"}),"Baixar QR Code"]}),"link"===e.type&&e.url&&(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(){navigator.clipboard.writeText(e.url),alert("Link copiado!")},children:[(0,r.jsx)("i",{className:"fas fa-copy mr-2"}),"Copiar Link"]}),h&&(0,r.jsxs)("button",{className:"dropdown-item text-danger",onClick:function(){return function(e){if(window.confirm('Tem certeza que deseja excluir "'.concat(e.name,'"?')))if("spaces_control"===e.source&&e.id.startsWith("floor-")){var t=e.id.replace("floor-","");_.mutate(t)}else D.mutate(e.id)}(e)},disabled:D.isPending||_.isPending,children:[(0,r.jsx)("i",{className:"far fa-trash-alt mr-2"}),D.isPending||_.isPending?"Excluindo...":"Excluir"]})]})]})]})})},e.id)})}),t&&(0,r.jsxs)("div",{className:"text-muted d-flex align-items-center",role:"button",onClick:function(){return g(!0)},style:{cursor:"pointer",fontSize:"0.95rem"},children:[(0,r.jsx)("i",{className:"fas fa-plus mr-2"})," Gerar",T&&(0,r.jsx)("i",{className:"fas fa-spinner fa-spin ml-2"})]}),y&&(0,r.jsx)(c.default,{show:y,onClose:function(){g(!1),w(null)},editData:j})]})}},47339(e,t,n){"use strict";n.d(t,{A:()=>s,o:()=>i});n(28706),n(76031);var r={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"},a={success:"fas fa-check-circle",error:"fas fa-exclamation-circle",warning:"fas fa-exclamation-triangle",info:"fas fa-info-circle"};function o(e){var t=e.title,n=e.message,o=e.type,i=e.duration,s=void 0===i?3e3:i,l=document.createElement("div");l.style.cssText="\n position: fixed;\n top: 20px;\n right: 20px;\n min-width: 300px;\n max-width: 500px;\n background: white;\n border-left: 4px solid ".concat(r[o],";\n border-radius: 4px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n padding: 16px 20px;\n z-index: 9999;\n font-family: 'Inter', sans-serif;\n animation: slideInRight 0.3s ease-out;\n "),l.innerHTML='\n <div style="display: flex; align-items: flex-start; gap: 12px;">\n <i class="'.concat(a[o],'" style="color: ').concat(r[o],'; font-size: 20px; margin-top: 2px;"></i>\n <div style="flex: 1;">\n ').concat(t?'<div style="font-weight: 600; font-size: 14px; color: #333; margin-bottom: 4px;">'.concat(t,"</div>"):"",'\n <div style="font-size: 13px; color: #666; line-height: 1.4;">').concat(n,'</div>\n </div>\n <button onclick="this.parentElement.parentElement.remove()" style="\n background: none;\n border: none;\n color: #999;\n font-size: 18px;\n cursor: pointer;\n padding: 0;\n margin-left: 8px;\n line-height: 1;\n ">×</button>\n </div>\n ');var c=document.createElement("style");c.textContent="\n @keyframes slideInRight {\n from {\n transform: translateX(100%);\n opacity: 0;\n }\n to {\n transform: translateX(0);\n opacity: 1;\n }\n }\n @keyframes slideOutRight {\n from {\n transform: translateX(0);\n opacity: 1;\n }\n to {\n transform: translateX(100%);\n opacity: 0;\n }\n }\n ",document.querySelector("style[data-notification-styles]")||(c.setAttribute("data-notification-styles","true"),document.head.appendChild(c)),document.body.appendChild(l),setTimeout(function(){l.style.animation="slideOutRight 0.3s ease-in",setTimeout(function(){l.remove()},300)},s)}var i={success:function(e,t){return o({message:e,type:"success",title:t})},error:function(e,t){return o({message:e,type:"error",title:t})},warning:function(e,t){return o({message:e,type:"warning",title:t})},warn:function(e,t){return o({message:e,type:"warning",title:t})},info:function(e,t){return o({message:e,type:"info",title:t})}};const s=i},48592(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>p});n(52675),n(89463),n(2259),n(50113),n(23418),n(64346),n(23792),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(88195),i=n(14463),s=n(47339),l=n(33384);function c(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return u(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(u(t={},r,function(){return this}),t),m=d.prototype=s.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,u(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return l.prototype=d,u(m,"constructor",d),u(d,"constructor",l),l.displayName="GeneratorFunction",u(d,a,"GeneratorFunction"),u(m),u(m,a,"Generator"),u(m,r,function(){return this}),u(m,"toString",function(){return"[object Generator]"}),(c=function(){return{w:o,m:p}})()}function u(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}u=function(e,t,n,r){function o(t,n){u(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},u(e,t,n,r)}function d(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function p(e){var t=e.activities,n=e.projetos,u=e.atividadesDisponiveis,m=e.currentDate,p=e.workloadHours,h=e.onActivityAdded,v=f((0,a.useState)(!1),2),b=v[0],y=v[1],g=f((0,a.useState)(null),2),x=g[0],j=g[1],w=f((0,a.useState)(null),2),S=w[0],N=w[1],k=f((0,a.useState)(null),2),C=k[0],O=k[1],A=f((0,a.useState)(""),2),E=A[0],P=A[1],F=f((0,a.useState)(""),2),T=F[0],D=F[1],_=f((0,a.useState)(""),2),I=_[0],M=_[1],R=f((0,a.useState)(""),2),z=R[0],L=R[1],q=function(){y(!1),j(null),N(null),O(null),P(""),D(""),M(""),L("")},B=function(){var e,t=(e=c().m(function e(t){var r,a,o,i;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,(0,l.submitActivityFromCard)(t,S,C,E,T,I,z,n,u,m,p);case 1:s.o.success("Atividade adicionada com sucesso!"),q(),h&&h(),e.n=3;break;case 2:e.p=2,i=e.v,console.error("Erro ao adicionar atividade a partir do planejamento:",i),o=(null==i||null===(r=i.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.message)||(null==i||null===(a=i.response)||void 0===a||null===(a=a.data)||void 0===a?void 0:a.error)||"Erro ao adicionar atividade",s.o.error(o);case 3:return e.a(2)}},e,null,[[0,2]])}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){d(o,r,a,i,s,"next",e)}function s(e){d(o,r,a,i,s,"throw",e)}i(void 0)})});return function(e){return t.apply(this,arguments)}}();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"card app-card-surface mt-3",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsx)("h5",{className:"tm-section-title mb-2",children:"Atividades Planejadas"}),(0,r.jsx)(o.A,{columns:[{key:"projeto",label:"Projeto",width:"14%"},{key:"atividade",label:"Atividade",width:"14%"},{key:"inicio",label:"Início",width:"14%",align:"center"},{key:"fim",label:"Fim",width:"14%",align:"center"},{key:"percentDia",label:"% do dia",width:"14%",align:"center"},{key:"duracao",label:"Duração",width:"14%",align:"center"},{key:"acoes",label:"Ações",width:"14%",align:"center"}],data:t,renderRow:function(e){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"ms-table-cell",title:e.projeto,children:e.projeto}),(0,r.jsx)("td",{className:"ms-table-cell",title:e.atividade,children:e.atividade}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.inicio}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.fim}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.percentDia}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.duracao}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:(0,r.jsx)("button",{className:"app-icon-button",onClick:function(){return function(e){var t,r,a,o,i=(0,l.findProjectByName)(e.projeto,n),s=(0,l.findActivityByName)(e.atividade,u);M(e.projeto),L(e.atividade),N(null!==(t=null==i?void 0:i.id)&&void 0!==t?t:null),O(null!==(r=null==s?void 0:s.id)&&void 0!==r?r:null),P(null!==(a=null==i?void 0:i.name)&&void 0!==a?a:""),D(null!==(o=null==s?void 0:s.name)&&void 0!==o?o:"");var c={startTime:e.inicio||"00:00",endTime:e.fim||"00:00",percentage:(0,l.extractPercentage)(e.percentDia),duration:(0,l.parseDurationToMinutes)(e.duracao),comment:""};j(c),y(!0)}(e)},title:"Registrar atividade planejada",children:(0,r.jsx)("i",{className:"fas fa-check ms-table-action-icon","aria-hidden":"true"})})})]})},emptyMessage:"Nenhuma atividade planejada para hoje"})]})}),(0,r.jsx)(i.default,{show:b,onClose:q,onSubmit:B,selectedProject:E||I,selectedActivity:T||z,workloadHours:p,prefilledData:x,allowProjectSelection:!0,projectOptions:n,activityOptions:u,selectedProjectId:S,selectedActivityId:C,suggestedProjectName:I,suggestedActivityName:z,onProjectChange:function(e){var t,r;if(null===e)return N(null),void P("");var a=n.find(function(t){return t.id===e});N(null!==(t=null==a?void 0:a.id)&&void 0!==t?t:null),P(null!==(r=null==a?void 0:a.name)&&void 0!==r?r:"")},onActivityChange:function(e){var t,n;if(null===e)return O(null),void D("");var r=u.find(function(t){return t.id===e});O(null!==(t=null==r?void 0:r.id)&&void 0!==t?t:null),D(null!==(n=null==r?void 0:r.name)&&void 0!==n?n:"")}})]})}},49293(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>y});n(52675),n(89463),n(2259),n(28706),n(50113),n(51629),n(23418),n(64346),n(23792),n(62062),n(72712),n(34782),n(23288),n(62010),n(2892),n(26099),n(58940),n(27495),n(38781),n(47764),n(71761),n(68156),n(23500),n(62953),n(76031);var r=n(74848),a=n(96540),o=n(33930),i=n(88195),s=n(14463),l=n(88821),c=n(39618),u=n(92268),d=n(59261),f=n(75842),m=n(81623),p=n(47339),h=n(96339);function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e){var t=e.projetos,n=e.atividadesDisponiveis,b=e.activities,y=e.currentDate,g=e.workloadHours,x=(e.onActivityEdit,e.onActivityDelete,e.onActivityAction,e.onActivityAdded),j=v((0,a.useState)(""),2),w=j[0],S=j[1],N=v((0,a.useState)(""),2),k=N[0],C=N[1],O=v((0,a.useState)(""),2),A=O[0],E=O[1],P=v((0,a.useState)(!1),2),F=P[0],T=P[1],D=v((0,a.useState)("00:00:00"),2),_=D[0],I=D[1],M=v((0,a.useState)("automatico"),2),R=M[0],z=M[1],L=v((0,a.useState)(!1),2),q=L[0],B=L[1],G=v((0,a.useState)(null),2),H=G[0],W=G[1],U=v((0,a.useState)(null),2),V=U[0],Q=U[1],K=v((0,a.useState)({}),2),$=K[0],J=K[1],Y=v((0,a.useState)({}),2),Z=Y[0],X=Y[1],ee=v((0,a.useState)(null),2),te=ee[0],ne=ee[1],re=v((0,a.useState)(null),2),ae=re[0],oe=re[1],ie=v((0,a.useState)(null),2),se=ie[0],le=ie[1],ce=v((0,a.useState)(!1),2),ue=ce[0],de=ce[1],fe=(0,a.useRef)(null),me=(0,o.I)({queryKey:["time-management","policy"],queryFn:h.Z,staleTime:6e4}).data,pe=(0,a.useMemo)(function(){return b.reduce(function(e,t){var n=t.duracao.match(/(\d+)h?\s*(\d+)?/);return n?e+60*parseInt(n[1]||"0")+parseInt(n[2]||"0"):e},0)},[b]);(0,a.useEffect)(function(){var e={},t={};b.forEach(function(n){e[n.id]=(0,a.createRef)(),t[n.id]=(0,a.createRef)()}),J(e),X(t)},[b]),(0,a.useEffect)(function(){return function(){fe.current&&clearInterval(fe.current)}},[]);var he=function(){return w?!!k||(p.o.warn("Selecione uma atividade primeiro!"),!1):(p.o.warn("Selecione um projeto primeiro!"),!1)},ve=function(){if(he()){T(!0);var e=new Date;oe(e),fe.current=setInterval(function(){var t=(new Date).getTime()-e.getTime(),n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),a=Math.floor(t%6e4/1e3);I("".concat(n.toString().padStart(2,"0"),":").concat(r.toString().padStart(2,"0"),":").concat(a.toString().padStart(2,"0")))},1e3)}},be=function(e){m.Z4.createActivity(e).then(function(){p.o.success("Atividade adicionada com sucesso!"),B(!1),ue&&(I("00:00:00"),oe(null),le(null),de(!1)),x&&x()}).catch(function(e){var t;if(console.error("Erro ao adicionar atividade:",e),422===(null===(t=e.response)||void 0===t?void 0:t.status)){var n,r,a,o=(null===(n=e.response)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.message)||(null===(r=e.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.error)||"Limite de horas diárias excedido",i=null===(a=e.response)||void 0===a||null===(a=a.data)||void 0===a?void 0:a.details;p.o.error(o),i&&console.warn("Detalhes do bloqueio:",i)}else{var s,l,c=(null===(s=e.response)||void 0===s||null===(s=s.data)||void 0===s?void 0:s.message)||(null===(l=e.response)||void 0===l||null===(l=l.data)||void 0===l?void 0:l.error)||"Erro ao adicionar atividade";p.o.error(c)}})},ye=function(e){C(e)},ge=function(e){console.log("Nova atividade:",e)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"card app-card-surface mt-3",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("div",{className:"d-flex justify-content-between align-items-center mb-3 flex-wrap",style:{gap:"8px"},children:[(0,r.jsx)("div",{style:{flex:"1 1 auto",minWidth:0,maxWidth:"100%"},children:(0,r.jsx)(d.default,{selectedProject:w,projetos:t,onProjectChange:function(e){S(e),E("")},selectedActivity:k,selectedTask:A,atividadesDisponiveis:n,onSelectActivity:ye,onSelectTask:E,onAddNewActivity:ge})}),(0,r.jsx)("div",{className:"d-flex align-items-center",style:{gap:"8px",flexShrink:0,flexGrow:0},children:(0,r.jsx)(f.default,{selectedProject:w,selectedActivity:k,onSelectActivity:ye,onAddNewActivity:ge,atividadesDisponiveis:n,counterMode:R,onModeChange:z,onStartCounter:ve,onStopCounter:function(){if(fe.current&&(clearInterval(fe.current),fe.current=null),T(!1),"00:00:00"!==_&&ae){var e=new Date,t=v(_.split(":").map(Number),2),n=60*t[0]+t[1],r=n/(60*g)*100,a=ae.toTimeString().substring(0,5),o=e.toTimeString().substring(0,5);le({startTime:a,endTime:o,percentage:r,duration:n,comment:""}),de(!0),B(!0)}I("00:00:00"),oe(null)},onAddManualTime:function(){he()&&(de(!1),le(null),B(!0))},isCounterRunning:F,counterTime:_})})]}),(0,r.jsx)(i.A,{columns:[{key:"projeto",label:"Projeto",width:"18%"},{key:"atividade",label:"Atividade",width:"18%"},{key:"task",label:"Task",width:"14%"},{key:"inicio",label:"Início",width:"10%"},{key:"fim",label:"Fim",width:"10%"},{key:"percentDia",label:"% do dia",width:"10%"},{key:"duracao",label:"Duração",width:"10%"},{key:"acoes",label:"Ações",width:"10%"}],data:b,renderRow:function(e){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"ms-table-cell",children:e.projeto}),(0,r.jsx)("td",{className:"ms-table-cell",children:e.atividade}),(0,r.jsx)("td",{className:"ms-table-cell",children:e.task||"-"}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.inicio}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.fim}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.percentDia}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.duracao}),(0,r.jsxs)("td",{className:"ms-table-cell-center position-relative",children:[(0,r.jsx)("button",{ref:Z[e.id],className:"app-icon-button",onClick:function(){return function(e){S(e.projeto),C(e.atividade),e.task?E(e.task):E(""),ne(e.id)}(e)},title:"Repetir Atividade",children:(0,r.jsx)("img",{src:"/images/icons/Group(3).svg",alt:"Play",className:"ms-table-action-icon"})}),te===e.id&&(0,r.jsx)(u.A,{show:!0,onClose:function(){return ne(null)},position:"bottom",triggerRef:Z[e.id],options:[{label:"Automático",value:"automatico",icon:"fas fa-check",selected:!1},{label:"Manual",value:"manual",icon:"fas fa-check",selected:!1}],onSelect:function(e){return t=e,ne(null),void("automatico"===t?ve():(de(!1),le(null),B(!0)));var t}}),(0,r.jsx)("button",{ref:$[e.id],className:"app-icon-button",onClick:function(){return t=e.id,void W(t);var t},title:"Comentário",children:(0,r.jsx)("img",{src:"/images/icons/Group(4).svg",alt:"Comentário",className:"ms-table-action-icon"})}),H===e.id&&(0,r.jsx)(l.default,{show:!0,onClose:function(){return W(null)},onSave:function(t){return function(e,t){var n={comment:t};m.Z4.updateActivity(e,n).then(function(){p.o.success("Comentário atualizado com sucesso!"),W(null),x&&x()}).catch(function(e){var t,n;console.error("Erro ao atualizar comentário:",e);var r=(null===(t=e.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.message)||(null===(n=e.response)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.error)||"Erro ao atualizar comentário";p.o.error(r)})}(e.id,t)},initialComment:e.comment||"",activityName:e.atividade,triggerRef:$[e.id]}),(0,r.jsx)("button",{className:"app-icon-button",onClick:function(){return function(e){Q({id:e.id,name:e.atividade,project:e.projeto})}(e)},title:"Deletar",children:(0,r.jsx)("img",{src:"/images/icons/Group(5).svg",alt:"Deletar",className:"ms-table-action-icon"})})]})]})},emptyMessage:"Nenhuma atividade registrada hoje"})]})}),(0,r.jsx)(s.default,{show:q,onClose:function(){B(!1),ue&&(I("00:00:00"),oe(null),le(null),de(!1))},onSubmit:function(e){var r=t.find(function(e){return e.name===w});if(r){var a=60*g,o={date:y,project_id:r.id,start_time:e.startTime&&"00:00"!==e.startTime?"".concat(y," ").concat(e.startTime,":00"):void 0,end_time:e.endTime&&"00:00"!==e.endTime?"".concat(y," ").concat(e.endTime,":00"):void 0,percentage:e.percentage||void 0,duration:e.duration||0,comment:e.comment||"",workload_minutes:a};if(A)m.Z4.getProjectTasks(r.id).then(function(e){var t=e.find(function(e){return e.name===A});t&&(o.project_task_id=t.id,o.activity_name_legacy=k),be(o)}).catch(function(e){console.error("Erro ao buscar task:",e),p.o.error("Erro ao buscar task selecionada")});else if(k){var i=n.find(function(e){return e.name===k});i&&(o.activity_template_id=i.id,o.activity_name_legacy=k),be(o)}else p.o.error("Selecione uma tarefa ou atividade!")}else p.o.error("Projeto não encontrado!")},selectedProject:w,selectedActivity:k,selectedTask:A,workloadHours:g,prefilledData:se,isReadOnly:ue,alreadyRegisteredMinutes:pe,dailyLimitHours:null!=me&&me.blockOvertimeTimesheet?null==me?void 0:me.dailyHoursLimit:null}),V&&(0,r.jsx)(c.default,{show:!!V,onClose:function(){return Q(null)},onConfirm:function(){V&&m.Z4.deleteActivity(V.id).then(function(){p.o.success("Atividade excluída com sucesso!"),Q(null),x&&x()}).catch(function(e){var t,n;console.error("Erro ao excluir atividade:",e);var r=(null===(t=e.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.message)||(null===(n=e.response)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.error)||"Erro ao excluir atividade";p.o.error(r)})},activityName:V.name,projectName:V.project})]})}},49299(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>b});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(27495),n(38781),n(47764),n(23500),n(62953);var r=n(74848),a=n(28482),o=n(5614),i=n(69107),s=n(46668),l=n(77984),c=n(23495),u=n(88224);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){p(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function p(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=d(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==d(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return v(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(e){var t=e.teams,n=void 0===t?[]:t;if(0===n.length)return(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"200px",color:"#5C5D5D",fontFamily:"Inter",fontSize:"14px"},children:"Sem dados disponíveis"});var d=Math.max.apply(Math,h(n.map(function(e){return e.total})).concat([20])),f=4*Math.ceil(d/4),p=f/5,v=Array.from({length:6},function(e,t){return Math.round(t*p)}),b=n.map(function(e){var t=e.regular+e.extra;return m(m({},e),{},{background:f-t})});return(0,r.jsxs)("div",{children:[(0,r.jsx)(a.u,{width:"100%",height:200,children:(0,r.jsxs)(u.E,{data:b,layout:"vertical",margin:{top:30,right:60,left:80,bottom:10},barSize:32,children:[(0,r.jsx)(i.d,{strokeDasharray:"3 3",horizontal:!1,stroke:"#E0E0E0"}),(0,r.jsx)(l.W,{type:"number",domain:[0,f],ticks:v,axisLine:!1,tickLine:!1,tick:{fill:"#5C5D5D",fontSize:12,fontFamily:"Inter"},orientation:"top"}),(0,r.jsx)(c.h,{type:"category",dataKey:"name",axisLine:!1,tickLine:!1,tick:{fill:"#5C5D5D",fontSize:12,fontWeight:500,fontFamily:"Inter"},width:70}),(0,r.jsx)(s.yP,{dataKey:"regular",stackId:"team",fill:"#186073",radius:[0,0,0,0],children:(0,r.jsx)(o.Ze,{dataKey:"regular",position:"inside",formatter:function(e){return e>0?"".concat(e,"h"):""},style:{fill:"#FFFFFF",fontSize:11,fontWeight:600,fontFamily:"Inter"}})}),(0,r.jsx)(s.yP,{dataKey:"extra",stackId:"team",fill:"#FF6D6D",radius:[0,0,0,0],children:(0,r.jsx)(o.Ze,{dataKey:"extra",position:"inside",formatter:function(e){return e>0?"".concat(e,"h"):""},style:{fill:"#FFFFFF",fontSize:11,fontWeight:600,fontFamily:"Inter"}})}),(0,r.jsx)(s.yP,{dataKey:"background",stackId:"team",fill:"rgba(214, 219, 237, 0.40)",radius:[0,4,4,0]})]})}),(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-center flex-wrap gap-3 mt-3",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{paddingRight:"12px"},children:[(0,r.jsx)("div",{style:{width:"12px",height:"12px",background:"#186073",borderRadius:"2px",marginRight:"8px"}}),(0,r.jsx)("span",{style:{fontSize:"12px",color:"#5C5D5D",fontFamily:"Inter"},children:"Horas Regulares"})]}),(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{paddingRight:"12px"},children:[(0,r.jsx)("div",{style:{width:"12px",height:"12px",background:"#FF6D6D",borderRadius:"2px",marginRight:"8px"}}),(0,r.jsx)("span",{style:{fontSize:"12px",color:"#5C5D5D",fontFamily:"Inter"},children:"Horas Extras"})]})]})]})}},49791(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>y});n(52675),n(89463),n(2259),n(23418),n(74423),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(26099),n(3362),n(27495),n(38781),n(21699),n(47764),n(71761),n(62953),n(3296),n(27208),n(48408);var r=n(74848),a=n(96540),o=n(94034),i=n(97665),s=new(n(15072).E)({defaultOptions:{queries:{staleTime:0,refetchOnWindowFocus:!1,retry:1},mutations:{retry:0}}}),l=n(76336);function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var d=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,18098))}),f=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,65342))}),m=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,52558))}),p=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,57909))}),h=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,23696))}),v=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,43432))});function b(e,t){var n=location.hash.match(/tab=([a-z-]+)$/i),r=null==n?void 0:n[1];return r?t&&!t.includes(r)?e:r:e}function y(){var e=(0,l.L)(),t=e.canView,n=e.canEdit,u=e.canDelete,y=e.canCreate,g=!0===t,x=n||u||y,j=g?"overview":"bater-ponto",w=(0,a.useMemo)(function(){return b(j)},[j]),S=c((0,a.useState)(w),2),N=S[0],k=S[1];(0,a.useEffect)(function(){var e,t;e=N,(t=new URL(location.href)).hash="tab=".concat(e),history.replaceState(null,"",t.toString())},[N]),(0,a.useEffect)(function(){return document.body.classList.add("tm-page-active"),function(){document.body.classList.remove("tm-page-active")}},[]);var C=(0,a.useMemo)(function(){if(g){var e=[{key:"overview",label:"Visão Geral"},{key:"ponto",label:"Controle de Ponto"},{key:"bater-ponto",label:"Bater Ponto"},{key:"timesheet",label:"Timesheet"},{key:"modo-foco",label:"Modo Foco"}];return x&&e.push({key:"settings",label:"Configurações"}),e}return[{key:"bater-ponto",label:"Bater Ponto"},{key:"timesheet",label:"Timesheet"},{key:"modo-foco",label:"Modo Foco"}]},[g,x]);(0,a.useEffect)(function(){var e=C.map(function(e){return e.key}),t=b(j,e);e.includes(N)||k(t)},[N,j,C]),(0,a.useEffect)(function(){var e=function(){return k(b(j,C.map(function(e){return e.key})))};return window.addEventListener("hashchange",e),function(){return window.removeEventListener("hashchange",e)}},[j,C]);return(0,r.jsx)(i.Ht,{client:s,children:(0,r.jsxs)("section",{className:"zero-padding ".concat(g?"":"page"),style:{position:"relative"},children:[(0,r.jsx)(o.A,{items:C,title:"GESTÃO DE TEMPO",activeKey:N,onChange:function(e){return k(e)}}),(0,r.jsx)("div",{className:g?"tm-shell":"",style:{position:"relative",zIndex:1},children:(0,r.jsx)(a.Suspense,{fallback:(0,r.jsx)("div",{className:"p-3",children:"Carregando…"}),children:function(){switch(N){case"overview":return(0,r.jsx)(p,{});case"ponto":return(0,r.jsx)(h,{});case"settings":return(0,r.jsx)(v,{});case"bater-ponto":return(0,r.jsx)(d,{});case"timesheet":return(0,r.jsx)(f,{});case"modo-foco":return(0,r.jsx)(m,{});default:return g?(0,r.jsx)(p,{}):(0,r.jsx)(d,{})}}()})})]})})}},50418(e,t,n){"use strict";n.d(t,{Qb:()=>d,py:()=>c});n(52675),n(89463),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362);var r=n(71083);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}var l="/time-management/justifications";function c(e){return u.apply(this,arguments)}function u(){return(u=s(a().m(function e(t){var n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.A.post("".concat(l,"/reasons"),t);case 1:return n=e.v,e.a(2,n.data)}},e)}))).apply(this,arguments)}function d(e){return f.apply(this,arguments)}function f(){return(f=s(a().m(function e(t){var n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.A.post("".concat(l,"/licenses"),t);case 1:return n=e.v,e.a(2,n.data)}},e)}))).apply(this,arguments)}},50455(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>o});n(42762);var r=n(74848),a=n(1806);function o(e){var t=e.isOpen,n=e.onClose,o=(e.memberName,e.memberInitials),i=void 0===o?"?":o,s=e.justify;if(!t)return null;var l=s&&""!==s.trim(),c=["#F59E0B","#EF4444","#10B981","#3B82F6","#8B5CF6","#EC4899"],u=c[Math.floor(Math.random()*c.length)];return(0,r.jsx)(a.A,{show:t,onClose:n,title:"Justificativa",size:"md",footer:(0,r.jsx)("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:n,style:{fontFamily:"Inter",fontSize:"14px",paddingLeft:"20px",paddingRight:"20px"},children:"Fechar"}),children:(0,r.jsx)("div",{style:{padding:"24px"},children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("div",{className:"rounded-circle text-white d-flex align-items-center justify-content-center flex-shrink-0",style:{width:40,height:40,backgroundColor:u,fontWeight:700,fontSize:"16px"},children:i}),(0,r.jsx)("div",{className:"ml-3 flex-grow-1",children:l?(0,r.jsx)("p",{className:"mb-0",style:{fontFamily:"Inter",fontSize:"14px",color:"#5C5D5D",lineHeight:"1.6",whiteSpace:"pre-wrap"},children:s}):(0,r.jsx)("p",{className:"mb-0 text-muted",style:{fontFamily:"Inter",fontWeight:500,lineHeight:"100%",letterSpacing:"0%"},children:"Ainda não foi fornecida uma justificativa para esta ocorrência."})})]})})})}},50860(e,t,n){"use strict";n.d(t,{A:()=>c});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23792),n(89572),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(47764),n(23500),n(62953);var r=n(74848),a=n(96540);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){var t=e.title,n=e.subtitle,o=e.right,i=e.children,l=e.className,c=e.style;return(0,a.useEffect)(function(){var e=window;e&&e.$&&"function"==typeof e.$.fn.tooltip&&e.$('[data-toggle="tooltip"]').tooltip({container:"body",html:!0,boundary:"viewport",placement:"auto"})},[]),(0,r.jsxs)("section",{className:"content options-section-project ".concat(null!=l?l:""),style:s(s({},c),{},{position:"relative",zIndex:1}),children:[(t||n||o)&&(0,r.jsxs)("div",{className:"d-flex justify-content-between align-items-start mb-3 mt-3",children:[(0,r.jsxs)("div",{children:[t&&(0,r.jsx)("h4",{className:"meta-title mb-2",children:t}),n&&(0,r.jsx)("p",{className:"meta-subtitle mb-0",children:n})]}),o&&(0,r.jsx)("div",{className:"ms-3",children:o})]}),i]})}},52354(e,t,n){"use strict";n.d(t,{F:()=>r});var r=n(71083).A.create({baseURL:"/",timeout:25e3,withCredentials:!0})},52558(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>O});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(2892),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(97665),i=n(33930),s=n(57097),l=n(34559),c=n(69794),u=n(97839),d=n(26723),f=n(50860),m=(n(94170),n(59904),n(84185),n(40875),n(79432),n(10287),n(3362),n(52354));function p(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return h(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(h(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,h(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,h(d,"constructor",c),h(c,"constructor",l),l.displayName="GeneratorFunction",h(c,a,"GeneratorFunction"),h(d),h(d,a,"Generator"),h(d,r,function(){return this}),h(d,"toString",function(){return"[object Generator]"}),(p=function(){return{w:o,m:f}})()}function h(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}h=function(e,t,n,r){function o(t,n){h(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},h(e,t,n,r)}function v(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function b(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){v(o,r,a,i,s,"next",e)}function s(e){v(o,r,a,i,s,"throw",e)}i(void 0)})}}var y="/api/time/focus-mode";function g(){return x.apply(this,arguments)}function x(){return(x=b(p().m(function e(){var t,n;return p().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,m.F.get(y);case 1:if(t=e.v,(n=t.data)&&0!==Object.keys(n).length){e.n=2;break}return e.a(2,null);case 2:return e.a(2,n)}},e)}))).apply(this,arguments)}function j(e){return w.apply(this,arguments)}function w(){return(w=b(p().m(function e(t){var n,r;return p().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,m.F.put(y,t);case 1:return n=e.v,r=n.data,e.a(2,r)}},e)}))).apply(this,arguments)}var S=n(20826);function N(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return k(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var C=["time-management","focus-mode"];function O(){var e=(0,o.jE)(),t=N(a.useState(!1),2),n=t[0],m=t[1],p=(0,i.I)({queryKey:C,queryFn:g,staleTime:0}),h=p.data,v=(p.isLoading,(0,s.n)({mutationFn:j,onSuccess:function(){return e.invalidateQueries({queryKey:C})}})),b=N(a.useState(""),2),y=b[0],x=b[1],w=N(a.useState(""),2),k=w[0],O=w[1],A=N(a.useState(""),2),E=A[0],P=A[1],F=N(a.useState(""),2),T=F[0],D=F[1],_=N(a.useState(""),2),I=_[0],M=_[1];(0,a.useEffect)(function(){var e,t,n,r,a;h&&(x(null!==(e=h.clock)&&void 0!==e?e:""),O(null!==(t=h.method)&&void 0!==t?t:""),P(null!==(n=h.background)&&void 0!==n?n:""),D(null!==(r=h.workMinutes)&&void 0!==r?r:""),M(null!==(a=h.breakMinutes)&&void 0!==a?a:""))},[h]),(0,a.useEffect)(function(){"pomodoro"===k&&(D(25),M(5)),"regra_52_17"===k&&(D(52),M(17))},[k]);var R="personalizado"===k,z=!(!y||!k||!E||R&&(!T||!I));return(0,r.jsx)("div",{style:{maxWidth:"1400px",margin:"0 auto"},children:(0,r.jsxs)(f.A,{children:[(0,r.jsxs)("div",{className:"card app-card-surface",children:[(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"tm-label d-block mb-1",children:"Tipo de Relógio"}),(0,r.jsx)(l.A,{className:"w-100",options:[{label:"Digital",value:"digital"}],placeholder:"Selecione o tipo de relógio",size:"md",value:y||void 0,onChange:function(e){return x(e)}})]}),(0,r.jsxs)("div",{className:"form-group mt-3",children:[(0,r.jsx)("label",{className:"tm-label d-block mb-1",children:"Métodos de Foco"}),(0,r.jsx)(l.A,{className:"w-100",options:[{label:"Pomodoro (25/5)",value:"pomodoro"},{label:"Regra 52/17",value:"regra_52_17"},{label:"Personalizado",value:"personalizado"}],placeholder:"Selecione o modo que melhor funciona para você",size:"md",value:k||void 0,onChange:function(e){return O(e)}})]}),R&&(0,r.jsxs)("div",{className:"row mt-3",children:[(0,r.jsxs)("div",{className:"col-md-6",children:[(0,r.jsx)("label",{className:"tm-label d-block mb-1",children:"Minutos de foco"}),(0,r.jsx)("input",{type:"number",className:"form-control",placeholder:"Ex.: 30"})]}),(0,r.jsxs)("div",{className:"col-md-6 mt-3 mt-md-0",children:[(0,r.jsx)("label",{className:"tm-label d-block mb-1",children:"Minutos de descanso"}),(0,r.jsx)("input",{type:"number",className:"form-control",placeholder:"Ex.: 5"})]})]}),(0,r.jsx)("div",{className:"mt-4",children:(0,r.jsx)(u.default,{method:k||""})}),(0,r.jsxs)("div",{className:"mt-4",children:[(0,r.jsx)("label",{className:"tm-label d-block mb-2",children:"Escolha o Plano de Fundo"}),(0,r.jsx)(c.default,{selected:E||"",onSelect:function(e){return P(e)}})]})]}),(0,r.jsxs)("div",{className:"card-footer d-flex justify-content-end gap-2",children:[(0,r.jsx)("button",{className:"btn tm-btn-cancel mr-2",disabled:!z,onClick:function(){return m(!0)},children:"Iniciar"}),(0,r.jsx)(S.A,{label:"Salvar Alterações",variant:"solid",onClick:function(){z&&v.mutate({clock:y,method:k,background:E,workMinutes:""===T?null:Number(T),breakMinutes:""===I?null:Number(I)})},className:"px-3 py-1",style:{height:"38px",paddingLeft:"12px",paddingRight:"12px",paddingTop:"6px",paddingBottom:"6px"}})]})]}),(0,r.jsx)(d.default,{open:n,onClose:function(){return m(!1)},clock:y||"digital",background:E||"black",workMinutes:Number(T||25),breakMinutes:Number(I||5)})]})})}},52798(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>m});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(58940),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(33930),o=n(97665),i=n(57097),s=n(96339),l=n(96540),c=n(76336);function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var f=["time-management","policy"];function m(){var e=(0,c.L)().canEdit,t=(0,o.jE)(),n=u((0,l.useState)(!1),2),d=n[0],m=n[1],p=u((0,l.useState)(!1),2),h=p[0],v=p[1],b=u((0,l.useState)(!1),2),y=b[0],g=b[1],x=u((0,l.useState)(!1),2),j=x[0],w=x[1],S=u((0,l.useState)(5),2),N=S[0],k=S[1],C=u((0,l.useState)(10),2),O=C[0],A=C[1],E=u((0,l.useState)(2),2),P=E[0],F=E[1],T=(0,a.I)({queryKey:f,queryFn:s.Z}),D=T.data;T.isFetching;(0,l.useEffect)(function(){D&&(m(D.enableAdvanceTolerance),v(D.enableDelayTolerance),g(D.enableDistanceTolerance),w(D.editPoint),k(D.advanceTolerance||5),A(D.delayTolerance||10),F(D.distanceTolerance||2))},[D]);var _=(0,i.n)({mutationFn:function(e){return(0,s.E)(e)},onSuccess:function(){t.invalidateQueries({queryKey:f})}}),I=function(){D&&_.mutate({enableAdvanceTolerance:d,enableDelayTolerance:h,enableDistanceTolerance:y,editPoint:j,advanceTolerance:d?N:0,delayTolerance:h?O:0,distanceTolerance:y?P:0})};return(0,l.useEffect)(function(){D&&I()},[d,h,y,j]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-12 col-md-6 col-xl-3 mb-3",children:(0,r.jsx)("div",{className:"card h-100 tm-card-mobile-auto ".concat(d?"border-primary bg-primary-soft":""),style:{border:"1px solid #e0e0e0",borderRadius:"8px"},children:(0,r.jsxs)("div",{className:"card-body d-flex flex-column",children:[(0,r.jsxs)("div",{className:"custom-control custom-checkbox mb-2",children:[(0,r.jsx)("input",{type:"checkbox",id:"pol-adiant",className:"custom-control-input",checked:d,onChange:function(e){return m(e.target.checked)},disabled:!e}),(0,r.jsxs)("label",{className:"custom-control-label ".concat(d?"text-primary":""),htmlFor:"pol-adiant",children:["Tolerância para adiantamento de",!e&&(0,r.jsx)("i",{className:"fas fa-lock ml-2 text-muted",style:{fontSize:"0.7rem"}})]})]}),(0,r.jsx)("small",{className:"text-muted d-block mb-2",style:{fontSize:"0.85rem"},children:"Define quantos minutos antes do horário previsto o colaborador pode bater o ponto sem ser considerado antecipado."}),(0,r.jsxs)("div",{className:"input-group mt-auto",children:[(0,r.jsx)("input",{type:"number",className:"form-control",value:N,onChange:function(e){return k(parseInt(e.target.value)||0)},onBlur:I,disabled:!d||!e,min:"0"}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("span",{className:"input-group-text",children:"min"})})]})]})})}),(0,r.jsx)("div",{className:"col-12 col-md-6 col-xl-3 mb-3",children:(0,r.jsx)("div",{className:"card h-100 tm-card-mobile-auto ".concat(h?"border-primary bg-primary-soft":""),style:{border:"1px solid #e0e0e0",borderRadius:"8px"},children:(0,r.jsxs)("div",{className:"card-body d-flex flex-column",children:[(0,r.jsxs)("div",{className:"custom-control custom-checkbox mb-2",children:[(0,r.jsx)("input",{type:"checkbox",id:"pol-atraso",className:"custom-control-input",checked:h,onChange:function(e){return v(e.target.checked)},disabled:!e}),(0,r.jsxs)("label",{className:"custom-control-label ".concat(h?"text-primary":""),htmlFor:"pol-atraso",children:["Tolerância para atraso de",!e&&(0,r.jsx)("i",{className:"fas fa-lock ml-2 text-muted",style:{fontSize:"0.7rem"}})]})]}),(0,r.jsx)("small",{className:"text-muted d-block mb-2",style:{fontSize:"0.85rem"},children:"Define quantos minutos após o horário previsto o colaborador pode bater o ponto sem ser considerado em atraso."}),(0,r.jsxs)("div",{className:"input-group mt-auto",children:[(0,r.jsx)("input",{type:"number",className:"form-control",value:O,onChange:function(e){return A(parseInt(e.target.value)||0)},onBlur:I,disabled:!h||!e,min:"0"}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("span",{className:"input-group-text",children:"min"})})]})]})})}),(0,r.jsx)("div",{className:"col-12 col-md-6 col-xl-3 mb-3",children:(0,r.jsx)("div",{className:"card h-100 tm-card-mobile-auto ".concat(y?"border-primary bg-primary-soft":""),style:{border:"1px solid #e0e0e0",borderRadius:"8px"},children:(0,r.jsxs)("div",{className:"card-body d-flex flex-column",children:[(0,r.jsxs)("div",{className:"custom-control custom-checkbox mb-2",children:[(0,r.jsx)("input",{type:"checkbox",id:"pol-dist",className:"custom-control-input",checked:y,onChange:function(e){return g(e.target.checked)},disabled:!e}),(0,r.jsxs)("label",{className:"custom-control-label ".concat(y?"text-primary":""),htmlFor:"pol-dist",children:["Tolerância para distância de",!e&&(0,r.jsx)("i",{className:"fas fa-lock ml-2 text-muted",style:{fontSize:"0.7rem"}})]})]}),(0,r.jsx)("small",{className:"text-muted d-block mb-2",style:{fontSize:"0.85rem"},children:"Define o raio de distância permitido em torno do local cadastrado para validar o ponto por geolocalização."}),(0,r.jsxs)("div",{className:"input-group mt-auto",children:[(0,r.jsx)("input",{type:"number",className:"form-control",value:P,onChange:function(e){return F(parseInt(e.target.value)||0)},onBlur:I,disabled:!y||!e,min:"0"}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("span",{className:"input-group-text",children:"km"})})]})]})})}),(0,r.jsx)("div",{className:"col-12 col-md-6 col-xl-3 mb-3",children:(0,r.jsx)("div",{className:"card h-100 tm-card-mobile-auto ".concat(j?"border-primary bg-primary-soft":""),style:{border:"1px solid #e0e0e0",borderRadius:"8px"},children:(0,r.jsxs)("div",{className:"card-body d-flex flex-column",children:[(0,r.jsxs)("div",{className:"custom-control custom-checkbox mb-2",children:[(0,r.jsx)("input",{type:"checkbox",id:"pol-edicao",className:"custom-control-input",checked:j,onChange:function(e){return w(e.target.checked)},disabled:!e}),(0,r.jsxs)("label",{className:"custom-control-label ".concat(j?"text-primary":""),htmlFor:"pol-edicao",children:["Edição de Ponto",!e&&(0,r.jsx)("i",{className:"fas fa-lock ml-2 text-muted",style:{fontSize:"0.7rem"}})]})]}),(0,r.jsx)("small",{className:"text-muted",style:{fontSize:"0.85rem"},children:"O membro poderá editar seu ponto caso ocorra alguma ocorrência leve."})]})})})]}),_.isPending&&(0,r.jsxs)("div",{className:"text-muted mt-2",children:[(0,r.jsx)("i",{className:"fas fa-spinner fa-spin mr-2"}),"Salvando..."]})]})}},54958(e,t,n){"use strict";var r=n(3066);n(28706),n(51629),n(23792),n(48598),n(62062),n(79432),n(26099),n(27495),n(25440),n(23500),n(62953);var a,o,i;(0,r.E)(n(86628));a=n(97677),i={},(o=a).keys().forEach(function(e){return i[e]=o(e).default}),window.resolveReactComponent=function(e){var t=i["./".concat(e,".jsx")]||i["./".concat(e,".tsx")];if(void 0===t){var n=Object.keys(i).map(function(e){return e.replace("./","").replace(".jsx","").replace(".tsx","")});throw new Error('React controller "'.concat(e,'" does not exist. Possible values: ').concat(n.join(", ")))}return t},console.log("Symfony UX React bootstrap (TS) loaded"),console.log("React UX app.js loaded successfully")},55098(e,t,n){"use strict";n.d(t,{KI:()=>u,Te:()=>v,WS:()=>f,iM:()=>l,rI:()=>p});n(52675),n(89463),n(28706),n(51629),n(23792),n(34782),n(1688),n(23288),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(38781),n(47764),n(23500),n(62953),n(3296),n(27208),n(48408);var r=n(69404);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}function l(e){return c.apply(this,arguments)}function c(){return(c=s(a().m(function e(t){var n,o,i,s;return a().w(function(e){for(;;)switch(e.n){case 0:return n=new URLSearchParams,null!=t&&t.start_date&&n.append("start_date",t.start_date),null!=t&&t.end_date&&n.append("end_date",t.end_date),null!=t&&t.types&&t.types.length>0&&t.types.forEach(function(e){n.append("types[]",e)}),null!=t&&t.time_start&&n.append("time_start",t.time_start),null!=t&&t.time_end&&n.append("time_end",t.time_end),null!=t&&t.status&&n.append("status",t.status),null!=t&&t.role&&n.append("role",t.role),null!=t&&t.keyword&&n.append("keyword",t.keyword),null!=t&&t.page&&t.page>0&&n.append("page",t.page.toString()),null!=t&&t.limit&&t.limit>0&&n.append("limit",t.limit.toString()),o=n.toString(),i="/time-management/members-occurrences".concat(o?"?".concat(o):""),e.n=1,r.u.get(i);case 1:return s=e.v,e.a(2,s.data)}},e)}))).apply(this,arguments)}function u(e,t){return d.apply(this,arguments)}function d(){return(d=s(a().m(function e(t,n){var o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.u.post("/time-management/occurrence/approve?id=".concat(t,"&approved=").concat(n));case 1:return o=e.v,e.a(2,o.data)}},e)}))).apply(this,arguments)}function f(){return m.apply(this,arguments)}function m(){return m=s(a().m(function e(){var t,n,o,i,s,l,c,u=arguments;return a().w(function(e){for(;;)switch(e.n){case 0:return t=u.length>0&&void 0!==u[0]?u[0]:1,n=u.length>1&&void 0!==u[1]?u[1]:10,o=u.length>2?u[2]:void 0,(i=new URLSearchParams).append("page",t.toString()),i.append("limit",n.toString()),null!=o&&o.start_date&&i.append("start_date",o.start_date),null!=o&&o.end_date&&i.append("end_date",o.end_date),null!=o&&o.recordType&&i.append("record_type",o.recordType),null!=o&&o.validatedBy&&i.append("validated_by",o.validatedBy),null!=o&&o.channel&&i.append("channel",o.channel),null!=o&&o.mode&&i.append("mode",o.mode),null!=o&&o.keyword&&i.append("keyword",o.keyword),s=i.toString(),l="/time-management/clock-in-history?".concat(s),e.n=1,r.u.get(l);case 1:return c=e.v,e.a(2,c.data)}},e)})),m.apply(this,arguments)}function p(e){return h.apply(this,arguments)}function h(){return(h=s(a().m(function e(t){var n,o,i,s,l,c,u,d;return a().w(function(e){for(;;)switch(e.n){case 0:return n=new URLSearchParams,null!=t&&t.start_date&&n.append("start_date",t.start_date),null!=t&&t.end_date&&n.append("end_date",t.end_date),null!=t&&t.recordType&&n.append("record_type",t.recordType),null!=t&&t.validatedBy&&n.append("validated_by",t.validatedBy),null!=t&&t.channel&&n.append("channel",t.channel),null!=t&&t.mode&&n.append("mode",t.mode),null!=t&&t.keyword&&n.append("keyword",t.keyword),o=n.toString(),i="/time-management/clock-in-history/export".concat(o?"?".concat(o):""),e.n=1,r.u.get(i,{responseType:"blob"});case 1:s=e.v,l=new Blob([s.data],{type:"text/csv"}),c=window.URL.createObjectURL(l),(u=document.createElement("a")).href=c,d=(new Date).toISOString().slice(0,10),u.download="historico-pontos-".concat(d,".csv"),document.body.appendChild(u),u.click(),document.body.removeChild(u),window.URL.revokeObjectURL(c);case 2:return e.a(2)}},e)}))).apply(this,arguments)}function v(e){return b.apply(this,arguments)}function b(){return(b=s(a().m(function e(t){var n,o,i,s;return a().w(function(e){for(;;)switch(e.n){case 0:return n=new URLSearchParams,t&&n.append("date",t),o=n.toString(),i="/time-management/daily-statistics".concat(o?"?".concat(o):""),e.n=1,r.u.get(i);case 1:return s=e.v,e.a(2,s.data)}},e)}))).apply(this,arguments)}},55278(e,t,n){"use strict";n.d(t,{Eq:()=>f,Nt:()=>v,vD:()=>l,xD:()=>u,yJ:()=>p,zR:()=>y});n(52675),n(89463),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362);var r=n(52354);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}function l(){return c.apply(this,arguments)}function c(){return(c=s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/can-view-maps");case 1:return t=e.v,n=t.data,e.a(2,n.can_view_maps)}},e)}))).apply(this,arguments)}function u(e){return d.apply(this,arguments)}function d(){return(d=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.put("/time-management/can-view-maps",{can_view_maps:t});case 1:return n=e.v,o=n.data,e.a(2,o.can_view_maps)}},e)}))).apply(this,arguments)}function f(){return m.apply(this,arguments)}function m(){return(m=s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/location");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function p(e){return h.apply(this,arguments)}function h(){return(h=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.post("/time-management/location",t);case 1:return n=e.v,o=n.data,e.a(2,o.data)}},e)}))).apply(this,arguments)}function v(e,t){return b.apply(this,arguments)}function b(){return(b=s(a().m(function e(t,n){var o,i;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.put("/time-management/location/".concat(t),n);case 1:return o=e.v,i=o.data,e.a(2,i.data)}},e)}))).apply(this,arguments)}function y(e){return g.apply(this,arguments)}function g(){return(g=s(a().m(function e(t){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.delete("/time-management/location/".concat(t));case 1:return e.a(2)}},e)}))).apply(this,arguments)}},55801(e,t,n){"use strict";n.d(t,{G8:()=>l,Tt:()=>f,iY:()=>u,kc:()=>p});n(52675),n(89463),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362);var r=n(52354);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}function l(){return c.apply(this,arguments)}function c(){return(c=s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/validation");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function u(e){return d.apply(this,arguments)}function d(){return(d=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.post("/time-management/validation",{mode:t});case 1:return n=e.v,o=n.data,e.a(2,o.data)}},e)}))).apply(this,arguments)}function f(e){return m.apply(this,arguments)}function m(){return(m=s(a().m(function e(t){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.post("/time-management/validation/others",{type:t});case 1:return e.a(2)}},e)}))).apply(this,arguments)}function p(e){return h.apply(this,arguments)}function h(){return(h=s(a().m(function e(t){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.delete("/time-management/validation/others/".concat(t));case 1:return e.a(2)}},e)}))).apply(this,arguments)}},57909(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>O});n(52675),n(89463),n(2259),n(28706),n(2008),n(50113),n(78350),n(23418),n(64346),n(23792),n(62062),n(34782),n(30237),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(68156),n(42762),n(62953);var r=n(74848),a=n(96540),o=n(49785),i=n(33930),s=n(10280),l=n(84136),c=n(55098),u=n(69404);function d(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return f(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(f(t={},r,function(){return this}),t),m=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,f(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return l.prototype=c,f(m,"constructor",c),f(c,"constructor",l),l.displayName="GeneratorFunction",f(c,a,"GeneratorFunction"),f(m),f(m,a,"Generator"),f(m,r,function(){return this}),f(m,"toString",function(){return"[object Generator]"}),(d=function(){return{w:o,m:p}})()}function f(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}f=function(e,t,n,r){function o(t,n){f(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},f(e,t,n,r)}function m(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function p(){return h.apply(this,arguments)}function h(){var e;return e=d().m(function e(){var t,n;return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,u.u.get("/time-management/members/roles");case 1:return t=e.v,n=Array.isArray(t.data)?t.data:t.data.data||[],e.a(2,n)}},e)}),h=function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){m(o,r,a,i,s,"next",e)}function s(e){m(o,r,a,i,s,"throw",e)}i(void 0)})},h.apply(this,arguments)}n(76031);function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=v((0,a.useState)(e),2),r=n[0],o=n[1];return(0,a.useEffect)(function(){var n=setTimeout(function(){o(e)},t);return function(){clearTimeout(n)}},[e,t]),r}var g=n(72210),x=n(73215),j=n(50860);function w(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return S(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(S(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,S(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,S(d,"constructor",c),S(c,"constructor",l),l.displayName="GeneratorFunction",S(c,a,"GeneratorFunction"),S(d),S(d,a,"Generator"),S(d,r,function(){return this}),S(d,"toString",function(){return"[object Generator]"}),(w=function(){return{w:o,m:f}})()}function S(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}S=function(e,t,n,r){function o(t,n){S(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},S(e,t,n,r)}function N(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return C(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function O(){var e,t,n,u,d,f,m,h,v,b,S,C,O,A,E,P=(0,o.mN)({defaultValues:{selectedDate:(C=new Date,O=C.getFullYear(),A=String(C.getMonth()+1).padStart(2,"0"),E=String(C.getDate()).padStart(2,"0"),"".concat(O,"-").concat(A,"-").concat(E)),occurrencePage:1,occurrencePageSize:10,historyPage:1,historyPageSize:10,searchKeyword:"",selectedRole:"",roleString:"",occurrenceType:"",timeStart:"",timeEnd:"",status:"",historyRecordType:"",historyValidatedBy:"",historyChannel:"",historyMode:"",historySearchKeyword:""}}),F=P.watch,T=P.setValue,D=k((0,a.useState)(!1),2),_=(D[0],D[1],k((0,a.useState)(!1),2)),I=_[0],M=_[1],R=F("selectedDate"),z=F("occurrencePage"),L=F("occurrencePageSize"),q=F("historyPage"),B=F("historyPageSize"),G=F("searchKeyword"),H=F("selectedRole"),W=F("roleString"),U=F("occurrenceType"),V=F("timeStart"),Q=F("timeEnd"),K=F("status"),$=F("historyRecordType"),J=F("historyValidatedBy"),Y=F("historyChannel"),Z=F("historyMode"),X=F("historySearchKeyword"),ee=y(G,500),te=y(X,500),ne=(0,a.useMemo)(function(){var e={};return R&&(e.start_date=R,e.end_date=R),U&&(e.types=[U]),V&&(e.time_start=V),Q&&(e.time_end=Q),K&&(e.status=K),W&&(e.role=W),ee&&(e.keyword=ee),e.page=z,e.limit=L,e},[R,U,V,Q,K,W,ee,z,L]),re=(0,i.I)({queryKey:["time-management","overview","members-occurrences",ne],queryFn:function(){return(0,c.iM)(ne)},staleTime:6e4,refetchInterval:6e4}),ae=re.data,oe=re.isLoading,ie=(0,i.I)({queryKey:["time-management","member-roles"],queryFn:p,staleTime:3e5}),se=ie.data,le=ie.isLoading,ce=(0,i.I)({queryKey:["time-management","overview","kpis",R],queryFn:function(){return(0,c.Te)(R)},staleTime:3e4,refetchInterval:3e4}),ue=ce.data,de=ce.isLoading,fe=(0,a.useMemo)(function(){var e={page:q,limit:B};return R&&(e.start_date=R,e.end_date=R),$&&(e.recordType=$),J&&(e.validatedBy=J),Y&&(e.channel=Y),Z&&(e.mode=Z),te&&(e.keyword=te),e},[R,q,B,$,J,Y,Z,te]),me=(0,i.I)({queryKey:["time-management","overview","clock-in-history",fe],queryFn:function(){return(0,c.WS)(q,B,fe)},staleTime:6e4,refetchInterval:6e4}),pe=me.data,he=(me.isLoading,(0,a.useMemo)(function(){var e;return null!==(e=null==ae?void 0:ae.data.flatMap(function(e){return e.occurrences.map(function(t){var n="".concat(e.member.firstName," ").concat(e.member.lastName).trim(),r=t.hitSpotTime.time?t.hitSpotTime.time.substring(0,5):"-",a=l.L[t.type]||t.type;return{id:t.id,nome:n,iniciais:void 0,avatarBg:void 0,ocorrencia:a,horario:r,status:(0,l.j)(t.severity),justify:t.justify||null}})}))&&void 0!==e?e:[]},[ae])),ve=(0,a.useMemo)(function(){if(console.log("🔍 rolesData recebida:",se),console.log("🔍 É array?",Array.isArray(se)),!se||!Array.isArray(se))return console.log("⚠️ rolesData não é um array válido"),[];console.log("📊 Roles da API (array):",se);var e=se.filter(function(e){var t=e.role&&""!==e.role.trim();return t||console.log("⚠️ Role inválida filtrada:",e),t}).map(function(e){return{value:e.id,label:e.role}});return console.log("✅ Role options transformadas:",e),e},[se]),be=(0,a.useMemo)(function(){var e;return null!==(e=null==pe?void 0:pe.data.map(function(e){return{id:e.id,nome:e.memberName,data:e.time,tipo:e.recordType,validacao:e.validatedBy,canal:e.channel,modo:e.mode,memberId:e.memberId,type:e.type,status:e.status,latitude:e.latitude,longitude:e.longitude,selfie:e.selfie,print:e.print,createdAt:e.createdAt,updatedAt:e.updatedAt,justificationType:e.justificationType,justificationId:e.justificationId,justification:e.justification}}))&&void 0!==e?e:[]},[pe]),ye=function(){var e,t=(e=w().m(function e(){var t,n;return w().w(function(e){for(;;)switch(e.p=e.n){case 0:return M(!0),e.p=1,t={},$&&(t.recordType=$),J&&(t.validatedBy=J),Y&&(t.channel=Y),Z&&(t.mode=Z),te&&(t.keyword=te),e.n=2,(0,c.rI)(t);case 2:e.n=4;break;case 3:e.p=3,n=e.v,console.error("Erro ao exportar CSV:",n),alert("Erro ao exportar arquivo CSV");case 4:return e.p=4,M(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){N(o,r,a,i,s,"next",e)}function s(e){N(o,r,a,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}(),ge=function(e){var t=new Date(R+"T00:00:00");t.setDate(t.getDate()+e);var n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");T("selectedDate","".concat(n,"-").concat(r,"-").concat(a)),T("occurrencePage",1),T("historyPage",1)};return(0,r.jsxs)(j.A,{children:[(0,r.jsx)("div",{className:"mb-3",style:{display:"flex",justifyContent:"flex-end",alignItems:"center",marginTop:"16px"},children:(0,r.jsxs)("div",{style:{position:"relative",display:"inline-block"},children:[(0,r.jsx)("input",{ref:function(e){if(e){var t=e.nextElementSibling,n=null==t?void 0:t.querySelector(".tm-date-trigger");n&&!n.onclick&&(n.onclick=function(){e.showPicker?e.showPicker():e.click()})}},type:"date",value:R,onChange:function(e){T("selectedDate",e.target.value),T("occurrencePage",1),T("historyPage",1)},style:{position:"absolute",opacity:0,width:"100%",height:"100%",cursor:"pointer",zIndex:-1,pointerEvents:"none"}}),(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{gap:8},children:[(0,r.jsx)("button",{type:"button",className:"btn btn-link text-muted p-1",onClick:function(e){e.stopPropagation(),ge(-1)},"aria-label":"Dia anterior",children:(0,r.jsx)("i",{className:"fas fa-chevron-left"})}),(0,r.jsx)("div",{className:"tm-date-trigger",style:{fontFamily:"Inter, sans-serif",fontSize:"14px",fontWeight:400,color:"#186073",userSelect:"none"},children:function(e){if(!e)return"";var t=new Date(e+"T00:00:00"),n=["Dom.","Seg.","Ter.","Qua.","Qui.","Sex.","Sáb."][t.getDay()],r=t.getDate(),a=["Jan.","Fev.","Mar.","Abr.","Mai.","Jun.","Jul.","Ago.","Set.","Out.","Nov.","Dez."][t.getMonth()],o=t.getFullYear();return"".concat(n," ").concat(r," de ").concat(a," ").concat(o)}(R)}),(0,r.jsx)("button",{type:"button",className:"btn btn-link text-muted p-1",onClick:function(e){e.stopPropagation(),ge(1)},"aria-label":"Próximo dia",children:(0,r.jsx)("i",{className:"fas fa-chevron-right"})})]})]})}),(0,r.jsx)("div",{className:"mt-3",children:(0,r.jsxs)("div",{className:"row justify-content-start align-items-stretch",children:[(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg mb-2",children:(0,r.jsx)(s.A,{value:de?"...":null!==(e=null==ue?void 0:ue.working)&&void 0!==e?e:0,label:"Membros trabalhando",variant:"green",className:"rounded-lg elevation-1 h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg mb-2",children:(0,r.jsx)(s.A,{value:de?"...":null!==(t=null==ue?void 0:ue.onBreak)&&void 0!==t?t:0,label:"Membros em pausa",variant:"blue",className:"rounded-lg elevation-1 h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg mb-2",children:(0,r.jsx)(s.A,{value:de?"...":null!==(n=null==ue?void 0:ue.absences)&&void 0!==n?n:0,label:"Ausência no dia",variant:"red",className:"rounded-lg elevation-1 h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg mb-2",children:(0,r.jsx)(s.A,{value:de?"...":null!==(u=null==ue?void 0:ue.onLicense)&&void 0!==u?u:0,label:"Membros em licença",variant:"white",className:"rounded-lg elevation-1 h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg mb-2",children:(0,r.jsx)(s.A,{value:de?"...":null!==(d=null==ue?void 0:ue.pendingOccurrences)&&void 0!==d?d:0,label:"Ocorrências pendentes",variant:"gray",className:"rounded-lg elevation-1 h-100"})})]})}),(0,r.jsx)(g.default,{data:he,title:"Ocorrências",searchKeyword:G,onSearchChange:function(e){return T("searchKeyword",e)},roleOptions:ve,selectedRole:H,onRoleChange:function(e){console.log("Função selecionada (ID):",e),T("selectedRole",e);var t=null==se?void 0:se.find(function(t){return t.id===e}),n=(null==t?void 0:t.role)||"";console.log("Role string para backend:",n),T("roleString",n)},isLoading:oe,isLoadingRoles:le,onApplyFilters:function(e){T("occurrenceType",e.occurrenceType),T("timeStart",e.timeStart),T("timeEnd",e.timeEnd),T("status",e.status),T("occurrencePage",1)},onClearFilters:function(){T("occurrenceType",""),T("timeStart",""),T("timeEnd",""),T("status",""),T("occurrencePage",1)},hasActiveFilters:""!==U||""!==V||""!==Q||""!==K,total:null!==(f=null==ae||null===(m=ae.pagination)||void 0===m?void 0:m.total)&&void 0!==f?f:0,totalPages:null==ae||null===(h=ae.pagination)||void 0===h?void 0:h.totalPages,page:z,pageSize:L,onPageChange:function(e){return T("occurrencePage",e)},onPageSizeChange:function(e){return T("occurrencePageSize",e)}}),(0,r.jsx)(x.default,{data:be,total:null!==(v=null==pe||null===(b=pe.pagination)||void 0===b?void 0:b.total)&&void 0!==v?v:0,totalPages:null==pe||null===(S=pe.pagination)||void 0===S?void 0:S.total_pages,page:q,pageSize:B,onPageChange:function(e){return T("historyPage",e)},onPageSizeChange:function(e){return T("historyPageSize",e)},hasActiveFilters:""!==$||""!==J||""!==Y||""!==Z,searchKeyword:X,onSearchChange:function(e){return T("historySearchKeyword",e)},onExportCSV:ye,isExporting:I,onApplyFilters:function(e){T("historyRecordType",e.recordType),T("historyValidatedBy",e.validatedBy),T("historyChannel",e.channel),T("historyMode",e.mode),T("historyPage",1)},onClearFilters:function(){T("historyRecordType",""),T("historyValidatedBy",""),T("historyChannel",""),T("historyMode",""),T("historyPage",1)}})]})}},59261(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>d});n(52675),n(89463),n(2259),n(50113),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(33930),i=n(73638);function s(e){var t=e.show,n=e.onClose,a=e.atividades,o=e.selectedActivity,s=e.onSelectActivity,l=e.onAddNew,c=e.triggerRef,u=e.title,d=void 0===u?"Selecionar Atividade":u,f=e.hideAddNew,m=void 0===f||f,p=e.centered,h=void 0!==p&&p;return(0,r.jsxs)(i.A,{show:t,onClose:n,position:"bottom",width:"220px",triggerRef:c,centered:h,children:[(0,r.jsx)("div",{style:{padding:"10px 15px",fontSize:"13px",color:"#5C5D5D",borderBottom:"2px solid #EAEEF3",fontWeight:600},children:d}),(0,r.jsx)("div",{style:{maxHeight:"250px",overflowY:"auto"},children:a.map(function(e){return(0,r.jsx)("div",{style:{padding:"10px 15px",cursor:"pointer",fontSize:"13px",color:"#5C5D5D",borderBottom:"1px solid #EAEEF3",backgroundColor:o===e.name?"#F3F3F3":"transparent"},onClick:function(){s(e.name),n()},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#F8F9FA"},onMouseLeave:function(t){return t.currentTarget.style.backgroundColor=o===e.name?"#F3F3F3":"transparent"},children:e.name},e.id)})}),!m&&(0,r.jsxs)("div",{style:{padding:"10px 15px",cursor:"pointer",fontSize:"13px",color:"#17A2B8",fontWeight:600,borderTop:"2px solid #EAEEF3"},onClick:function(){var e=prompt("Nome da nova atividade:");e&&l(e)},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#F8F9FA"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="transparent"},children:[(0,r.jsx)("i",{className:"fas fa-plus",style:{marginRight:"8px"}}),"Adicionar Nova"]})]})}var l=n(81623);function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){var t=e.projetos,n=(e.atividadesDisponiveis,e.selectedProject),u=e.selectedActivity,d=e.selectedTask,f=void 0===d?"":d,m=e.onProjectChange,p=e.onSelectActivity,h=e.onSelectTask,v=e.onAddNewActivity,b=(0,a.useRef)(null),y=(0,a.useRef)(null),g=c((0,a.useState)(!1),2),x=g[0],j=g[1],w=c((0,a.useState)(!1),2),S=w[0],N=w[1],k=t.find(function(e){return e.name===n}),C=null==k?void 0:k.id,O=(0,o.I)({queryKey:["timesheet-project-tasks",C],queryFn:function(){return l.Z4.getProjectTasks(C)},enabled:!!C,staleTime:6e4,refetchOnWindowFocus:!1}).data,A=void 0===O?[]:O,E=(0,o.I)({queryKey:["timesheet-activity-templates"],queryFn:function(){return l.Z4.getActivityTemplates()},enabled:!0,staleTime:6e4,refetchOnWindowFocus:!1}).data,P=void 0===E?[]:E;return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{gap:"12px",width:"100%"},children:[(0,r.jsx)("div",{className:"project-select-wrapper",children:(0,r.jsxs)("select",{value:n,onChange:function(e){return m(e.target.value)},children:[(0,r.jsx)("option",{value:"",children:"Está trabalhando em qual projeto?"}),t.map(function(e){return(0,r.jsx)("option",{value:e.name,children:e.name},e.id)})]})}),(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{gap:"8px",flexShrink:0},children:[(0,r.jsxs)(i.d,{children:[(0,r.jsx)("button",{ref:b,onClick:function(){return j(!x)},title:"Selecionar Tarefa",className:"app-icon-button",disabled:!C,style:{backgroundColor:f?"rgba(24, 96, 115, 0.10)":"white",border:f?"1px solid rgba(24, 96, 115, 0.25)":"1px solid rgba(0, 0, 0, 0.15)"},children:(0,r.jsx)("img",{src:f?"/images/icons/Group(7).svg":"/images/icons/price-tag-3-line.png",alt:"Selecionar Tarefa"})}),(0,r.jsx)(s,{show:x,onClose:function(){return j(!1)},atividades:A,selectedActivity:f,onSelectActivity:function(e){h&&h(e),j(!1)},onAddNew:v,triggerRef:b,title:"Selecionar Tarefa",hideAddNew:!0,centered:!0})]}),(0,r.jsxs)(i.d,{children:[(0,r.jsx)("button",{ref:y,onClick:function(){return N(!S)},title:"Selecionar Atividades",className:"app-icon-button",style:{backgroundColor:u?"rgba(24, 96, 115, 0.10)":"white",border:u?"1px solid rgba(24, 96, 115, 0.25)":"1px solid rgba(0, 0, 0, 0.15)"},children:(0,r.jsx)("img",{src:u?"/images/icons/Frame(1).svg":"/images/icons/frame(2).svg",alt:"Selecionar Atividades"})}),(0,r.jsx)(s,{show:S,onClose:function(){return N(!1)},atividades:P,selectedActivity:u,onSelectActivity:function(e){p(e),N(!1)},onAddNew:v,triggerRef:y,title:"Selecionar Atividades",centered:!0})]})]})]})})}},61909(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>o});n(52675),n(89463),n(28706),n(78459),n(11392);var r=n(74848),a=n(1806);function o(e){var t=e.isOpen,n=e.onClose,o=e.record;if(!t||!o)return null;var i=function(e){return e.startsWith("data:image")?e:"data:image/jpeg;base64,".concat(e)};return(0,r.jsx)(a.A,{show:t,onClose:n,title:"Visualizando Ponto - ".concat(o.memberName),size:"md",footer:(0,r.jsx)("button",{type:"button",className:"btn btn-secondary",onClick:n,style:{fontFamily:"Inter",fontSize:"14px"},children:"Fechar"}),children:(0,r.jsxs)("div",{style:{padding:"24px"},children:[(0,r.jsx)("div",{className:"mt-4",children:function(){if(o.selfie)return(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("img",{src:i(o.selfie),alt:"Selfie de validação",className:"img-fluid rounded",style:{maxHeight:"500px",maxWidth:"100%",objectFit:"contain"}}),(0,r.jsx)("div",{className:"mt-3",style:{color:"#6c757d",fontSize:"15px"},children:o.time})]});if(o.print)return(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("img",{src:i(o.print),alt:"Print de tela",className:"img-fluid rounded",style:{maxHeight:"500px",maxWidth:"100%",objectFit:"contain"}}),(0,r.jsx)("div",{className:"mt-3",style:{color:"#6c757d",fontSize:"15px"},children:o.time})]});if("geolocation"===o.validatedBy&&o.latitude&&o.longitude){var e=parseFloat(o.latitude),t=parseFloat(o.longitude),n="https://www.openstreetmap.org/export/embed.html?bbox=".concat(t-.01,",").concat(e-.01,",").concat(t+.01,",").concat(e+.01,"&layer=mapnik&marker=").concat(e,",").concat(t);return(0,r.jsxs)("div",{children:[(0,r.jsx)("iframe",{width:"100%",height:"450",frameBorder:"0",scrolling:"no",marginHeight:0,marginWidth:0,src:n,style:{border:"none",borderRadius:"8px"}}),(0,r.jsxs)("div",{className:"text-center mt-3",style:{color:"#6c757d",fontSize:"15px"},children:["Latitude: ",o.latitude,", Longitude: ",o.longitude]})]})}return"manual"===o.validatedBy||"sistema"===o.channel?(0,r.jsxs)("div",{className:"alert alert-info",role:"alert",children:[(0,r.jsx)("i",{className:"fas fa-info-circle mr-2"}),(0,r.jsx)("strong",{children:"Registro Manual"}),(0,r.jsxs)("p",{className:"mb-0 mt-2",children:["Este registro de ponto foi batido manualmente pelo usuário"," ",(0,r.jsx)("strong",{children:o.memberName})]}),"ausente"===o.status&&(0,r.jsx)("p",{className:"mb-0 mt-2",children:(0,r.jsx)("span",{className:"badge badge-warning",children:"Status: Ausente"})})]}):(0,r.jsxs)("div",{className:"alert alert-secondary",role:"alert",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle mr-2"}),"Nenhuma informação de validação disponível para este registro."]})}()}),o.justification&&(0,r.jsxs)("div",{className:"mt-4 pt-4",style:{borderTop:"1px solid #dee2e6"},children:[(0,r.jsx)("h6",{style:{fontFamily:"Inter",fontSize:"16px",fontWeight:600,color:"#5C5D5D",marginBottom:"16px"},children:function(e){switch(e){case"license":return"Licença";case"reason":return"Abono";default:return e}}(o.justification.type)}),"license"===o.justification.type&&void 0!==o.justification.partialLicense&&(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsx)("label",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:600,color:"#5C5D5D",marginBottom:"8px",display:"block"},children:"Licença Parcial"}),(0,r.jsx)("input",{type:"text",className:"form-control",value:o.justification.partialLicense?"Sim":"Não",readOnly:!0,style:{fontFamily:"Inter",fontSize:"14px",backgroundColor:"#f8f9fa",cursor:"not-allowed"}})]}),"license"===o.justification.type&&o.justification.payOffLicense&&(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsx)("label",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:600,color:"#5C5D5D",marginBottom:"8px",display:"block"},children:"Motivo"}),(0,r.jsx)("input",{type:"text",className:"form-control",value:function(e){switch(e){case"licenca_maternidade":return"Licença maternidade";case"licenca_medica":return"Licença médica";case"licenca_casamento":return"Licença casamento";case"other":return"Outro";default:return e}}(o.justification.payOffLicense),readOnly:!0,style:{fontFamily:"Inter",fontSize:"14px",backgroundColor:"#f8f9fa",cursor:"not-allowed"}})]}),(o.justification.startPeriod||o.justification.endPeriod)&&(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsx)("label",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:600,color:"#5C5D5D",marginBottom:"8px",display:"block"},children:"Período"}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{className:"col-6",children:[(0,r.jsxs)("div",{className:"input-group",children:[(0,r.jsx)("input",{type:"text",className:"form-control",value:o.justification.startPeriod||"—",readOnly:!0,style:{fontFamily:"Inter",fontSize:"14px",backgroundColor:"#f8f9fa",cursor:"not-allowed"}}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("span",{className:"input-group-text",style:{backgroundColor:"#f8f9fa"},children:(0,r.jsx)("i",{className:"far fa-calendar-alt"})})})]}),(0,r.jsx)("small",{className:"text-muted",style:{fontFamily:"Inter",fontSize:"12px"},children:"Data de início"})]}),(0,r.jsxs)("div",{className:"col-6",children:[(0,r.jsxs)("div",{className:"input-group",children:[(0,r.jsx)("input",{type:"text",className:"form-control",value:o.justification.endPeriod||"—",readOnly:!0,style:{fontFamily:"Inter",fontSize:"14px",backgroundColor:"#f8f9fa",cursor:"not-allowed"}}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("span",{className:"input-group-text",style:{backgroundColor:"#f8f9fa"},children:(0,r.jsx)("i",{className:"far fa-calendar-alt"})})})]}),(0,r.jsx)("small",{className:"text-muted",style:{fontFamily:"Inter",fontSize:"12px"},children:"Data de finalização"})]})]})]}),o.justification.description&&(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsx)("label",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:600,color:"#5C5D5D",marginBottom:"8px",display:"block"},children:"Descrição"}),(0,r.jsx)("textarea",{className:"form-control",value:o.justification.description,readOnly:!0,rows:3,style:{fontFamily:"Inter",fontSize:"14px",backgroundColor:"#f8f9fa",cursor:"not-allowed",resize:"none"}})]})]})]})})}},64466(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>C});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(51629),n(23792),n(89572),n(94170),n(2892),n(59904),n(67945),n(84185),n(83851),n(81278),n(40875),n(79432),n(10287),n(26099),n(3362),n(47764),n(42762),n(23500),n(62953);var r,a,o=n(74848),i=n(49785),s=n(97665),l=n(57097),c=n(34559);n(23418),n(64346),n(34782),n(23288),n(62010),n(27495),n(38781),n(62062),n(5506);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e.MEDICAL_CERTIFICATE="medical_certificate",e.CHILD_MONITORING="child_monitoring",e.SPOUSE_MONITORING="spouse_monitoring",e.UNION_ACTIVITY="union_activity",e.WEATHER_DELAY="weather_delay",e.TRANSPORT_DELAY="transport_delay",e.COMPENSATED_TIME_OFF="compensated_time_off",e.EMPLOYEE_MARRIAGE="employee_marriage",e.COURT_APPEARANCE="court_appearance",e.ELECTORAL_SERVICE="electoral_service",e.MILITARY_SERVICE="military_service",e.BLOOD_DONATION="blood_donation",e.OTHER="other"}(a||(a={}));var p=(m(m(m(m(m(m(m(m(m(m(r={},a.MEDICAL_CERTIFICATE,"Atestado médico"),a.CHILD_MONITORING,"Acompanhamento de filho"),a.SPOUSE_MONITORING,"Acompanhamento de cônjuge"),a.UNION_ACTIVITY,"Atividade sindical"),a.WEATHER_DELAY,"Atraso por chuva"),a.TRANSPORT_DELAY,"Atraso por transporte"),a.COMPENSATED_TIME_OFF,"Compensação de horas"),a.EMPLOYEE_MARRIAGE,"Casamento"),a.COURT_APPEARANCE,"Audiência judicial"),a.ELECTORAL_SERVICE,"Serviço eleitoral"),m(m(m(r,a.MILITARY_SERVICE,"Serviço militar"),a.BLOOD_DONATION,"Doação de sangue"),a.OTHER,"Outro"));var h=n(50418),v=n(96540),b=n(1806),y=n(47339);function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function x(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function j(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?x(Object(n),!0).forEach(function(t){w(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function w(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=g(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=g(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==g(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return N(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(N(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,N(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,N(d,"constructor",c),N(c,"constructor",l),l.displayName="GeneratorFunction",N(c,a,"GeneratorFunction"),N(d),N(d,a,"Generator"),N(d,r,function(){return this}),N(d,"toString",function(){return"[object Generator]"}),(S=function(){return{w:o,m:f}})()}function N(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}N=function(e,t,n,r){function o(t,n){N(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},N(e,t,n,r)}function k(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function C(e){var t,n,r=e.isOpen,u=e.onClose,f=e.record,m=(e.onSave,(0,s.jE)()),g=(0,i.mN)({mode:"onChange",defaultValues:{tipoAbono:"dia_inteiro",motivo:"",descricao:"",periodoInicioData:"",periodoInicioHora:"",periodoFimData:"",periodoFimHora:""}}),x=g.register,w=g.handleSubmit,N=g.control,C=g.watch,O=g.reset,A=g.formState.errors,E=C("tipoAbono"),P=C("motivo"),F=(0,v.useMemo)(function(){return Object.entries(p).map(function(e){var t=d(e,2);return{value:t[0],label:t[1]}})},[]),T=(0,l.n)({mutationFn:(t=S().m(function e(t){var n;return S().w(function(e){for(;;)switch(e.n){case 0:if(null!=f&&f.id){e.n=1;break}throw new Error("ID do registro (hitTheSpotId) não encontrado");case 1:return console.log(f),n={hitTheSpotId:f.id,timeReason:"dia_inteiro"===t.tipoAbono?"all_day":"a_part_of_the_hour",payOffAbsence:t.motivo,otherText:t.motivo===a.OTHER?t.descricao:void 0,startPeriod:"horas_falta"===t.tipoAbono?"".concat(t.periodoInicioData,"T").concat(t.periodoInicioHora,":00"):void 0,endPeriod:"horas_falta"===t.tipoAbono?"".concat(t.periodoFimData,"T").concat(t.periodoFimHora,":00"):void 0,description:t.descricao||void 0},e.a(2,(0,h.py)(n))}},e)}),n=function(){var e=this,n=arguments;return new Promise(function(r,a){var o=t.apply(e,n);function i(e){k(o,r,a,i,s,"next",e)}function s(e){k(o,r,a,i,s,"throw",e)}i(void 0)})},function(e){return n.apply(this,arguments)}),onSuccess:function(e){m.invalidateQueries({queryKey:["time-management","hit-spot-time-history"]}),y.A.success(e.message||"Abono aplicado com sucesso!","Sucesso"),I()},onError:function(e){var t,n=(null===(t=e.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.error)||"Erro ao aplicar abono";y.A.error(n,"Erro")}}),D=T.mutate,_=T.isPending,I=function(){O(),u()};return r?(0,o.jsx)(b.A,{show:r,onClose:I,title:"Abonar",size:"md",footer:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:I,disabled:_,children:"Cancelar"}),(0,o.jsx)("button",{type:"submit",form:"abonarForm",className:"btn btn-primary",disabled:_,style:{backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:_?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("i",{className:"fas fa-spinner fa-spin mr-1"}),"Salvando..."]}):"Aplicar Abono"})]}),children:(0,o.jsxs)("form",{id:"abonarForm",onSubmit:w(function(e){e.motivo?e.motivo!==a.OTHER||e.descricao.trim()?"horas_falta"!==e.tipoAbono||e.periodoInicioData&&e.periodoInicioHora&&e.periodoFimData&&e.periodoFimHora?D(e):y.A.warning("Por favor, preencha o período de início e finalização.","Campo obrigatório"):y.A.warning("Por favor, descreva o motivo.","Campo obrigatório"):y.A.warning("Por favor, selecione o motivo.","Campo obrigatório")}),children:[(0,o.jsxs)("div",{className:"mb-4",children:[(0,o.jsxs)("div",{className:"form-check mb-3",children:[(0,o.jsx)("input",j(j({},x("tipoAbono")),{},{className:"form-check-input",type:"radio",id:"abonarDiaInteiro",value:"dia_inteiro",style:{width:"20px",height:"20px",cursor:"pointer"}})),(0,o.jsx)("label",{className:"form-check-label",htmlFor:"abonarDiaInteiro",style:{fontWeight:400,color:"#5C5D5D",marginLeft:"8px",cursor:"pointer"},children:"Abonar o dia inteiro"})]}),(0,o.jsxs)("div",{className:"form-check",children:[(0,o.jsx)("input",j(j({},x("tipoAbono")),{},{className:"form-check-input",type:"radio",id:"abonarHorasFalta",value:"horas_falta",style:{width:"20px",height:"20px",cursor:"pointer"}})),(0,o.jsx)("label",{className:"form-check-label",htmlFor:"abonarHorasFalta",style:{color:"#5C5D5D",marginLeft:"8px",cursor:"pointer"},children:"Abonar somente as horas em falta do dia"})]})]}),(0,o.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,o.jsx)("h6",{style:{color:"#5C5D5D",marginBottom:"8px"},children:"Selecione o Motivo"}),(0,o.jsx)("p",{children:"Informe o motivo pelo qual este ponto precisa ser ajustado."}),(0,o.jsxs)("div",{className:"row",children:[(0,o.jsxs)("div",{className:P===a.OTHER?"col-4":"col-12",children:[(0,o.jsx)(i.xI,{name:"motivo",control:N,rules:{required:"Motivo é obrigatório"},render:function(e){var t=e.field;return(0,o.jsx)(c.A,{options:F,value:t.value,placeholder:"Motivo*",size:"md",onChange:function(e){t.onChange(e),e!==a.OTHER&&O(function(e){return j(j({},e),{},{descricao:""})})}})}}),A.motivo&&(0,o.jsx)("small",{className:"text-danger d-block mt-1",children:A.motivo.message})]}),P===a.OTHER&&(0,o.jsxs)("div",{className:"col-8",children:[(0,o.jsx)("input",j(j({},x("descricao",{required:P===a.OTHER&&"Descrição é obrigatória"})),{},{type:"text",className:"form-control",placeholder:"Descreva o motivo*",style:{height:"100%"}})),A.descricao&&(0,o.jsx)("small",{className:"text-danger d-block mt-1",children:A.descricao.message})]})]})]}),"horas_falta"===E&&(0,o.jsxs)("div",{className:"row",children:[(0,o.jsxs)("div",{className:"col-6 mb-3",children:[(0,o.jsx)("h6",{style:{color:"#5C5D5D",marginBottom:"8px"},children:"Período de Início"}),(0,o.jsxs)("div",{className:"mb-2",children:[(0,o.jsx)("div",{className:"input-group",children:(0,o.jsx)("input",j(j({},x("periodoInicioData",{required:"horas_falta"===E&&"Data de início obrigatória"})),{},{type:"date",className:"form-control"}))}),A.periodoInicioData&&(0,o.jsx)("small",{className:"text-danger d-block mt-1",children:A.periodoInicioData.message})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("input",j(j({},x("periodoInicioHora",{required:"horas_falta"===E&&"Hora de início obrigatória"})),{},{type:"time",className:"form-control",placeholder:"Horas"})),A.periodoInicioHora&&(0,o.jsx)("small",{className:"text-danger d-block mt-1",children:A.periodoInicioHora.message})]})]}),(0,o.jsxs)("div",{className:"col-6 mb-3",children:[(0,o.jsx)("h6",{style:{color:"#5C5D5D",marginBottom:"8px"},children:"Período de Finalização"}),(0,o.jsxs)("div",{className:"mb-2",children:[(0,o.jsx)("div",{className:"input-group",children:(0,o.jsx)("input",j(j({},x("periodoFimData",{required:"horas_falta"===E&&"Data de fim obrigatória"})),{},{type:"date",className:"form-control"}))}),A.periodoFimData&&(0,o.jsx)("small",{className:"text-danger d-block mt-1",children:A.periodoFimData.message})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("input",j(j({},x("periodoFimHora",{required:"horas_falta"===E&&"Hora de fim obrigatória"})),{},{type:"time",className:"form-control",placeholder:"Horas"})),A.periodoFimHora&&(0,o.jsx)("small",{className:"text-danger d-block mt-1",children:A.periodoFimHora.message})]})]})]})]})}):null}},65207(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>o});n(62062),n(62010),n(9868),n(26099);var r=n(74848),a=n(10280);function o(e){var t=e.onCollaboratorClick,n=e.kpis,o=e.members,i=void 0===o?[]:o;if(0===i.length)return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"row mb-4",children:(n?[{label:"Total de Horas Trabalhadas",value:n.totalHoursWorked.formatted,variant:"teal-dark"},{label:"Total de Horas Faltantes",value:n.totalMissingHours.formatted,variant:"salmon"},{label:"Total de Horas Extras",value:n.totalExtraHours.formatted,variant:"turquoise"},{label:"Sobrecarga de Trabalho",value:"".concat(n.workOverload.toFixed(1),"%"),variant:"cyan"}]:[{label:"Total de Horas Trabalhadas",value:"0h00",variant:"teal-dark"},{label:"Total de Horas Faltantes",value:"0h00",variant:"salmon"},{label:"Total de Horas Extras",value:"0h00",variant:"turquoise"},{label:"Sobrecarga de Trabalho",value:"0%",variant:"cyan"}]).map(function(e,t){return(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(a.A,{value:e.value,label:e.label,variant:e.variant,className:"h-100"})},t)})}),(0,r.jsx)("div",{className:"text-center p-5 text-muted",children:"Nenhum membro encontrado para esta equipe/time."})]});var s=n?[{label:"Total de Horas Trabalhadas",value:n.totalHoursWorked.formatted,variant:"teal-dark"},{label:"Total de Horas Faltantes",value:n.totalMissingHours.formatted,variant:"salmon"},{label:"Total de Horas Extras",value:n.totalExtraHours.formatted,variant:"turquoise"},{label:"Sobrecarga de Trabalho",value:"".concat(n.workOverload.toFixed(1),"%"),variant:"cyan"}]:[{label:"Total de Horas Trabalhadas",value:"0h00",variant:"teal-dark"},{label:"Total de Horas Faltantes",value:"0h00",variant:"salmon"},{label:"Total de Horas Extras",value:"0h00",variant:"turquoise"},{label:"Sobrecarga de Trabalho",value:"0%",variant:"cyan"}];return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"row mb-4",children:s.map(function(e,t){return(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(a.A,{value:e.value,label:e.label,variant:e.variant,className:"h-100"})},t)})}),(0,r.jsx)("div",{className:"card app-card-surface mt-3",children:(0,r.jsx)("div",{className:"card-body p-0",children:(0,r.jsx)("div",{className:"ms-table-occurrences-wrapper",children:(0,r.jsxs)("table",{className:"ms-table-occurrences ms-table-occurrences-with-divider",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Colaborador"}),(0,r.jsx)("th",{children:"Carga Horária"}),(0,r.jsx)("th",{children:"Média Diária"}),(0,r.jsx)("th",{children:"Total de Horas"}),(0,r.jsx)("th",{children:"Horas Regulares"}),(0,r.jsx)("th",{children:"Horas Extras"}),(0,r.jsx)("th",{children:"Sobrecarga de Trabalho"}),(0,r.jsx)("th",{className:"ms-text-right",children:"Ações"})]})}),(0,r.jsx)("tbody",{children:0===i.length?(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:8,className:"ms-table-occurrences-empty",children:"Nenhum membro encontrado"})}):i.map(function(e){return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("div",{className:"tm-avatar-32 rounded-circle d-flex align-items-center justify-content-center text-white",style:{background:e.avatarBg},children:e.initials}),(0,r.jsx)("span",{children:e.name})]})}),(0,r.jsx)("td",{children:e.weeklyHours}),(0,r.jsx)("td",{children:e.dailyAverage}),(0,r.jsx)("td",{children:e.totalHours}),(0,r.jsx)("td",{children:e.regularHours}),(0,r.jsx)("td",{children:e.extraHours}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"badge badge-".concat((n=e.badge,{Baixa:"success",Moderada:"warning",Preocupante:"danger"}[n])),children:e.badge})}),(0,r.jsx)("td",{className:"ms-text-right",children:(0,r.jsx)("button",{className:"ms-table-occurrences-action-button",title:"Ver detalhes",onClick:function(){return null==t?void 0:t({id:e.id,name:e.name,initials:e.initials,avatarBg:e.avatarBg})},children:(0,r.jsx)("img",{src:"/images/icons/Group copy.svg",alt:"Ver gráfico",className:"ms-table-occurrences-action-icon",style:{width:"15px",height:"15px"}})})})]},e.id);var n})})]})})})})]})}},65342(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>w});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(62062),n(34782),n(1688),n(23288),n(94170),n(62010),n(2892),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(68156),n(62953);var r=n(74848),a=n(96540),o=n(33930),i=n(20826),s=n(92801),l=n(1125),c=n(50860),u=n(49293),d=n(36279),f=n(48592),m=n(17649),p=n(81623),h=n(10280);function v(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return b(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(b(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,b(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,b(d,"constructor",c),b(c,"constructor",l),l.displayName="GeneratorFunction",b(c,a,"GeneratorFunction"),b(d),b(d,a,"Generator"),b(d,r,function(){return this}),b(d,"toString",function(){return"[object Generator]"}),(v=function(){return{w:o,m:f}})()}function b(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}b=function(e,t,n,r){function o(t,n){b(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},b(e,t,n,r)}function y(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function g(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){y(o,r,a,i,s,"next",e)}function s(e){y(o,r,a,i,s,"throw",e)}i(void 0)})}}function x(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return j(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?j(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function w(){var e,t,n=x((0,a.useState)(!0),2),b=n[0],y=n[1],j=x((0,a.useState)(new Date),2),w=j[0],S=j[1],N=x((0,a.useState)(8),2),k=N[0],C=N[1],O=x((0,a.useState)(!1),2),A=O[0],E=O[1],P=x((0,a.useState)(!1),2),F=P[0],T=P[1],D=x((0,a.useState)(null),2),_=D[0],I=D[1],M=x((0,a.useState)(!1),2),R=M[0],z=M[1],L=x((0,a.useState)(null),2),q=L[0],B=L[1],G=x((0,a.useState)(!1),2),H=G[0],W=G[1],U=(0,a.useRef)(null),V=function(e){return e.toISOString().split("T")[0]},Q=function(e,t){if(!e||!t)return"00:00";var n=x(e.split(":").map(Number),2),r=n[0],a=n[1],o=x(t.split(":").map(Number),2),i=60*o[0]+o[1]-(60*r+a),s=Math.floor(i/60),l=i%60;return"".concat(String(s).padStart(2,"0"),":").concat(String(l).padStart(2,"0"))},K=(0,o.I)({queryKey:["timesheet-activities",V(w)],queryFn:function(){return p.Ay.getActivities(V(w))},enabled:!0,retry:1,refetchOnWindowFocus:!1}),$=K.data,J=void 0===$?[]:$,Y=K.refetch,Z=K.isLoading,X=K.error,ee=(0,o.I)({queryKey:["timesheet-projects"],queryFn:function(){return p.Ay.getProjects()},enabled:!0,retry:1,refetchOnWindowFocus:!1}),te=ee.data,ne=void 0===te?[]:te,re=(ee.isLoading,ee.error,(0,o.I)({queryKey:["timesheet-activity-templates"],queryFn:function(){return p.Ay.getActivityTemplates()},enabled:!0,retry:1,refetchOnWindowFocus:!1})),ae=re.data,oe=void 0===ae?[]:ae,ie=(re.isLoading,re.error,(0,o.I)({queryKey:["timesheet-scheduled-activities",V(w)],queryFn:function(){return p.Ay.getScheduledActivities(V(w))},enabled:!0,retry:1,refetchOnWindowFocus:!1})),se=ie.data,le=void 0===se?[]:se,ce=ie.refetch,ue=ie.isLoading,de=ie.error,fe=(0,o.I)({queryKey:["timesheet-planned-activities",V(w)],queryFn:function(){return p.Ay.getPlannedActivities(V(w))},enabled:!0,retry:1,refetchOnWindowFocus:!1}),me=fe.data,pe=void 0===me?[]:me,he=fe.refetch,ve=fe.isLoading,be=fe.error,ye=(0,o.I)({queryKey:["timesheet-hours-worked-kpi",V(w)],queryFn:function(){return p.Ay.getHoursWorkedKPI(V(w))},enabled:!0,retry:1,refetchOnWindowFocus:!1}),ge=ye.data,xe=ye.isLoading,je=ye.refetch,we=(0,o.I)({queryKey:["timesheet-workload",V(w)],queryFn:function(){return p.Ay.getWorkload(V(w))},enabled:!0,retry:1,refetchOnWindowFocus:!1}),Se=we.data,Ne=we.isLoading,ke=(0,o.I)({queryKey:["timesheet-day-kpis",V(w)],queryFn:function(){return p.Ay.getDayKPIs(V(w))},enabled:!0,retry:1,refetchOnWindowFocus:!1}),Ce=ke.data,Oe=ke.isLoading,Ae=ke.refetch;(0,a.useEffect)(function(){void 0!==Se&&C(Se)},[Se]);var Ee=function(){var e=g(v().m(function e(t){var n;return v().w(function(e){for(;;)switch(e.p=e.n){case 0:return C(t),e.p=1,e.n=2,p.Ay.updateWorkload(V(w),t);case 2:je(),e.n=4;break;case 3:e.p=3,n=e.v,console.error("Erro ao atualizar carga horária:",n);case 4:return e.a(2)}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}(),Pe=J.map(function(e){return{id:e.id,projeto:e.project_name,atividade:e.activity_name||e.activity_template_name||e.activity_name_legacy||"",task:e.project_task_name||"",inicio:e.start_time||"00:00",fim:e.end_time||"00:00",percentDia:"".concat(e.percentage,"%"),duracao:(t=e.duration,n=Math.floor(t/60),r=t%60,"".concat(n.toString().padStart(2,"0"),":").concat(r.toString().padStart(2,"0"))),comment:e.comment||""};var t,n,r}),Fe=ne.map(function(e){return{id:e.id,name:e.name}}),Te=oe.map(function(e){return{id:e.id,name:e.name}});var De=function(){var e=g(v().m(function e(){var t,n;return v().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,(0,p.jZ)(V(w));case 1:return t=e.v,I(t.timesheetDayId),z(t.hasSatisfaction),W(t.isFinalized),B(t.workSatisfaction),y(!t.isFinalized),e.a(2,t);case 2:return e.p=2,n=e.v,console.error("Erro ao verificar status do dia:",n),B(null),e.a(2,null)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}();(0,a.useEffect)(function(){console.log("🔄 Carregando atividades para data:",V(w)),Y(),De()},[w,Y]),(0,a.useEffect)(function(){},[J,ne,oe]);var _e,Ie,Me,Re,ze,Le=function(){var e=g(v().m(function e(t){var n,r,a,o,i;return v().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,n=_,H){e.n=2;break}return e.n=1,p.Ay.finalizeDay(V(w));case 1:r=e.v,console.log("Dia finalizado:",w),y(!1),W(!0),null!=r&&r.id&&(n=r.id,I(r.id)),e.n=3;break;case 2:y(!1);case 3:if(n){e.n=5;break}return e.n=4,De();case 4:o=e.v,n=null!==(a=null==o?void 0:o.timesheetDayId)&&void 0!==a?a:null;case 5:if(null===t||!n){e.n=6;break}return e.n=6,(0,p.VU)(n,t);case 6:return e.n=7,De();case 7:e.n=9;break;case 8:throw e.p=8,i=e.v,console.error("Erro ao finalizar dia:",i),i;case 9:return e.a(2)}},e,null,[[0,8]])}));return function(t){return e.apply(this,arguments)}}();return A?(0,r.jsx)(s.A,{title:"Dashboard - Controle de Atividades",subtitle:"Visão detalhada das horas trabalhadas e performance pessoal",showBackButton:!0,onBack:function(){return E(!1)},showExportButton:!0,onExport:function(){return console.log("Exportar dashboard")}}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(c.A,{title:"",subtitle:"",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center mb-3",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center mr-auto",children:[(0,r.jsx)("i",{className:"fas fa-chevron-left ".concat(Z?"text-muted":""," mr-2 ").concat(Z?"":"text-primary"),onClick:Z?void 0:function(){var e=new Date(w);e.setDate(e.getDate()-1),S(e)}}),(0,r.jsxs)("span",{className:"tm-date-label",onClick:function(){U.current&&U.current.showPicker()},title:"Clique para selecionar uma data",children:[(_e=w,Ie=["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"][_e.getDay()],Me=_e.getDate().toString().padStart(2,"0"),Re=["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"][_e.getMonth()],ze=_e.getFullYear(),"".concat(Ie,", ").concat(Me," ").concat(Re,". ").concat(ze)),Z&&(0,r.jsx)("span",{className:"ml-2",children:(0,r.jsx)("i",{className:"fas fa-spinner fa-spin text-primary"})}),(0,r.jsx)("input",{ref:U,type:"date",value:V(w),onChange:function(e){var t=new Date(e.target.value+"T00:00:00");S(t)},className:"sr-only"})]}),(0,r.jsx)("i",{className:"fas fa-chevron-right ".concat(Z?"text-muted":""," ml-2 ").concat(Z?"":"text-primary"),onClick:Z?void 0:function(){var e=new Date(w);e.setDate(e.getDate()+1),S(e)}})]}),(0,r.jsx)(i.A,{label:"Ver Dashboard",icon:"/images/icons/graph.svg",variant:"solid",onClick:function(){return E(!0)}}),(0,r.jsx)(i.A,{label:b?"Finalizar Dia":"Editar Dia",icon:b?"fas fa-check":"fas fa-pen",variant:"outline",onClick:function(){b?T(!0):(y(!0),W(!1))}})]}),(0,r.jsx)("div",{className:"mt-3",children:(0,r.jsxs)("div",{className:"row justify-content-start align-items-stretch",children:[(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(h.A,{value:null!==(e=null==Ce?void 0:Ce.projetos_desenvolvidos)&&void 0!==e?e:0,label:"Projetos Desenvolvidos",variant:"teal-dark",isLoading:Oe,className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(h.A,{value:null!==(t=null==Ce?void 0:Ce.atividades_desenvolvidas)&&void 0!==t?t:0,label:"Atividades Desenvolvidas",variant:"cyan",isLoading:Oe,className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(h.A,{value:xe?"Carregando...":ge?"".concat(ge.formatted_time," | ").concat(ge.percentage):"00:00h | 0%",label:"Horas Trabalhadas",variant:"turquoise",className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(h.A,{value:k,label:"Carga Horária",variant:"dark-gray",editable:!0,isInteger:!0,isLoading:Ne,onValueChange:function(e){Ee(e)},className:"h-100"})})]})}),Z?(0,r.jsx)(l.A,{message:"Carregando atividades..."}):X?(0,r.jsxs)("div",{className:"alert alert-danger",role:"alert",children:[(0,r.jsx)("strong",{children:"Erro ao carregar atividades:"})," ",X.message,(0,r.jsx)("button",{className:"btn btn-sm btn-outline-danger ml-2",onClick:function(){return Y()},children:"Tentar novamente"})]}):(0,r.jsx)(u.default,{projetos:Fe,atividadesDisponiveis:Te,activities:Pe,currentDate:V(w),workloadHours:k,onActivityEdit:function(e){return console.log("Editar atividade:",e)},onActivityDelete:function(e){return console.log("Deletar atividade:",e)},onActivityAction:function(e){return console.log("Ação adicional:",e)},onActivityAdded:function(){Y(),je(),Ae()}}),ue?(0,r.jsx)(l.A,{message:"Carregando atividades previstas..."}):de?(0,r.jsxs)("div",{className:"alert alert-warning",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-triangle mr-2"}),"Erro ao carregar atividades previstas"]}):(0,r.jsx)(d.default,{activities:le.map(function(e){return{id:e.id,projeto:e.projeto,atividade:e.atividade,inicio:e.inicio,fim:e.fim,percentDia:"".concat(Math.round(e.porcentagem_diaria||0),"%"),status:"A Fazer",prioridade:"Média",duracao:Q(e.inicio,e.fim)}}),projetos:Fe,atividadesDisponiveis:Te,currentDate:V(w),workloadHours:k,onActivityAdded:function(){Y(),ce(),he(),je(),Ae()}}),ve?(0,r.jsx)(l.A,{message:"Carregando atividades planejadas..."}):be?(0,r.jsxs)("div",{className:"alert alert-warning",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-triangle mr-2"}),"Erro ao carregar atividades planejadas"]}):(0,r.jsx)(f.default,{activities:pe.map(function(e){return{id:e.id,projeto:e.projeto,atividade:e.atividade,inicio:e.inicio,fim:e.fim,percentDia:"".concat(Math.round(e.porcentagem_diaria||0),"%"),duracao:Q(e.inicio,e.fim)}}),projetos:Fe,atividadesDisponiveis:Te,currentDate:V(w),workloadHours:k,onActivityAdded:function(){Y(),je(),Ae()}}),(0,r.jsx)(m.default,{show:F,onClose:function(){return T(!1)},hasExistingSatisfaction:R,initialSatisfaction:q,onConfirmFinalize:Le})]})})}},67784(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>l});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(42762),n(62953);var r=n(74848),a=n(96540),o=n(1806);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e){var t=e.isOpen,n=e.onClose,s=e.onSave,l=e.occurrenceTitle,c=void 0===l?"":l,u=e.existingJustification,d=void 0===u?null:u,f=e.isSaving,m=void 0!==f&&f,p=i((0,a.useState)(""),2),h=p[0],v=p[1],b=d&&""!==d.trim(),y=function(){b||v(""),n()};return t?(0,r.jsx)(o.A,{show:t,onClose:y,title:"Justificativa",size:"md",footer:b?(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:y,children:"Fechar"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:y,disabled:m,children:"Fechar"}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary",onClick:function(){b||(h.trim()?s(h):alert("Por favor, escreva uma justificativa."))},disabled:m||!h.trim(),style:{backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:m?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"spinner-border spinner-border-sm me-2"}),"Enviando..."]}):(0,r.jsx)(r.Fragment,{children:"Enviar Justificativa"})})]}),children:(0,r.jsxs)("div",{style:{padding:"24px"},children:[c&&(0,r.jsxs)("p",{className:"text-muted mb-3",style:{fontFamily:"Inter",fontSize:"14px"},children:["Ocorrência: ",(0,r.jsx)("strong",{children:c})]}),(0,r.jsx)("div",{className:"form-group mb-0",children:b?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"form-control bg-light",style:{fontFamily:"Inter",fontSize:"14px",minHeight:"100px",whiteSpace:"pre-wrap",color:"#5C5D5D"},children:d}),(0,r.jsxs)("div",{className:"alert alert-info mt-3 mb-0",style:{fontFamily:"Inter",fontSize:"13px"},children:[(0,r.jsx)("i",{className:"fas fa-info-circle me-2"}),"Esta justificativa foi enviada anteriormente e não pode ser editada."]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("textarea",{className:"form-control",rows:4,placeholder:"Escreva sua justificativa",value:h,onChange:function(e){return v(e.target.value)},disabled:m,style:{fontFamily:"Inter",fontSize:"14px",resize:"vertical"}}),(0,r.jsx)("small",{className:"text-muted",style:{fontFamily:"Inter",fontSize:"13px"},children:"Tem certeza de que deseja enviar esta justificativa? Ela não poderá ser editada futuramente."})]})})]})}):null}},68925(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>c});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(62062),n(34782),n(1688),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(68156),n(62953),n(76031);var r=n(74848),a=n(96540),o=n(82942);n(85231);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e){var t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return"".concat(["Domingo","Segunda-Feira","Terça-Feira","Quarta-Feira","Quinta-Feira","Sexta-Feira","Sábado"][e.getDay()]," - ").concat(t,"/").concat(n,"/").concat(r)}function c(e){var t=e.onRegister,n=e.availableOptions,s=void 0===n?[]:n,c=e.onSelectOption,u=e.isNoneMode,d=void 0!==u&&u,f=e.disabled,m=void 0!==f&&f,p=(e.onPointCleared,i((0,a.useState)(new Date),2)),h=p[0],v=p[1],b=i((0,a.useState)((new Date).toISOString().split("T")[0]),2),y=(b[0],b[1],i((0,a.useState)(!1),2)),g=(y[0],y[1],i((0,a.useState)(null),2));g[0],g[1];(0,a.useEffect)(function(){var e=setInterval(function(){return v(new Date)},1e3);return function(){return clearInterval(e)}},[]);var x=String(h.getHours()).padStart(2,"0"),j=String(h.getMinutes()).padStart(2,"0"),w=String(h.getSeconds()).padStart(2,"0");return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"ms-clock-card-box",children:[(0,r.jsxs)("div",{className:"ms-clock-card-time",children:[x,":",j,":",w]}),(0,r.jsx)("div",{className:"ms-clock-card-date",children:l(h)})]}),d||0===s.length?(0,r.jsx)("button",{className:"ms-clock-card-register-btn",onClick:t,disabled:m,children:"Registrar Ponto"}):1===s.length?(0,r.jsx)("button",{className:"ms-clock-card-register-btn",onClick:function(){return null==c?void 0:c(s[0])},disabled:m,children:(0,o.kC)(s[0])}):(0,r.jsxs)("div",{className:"btn-group btn-block dropdown ms-clock-card-dropdown-wrapper",children:[(0,r.jsx)("button",{className:"ms-clock-card-register-btn dropdown-toggle","data-toggle":"dropdown",type:"button",disabled:m,children:"Registrar Ponto"}),(0,r.jsx)("div",{className:"dropdown-menu dropdown-menu-right",children:s.map(function(e,t){return(0,r.jsxs)("a",{className:"dropdown-item ".concat(m?"disabled":""),href:"#",onClick:function(t){t.preventDefault(),m||null==c||c(e)},children:[(0,r.jsx)("i",{className:"".concat((0,o.JC)(e)," mr-2")}),(0,o.kC)(e)]},t)})})]})]})}},69404(e,t,n){"use strict";n.d(t,{u:()=>r});var r=n(71083).A.create({baseURL:"/",timeout:25e3,withCredentials:!0})},69511(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>s});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(68156),n(62953),n(76031);var r=n(74848),a=n(96540);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s(e){var t=e.activeTab,n=e.onTabChange,i=e.selectedDate,s=e.onDateChange,l=o((0,a.useState)(new Date),2),c=l[0],u=l[1],d=o((0,a.useState)(!1),2),f=d[0],m=d[1],p=(0,a.useRef)(null);(0,a.useEffect)(function(){var e=setInterval(function(){return u(new Date)},1e3);return function(){return clearInterval(e)}},[]);var h,v,b,y,g,x,j=String(c.getHours()).padStart(2,"0"),w=String(c.getMinutes()).padStart(2,"0"),S=String(c.getSeconds()).padStart(2,"0");return(0,r.jsxs)("div",{style:{backgroundColor:"#FFFFFF",borderRadius:"0 0 12px 12px",padding:"24px 20px",marginBottom:"16px"},children:[(0,r.jsx)("div",{style:{textAlign:"center",marginBottom:"12px"},children:(0,r.jsxs)("div",{style:{fontSize:"48px",fontWeight:700,lineHeight:1.1,color:"#2E3A46",letterSpacing:".5px",fontFamily:"Inter"},children:[j,":",w,":",S]})}),"ponto"===t&&(0,r.jsxs)("div",{style:{textAlign:"center",marginBottom:"16px",position:"relative"},children:[(0,r.jsxs)("button",{onClick:function(){m(!0),setTimeout(function(){var e,t,n;null===(e=p.current)||void 0===e||e.focus(),null===(t=p.current)||void 0===t||null===(n=t.showPicker)||void 0===n||n.call(t)},10)},style:{background:"none",border:"none",padding:"8px 16px",cursor:"pointer",fontSize:"13px",color:"#17A2B8",fontFamily:"Inter",fontWeight:500,textDecoration:f?"underline":"none"},children:[(0,r.jsx)("i",{className:"far fa-calendar-alt mr-2"}),(h=i,v=new Date(h+"T00:00:00"),b=["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"][v.getDay()],y=v.getDate(),g=v.getMonth()+1,x=v.getFullYear(),"".concat(b,", ").concat(String(y).padStart(2,"0"),"/").concat(String(g).padStart(2,"0"),"/").concat(x))]}),f&&(0,r.jsx)("input",{ref:p,type:"date",value:i,onChange:function(e){var t=e.target.value;t&&(s(t),m(!1))},onBlur:function(){return m(!1)},style:{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"4px",padding:"8px",fontSize:"14px",border:"1px solid #ced4da",borderRadius:"6px",zIndex:1e3,backgroundColor:"#FFFFFF",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"}})]}),(0,r.jsxs)("div",{style:{display:"flex",borderBottom:"1px solid #E5E7EB"},children:[(0,r.jsx)("button",{onClick:function(){return n("ponto")},style:{flex:1,padding:"12px",border:"none",background:"none",fontSize:"15px",fontWeight:"ponto"===t?600:400,color:"ponto"===t?"#17A2B8":"#6B7280",borderBottom:"ponto"===t?"2px solid #17A2B8":"none",cursor:"pointer",fontFamily:"Inter",transition:"all 0.2s"},children:"Ponto"}),(0,r.jsx)("button",{onClick:function(){return n("ocorrencias")},style:{flex:1,padding:"12px",border:"none",background:"none",fontSize:"15px",fontWeight:"ocorrencias"===t?600:400,color:"ocorrencias"===t?"#17A2B8":"#6B7280",borderBottom:"ocorrencias"===t?"2px solid #17A2B8":"none",cursor:"pointer",fontFamily:"Inter",transition:"all 0.2s"},children:"Ocorrências"})]})]})}},69794(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>l});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var s=[{id:"black",src:"/images/tenant/black_full_card.png",alt:"Fundo preto"},{id:"blue",src:"/images/tenant/blue_full_card.png",alt:"Fundo azul"},{id:"white",src:"/images/tenant/white_full_card.png",alt:"Fundo branco"}];function l(e){var t=e.selected,n=e.onSelect,i=(0,a.useRef)(null),l=o((0,a.useState)(!1),2),c=l[0],u=l[1],d=o((0,a.useState)(0),2),f=d[0],m=d[1],p=o((0,a.useState)(0),2),h=p[0],v=p[1];(0,a.useEffect)(function(){var e=i.current;if(e){var t=function(t){var n,r;u(!0);var a="touches"in t?t.touches[0].pageX:t.pageX;m(a-e.getBoundingClientRect().left),v(e.scrollLeft),null===(n=document.activeElement)||void 0===n||null===(r=n.blur)||void 0===r||r.call(n),e.style.cursor="grabbing"},n=function(){u(!1),i.current&&(i.current.style.cursor="grab")},r=function(e){if(c){e.preventDefault();var t=i.current,n=("touches"in e?e.touches[0].pageX:e.pageX)-t.getBoundingClientRect().left;t.scrollLeft=h-(n-f)}};return e.addEventListener("mousedown",t),e.addEventListener("mouseleave",n),e.addEventListener("mouseup",n),e.addEventListener("mousemove",r),e.addEventListener("touchstart",t,{passive:!1}),e.addEventListener("touchend",n),e.addEventListener("touchmove",r,{passive:!1}),function(){e.removeEventListener("mousedown",t),e.removeEventListener("mouseleave",n),e.removeEventListener("mouseup",n),e.removeEventListener("mousemove",r),e.removeEventListener("touchstart",t),e.removeEventListener("touchend",n),e.removeEventListener("touchmove",r)}}},[c,f,h]),(0,a.useEffect)(function(){var e=i.current;if(e){var t=function(t){Math.abs(t.deltaX)<Math.abs(t.deltaY)&&(e.scrollLeft+=t.deltaY,t.preventDefault())};return e.addEventListener("wheel",t,{passive:!1}),function(){return e.removeEventListener("wheel",t)}}},[]);return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"position-relative",children:(0,r.jsx)("div",{ref:i,className:"d-flex align-items-center justify-content-center",style:{overflowX:"auto",display:"flex",alignItems:"center",scrollSnapType:"x mandatory",WebkitOverflowScrolling:"touch",paddingBottom:8,cursor:"grab",scrollbarWidth:"none"},tabIndex:0,onKeyDown:function(e){var t=i.current;if(t){"ArrowRight"===e.key&&t.scrollBy({left:436,behavior:"smooth"}),"ArrowLeft"===e.key&&t.scrollBy({left:-436,behavior:"smooth"})}},children:s.map(function(e){var a=t===e.id;return(0,r.jsx)("button",{type:"button",onClick:function(){return n(e.id)},className:"btn p-0 border-0",style:{scrollSnapAlign:"center",outline:"none",background:"transparent",userSelect:"none"},"aria-label":"Selecionar plano de fundo ".concat(e.alt),title:e.alt,children:(0,r.jsxs)("div",{className:"position-relative",style:{width:420,maxWidth:"70vw",height:220,borderRadius:16,overflow:"hidden",transform:a?"scale(1.02)":"scale(0.96)",transition:"transform 200ms ease, box-shadow 200ms ease, filter 200ms ease, opacity 200ms ease",filter:a?"none":"blur(2px)",opacity:a?1:.85,border:a?"2px solid rgba(0,123,255,0.6)":"2px solid transparent",cursor:"pointer",margin:"4px"},children:[(0,r.jsx)("img",{src:e.src,alt:e.alt,draggable:!1,style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"black"===e.id?"0% 100%":"center",pointerEvents:"none"}}),a&&(0,r.jsx)("span",{className:"position-absolute badge badge-primary",style:{top:8,right:8,borderRadius:12,padding:"2px 8px",fontWeight:600},children:"Selecionado"})]})},e.id)})})}),(0,r.jsx)("div",{className:"d-flex justify-content-center mt-2",children:s.map(function(e){var a=t===e.id;return(0,r.jsx)("span",{onClick:function(){return n(e.id)},className:"mx-1",style:{width:8,height:8,borderRadius:"50%",display:"inline-block",background:a?"#007bff":"rgba(0,0,0,0.2)",cursor:"pointer"},"aria-label":"Ir para ".concat(e.alt),title:e.alt},e.id)})})]})}},70038(e,t,n){"use strict";n.d(t,{b1:()=>p,hY:()=>l,nx:()=>v,z1:()=>u,zS:()=>f});n(52675),n(89463),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362);var r=n(52354);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}function l(){return c.apply(this,arguments)}function c(){return(c=s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/work-shifts");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function u(e){return d.apply(this,arguments)}function d(){return(d=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.post("/time-management/work-shifts",t);case 1:return n=e.v,o=n.data,e.a(2,o.data)}},e)}))).apply(this,arguments)}function f(e,t){return m.apply(this,arguments)}function m(){return(m=s(a().m(function e(t,n){var o,i;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.put("/time-management/work-shifts/".concat(t),n);case 1:return o=e.v,i=o.data,e.a(2,i.data)}},e)}))).apply(this,arguments)}function p(e){return h.apply(this,arguments)}function h(){return(h=s(a().m(function e(t){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.delete("/time-management/work-shifts/".concat(t));case 1:return e.a(2)}},e)}))).apply(this,arguments)}function v(e,t){return b.apply(this,arguments)}function b(){return(b=s(a().m(function e(t,n){var o,i;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.post("/time-management/work-shifts/".concat(t,"/members"),{memberIds:n});case 1:return o=e.v,i=o.data,e.a(2,i.data)}},e)}))).apply(this,arguments)}},71458(e,t,n){"use strict";n.d(t,{A:()=>m});n(52675),n(89463),n(2259),n(28706),n(50113),n(23418),n(74423),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(9868),n(26099),n(27495),n(38781),n(21699),n(47764),n(71761),n(62953);var r=n(74848),a=n(46539),o=n(28482),i=n(69107),s=n(46668),l=n(77984),c=n(23495),u=n(88224);function d(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e){var t=e.selectedFilters,n=e.weeklyData,f=e.attendanceData,m=void 0===f?[]:f,p=t.includes("attendance"),h=t.includes("task"),v=(n.length>0&&n[0].label,[].concat(d(n.map(function(e){return e.total_hours})),d(m.map(function(e){return e.total_hours})))),b=Math.max.apply(Math,d(v).concat([8])),y=10*Math.ceil(b/10)||100,g=n.map(function(e,t){var n=m.find(function(t){return t.period===e.period}),r=h?e.total_hours:0,a=p&&n?n.total_hours:0,o=e.label||"Período ".concat(e.period),i=o;if("week"===e.type){var s=o.match(/^Sem \d+/);i=s?s[0]:o}return{label:i,fullLabel:o,type:e.type||"unknown",byTask:r,byAttendance:a,backgroundTask:Math.max(0,y-r),backgroundAttendance:Math.max(0,y-a)}}),x=g.length<=7?48:g.length<=12?36:24;return(0,r.jsxs)("div",{style:{userSelect:"none",transform:"none",transition:"none"},children:[(0,r.jsx)(o.u,{width:"100%",height:300,style:{transform:"none"},children:(0,r.jsxs)(u.E,{data:g,margin:{top:20,right:30,left:20,bottom:40},barSize:x,barGap:4,style:{cursor:"default"},onMouseMove:function(e){var t;return null==e||null===(t=e.stopPropagation)||void 0===t?void 0:t.call(e)},onMouseDown:function(e){var t;return null==e||null===(t=e.stopPropagation)||void 0===t?void 0:t.call(e)},onMouseUp:function(e){var t;return null==e||null===(t=e.stopPropagation)||void 0===t?void 0:t.call(e)},onClick:function(e){var t;return null==e||null===(t=e.stopPropagation)||void 0===t?void 0:t.call(e)},children:[(0,r.jsx)(i.d,{strokeDasharray:"3 3",vertical:!1,stroke:"#E0E0E0"}),(0,r.jsx)(c.h,{domain:[0,y],axisLine:!1,tickLine:!1,tick:{fill:"#5C5D5D",fontSize:12},width:40,tickFormatter:function(e){return"".concat(e,"h")}}),(0,r.jsx)(l.W,{dataKey:"label",axisLine:!1,tickLine:!1,tick:{fill:"#5C5D5D",fontSize:10},interval:0,angle:g.length>8?-45:0,textAnchor:g.length>8?"end":"middle",height:g.length>8?60:30}),(0,r.jsx)(a.m,{content:(0,r.jsx)(function(e){var t=e.active,n=e.payload;e.label;if(t&&n&&n.length){var a=n[0].payload;return(0,r.jsxs)("div",{style:{background:"rgba(255, 255, 255, 0.95)",border:"1px solid #ccc",borderRadius:"6px",padding:"6px 10px",boxShadow:"0 1px 4px rgba(0,0,0,0.1)",fontSize:"11px",lineHeight:"1.4",minWidth:"auto",maxWidth:"180px"},children:[(0,r.jsx)("div",{style:{fontWeight:600,marginBottom:"3px",fontSize:"11px",color:"#333"},children:a.fullLabel}),h&&a.byTask>0&&(0,r.jsxs)("div",{style:{color:"#17A2B8",fontSize:"10px",margin:"2px 0"},children:["Tarefa: ",(0,r.jsxs)("strong",{children:[a.byTask.toFixed(1),"h"]})]}),p&&a.byAttendance>0&&(0,r.jsxs)("div",{style:{color:"#186073",fontSize:"10px",margin:"2px 0"},children:["Registro: ",(0,r.jsxs)("strong",{children:[a.byAttendance.toFixed(1),"h"]})]})]})}return null},{})}),p&&(0,r.jsx)(s.yP,{dataKey:"byAttendance",fill:"#186073",radius:[4,4,0,0],isAnimationActive:!1}),h&&(0,r.jsx)(s.yP,{dataKey:"byTask",fill:"#17A2B8",radius:[4,4,0,0],isAnimationActive:!1})]})}),(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-center gap-4 mt-3",children:[p&&(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{paddingRight:"12px"},children:[(0,r.jsx)("div",{style:{width:"12px",height:"12px",background:"#186073",borderRadius:"2px",marginRight:"8px"}}),(0,r.jsx)("span",{style:{fontSize:"12px",color:"#5C5D5D"},children:"Por Registro de Ponto"})]}),h&&(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{paddingRight:"12px"},children:[(0,r.jsx)("div",{style:{width:"12px",height:"12px",background:"#17A2B8",borderRadius:"2px",marginRight:"8px"}}),(0,r.jsx)("span",{style:{fontSize:"12px",color:"#5C5D5D"},children:"Por Tarefa"})]})]})]})}},72210(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>g});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(58940),n(27495),n(38781),n(31415),n(47764),n(90744),n(42762),n(23500),n(62953);var r=n(74848),a=n(96540),o=n(97665),i=n(57097),s=n(34559),l=n(50455),c=n(55098),u=n(47339),d=n(76336);function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function h(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=f(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==f(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e){var t,n,r=e.trim().split(/\s+/);return((null!==(t=null===(n=r[0])||void 0===n?void 0:n[0])&&void 0!==t?t:"")+(r.length>1?r[r.length-1][0]:"")).toUpperCase()}function g(e){var t,n,f,m,h=e.data,b=e.title,g=e.searchKeyword,x=void 0===g?"":g,j=e.onSearchChange,w=e.roleOptions,S=void 0===w?[]:w,N=e.selectedRole,k=e.onRoleChange,C=e.isLoading,O=void 0!==C&&C,A=e.isLoadingRoles,E=void 0!==A&&A,P=(e.onOpenFilters,e.onApplyFilters),F=e.onClearFilters,T=e.hasActiveFilters,D=void 0!==T&&T,_=e.total,I=e.totalPages,M=e.page,R=void 0===M?1:M,z=e.pageSize,L=void 0===z?10:z,q=e.onPageChange,B=e.onPageSizeChange,G=(0,d.L)().canEdit,H=null!=_?_:h.length,W=Math.ceil(H/L),U=R<(null!=I?I:W),V=(0,o.jE)(),Q=v((0,a.useState)({isOpen:!1}),2),K=Q[0],$=Q[1],J=v((0,a.useState)(new Set),2),Y=(J[0],J[1]),Z=(0,i.n)({mutationFn:function(e){var t=e.occurrenceId,n=e.approved;return(0,c.KI)(t,n)},onSuccess:function(e,t){var n=t.approved?"Justificativa aprovada com sucesso!":"Justificativa rejeitada com sucesso!";u.A.success(n,"Sucesso"),Y(new Set),V.invalidateQueries({queryKey:["time-management","overview","members-occurrences"]})},onError:function(e){var t,n=(null==e||null===(t=e.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.error)||"Erro ao processar justificativa";u.A.error(n,"Erro")}}),X=function(e,t){Z.mutate({occurrenceId:e.id,approved:t})},ee=v((0,a.useState)(!1),2),te=ee[0],ne=ee[1],re=(0,a.useRef)(null),ae=(0,a.useRef)(null),oe=v((0,a.useState)({occurrenceType:"",timeStart:"",timeEnd:"",status:""}),2),ie=oe[0],se=oe[1],le=function(){P&&P(ie),ne(!1)},ce=function(){se({occurrenceType:"",timeStart:"",timeEnd:"",status:""}),F&&F(),ne(!1)};return(0,a.useEffect)(function(){Y(new Set)},[R,h]),(0,a.useEffect)(function(){function e(e){if(te){var t=e.target,n=re.current&&re.current.contains(t),r=ae.current&&ae.current.contains(t);n||r||ne(!1)}}return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[te]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.default,{isOpen:K.isOpen,onClose:function(){$({isOpen:!1})},memberName:(null===(t=K.occurrence)||void 0===t?void 0:t.nome)||"",memberInitials:(null===(n=K.occurrence)||void 0===n?void 0:n.iniciais)||y((null===(f=K.occurrence)||void 0===f?void 0:f.nome)||""),justify:null===(m=K.occurrence)||void 0===m?void 0:m.justify}),(0,r.jsxs)("div",{className:"card app-card-surface mt-2",children:[(0,r.jsxs)("div",{className:"card-header app-controls-bar tm-controls-bar",children:[(0,r.jsxs)("div",{className:"d-none d-lg-flex align-items-center w-100",children:[(0,r.jsx)("h3",{className:"card-title mb-0 mr-2",children:b}),(0,r.jsx)("span",{className:"text-muted","data-toggle":"tooltip","data-placement":"top",title:"Lista de ocorrências recentes",children:(0,r.jsx)("i",{className:"far fa-question-circle"})}),(0,r.jsxs)("div",{className:"ml-auto d-flex align-items-center",style:{gap:8},children:[(0,r.jsxs)("div",{className:"app-controls-search",style:{width:220},children:[(0,r.jsx)("i",{className:"fas fa-search mr-2 text-muted"}),(0,r.jsx)("input",{type:"text",className:"form-control",placeholder:"Buscar por membro",value:x,onChange:function(e){return null==j?void 0:j(e.target.value)}})]}),(0,r.jsx)("div",{style:{width:220},children:(0,r.jsx)(s.A,{options:S,value:N,placeholder:"Selecionar função",onChange:k,loading:E})}),(0,r.jsxs)("div",{className:"dropdown",ref:re,children:[(0,r.jsx)("button",{type:"button",className:"app-list-filter-btn ".concat(D?"has-filters":""),onClick:function(){return ne(!te)},title:D?"Filtros ativos":"Filtros",children:(0,r.jsx)("i",{className:"fas fa-filter"})}),te&&(0,r.jsxs)("div",{className:"dropdown-menu app-filter-dropdown show",style:{right:0},children:[(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Tipo de ocorrência"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:ie.occurrenceType,onChange:function(e){return se(p(p({},ie),{},{occurrenceType:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"atraso",children:"Atraso"}),(0,r.jsx)("option",{value:"duplicado",children:"Ponto duplicado"}),(0,r.jsx)("option",{value:"falta",children:"Falta"})]})]}),(0,r.jsxs)("div",{className:"form-row",children:[(0,r.jsxs)("div",{className:"form-group col",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Hora início"}),(0,r.jsx)("input",{type:"time",className:"form-control form-control-sm",value:ie.timeStart,onChange:function(e){return se(p(p({},ie),{},{timeStart:e.target.value}))}})]}),(0,r.jsxs)("div",{className:"form-group col",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Hora fim"}),(0,r.jsx)("input",{type:"time",className:"form-control form-control-sm",value:ie.timeEnd,onChange:function(e){return se(p(p({},ie),{},{timeEnd:e.target.value}))}})]})]}),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Status"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:ie.status,onChange:function(e){return se(p(p({},ie),{},{status:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"leve",children:"Leve"}),(0,r.jsx)("option",{value:"atencao",children:"Atenção"}),(0,r.jsx)("option",{value:"resolvido",children:"Resolvido"})]})]}),(0,r.jsxs)("div",{className:"d-flex justify-content-between pt-1",children:[(0,r.jsx)("button",{type:"button",className:"btn btn-sm text-muted",onClick:ce,children:"Limpar"}),(0,r.jsx)("button",{type:"button",className:"btn btn-sm btn-primary",onClick:le,children:"Aplicar"})]})]})]})]})]}),(0,r.jsxs)("div",{className:"d-lg-none",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between mb-2",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("h3",{className:"card-title mb-0",children:b}),(0,r.jsx)("span",{className:"ml-2 text-muted",title:"Lista de ocorrências recentes",children:(0,r.jsx)("i",{className:"far fa-question-circle"})})]}),(0,r.jsxs)("div",{className:"dropdown",ref:ae,children:[(0,r.jsx)("button",{type:"button",className:"app-list-filter-btn ".concat(D?"has-filters":""),onClick:function(){return ne(!te)},children:(0,r.jsx)("i",{className:"fas fa-filter"})}),te&&(0,r.jsxs)("div",{className:"dropdown-menu app-filter-dropdown show",style:{right:0},children:[(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Tipo de ocorrência"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:ie.occurrenceType,onChange:function(e){return se(p(p({},ie),{},{occurrenceType:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"atraso",children:"Atraso"}),(0,r.jsx)("option",{value:"duplicado",children:"Ponto duplicado"}),(0,r.jsx)("option",{value:"falta",children:"Falta"})]})]}),(0,r.jsxs)("div",{className:"form-row",children:[(0,r.jsxs)("div",{className:"form-group col",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Hora início"}),(0,r.jsx)("input",{type:"time",className:"form-control form-control-sm",value:ie.timeStart,onChange:function(e){return se(p(p({},ie),{},{timeStart:e.target.value}))}})]}),(0,r.jsxs)("div",{className:"form-group col",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Hora fim"}),(0,r.jsx)("input",{type:"time",className:"form-control form-control-sm",value:ie.timeEnd,onChange:function(e){return se(p(p({},ie),{},{timeEnd:e.target.value}))}})]})]}),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Status"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:ie.status,onChange:function(e){return se(p(p({},ie),{},{status:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"leve",children:"Leve"}),(0,r.jsx)("option",{value:"atencao",children:"Atenção"}),(0,r.jsx)("option",{value:"resolvido",children:"Resolvido"})]})]}),(0,r.jsxs)("div",{className:"d-flex justify-content-between pt-1",children:[(0,r.jsx)("button",{type:"button",className:"btn btn-sm text-muted",onClick:ce,children:"Limpar"}),(0,r.jsx)("button",{type:"button",className:"btn btn-sm btn-primary",onClick:le,children:"Aplicar"})]})]})]})]}),(0,r.jsxs)("div",{className:"d-flex flex-column",children:[(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsxs)("div",{className:"app-controls-search",children:[(0,r.jsx)("i",{className:"fas fa-search mr-2 text-muted"}),(0,r.jsx)("input",{type:"text",className:"form-control",placeholder:"Buscar por membro",value:x,onChange:function(e){return null==j?void 0:j(e.target.value)}})]})}),(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsx)(s.A,{options:S,value:N,placeholder:"Selecionar função",size:"sm",onChange:k,loading:E,className:""})})]})]})]}),(0,r.jsxs)("div",{className:"card-body p-0",children:[(0,r.jsx)("div",{className:"ms-table-occurrences-wrapper",children:(0,r.jsxs)("table",{className:"ms-table-occurrences ms-table-occurrences-with-divider",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Colaborador"}),(0,r.jsx)("th",{children:"Ocorrências"}),(0,r.jsx)("th",{children:"Horário do ponto"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"ms-text-right",children:"Ações"})]})}),(0,r.jsxs)("tbody",{children:[O?(0,r.jsx)("tr",{children:(0,r.jsxs)("td",{colSpan:5,className:"ms-table-occurrences-empty",children:[(0,r.jsx)("div",{className:"spinner-border text-primary",role:"status",children:(0,r.jsx)("span",{className:"sr-only",children:"Carregando..."})}),(0,r.jsx)("p",{className:"text-muted mt-2 mb-0",children:"Carregando ocorrências..."})]})}):h.map(function(e){var t,n,a,o,i,s=null!==(t=e.iniciais)&&void 0!==t?t:y(e.nome),l=null!==(n=e.avatarBg)&&void 0!==n?n:"bg-secondary";return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("div",{className:"rounded text-white d-inline-flex align-items-center justify-content-center ".concat(l),style:{width:36,height:36,fontWeight:700},children:s}),(0,r.jsx)("span",{className:"ml-2",children:e.nome})]})}),(0,r.jsx)("td",{children:(i=e.ocorrencia,{ponto_duplicado:"Ponto Duplicado",atraso:"Atraso",atraso_severo:"Atraso Severo",saida_antecipada:"Saída Antecipada",ponto_dia_folga:"Ponto em Dia de Folga",ausencia_sem_justificativa:"Ausência sem Justificativa",ausencia_com_justificativa:"Ausência com Justificativa",registro_nao_fechado:"Ponto Não Fechado",sequencia_invalida:"Sequência Inválida"}[i]||i)}),(0,r.jsx)("td",{children:e.horario}),(0,r.jsx)("td",{children:(a=e.status,o={leve:{color:"#01D6C5",label:"Leve"},atencao:{color:"#DC3545",label:"Atenção"},resolvido:{color:"#17A2B8BF",label:"Resolvido"},pendente:{color:"#DC3545",label:"Pendente"}}[a],(0,r.jsxs)("div",{className:"ms-table-occurrences-status",children:[(0,r.jsx)("span",{className:"ms-table-occurrences-status-dot",style:{backgroundColor:o.color}}),(0,r.jsx)("span",{children:o.label})]}))}),(0,r.jsx)("td",{className:"ms-text-right",children:(0,r.jsxs)("div",{className:"btn-group",children:[(0,r.jsx)("button",{type:"button",className:"ms-table-occurrences-action-button","data-toggle":"dropdown","aria-expanded":"false",title:"Mais ações",children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v ms-table-occurrences-action-icon"})}),(0,r.jsxs)("div",{className:"dropdown-menu dropdown-menu-right",role:"menu",children:[(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(t){var n;t.preventDefault(),$({isOpen:!0,occurrence:n=e}),Y(function(e){return new Set(e).add(n.id)})},children:[(0,r.jsx)("i",{className:"far fa-file-alt mr-2"})," Ler Justificativa"]}),G&&(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(t){t.preventDefault(),X(e,!0)},disabled:Z.isPending||"resolvido"===e.status||"pendente"===e.status,children:[(0,r.jsx)("i",{className:"fas fa-check mr-2"}),Z.isPending?"Processando...":"Aprovar"]}),G&&(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(t){t.preventDefault(),X(e,!1)},disabled:Z.isPending||"resolvido"===e.status||"pendente"===e.status,children:[(0,r.jsx)("i",{className:"fas fa-times mr-2"}),"Rejeitar"]})]})]})})]},e.id)}),!O&&0===h.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:5,className:"ms-table-occurrences-empty",children:"Nenhuma ocorrência"})})]})]})}),(0,r.jsxs)("div",{className:"app-table-footer",style:{padding:"15px"},children:[(0,r.jsx)("div",{className:"app-table-footer__left",children:(0,r.jsxs)("small",{className:"text-muted",children:["Mostrando ",h.length," de ",H," Resultados"]})}),(0,r.jsx)("nav",{"aria-label":"Navegação da tabela",className:"app-table-footer__center",children:(0,r.jsxs)("ul",{className:"pagination pagination-sm mb-0 app-table-pagination",children:[(0,r.jsx)("li",{className:"page-item ".concat(R<=1?"disabled":""),children:(0,r.jsx)("button",{className:"page-link",onClick:function(){return null==q?void 0:q(Math.max(1,R-1))},"aria-label":"Anterior",disabled:R<=1,children:(0,r.jsx)("span",{"aria-hidden":"true",children:"‹"})})}),(0,r.jsx)("li",{className:"page-item active",children:(0,r.jsx)("span",{className:"page-link",children:R})}),(0,r.jsx)("li",{className:"page-item ".concat(U?"":"disabled"),children:(0,r.jsx)("button",{className:"page-link",onClick:function(){U&&(null==q||q(R+1))},"aria-label":"Próxima",disabled:!U,children:(0,r.jsx)("span",{"aria-hidden":"true",children:"›"})})})]})}),(0,r.jsxs)("div",{className:"d-flex align-items-center app-table-footer__right",children:[(0,r.jsx)("span",{className:"text-muted mr-2",children:"Resultados por página"}),(0,r.jsx)("select",{className:"custom-select custom-select-sm",style:{width:72},value:L,onChange:function(e){return null==B?void 0:B(parseInt(e.target.value,10))},children:[10,20,50,100].map(function(e){return(0,r.jsx)("option",{value:e,children:e},e)})})]})]})]})]})]})}},72722(e,t,n){"use strict";n.d(t,{A:()=>m});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(50113),n(51629),n(23418),n(74423),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(27495),n(38781),n(21699),n(47764),n(23500),n(62953);var r=n(74848),a=n(96540);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||d(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e){var t=e.options,n=e.selectedValues,o=e.onChange,i=e.placeholder,l=void 0===i?"Selecione":i,d=e.className,f=void 0===d?"":d,m=e.style,p=void 0===m?{}:m,h=e.dropdownStyle,v=void 0===h?{}:h,b=u((0,a.useState)(!1),2),y=b[0],g=b[1],x=(0,a.useRef)(null);(0,a.useEffect)(function(){var e=function(e){x.current&&!x.current.contains(e.target)&&g(!1)};return y&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[y]);var j=function(e){n.includes(e)?o(n.filter(function(t){return t!==e})):o([].concat(c(n),[e]))};return(0,r.jsxs)("div",{ref:x,className:"dropdown ".concat(f),style:s({position:"relative",display:"inline-block",minWidth:"220px"},p),children:[(0,r.jsxs)("button",{type:"button",className:"d-flex justify-content-between align-items-center",onClick:function(){return g(!y)},style:{width:"100%",minWidth:"fit-content",padding:"10px 12px",backgroundColor:"#F8F9FA",border:"1px solid #E0E0E0",height:"20px",borderRadius:"8px",cursor:"pointer",color:"#5C5D5D",outline:"none",transition:"all 0.2s ease",whiteSpace:"nowrap"},onMouseEnter:function(e){e.currentTarget.style.backgroundColor="#F0F0F0"},onMouseLeave:function(e){e.currentTarget.style.backgroundColor="#F8F9FA"},children:[(0,r.jsx)("span",{style:{textAlign:"left",paddingRight:"8px",whiteSpace:"nowrap"},children:function(){if(0===n.length)return l;if(n.length===t.length)return"".concat(t.length," Opções Selecionadas");if(1===n.length){var e=t.find(function(e){return e.value===n[0]});return(null==e?void 0:e.label)||l}return"".concat(n.length," Opções Selecionadas")}()}),(0,r.jsx)("i",{className:"fas fa-chevron-down",style:{fontSize:"10px",color:"#999",flexShrink:0,transform:y?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}})]}),y&&(0,r.jsx)("div",{style:s({position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:"100%",width:"max-content",backgroundColor:"#FFFFFF",border:"1px solid #E0E0E0",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.1)",zIndex:1e3,maxHeight:"250px",overflowY:"auto"},v),children:t.map(function(e){return(0,r.jsxs)("label",{style:{display:"flex",alignItems:"center",padding:"8px 16px",cursor:"pointer",fontSize:"14px",color:"#333",fontFamily:"Inter",fontWeight:400,lineHeight:"100%",letterSpacing:"0%",transition:"background-color 0.15s ease",whiteSpace:"nowrap"},onMouseEnter:function(e){e.currentTarget.style.backgroundColor="#F8F9FA"},onMouseLeave:function(e){e.currentTarget.style.backgroundColor="transparent"},children:[(0,r.jsx)("input",{type:"checkbox",className:"tm-select-checkbox",checked:n.includes(e.value),onChange:function(){return j(e.value)}}),(0,r.jsx)("span",{style:{whiteSpace:"nowrap",fontFamily:"Inter",fontWeight:400,lineHeight:"100%",letterSpacing:"0%"},children:e.label})]},e.value)})})]})}},72810(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>o});n(62062),n(26099);var r=n(74848),a=n(82942);function o(e){var t=e.isOpen,n=e.onClose,o=e.options,i=e.onSelectOption;return t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{onClick:n,style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1040,animation:"fadeIn 0.2s ease-in-out"}}),(0,r.jsxs)("div",{style:{position:"fixed",bottom:0,left:0,right:0,backgroundColor:"#FFFFFF",borderRadius:"16px 16px 0 0",padding:"24px 20px",paddingBottom:"32px",zIndex:1050,animation:"slideUp 0.3s ease-out",boxShadow:"0 -4px 16px rgba(0, 0, 0, 0.1)"},children:[(0,r.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,r.jsx)("h5",{style:{fontFamily:"Inter",fontSize:"18px",fontWeight:600,color:"#1F2937",marginBottom:"4px"},children:"Registrar Ponto"}),(0,r.jsx)("p",{style:{fontFamily:"Inter",fontSize:"13px",color:"#9CA3AF",margin:0},children:"Selecione uma opção para registrar seu ponto"})]}),(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:o.map(function(e,t){return(0,r.jsxs)("button",{onClick:function(){i(e),n()},style:{display:"flex",alignItems:"center",gap:"16px",padding:"16px",backgroundColor:"#F9FAFB",border:"none",borderRadius:"8px",cursor:"pointer",transition:"background-color 0.2s",width:"100%"},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#F3F4F6"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="#F9FAFB"},children:[(0,r.jsx)("div",{style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#FFFFFF",borderRadius:"8px",color:"#17A2B8"},children:(0,r.jsx)("i",{className:(0,a.JC)(e),style:{fontSize:"20px"}})}),(0,r.jsx)("div",{style:{flex:1,textAlign:"left"},children:(0,r.jsx)("div",{style:{fontFamily:"Inter",fontSize:"15px",fontWeight:500,color:"#1F2937"},children:(0,a.kC)(e)})})]},t)})}),(0,r.jsx)("button",{onClick:n,style:{width:"100%",marginTop:"16px",padding:"14px",backgroundColor:"transparent",border:"1px solid #E5E7EB",borderRadius:"8px",color:"#6B7280",fontSize:"15px",fontWeight:500,fontFamily:"Inter",cursor:"pointer"},children:"Cancelar"})]}),(0,r.jsx)("style",{children:"\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n \n @keyframes slideUp {\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n }\n "})]}):null}},73215(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>m});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(58940),n(27495),n(38781),n(47764),n(23500),n(62953);var r=n(74848),a=n(96540),o=n(61909),i=n(88195);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==s(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e){var t=e.data,n=e.total,s=e.totalPages,l=e.page,u=void 0===l?1:l,f=e.pageSize,m=void 0===f?10:f,p=e.onPageChange,h=e.onPageSizeChange,v=e.title,b=void 0===v?"Histórico":v,y=(e.onOpenFilters,e.hasActiveFilters),g=void 0!==y&&y,x=e.searchKeyword,j=void 0===x?"":x,w=e.onSearchChange,S=e.onExportCSV,N=e.isExporting,k=void 0!==N&&N,C=e.isLoading,O=void 0!==C&&C,A=e.onApplyFilters,E=e.onClearFilters,P=d((0,a.useState)(!1),2),F=P[0],T=P[1],D=d((0,a.useState)(null),2),_=D[0],I=D[1],M=null!=n?n:t.length,R=Math.ceil(M/m),z=u<(null!=s?s:R),L=d((0,a.useState)(!1),2),q=L[0],B=L[1],G=(0,a.useRef)(null),H=(0,a.useRef)(null),W=d((0,a.useState)({recordType:"",validatedBy:"",channel:"",mode:""}),2),U=W[0],V=W[1],Q=function(){A&&A(U),B(!1)},K=function(){V({recordType:"",validatedBy:"",channel:"",mode:""}),E&&E(),B(!1)};return(0,a.useEffect)(function(){function e(e){if(q){var t=e.target,n=G.current&&G.current.contains(t),r=H.current&&H.current.contains(t);n||r||B(!1)}}return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[q]),(0,r.jsxs)("div",{className:"card app-card-surface mt-3",children:[(0,r.jsxs)("div",{className:"card-header app-controls-bar tm-controls-bar",children:[(0,r.jsxs)("div",{className:"d-none d-lg-flex align-items-center",children:[(0,r.jsx)("h3",{className:"card-title mb-0 mr-3",children:b}),(0,r.jsxs)("div",{className:"card-tools ml-auto d-flex align-items-center",children:[(0,r.jsxs)("button",{type:"button",className:"app-table-action-btn ml-2",onClick:S,disabled:k,children:[(0,r.jsx)("i",{className:"fas ".concat(k?"fa-spinner fa-spin":"fa-file"," mr-2")}),k?"Exportando...":"Exportar CSV"]}),(0,r.jsxs)("div",{className:"app-controls-search ml-2",style:{width:220},children:[(0,r.jsx)("i",{className:"fas fa-search mr-2 text-muted"}),(0,r.jsx)("input",{type:"text",className:"form-control",placeholder:"Buscar por Membro",value:j,onChange:function(e){return null==w?void 0:w(e.target.value)}})]}),(0,r.jsxs)("div",{className:"dropdown ml-2",ref:G,children:[(0,r.jsx)("button",{type:"button",className:"app-list-filter-btn ".concat(g?"has-filters":""),onClick:function(){return B(!q)},title:"Filtros",children:(0,r.jsx)("i",{className:"fas fa-filter"})}),q&&(0,r.jsxs)("div",{className:"dropdown-menu app-filter-dropdown show",style:{right:0},children:[(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Tipo de registro"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:U.recordType,onChange:function(e){return V(c(c({},U),{},{recordType:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"first_check_in",children:"Primeira Entrada"}),(0,r.jsx)("option",{value:"first_check_out",children:"Primeira Saída"}),(0,r.jsx)("option",{value:"second_check_in",children:"Segunda Entrada"}),(0,r.jsx)("option",{value:"second_check_out",children:"Segunda Saída"})]})]}),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Validação por"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:U.validatedBy,onChange:function(e){return V(c(c({},U),{},{validatedBy:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"selfie",children:"Selfie"}),(0,r.jsx)("option",{value:"screenshot",children:"Screenshot"}),(0,r.jsx)("option",{value:"geolocation",children:"Geolocalização"}),(0,r.jsx)("option",{value:"manual",children:"Manual"})]})]}),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Canal"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:U.channel,onChange:function(e){return V(c(c({},U),{},{channel:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"mobile",children:"App"}),(0,r.jsx)("option",{value:"web",children:"Navegador"}),(0,r.jsx)("option",{value:"sistema",children:"Sistema"})]})]}),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Modo"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:U.mode,onChange:function(e){return V(c(c({},U),{},{mode:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"individual",children:"Individual"}),(0,r.jsx)("option",{value:"coletivo",children:"Coletivo"})]})]}),(0,r.jsxs)("div",{className:"d-flex justify-content-between pt-1",children:[(0,r.jsx)("button",{className:"btn btn-sm text-muted",type:"button",onClick:K,children:"Limpar"}),(0,r.jsx)("button",{className:"btn btn-sm btn-primary",type:"button",onClick:Q,children:"Aplicar"})]})]})]})]})]}),(0,r.jsxs)("div",{className:"d-lg-none",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between mb-2",children:[(0,r.jsx)("h3",{className:"card-title mb-0",children:b}),(0,r.jsxs)("div",{className:"dropdown",ref:H,children:[(0,r.jsx)("button",{type:"button",className:"app-list-filter-btn ".concat(g?"has-filters":""),onClick:function(){return B(!q)},children:(0,r.jsx)("i",{className:"fas fa-filter"})}),q&&(0,r.jsxs)("div",{className:"dropdown-menu app-filter-dropdown show",style:{right:0},children:[(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Tipo de registro"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:U.recordType,onChange:function(e){return V(c(c({},U),{},{recordType:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"first_check_in",children:"Primeira Entrada"}),(0,r.jsx)("option",{value:"first_check_out",children:"Primeira Saída"}),(0,r.jsx)("option",{value:"second_check_in",children:"Segunda Entrada"}),(0,r.jsx)("option",{value:"second_check_out",children:"Segunda Saída"})]})]}),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Validação por"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:U.validatedBy,onChange:function(e){return V(c(c({},U),{},{validatedBy:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"selfie",children:"Selfie"}),(0,r.jsx)("option",{value:"screenshot",children:"Screenshot"}),(0,r.jsx)("option",{value:"geolocation",children:"Geolocalização"}),(0,r.jsx)("option",{value:"manual",children:"Manual"})]})]}),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Canal"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:U.channel,onChange:function(e){return V(c(c({},U),{},{channel:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"mobile",children:"App"}),(0,r.jsx)("option",{value:"web",children:"Navegador"}),(0,r.jsx)("option",{value:"sistema",children:"Sistema"})]})]}),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Modo"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:U.mode,onChange:function(e){return V(c(c({},U),{},{mode:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"individual",children:"Individual"}),(0,r.jsx)("option",{value:"coletivo",children:"Coletivo"})]})]}),(0,r.jsxs)("div",{className:"d-flex justify-content-between pt-1",children:[(0,r.jsx)("button",{className:"btn btn-sm text-muted",type:"button",onClick:K,children:"Limpar"}),(0,r.jsx)("button",{className:"btn btn-sm btn-primary",type:"button",onClick:Q,children:"Aplicar"})]})]})]})]}),(0,r.jsxs)("div",{className:"d-flex flex-column",children:[(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsxs)("div",{className:"input-group input-group-sm",children:[(0,r.jsx)("input",{type:"text",className:"form-control",placeholder:"Buscar por Membro",value:j,onChange:function(e){return null==w?void 0:w(e.target.value)}}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("button",{type:"button",className:"btn btn-default",children:(0,r.jsx)("i",{className:"fas fa-search"})})})]})}),(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsxs)("button",{type:"button",className:"btn btn-sm btn-default w-100",title:"Exportar CSV",onClick:S,disabled:k,children:[(0,r.jsx)("i",{className:"fas ".concat(k?"fa-spinner fa-spin":"fa-file"," mr-2")}),k?"Exportando...":"Exportar CSV"]})})]})]})]}),(0,r.jsx)("div",{className:"card-body",children:O?(0,r.jsx)("div",{className:"text-center py-4",children:(0,r.jsx)("div",{className:"spinner-border text-primary",role:"status",children:(0,r.jsx)("span",{className:"sr-only",children:"Carregando..."})})}):(0,r.jsx)(i.A,{columns:[{key:"nome",label:"Nome"},{key:"data",label:"Data",width:"18%"},{key:"tipo",label:"Tipo de Registro",width:"16%"},{key:"validacao",label:"Validação por",width:"18%"},{key:"canal",label:"Canal",width:"16%"},{key:"modo",label:"Modo",width:"12%"},{key:"acoes",label:"Ações",width:"8%",align:"right"}],data:t,renderRow:function(e){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"ms-table-cell",style:{textTransform:"capitalize"},children:e.nome}),(0,r.jsx)("td",{className:"ms-table-cell",style:{textTransform:"capitalize"},children:e.data}),(0,r.jsx)("td",{className:"ms-table-cell",style:{textTransform:"capitalize"},children:e.tipo}),(0,r.jsx)("td",{className:"ms-table-cell",style:{textTransform:"capitalize"},children:e.validacao}),(0,r.jsx)("td",{className:"ms-table-cell",style:{textTransform:"capitalize"},children:e.canal}),(0,r.jsx)("td",{className:"ms-table-cell",style:{textTransform:"capitalize"},children:e.modo}),(0,r.jsx)("td",{className:"app-table-cell-right",children:(0,r.jsx)("button",{type:"button",className:"app-table-action-button",onClick:function(){return function(e){var t={id:e.id,memberName:e.nome,memberId:e.memberId||0,time:e.data,recordType:e.tipo,type:e.type||"",validatedBy:e.validacao,channel:e.canal,mode:e.modo,status:e.status||"registrado",latitude:e.latitude||null,longitude:e.longitude||null,selfie:e.selfie||null,print:e.print||null,createdAt:e.createdAt||"",updatedAt:e.updatedAt||"",justificationType:e.justificationType||null,justificationId:e.justificationId||null,justification:e.justification||null};I(t),T(!0)}(e)},title:"Visualizar detalhes",children:(0,r.jsx)("i",{className:"fas fa-eye app-table-action-icon"})})})]})},emptyMessage:"Sem registros"})}),(0,r.jsxs)("div",{className:"card-footer app-table-footer",children:[(0,r.jsx)("div",{className:"app-table-footer__left",children:(0,r.jsxs)("small",{className:"text-muted",children:["Mostrando ",t.length," de ",M," Resultados"]})}),(0,r.jsx)("nav",{"aria-label":"Navegação da tabela",className:"app-table-footer__center",children:(0,r.jsxs)("ul",{className:"pagination pagination-sm mb-0 app-table-pagination",children:[(0,r.jsx)("li",{className:"page-item ".concat(u<=1?"disabled":""),children:(0,r.jsx)("button",{className:"page-link",onClick:function(){return null==p?void 0:p(Math.max(1,u-1))},"aria-label":"Anterior",disabled:u<=1,children:(0,r.jsx)("span",{"aria-hidden":"true",children:"‹"})})}),(0,r.jsx)("li",{className:"page-item active",children:(0,r.jsx)("span",{className:"page-link",children:u})}),(0,r.jsx)("li",{className:"page-item ".concat(z?"":"disabled"),children:(0,r.jsx)("button",{className:"page-link",onClick:function(){z&&(null==p||p(u+1))},"aria-label":"Próxima",disabled:!z,children:(0,r.jsx)("span",{"aria-hidden":"true",children:"›"})})})]})}),(0,r.jsxs)("div",{className:"d-flex align-items-center app-table-footer__right",children:[(0,r.jsx)("span",{className:"text-muted mr-2",children:"Resultados por página"}),(0,r.jsx)("select",{className:"custom-select custom-select-sm",style:{width:72},value:m,onChange:function(e){return null==h?void 0:h(parseInt(e.target.value,10))},children:[10,20,50,100].map(function(e){return(0,r.jsx)("option",{value:e,children:e},e)})})]})]}),(0,r.jsx)(o.default,{isOpen:F,onClose:function(){T(!1),I(null)},record:_})]})}},73236(e,t,n){"use strict";n.d(t,{A:()=>a});var r=n(74848);function a(e){var t=e.title,n=e.children,a=e.headerActions,o=e.className,i=void 0===o?"":o,s=e.bodyClassName,l=void 0===s?"":s;return(0,r.jsxs)("div",{className:"card app-card-surface ".concat(i),children:[(0,r.jsxs)("div",{className:"card-header app-controls-bar tm-controls-bar d-flex align-items-center",children:[(0,r.jsx)("h3",{className:"mb-0 mr-auto card-title",children:t}),a&&(0,r.jsx)("div",{children:a})]}),(0,r.jsx)("div",{className:"card-body ".concat(l),children:n})]})}},73638(e,t,n){"use strict";n.d(t,{A:()=>d,d:()=>f});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23418),n(64346),n(23792),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(58940),n(27495),n(38781),n(47764),n(23500),n(62953),n(76031);var r=n(74848),a=n(96540);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){var t=e.show,n=e.onClose,o=e.children,i=e.position,l=void 0===i?"bottom":i,u=e.width,d=void 0===u?"auto":u,f=e.triggerRef,m=e.centered,p=void 0!==m&&m,h=(0,a.useRef)(null),v=c((0,a.useState)({}),2),b=v[0],y=v[1];(0,a.useEffect)(function(){if(t){var e=function(e){var t=e.target;!h.current||h.current.contains(t)||null!=f&&f.current&&f.current.contains(t)||n()};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}},[t,n,f]);var g=(0,a.useCallback)(function(){if(t&&null!=f&&f.current&&h.current){var e=f.current.getBoundingClientRect(),n=h.current.offsetWidth||parseInt(d)||220,r=p?0:-150,a={position:"fixed",zIndex:900};switch(l){case"left":a.top="".concat(e.top,"px"),a.right="".concat(window.innerWidth-e.left+8,"px");break;case"right":a.top="".concat(e.top,"px"),a.left="".concat(e.right+8,"px");break;case"bottom":if(a.top="".concat(e.bottom+8,"px"),p){var o=e.left+e.width/2;a.left="".concat(o-n/2,"px")}else a.left="".concat(e.left+r,"px");a.transform="none",a.right="auto";break;case"top":if(a.bottom="".concat(window.innerHeight-e.top+8,"px"),p){var i=e.left+e.width/2;a.left="".concat(i-n/2,"px")}else a.left="".concat(e.left+r,"px");a.transform="none",a.right="auto"}y(a)}},[t,f,p,l,d]);return(0,a.useEffect)(function(){if(t)return window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),function(){window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g)}},[t,g]),(0,a.useEffect)(function(){if(t&&null!=f&&f.current&&h.current)g(),setTimeout(g,0);else if(t&&(null==f||!f.current)){y({left:{position:"absolute",top:"0",right:"100%",marginRight:"8px",transform:"none"},right:{position:"absolute",top:"0",left:"100%",marginLeft:"8px",transform:"none"},bottom:{position:"absolute",top:"100%",left:"0",transform:"none",marginTop:"8px"},top:{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px"}}[l])}},[t,l,f,g]),t?(0,r.jsx)("div",{ref:h,className:"dropdown-menu show",style:s(s({},b),{},{width:d}),children:o}):null}function f(e){var t=e.children;return(0,r.jsx)("div",{style:{position:"relative",display:"inline-block"},children:t})}},75842(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>d});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(20826),i=n(73638),s=n(92268),l={card:{backgroundColor:"#FFF",borderRadius:"8px",padding:"20px",marginTop:"20px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},title:{color:"#17A2B8",fontSize:"16px",fontWeight:600,marginBottom:"15px"},counter:{fontSize:"12px",fontWeight:400,color:"rgba(0, 0, 0, 0.25)",padding:"12px 15px",backgroundColor:"#EAEBEE",borderRadius:"5px",textAlign:"center",minWidth:"170px"},iconButton:{background:"transparent",border:"none",cursor:"pointer",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.2rem"},iconImage:{width:"20px",height:"20px"},select:{fontSize:"14px",padding:"8px 12px",border:"1px solid #EAEEF3",borderRadius:"5px",width:"100%",color:"#5C5D5D"},popover:{position:"absolute !important",top:"0 !important",right:"100% !important",marginRight:"8px !important",backgroundColor:"#FFF",border:"1px solid #EAEEF3",borderRadius:"5px",boxShadow:"0 4px 12px rgba(0,0,0,0.25)",zIndex:"9999 !important",minWidth:"200px",maxHeight:"300px",overflowY:"auto"},popoverItem:{padding:"10px 15px",cursor:"pointer",fontSize:"13px",color:"#5C5D5D",borderBottom:"1px solid #EAEEF3"}};function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){e.selectedProject,e.selectedActivity,e.onSelectActivity,e.onAddNewActivity,e.atividadesDisponiveis;var t=e.counterMode,n=e.onModeChange,u=e.onStartCounter,d=e.onStopCounter,f=e.onAddManualTime,m=e.isCounterRunning,p=e.counterTime,h=c((0,a.useState)(!1),2),v=h[0],b=h[1],y=(0,a.useRef)(null);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("style",{children:"\n\t\t\t\n\t\t\t"}),(0,r.jsx)("div",{style:l.counter,className:"counter-display-responsive",children:"automatico"===t?m?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{style:{fontSize:"14px",fontWeight:600,color:"#17A2B8"},children:p}),(0,r.jsx)("div",{style:{fontSize:"10px",color:"#6C757D"},children:"Contando..."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{style:{fontSize:"14px",fontWeight:600,color:"#6C757D"},children:p}),(0,r.jsx)("div",{style:{fontSize:"10px",color:"#6C757D"},children:"Pronto para iniciar"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{style:{fontSize:"14px",fontWeight:600,color:"#6C757D"},children:"Modo Manual"}),(0,r.jsx)("div",{style:{fontSize:"10px",color:"#6C757D"}})]})}),"automatico"===t?m?(0,r.jsx)(o.A,{label:"Parar Contador",icon:"/images/icons/stop.svg",variant:"solid",onClick:d,className:"btn-larger"}):(0,r.jsx)(o.A,{label:"Iniciar contador",icon:"/images/icons/Group(6).png",variant:"solid",onClick:u}):(0,r.jsx)(o.A,{label:"Adicionar Tempo",icon:"fas fa-plus",variant:"solid",onClick:f,className:"btn-larger"}),(0,r.jsxs)(i.d,{children:[(0,r.jsx)("button",{ref:y,style:l.iconButton,onClick:function(){return b(!v)},title:"Modo do Contador",className:"btn btn-link text-muted p-0",children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v"})}),(0,r.jsx)(s.A,{show:v,onClose:function(){return b(!1)},position:"bottom",triggerRef:y,options:[{label:"Automático",value:"automatico",icon:"/images/icons/automatico.svg",selected:"automatico"===t},{label:"Manual",value:"manual",icon:"/images/icons/play.svg",selected:"manual"===t}],onSelect:function(e){return n(e)}})]})]})}},75930(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>V});n(52675),n(89463),n(2259),n(45700),n(28706),n(88431),n(2008),n(50113),n(51629),n(23418),n(74423),n(64346),n(23792),n(48598),n(62062),n(72712),n(34782),n(15086),n(26910),n(59089),n(1688),n(60739),n(89572),n(23288),n(94170),n(62010),n(36033),n(2892),n(40150),n(59904),n(67945),n(84185),n(83851),n(81278),n(40875),n(79432),n(10287),n(26099),n(3362),n(27495),n(38781),n(31415),n(21699),n(47764),n(71761),n(68156),n(25440),n(42762),n(23500),n(62953),n(3296),n(27208),n(48408);var r=n(74848),a=n(96540),o=n(53482),i=n(97665),s=n(33930),l=n(57097),c=n(50860),u=n(1806),d=n(12921),f=n(52354);function m(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return p(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(p(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,p(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,p(d,"constructor",c),p(c,"constructor",l),l.displayName="GeneratorFunction",p(c,a,"GeneratorFunction"),p(d),p(d,a,"Generator"),p(d,r,function(){return this}),p(d,"toString",function(){return"[object Generator]"}),(m=function(){return{w:o,m:f}})()}function p(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}p=function(e,t,n,r){function o(t,n){p(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},p(e,t,n,r)}function h(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function v(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){h(o,r,a,i,s,"next",e)}function s(e){h(o,r,a,i,s,"throw",e)}i(void 0)})}}function b(){return(b=v(m().m(function e(t){var n,r;return m().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,f.F.post("/time-management/presence-lists",t);case 1:return n=e.v,r=n.data,e.a(2,r)}},e)}))).apply(this,arguments)}function y(){return(y=v(m().m(function e(t,n){var r,a;return m().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,f.F.post("/time-management/presence-lists/".concat(t,"/recreate"),n);case 1:return r=e.v,a=r.data,e.a(2,a)}},e)}))).apply(this,arguments)}function g(e){return x.apply(this,arguments)}function x(){return(x=v(m().m(function e(t){return m().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,f.F.delete("/time-management/presence-lists/".concat(t));case 1:return e.a(2)}},e)}))).apply(this,arguments)}function j(e,t){return w.apply(this,arguments)}function w(){return(w=v(m().m(function e(t,n){return m().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,f.F.delete("/time-management/presence-lists/".concat(t,"/participants/").concat(n));case 1:return e.a(2)}},e)}))).apply(this,arguments)}function S(e){return N.apply(this,arguments)}function N(){return(N=v(m().m(function e(t){var n,r;return m().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,f.F.get("/v2/file-management/files/".concat(t));case 1:return n=e.v,r=n.data,e.a(2,r.data)}},e)}))).apply(this,arguments)}function k(){return C.apply(this,arguments)}function C(){return(C=v(m().m(function e(){var t,n;return m().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,f.F.get("/time-management/presence-lists");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function O(e){return A.apply(this,arguments)}function A(){return(A=v(m().m(function e(t){var n,r;return m().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,f.F.get("/time-management/presence-lists/".concat(t));case 1:return n=e.v,r=n.data,e.a(2,r.data)}},e)}))).apply(this,arguments)}function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function P(e){return function(e){if(Array.isArray(e))return q(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||L(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F(Object(n),!0).forEach(function(t){D(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function D(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=E(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==E(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return I(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(I(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,I(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,I(d,"constructor",c),I(c,"constructor",l),l.displayName="GeneratorFunction",I(c,a,"GeneratorFunction"),I(d),I(d,a,"Generator"),I(d,r,function(){return this}),I(d,"toString",function(){return"[object Generator]"}),(_=function(){return{w:o,m:f}})()}function I(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}I=function(e,t,n,r){function o(t,n){I(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},I(e,t,n,r)}function M(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function R(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){M(o,r,a,i,s,"next",e)}function s(e){M(o,r,a,i,s,"throw",e)}i(void 0)})}}function z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||L(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(e,t){if(e){if("string"==typeof e)return q(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(e,t):void 0}}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var B=[{value:"",label:"Status"},{value:"draft",label:"Rascunho"},{value:"in_progress",label:"Em andamento"},{value:"finished",label:"Finalizado"}],G=[{value:"",label:"Status"},{value:"Presente",label:"Presente"},{value:"Pendente",label:"Pendente"},{value:"Ausente",label:"Ausente"}],H=[{value:"treinamento",label:"Treinamento"},{value:"palestra",label:"Palestra"},{value:"workshop",label:"Workshop"},{value:"reuniao",label:"Reunião"},{value:"outros",label:"Outros"}],W=[{value:"",label:"Origem"}].concat(H),U=[{value:"qr_code",label:"QR Code",icon:"fas fa-qrcode mr-2 text-primary"},{value:"photo",label:"Foto",icon:"fas fa-mobile-alt mr-2 text-primary"},{value:"signature",label:"Assinatura",icon:"fas fa-signature mr-2 text-primary"}];function V(){var e,t,n,o=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).onHeaderContextChange,l=z((0,a.useState)({startDate:"",endDate:""}),2),u=l[0],d=l[1],f=z((0,a.useState)(""),2),m=f[0],p=f[1],h=z((0,a.useState)(""),2),v=h[0],b=h[1],y=z((0,a.useState)(""),2),x=y[0],w=y[1],N=z((0,a.useState)(10),2),C=N[0],A=N[1],E=z((0,a.useState)("list"),2),P=E[0],F=E[1],D=z((0,a.useState)(!1),2),I=D[0],M=D[1],L=z((0,a.useState)(null),2),q=L[0],G=L[1],H=z((0,a.useState)(null),2),U=H[0],V=H[1],$=z((0,a.useState)(null),2),J=$[0],Y=$[1],Z=z((0,a.useState)(null),2),X=Z[0],ee=Z[1],te=z((0,a.useState)(null),2),ne=te[0],re=te[1],ae=z((0,a.useState)(new Set),2),le=ae[0],ue=ae[1],de=(0,i.jE)(),pe=(0,s.I)({queryKey:["time-management","presence-lists"],queryFn:k}),he=pe.data,ge=pe.isFetching,xe=pe.isError,je=pe.refetch,we=(0,s.I)({queryKey:["time-management","presence-list-details",null==X?void 0:X.id],queryFn:function(){return O(X.id)},enabled:null!==X}),Ne=ge&&!he,ke=null!==(e=null==he?void 0:he.rows)&&void 0!==e?e:[],Oe=null!==(t=null==he?void 0:he.summary)&&void 0!==t?t:{active_lists:0,closed_lists:0,pending_validations:0,validated:0,attendance_average:0,presences:0,absences:0},Ae=[{title:"Listas Ativas",value:String(Oe.active_lists),progress:Ce(Oe.active_lists,Oe.active_lists+Oe.closed_lists),footer:"Fechadas: ".concat(Oe.closed_lists)},{title:"Pendências de validação",value:String(Oe.pending_validations),progress:Ce(Oe.validated,Oe.validated+Oe.pending_validations),footer:"Validadas: ".concat(Oe.validated)},{title:"Média de presença",value:"".concat(Oe.attendance_average,"%"),progress:Oe.attendance_average,footer:"Presenças: ".concat(Oe.presences," Faltas: ").concat(Oe.absences)}];(0,a.useEffect)(function(){var e=window,t=e.TM_PUSHER_KEY||"",n=e.TM_PUSHER_CLUSTER||"mt1",r=Number(e.TM_USER_ID)||0;if(t&&r&&void 0!==e.Pusher){var a=new e.Pusher(t,{cluster:n,forceTLS:!0}),o="time-management-user-".concat(r),i=a.subscribe(o);return i.bind("presence-list-generating",function(e){var t=Number(null==e?void 0:e.presenceId);t>0&&(ue(function(e){return new Set(e).add(t)}),je())}),i.bind("presence-list-ready",function(t){var n=Number(null==t?void 0:t.presenceId);if(n>0){var r,a;ue(function(e){var t=new Set(e);return t.delete(n),t}),je();var o=null!=t&&t.title?' "'.concat(t.title,'"'):"";null===(r=e.toastr)||void 0===r||null===(a=r.success)||void 0===a||a.call(r,"Lista de presença".concat(o," processada com sucesso."))}}),i.bind("presence-list-failed",function(t){var n,r,a=Number(null==t?void 0:t.presenceId);a>0&&ue(function(e){var t=new Set(e);return t.delete(a),t});var o=null!=t&&t.error?" ".concat(t.error):"";null===(n=e.toastr)||void 0===n||null===(r=n.error)||void 0===r||r.call(n,"Falha ao processar lista de presença.".concat(o))}),function(){i.unbind_all(),a.unsubscribe(o)}}},[]),(0,a.useEffect)(function(){return function(){return null==o?void 0:o({title:"GESTÃO DE TEMPO",hideTabs:!1})}},[o]),(0,a.useEffect)(function(){var e;o&&o(X?{title:(null===(e=we.data)||void 0===e?void 0:e.list.title)||X.title||"Lista de presença",onBack:function(){return ee(null)},hideTabs:!0}:{title:"GESTÃO DE TEMPO",hideTabs:!1})},[null===(n=we.data)||void 0===n?void 0:n.list.title,o,X]);var Ee=(0,a.useMemo)(function(){var e=Se(x);return ke.filter(function(t){var n=!e||Se("".concat(t.title," ").concat(t.method," ").concat(t.status," ").concat(t.origin)).includes(e),r=function(e,t){return!t||("draft"===t?"Rascunho"===e:"finished"===t?"Finalizada"===e:"in_progress"!==t||("Em andamento"===e||"Aguardando"===e||"Erro"===e))}(t.status,m),a=function(e,t,n){if(!n.startDate&&!n.endDate)return!0;var r=e?new Date(e).getTime():Number.NaN,a=t?new Date(t).getTime():r;if(Number.isNaN(r)&&Number.isNaN(a))return!1;var o=n.startDate?new Date("".concat(n.startDate,"T00:00:00")).getTime():Number.NEGATIVE_INFINITY,i=n.endDate?new Date("".concat(n.endDate,"T23:59:59")).getTime():Number.POSITIVE_INFINITY,s=Number.isNaN(r)?a:r,l=Number.isNaN(a)?s:a;return s<=i&&l>=o}(t.validationStartsAt,t.validationEndsAt,u),o=!v||t.originKey===v;return n&&r&&a&&o})},[ke,u,v,x,m]),Pe=function(){var e=R(_().m(function e(t){return _().w(function(e){for(;;)switch(e.n){case 0:if(window.confirm('Tem certeza que deseja excluir a lista "'.concat(t.title,'"?'))){e.n=1;break}return e.a(2);case 1:return e.n=2,g(t.id);case 2:(null==X?void 0:X.id)===t.id&&ee(null),de.invalidateQueries({queryKey:["time-management","presence-lists"]}),de.invalidateQueries({queryKey:["time-management","presence-list-details",t.id]});case 3:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),Fe=function(){var e=R(_().m(function e(t){var n,r,a,o,i,s;return _().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,O(t.id);case 1:n=e.v,re(n),M(!0),e.n=3;break;case 2:e.p=2,s=e.v,i=(null==s||null===(r=s.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.message)||"Não foi possível carregar a lista para edição.",null===(a=window.toastr)||void 0===a||null===(o=a.error)||void 0===o||o.call(a,i);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),Te=function(){var e=R(_().m(function e(t){return _().w(function(e){for(;;)switch(e.n){case 0:if(X){e.n=1;break}return e.a(2);case 1:if(window.confirm("Remover ".concat(t.name," desta lista de presença?"))){e.n=2;break}return e.a(2);case 2:return e.n=3,j(X.id,t.id);case 3:de.invalidateQueries({queryKey:["time-management","presence-lists"]}),de.invalidateQueries({queryKey:["time-management","presence-list-details",X.id]});case 4:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),De=function(){var e=R(_().m(function e(t){var n,r,a;return _().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.photoFileId){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,S(t.photoFileId);case 2:if(r=e.v,a=(null===(n=r.local_urls)||void 0===n?void 0:n.view)||r.preview_url||r.content_url){e.n=3;break}return window.alert("Não foi possível carregar a foto enviada."),e.a(2);case 3:Y(a),V(t),e.n=5;break;case 4:e.p=4,e.v,window.alert("Não foi possível carregar a foto enviada.");case 5:return e.a(2)}},e,null,[[1,4]])}));return function(t){return e.apply(this,arguments)}}();return(0,r.jsxs)(c.A,{className:"tm-attendance-page",children:[!X&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"row no-gutters mb-md-4 app-controls-bar-row tm-attendance-controls-row",children:(0,r.jsxs)("div",{className:"col-12 d-flex flex-column flex-md-row justify-content-between align-items-md-center app-controls-bar filters-section pl-3 pr-2 py-2 tm-attendance-toolbar",children:[(0,r.jsx)("div",{className:"tm-attendance-header-actions mb-2 mb-md-0",children:(0,r.jsx)(Q,{icon:"fas fa-plus",onClick:function(){return M(!0)},children:"Criar Lista"})}),(0,r.jsxs)("div",{className:"tm-attendance-filters d-flex flex-column flex-md-row align-items-md-center justify-content-md-end order-2 w-100 w-md-auto","aria-label":"Filtros de presença",children:[(0,r.jsx)(ve,{value:u,onChange:d}),(0,r.jsx)(be,{options:B,value:m,onChange:p}),(0,r.jsx)(be,{options:W,value:v,onChange:b}),(0,r.jsx)(ye,{value:x,onChange:w}),(0,r.jsx)("button",{className:"tm-attendance-icon-button ".concat("cards"===P?"is-active":""),type:"button","aria-label":"cards"===P?"Ver em lista":"Ver em cards","aria-pressed":"cards"===P,onClick:function(){return F(function(e){return"cards"===e?"list":"cards"})},children:(0,r.jsx)("i",{className:"far fa-calendar-alt"})})]})]})}),(0,r.jsx)("div",{className:"tm-attendance-summary-grid",children:Ae.map(function(e){return(0,r.jsx)(oe,T({},e),e.title)})})]}),X?(0,r.jsx)(ce,{row:X,details:we.data,isLoading:we.isFetching&&!we.data,isError:we.isError,onRetry:function(){return we.refetch()},onShowPhoto:De,onRemoveParticipant:Te,itemsPerPage:C,onItemsPerPageChange:A}):xe?(0,r.jsxs)("div",{className:"tm-attendance-empty-card",children:["Não foi possível carregar as listas de presença.",(0,r.jsx)("button",{type:"button",className:"btn btn-link p-0 ml-2",onClick:function(){return je()},children:"Tentar novamente"})]}):Ne?(0,r.jsx)("div",{className:"tm-attendance-empty-card",children:"Carregando listas de presença..."}):"cards"===P?(0,r.jsx)(se,{rows:Ee,onView:ee,onEdit:Fe,onDelete:Pe,onShowQr:function(e){return G(e)},generatingIds:le}):(0,r.jsx)(ie,{rows:Ee,totalRows:ke.length,itemsPerPage:C,onItemsPerPageChange:A,onView:ee,onEdit:Fe,onDelete:Pe,onShowQr:function(e){return G(e)},generatingIds:le}),(0,r.jsx)(K,{show:I,onClose:function(){M(!1),re(null)},onCreated:function(e){G(e),e.id>0&&(ue(function(t){return new Set(t).add(e.id)}),je())},editDetails:ne}),(0,r.jsx)(fe,{row:q,onClose:function(){return G(null)}}),(0,r.jsx)(me,{participant:U,photoUrl:J,onClose:function(){V(null),Y(null)}})]})}function Q(e){var t=e.children,n=e.icon,a=e.onClick;return(0,r.jsxs)("button",{type:"button",className:"tm-attendance-create-button",onClick:a,children:[n&&(0,r.jsx)("i",{className:n,"aria-hidden":"true"}),t]})}function K(e){var t=e.show,n=e.onClose,s=e.onCreated,c=e.editDetails,d=(0,i.jE)(),m=!!c,p=z((0,a.useState)(""),2),h=p[0],v=p[1],g=z((0,a.useState)("treinamento"),2),x=g[0],j=g[1],w=z((0,a.useState)(""),2),S=w[0],N=w[1],k=z((0,a.useState)(""),2),C=k[0],A=k[1],E=z((0,a.useState)(""),2),F=E[0],T=E[1],D=z((0,a.useState)(""),2),I=D[0],M=D[1],L=z((0,a.useState)(""),2),q=L[0],B=L[1],G=z((0,a.useState)("qr_code"),2),W=G[0],V=G[1],Q=z((0,a.useState)([]),2),K=Q[0],J=Q[1],oe=z((0,a.useState)([]),2),ie=oe[0],se=oe[1],le=z((0,a.useState)([]),2),ce=le[0],ue=le[1],de=z((0,a.useState)([]),2),fe=de[0],me=de[1],pe=z((0,a.useState)(!1),2),he=pe[0],ve=pe[1],be=z((0,a.useState)(!1),2),ye=be[0],ge=be[1],xe=z((0,a.useState)(!1),2),je=xe[0],we=xe[1],Se=z((0,a.useState)(null),2),Ne=Se[0],ke=Se[1],Ce=z((0,a.useState)([]),2),Ae=Ce[0],Ee=Ce[1],Pe=z((0,a.useState)([]),2),Fe=Pe[0],Te=Pe[1],De=z((0,a.useState)([]),2),_e=De[0],Ie=De[1],Me=z((0,a.useState)(!1),2),Re=Me[0],ze=Me[1];(0,a.useEffect)(function(){var e,n,r,a,o,i,s,l;if(t){var u=null!==(e=null==c?void 0:c.participants.map(Z))&&void 0!==e?e:[],d=null!==(n=null==c?void 0:c.list.responsibles.map(X))&&void 0!==n?n:[];v(null!==(r=null==c?void 0:c.list.title)&&void 0!==r?r:""),j(null!==(a=null==c?void 0:c.list.eventOrigin)&&void 0!==a?a:"treinamento"),N(null!==(o=null==c?void 0:c.list.workload)&&void 0!==o?o:""),A(null!==(i=null==c?void 0:c.list.location)&&void 0!==i?i:""),T(null!==(s=null==c?void 0:c.list.programContent)&&void 0!==s?s:""),M(c?Oe(c.list.validationStartsAt):""),B(c?Oe(c.list.validationEndsAt):""),V(null!==(l=null==c?void 0:c.list.validationModel)&&void 0!==l?l:"qr_code"),J(u),se(d),ue(u),me(d),we(!1)}},[t,c]),(0,a.useEffect)(function(){t&&c&&(Ge("",ue,ve),Ge("",me,ge))},[t,c]);var Le,qe=(0,l.n)({mutationFn:function(e){return c?function(e,t){return y.apply(this,arguments)}(c.list.id,e):function(e){return b.apply(this,arguments)}(e)},onSuccess:(Le=R(_().m(function e(t){var r,a,o,i,l;return _().w(function(e){for(;;)switch(e.n){case 0:if(a=null,!((o=Number((null==t||null===(r=t.data)||void 0===r?void 0:r.id)||0))>0)||"qr_code"!==W&&"photo"!==W&&"signature"!==W){e.n=2;break}return e.n=1,O(o);case 1:l=e.v,a={id:l.list.id,title:l.list.title,method:l.list.method,globalToken:l.list.globalToken,signatureEditUrl:null!==(i=l.list.signatureEditUrl)&&void 0!==i?i:null};case 2:v(""),j("treinamento"),N(""),A(""),T(""),M(""),B(""),V("qr_code"),J([]),se([]),ue([]),me([]),we(!1),d.invalidateQueries({queryKey:["time-management","presence-lists"]}),n(),a&&s(a);case 3:return e.a(2)}},e)})),function(e){return Le.apply(this,arguments)})}),Be=!h.trim()||!I||!q||0===K.length||qe.isPending,Ge=function(){var e=R(_().m(function e(){var t,n,r,a,o,i=arguments;return _().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:"",n=i.length>1?i[1]:void 0,(r=i.length>2?i[2]:void 0)(!0),e.p=1,e.n=2,f.F.get("/v2/company/members",{params:{term:t,limit:100},headers:{Accept:"application/json"}});case 2:a=e.v,o=a.data,n(ne(o).map(Y));case 3:return e.p=3,r(!1),e.f(3);case 4:return e.a(2)}},e,null,[[1,,3,4]])}));return function(){return e.apply(this,arguments)}}(),He=function(){var e=R(_().m(function e(){var t,n,r,a,o,i,s,l,c,u,d;return _().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!(Fe.length>0)){e.n=1;break}return e.a(2);case 1:return ze(!0),e.p=2,e.n=3,Promise.all([f.F.get("/v2/company/members",{params:{term:"",limit:1e3},headers:{Accept:"application/json"}}),f.F.get("/v2/company/teams",{params:{term:""},headers:{Accept:"application/json"}}).catch(function(){return{data:{data:[]}}})]);case 3:t=e.v,n=z(t,2),r=n[0],a=n[1],o=ne(r.data).map(Y),i=ne(a.data).map(function(e){return{value:String(e.id),label:e.name||e.text||"#".concat(e.id)}}),Te(o),ue(function(e){return te(e,o)}),me(function(e){return te(e,o)}),Ie(i),e.n=5;break;case 4:e.p=4,d=e.v,u=(null==d||null===(s=d.response)||void 0===s||null===(s=s.data)||void 0===s?void 0:s.message)||"Não foi possível carregar os membros.",null===(l=window.toastr)||void 0===l||null===(c=l.error)||void 0===c||c.call(l,u);case 5:return e.p=5,ze(!1),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),We=function(e){Ee("participants"===e?K:ie),ke(e),He()},Ue=function(){ke(null),Ee([])},Ve=function(e,t){(function(e){return e instanceof Element&&!!e.closest(".tm-presence-select__multi-value__remove, .tm-presence-select__clear-indicator")})(e.target)||(e.preventDefault(),We(t))},Qe=function(e,t){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),We(t))};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.A,{show:t,onClose:n,title:m?"Editar Lista de Presença":"Nova Lista de Presença",size:"xl",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{type:"button",className:"btn btn-link text-muted text-decoration-none mr-auto",onClick:function(){var e,t,n=function(e){var t,n=window,r=String(n.TM_ATTENDANCE_LIST_PREVIEW_URL||"").trim();if(!r)return"";var a=e.selectedResponsibles.map(function(e,t){return{id:e.value||t+1,name:e.label||e.email||"Responsável ".concat(t+1),email:e.email||""}}),o=(null===(t=a[0])||void 0===t?void 0:t.name)||String(n.TM_ATTENDANCE_LIST_PREVIEW_RESPONSIBLE||"Responsavel MetaHuman"),i=String(n.TM_ATTENDANCE_LIST_PREVIEW_COMPANY||"MetaHuman"),s=e.selectedParticipants.map(function(e,t){return{user_id:e.value||t+1,name:e.label||"Participante ".concat(t+1),email:e.email||"",company:"",role:"",area:"",status:"pending"}}),l=new URL(r,window.location.origin);l.searchParams.set("title",e.title.trim()||"Lista de Presenca"),l.searchParams.set("description",e.title.trim()||"Lista de Presenca"),l.searchParams.set("event_type",function(e){var t=H.find(function(t){return t.value===e});return(null==t?void 0:t.label)||"Treinamento"}(e.eventOrigin)),e.validationStartsAt&&l.searchParams.set("date",ee(e.validationStartsAt));e.validationEndsAt&&l.searchParams.set("end_date",ee(e.validationEndsAt));l.searchParams.set("workload",e.workload.trim()||"15 minutos"),l.searchParams.set("location",e.location.trim()||"-"),e.programContent.trim()&&l.searchParams.set("program_content",e.programContent.trim());l.searchParams.set("participants",String(s.length||10)),s.length&&l.searchParams.set("participants_data",JSON.stringify(s));l.searchParams.set("company",i),l.searchParams.set("responsible",o),a.length&&l.searchParams.set("responsibles_data",JSON.stringify(a));return l.searchParams.set("exported_by",String(n.TM_ATTENDANCE_LIST_PREVIEW_RESPONSIBLE||o)),l.searchParams.set("unit",e.title.trim()||"Lista de Presenca"),l.toString()}({title:h,eventOrigin:x,workload:S,location:C,programContent:F,validationStartsAt:I,validationEndsAt:q,selectedParticipants:K,selectedResponsibles:ie});n?window.open(n,"_blank","noopener,noreferrer"):null===(e=window.toastr)||void 0===e||null===(t=e.error)||void 0===t||t.call(e,"Não foi possível abrir o preview da lista de presença.")},children:[(0,r.jsx)("i",{className:"far fa-eye mr-1"}),"Ver template"]}),(0,r.jsx)(u.M,{onCancel:n,onConfirm:function(){var e;Be||qe.mutate({title:h.trim(),event_origin:x,validation_model:W,workload:S.trim(),location:C.trim(),program_content:F.trim(),validation_starts_at:I,validation_ends_at:q,participant_user_ids:K.map(function(e){return e.value}),responsible_user_ids:ie.map(function(e){return e.value}),product:(null==c?void 0:c.list.productKey)||"manual",product_reference_id:null!==(e=null==c?void 0:c.list.productReferenceId)&&void 0!==e?e:null,send_chat_message:je})},cancelText:"Cancelar",confirmText:qe.isPending?m?"Salvando...":"Criando...":m?"Salvar alterações":"Criar lista",confirmDisabled:Be})]}),children:(0,r.jsxs)("form",{className:"tm-attendance-create-form",children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-md-7",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"presenceTitle",children:"Título da lista *"}),(0,r.jsx)("input",{id:"presenceTitle",type:"text",className:"form-control",value:h,onChange:function(e){return v(e.target.value)},placeholder:"Ex.: Lista de presença para treinamento"})]})}),(0,r.jsx)("div",{className:"col-md-5",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"presenceEventOrigin",children:"Origem do evento *"}),(0,r.jsx)("select",{id:"presenceEventOrigin",className:"form-control",value:x,onChange:function(e){return j(e.target.value)},children:H.map(function(e){return(0,r.jsx)("option",{value:e.value,children:e.label},e.value)})})]})})]}),(0,r.jsxs)("details",{className:"tm-attendance-optional-accordion mb-3",children:[(0,r.jsx)("summary",{className:"tm-attendance-optional-summary",children:"Campos opcionais da lista de assinatura"}),(0,r.jsxs)("div",{className:"tm-attendance-optional-body mt-3",children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"presenceWorkload",children:"Carga horária"}),(0,r.jsx)("input",{id:"presenceWorkload",type:"text",className:"form-control",value:S,maxLength:100,onChange:function(e){return N(e.target.value)},placeholder:"Ex.: 15 minutos"})]})}),(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"presenceLocation",children:"Local"}),(0,r.jsx)("input",{id:"presenceLocation",type:"text",className:"form-control",value:C,maxLength:80,onChange:function(e){return A(e.target.value)},placeholder:"Ex.: Sala 01"})]})})]}),(0,r.jsxs)("div",{className:"form-group mb-0",children:[(0,r.jsx)("label",{htmlFor:"presenceProgramContent",children:"Conteúdo programático"}),(0,r.jsx)("textarea",{id:"presenceProgramContent",className:"form-control",value:F,maxLength:1e3,rows:4,onChange:function(e){return T(e.target.value)},placeholder:"Descreva brevemente os tópicos abordados."}),(0,r.jsxs)("small",{className:"form-text text-muted",children:[F.length,"/1000 caracteres"]})]})]})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"presenceParticipants",children:"Participantes *"}),(0,r.jsx)("div",{role:"button",tabIndex:0,onMouseDown:function(e){return Ve(e,"participants")},onKeyDown:function(e){return Qe(e,"participants")},children:(0,r.jsx)(o.Ay,{inputId:"presenceParticipants",isMulti:!0,isSearchable:!1,openMenuOnClick:!1,openMenuOnFocus:!1,menuIsOpen:!1,isLoading:he,options:ce,value:K,onChange:function(e){return J(P(e))},placeholder:"Selecione os participantes",noOptionsMessage:function(){return"Nenhum participante encontrado"},classNamePrefix:"tm-presence-select",styles:ae,menuPortalTarget:"undefined"!=typeof document?document.body:void 0,menuPosition:"fixed"})})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"presenceResponsibles",children:"Responsáveis"}),(0,r.jsx)("div",{role:"button",tabIndex:0,onMouseDown:function(e){return Ve(e,"responsibles")},onKeyDown:function(e){return Qe(e,"responsibles")},children:(0,r.jsx)(o.Ay,{inputId:"presenceResponsibles",isMulti:!0,isSearchable:!1,openMenuOnClick:!1,openMenuOnFocus:!1,menuIsOpen:!1,isLoading:ye,options:fe,value:ie,onChange:function(e){return se(P(e))},placeholder:"Selecione os responsáveis",noOptionsMessage:function(){return"Nenhum responsável encontrado"},classNamePrefix:"tm-presence-select",styles:ae,menuPortalTarget:"undefined"!=typeof document?document.body:void 0,menuPosition:"fixed"})})]}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"presenceValidationStartsAt",children:"Validação a partir de *"}),(0,r.jsx)("input",{id:"presenceValidationStartsAt",type:"datetime-local",className:"form-control",value:I,onChange:function(e){return M(e.target.value)}})]})}),(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"presenceValidationEndsAt",children:"Validação até *"}),(0,r.jsx)("input",{id:"presenceValidationEndsAt",type:"datetime-local",className:"form-control",value:q,onChange:function(e){return B(e.target.value)}})]})})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{children:"Modelo de validação *"}),(0,r.jsx)("div",{className:"row",children:U.map(function(e){var t=W===e.value;return(0,r.jsx)("div",{className:"col-12 col-md-4 mb-2",children:(0,r.jsxs)("button",{type:"button",onClick:function(){return V(e.value)},className:"btn btn-block text-left d-flex align-items-center ".concat(t?"border-primary text-primary bg-primary-soft":"border"),children:[(0,r.jsx)("i",{className:e.icon}),e.label]})},e.value)})}),(0,r.jsx)("small",{className:"form-text text-muted",children:"QR Code e Foto geram um QR Code global por lista que o manager imprime e cola no evento. O participante precisa fazer login para confirmar presença."})]}),(0,r.jsxs)("div",{className:"custom-control custom-checkbox",children:[(0,r.jsx)("input",{type:"checkbox",className:"custom-control-input",id:"presenceSendChatMessage",checked:je,onChange:function(e){return we(e.target.checked)}}),(0,r.jsx)("label",{className:"custom-control-label",htmlFor:"presenceSendChatMessage",children:"Enviar mensagem automaticamente no chat para os participantes"})]}),qe.isError&&(0,r.jsx)("div",{className:"alert alert-danger mt-3 mb-0",children:re(qe.error,m)})]})}),(0,r.jsx)($,{show:null!==Ne,title:"responsibles"===Ne?"Selecionar Responsáveis":"Selecionar Participantes",members:Fe,teams:_e,selected:Ae,isLoading:Re,onChange:Ee,onClose:Ue,onConfirm:function(){"participants"===Ne&&(J(Ae),ue(function(e){return te(e,Ae)})),"responsibles"===Ne&&(se(Ae),me(function(e){return te(e,Ae)})),Ue()}})]})}function $(e){var t=e.show,n=e.title,o=e.members,i=e.teams,s=e.selected,l=e.isLoading,c=e.onChange,d=e.onClose,f=e.onConfirm,m=z((0,a.useState)(""),2),p=m[0],h=m[1],v=z((0,a.useState)(""),2),b=v[0],y=v[1],g=(0,a.useMemo)(function(){return new Map(s.map(function(e){return[String(e.value),e]}))},[s]),x=(0,a.useMemo)(function(){var e=Se("".concat(p));return o.filter(function(t){var n,r=!e||Se("".concat(t.label," ").concat(t.email)).includes(e),a=!b||(null!==(n=t.teams)&&void 0!==n?n:[]).some(function(e){return e.id===b});return r&&a})},[o,p,b]),j=x.length>0&&x.every(function(e){return g.has(String(e.value))});(0,a.useEffect)(function(){t||(h(""),y(""))},[t]);var w=function(e){var t=String(e.value);g.has(t)?c(s.filter(function(e){return String(e.value)!==t})):c([].concat(P(s),[e]))};return(0,r.jsxs)(u.A,{show:t,onClose:d,title:n,size:"lg",className:"tm-member-picker-modal",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("span",{className:"mr-auto small text-muted",children:[s.length," selecionado(s)"]}),(0,r.jsx)("button",{type:"button",className:"btn mhs-btn-cancel",onClick:d,children:"Cancelar"}),(0,r.jsx)("button",{type:"button",className:"btn mhs-btn-primary",onClick:f,children:"Selecionar"})]}),children:[(0,r.jsxs)("div",{className:"tm-member-picker-filters",children:[(0,r.jsx)("input",{type:"search",className:"form-control",value:p,onChange:function(e){return h(e.target.value)},placeholder:"Buscar por Nome"}),(0,r.jsxs)("select",{className:"form-control",value:b,onChange:function(e){return y(e.target.value)},children:[(0,r.jsx)("option",{value:"",children:"Filtrar por Equipe"}),i.map(function(e){return(0,r.jsx)("option",{value:e.value,children:e.label},e.value)})]})]}),(0,r.jsx)("div",{className:"tm-member-picker-table-wrap",children:(0,r.jsxs)("table",{className:"table mb-0 tm-member-picker-table",children:[(0,r.jsx)("thead",{className:"thead-light",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{style:{width:48},children:(0,r.jsxs)("label",{className:"tm-member-picker-check",children:[(0,r.jsx)("input",{type:"checkbox",checked:j,disabled:0===x.length,onChange:function(){if(j){var e=new Set(x.map(function(e){return String(e.value)}));c(s.filter(function(t){return!e.has(String(t.value))}))}else c(te(s,x))}}),(0,r.jsx)("span",{})]})}),(0,r.jsx)("th",{children:"Membro"}),(0,r.jsx)("th",{className:"text-black-50 font-weight-bold",children:"Equipe"})]})}),(0,r.jsxs)("tbody",{children:[l&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:3,className:"text-muted p-4",children:"Carregando membros..."})}),!l&&0===x.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:3,className:"text-muted p-4",children:"Nenhum resultado."})}),!l&&x.map(function(e){var t,n=g.has(String(e.value));return(0,r.jsxs)("tr",{className:n?"selected":"",onClick:function(){return w(e)},children:[(0,r.jsx)("td",{children:(0,r.jsxs)("label",{className:"tm-member-picker-check",onClick:function(e){return e.stopPropagation()},children:[(0,r.jsx)("input",{type:"checkbox",checked:n,onChange:function(){return w(e)}}),(0,r.jsx)("span",{})]})}),(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)(J,{member:e}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{children:e.label}),(0,r.jsx)("div",{className:"tm-member-picker-email",children:e.email})]})]})}),(0,r.jsx)("td",{className:"tm-member-picker-teams",children:(null!==(t=e.teams)&&void 0!==t?t:[]).map(function(e){return(0,r.jsx)("span",{className:"tm-member-picker-team",children:e.name},e.id)})})]},e.value)})]})]})})]})}function J(e){var t=e.member,n=(t.label||t.email||"?").charAt(0).toUpperCase();return t.avatar?(0,r.jsx)("img",{className:"tm-member-picker-avatar",src:t.avatar,alt:""}):(0,r.jsx)("span",{className:"tm-member-picker-avatar",children:n})}function Y(e){var t=e.id||e.user_id,n=e.text||e.name||"".concat(e.firstName||""," ").concat(e.lastName||"").trim()||e.email||"#".concat(t);return{value:Number(t),label:n,email:e.email||"",avatar:e.avatar||null,teams:ne(e.teams).map(function(e){return{id:String(e.id),name:e.name||e.text||"#".concat(e.id)}})}}function Z(e){return{value:e.userId,label:e.name||e.email||"#".concat(e.userId),email:e.email||""}}function X(e){return{value:e.userId,label:e.name||e.email||"#".concat(e.userId),email:e.email||""}}function ee(e){return e||""}function te(e,t){var n=new Map(e.map(function(e){return[String(e.value),e]}));return t.forEach(function(e){return n.set(String(e.value),e)}),Array.from(n.values())}function ne(e){return Array.isArray(null==e?void 0:e.results)?e.results:Array.isArray(null==e?void 0:e.data)?e.data:Array.isArray(e)?e:[]}function re(e,t){var n,r=null==e||null===(n=e.response)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.message;return r||(t?"Não foi possível editar a lista de presença.":"Não foi possível criar a lista de presença.")}var ae={control:function(e,t){return T(T({},e),{},{borderColor:t.isFocused?"#17A2B8":"#ECEDED",boxShadow:t.isFocused?"0 0 0 0.2rem rgba(23, 162, 184, 0.15)":"none","&:hover":{borderColor:"#17A2B8"}})},multiValue:function(e){return T(T({},e),{},{backgroundColor:"rgba(23, 162, 184, 0.12)"})},multiValueLabel:function(e){return T(T({},e),{},{color:"#0F6674"})},option:function(e,t){return T(T({},e),{},{backgroundColor:t.isSelected?"#17A2B8":t.isFocused?"rgba(23, 162, 184, 0.08)":"#FFFFFF",color:t.isSelected?"#FFFFFF":"#1E1E1E"})},menuPortal:function(e){return T(T({},e),{},{zIndex:10080})},menu:function(e){return T(T({},e),{},{zIndex:10080})}};function oe(e){var t=e.title,n=e.value,a=e.progress,o=e.footer;return(0,r.jsxs)("div",{className:"tm-attendance-card",children:[(0,r.jsx)("span",{className:"tm-attendance-card-title",children:t}),(0,r.jsx)("strong",{className:"tm-attendance-card-value",children:n}),(0,r.jsx)("div",{className:"tm-attendance-progress","aria-hidden":"true",children:(0,r.jsx)("span",{style:{width:"".concat(a,"%")}})}),(0,r.jsx)("span",{className:"tm-attendance-card-footer",children:o})]})}function ie(e){var t=e.rows,n=e.totalRows,o=e.itemsPerPage,i=e.onItemsPerPageChange,s=e.onView,l=e.onEdit,c=e.onDelete,u=e.onShowQr,d=e.generatingIds,f=void 0===d?new Set:d,m=z((0,a.useState)(null),2),p=m[0],h=m[1];return(0,r.jsxs)("div",{className:"tm-attendance-table-card",children:[(0,r.jsx)("div",{className:"table-responsive app-table-responsive",children:(0,r.jsxs)("table",{className:"table mb-0 tm-attendance-table",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Título da lista"}),(0,r.jsx)("th",{children:"Método"}),(0,r.jsx)("th",{children:"Produto"}),(0,r.jsx)("th",{children:"Colaboradores"}),(0,r.jsx)("th",{children:"Criada em"}),(0,r.jsx)("th",{children:"Início"}),(0,r.jsx)("th",{children:"Fim"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-center",children:"Ações"})]})}),(0,r.jsxs)("tbody",{children:[t.map(function(e){return(0,r.jsxs)("tr",{children:[(0,r.jsxs)("td",{children:[e.title,f.has(e.id)&&(0,r.jsxs)("span",{style:{marginLeft:6,fontSize:11,color:"#5a6a85",fontWeight:500},children:[(0,r.jsx)("i",{className:"fas fa-circle-notch fa-spin",style:{marginRight:3,color:"#3498db"}}),"Processando..."]})]}),(0,r.jsx)("td",{children:e.method}),(0,r.jsx)("td",{children:e.product}),(0,r.jsx)("td",{children:e.collaborators}),(0,r.jsx)("td",{children:e.createdAt}),(0,r.jsx)("td",{children:e.validationStartsAtLabel}),(0,r.jsx)("td",{children:e.validationEndsAtLabel}),(0,r.jsx)("td",{children:(0,r.jsx)(ge,{status:e.status})}),(0,r.jsx)("td",{children:(0,r.jsx)("div",{className:"tm-attendance-row-actions",children:e.hasMoreActions&&(0,r.jsxs)("div",{className:"tm-attendance-actions-menu",children:[(0,r.jsx)("button",{type:"button",className:"tm-attendance-action-button","aria-label":"Mais ações",onClick:function(){return h(function(t){return t===e.id?null:e.id})},children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v"})}),p===e.id&&(0,r.jsxs)("div",{className:"tm-attendance-actions-dropdown",children:[(0,r.jsxs)("button",{type:"button",onClick:function(){h(null),s(e)},children:[(0,r.jsx)("i",{className:"far fa-eye"}),"Visualizar"]}),(0,r.jsxs)("button",{type:"button",onClick:function(){h(null),l(e)},children:[(0,r.jsx)("i",{className:"far fa-edit"}),"Editar"]}),("QR Code"===e.method||"Foto"===e.method||"Lista de Assinatura"===e.method)&&(0,r.jsxs)("button",{type:"button",onClick:function(){h(null),u(e)},children:[(0,r.jsx)("i",{className:"fas fa-qrcode"}),"Ver QR Code"]}),(0,r.jsxs)("button",{type:"button",className:"is-danger",onClick:function(){h(null),c(e)},children:[(0,r.jsx)("i",{className:"far fa-trash-alt"}),"Excluir"]})]})]})})})]},e.id)}),0===t.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:9,className:"text-center text-muted py-4",children:"Nenhuma lista encontrada para os filtros selecionados."})})]})]})}),(0,r.jsxs)("div",{className:"tm-attendance-table-footer",children:[(0,r.jsxs)("span",{children:["Mostrando ",t.length," de ",n," listas"]}),(0,r.jsxs)("div",{className:"tm-attendance-pagination","aria-label":"Paginação",children:[(0,r.jsx)("button",{type:"button","aria-label":"Página anterior",children:(0,r.jsx)("i",{className:"fas fa-chevron-left"})}),(0,r.jsx)("span",{children:"1"}),(0,r.jsx)("button",{type:"button","aria-label":"Próxima página",children:(0,r.jsx)("i",{className:"fas fa-chevron-right"})})]}),(0,r.jsxs)("label",{children:["Resultados por página",(0,r.jsx)("select",{value:o,onChange:function(e){return i(Number(e.target.value))},children:[10,20,30,50].map(function(e){return(0,r.jsx)("option",{value:e,children:e},e)})})]})]})]})}function se(e){var t=e.rows,n=e.onView,a=e.onEdit,o=e.onDelete,i=e.onShowQr,s=e.generatingIds,l=void 0===s?new Set:s;return 0===t.length?(0,r.jsx)("div",{className:"tm-attendance-empty-card",children:"Nenhuma lista encontrada para os filtros selecionados."}):(0,r.jsx)("div",{className:"tm-attendance-list-card-grid",children:t.slice(0,3).map(function(e){return(0,r.jsx)(le,{row:e,onView:n,onEdit:a,onDelete:o,onShowQr:i,isGenerating:l.has(e.id)},e.id)})})}function le(e){var t=e.row,n=e.onView,o=e.onEdit,i=e.onDelete,s=e.onShowQr,l=e.isGenerating,c=void 0!==l&&l,u=z((0,a.useState)(!1),2),d=u[0],f=u[1];return(0,r.jsxs)("article",{className:"tm-attendance-list-card",children:[(0,r.jsxs)("div",{className:"tm-attendance-list-card-menu tm-attendance-actions-menu",children:[(0,r.jsx)("button",{type:"button",className:"tm-attendance-action-button","aria-label":"Mais ações",onClick:function(){return f(function(e){return!e})},children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v"})}),d&&(0,r.jsxs)("div",{className:"tm-attendance-actions-dropdown",children:[(0,r.jsxs)("button",{type:"button",onClick:function(){f(!1),n(t)},children:[(0,r.jsx)("i",{className:"far fa-eye"}),"Visualizar"]}),(0,r.jsxs)("button",{type:"button",onClick:function(){f(!1),o(t)},children:[(0,r.jsx)("i",{className:"far fa-edit"}),"Editar"]}),("QR Code"===t.method||"Foto"===t.method||"Lista de Assinatura"===t.method)&&(0,r.jsxs)("button",{type:"button",onClick:function(){f(!1),s(t)},children:[(0,r.jsx)("i",{className:"fas fa-qrcode"}),"Ver QR Code"]}),(0,r.jsxs)("button",{type:"button",className:"is-danger",onClick:function(){f(!1),i(t)},children:[(0,r.jsx)("i",{className:"far fa-trash-alt"}),"Excluir"]})]})]}),(0,r.jsxs)("header",{children:[(0,r.jsxs)("h3",{children:[t.title,c&&(0,r.jsxs)("span",{style:{marginLeft:6,fontSize:11,color:"#5a6a85",fontWeight:500},children:[(0,r.jsx)("i",{className:"fas fa-circle-notch fa-spin",style:{marginRight:3,color:"#3498db"}}),"Processando..."]})]}),(0,r.jsx)("span",{children:t.origin})]}),(0,r.jsx)("p",{className:"tm-attendance-list-card-description",children:t.description}),(0,r.jsxs)("div",{className:"tm-attendance-list-card-meta",children:[(0,r.jsx)("span",{children:"Produto"}),(0,r.jsx)("strong",{children:t.product})]}),(0,r.jsxs)("div",{className:"tm-attendance-list-card-meta",children:[(0,r.jsx)("span",{children:"Responsável"}),(0,r.jsx)("strong",{children:t.responsible})]}),(0,r.jsxs)("div",{className:"tm-attendance-list-card-meta",children:[(0,r.jsx)("span",{children:"Participantes"}),(0,r.jsx)("strong",{children:t.collaborators})]}),(0,r.jsx)("footer",{children:(0,r.jsxs)("div",{className:"tm-attendance-list-card-status",children:[(0,r.jsx)("span",{children:t.status}),(0,r.jsx)("strong",{className:"tm-attendance-list-card-dot tm-attendance-list-card-dot-".concat(Ne(t.status))}),(0,r.jsx)("time",{children:Ae(t.createdAt)})]})})]})}function ce(e){e.row;var t,n,o=e.details,i=e.isLoading,s=e.isError,l=e.onRetry,c=e.onShowPhoto,u=e.onRemoveParticipant,d=e.itemsPerPage,f=e.onItemsPerPageChange,m=z((0,a.useState)(""),2),p=m[0],h=m[1],v=z((0,a.useState)(""),2),b=v[0],y=v[1],g=null!==(t=null==o?void 0:o.participants)&&void 0!==t?t:[],x=null!==(n=null==o?void 0:o.list.validationEndsAt)&&void 0!==n?n:"",j=(0,a.useMemo)(function(){return function(e,t){return e.reduce(function(e,n){var r=je(n,t);return"Presente"===r&&(e.present+=1),"Pendente"===r&&(e.pending+=1),"Ausente"===r&&(e.absent+=1),e.total+=1,e},{present:0,pending:0,absent:0,total:0})}(g,x)},[g,x]),w=(0,a.useMemo)(function(){var e=Se(b);return g.filter(function(t){var n=je(t,x),r=!p||n===p,a=!e||Se("".concat(t.name," ").concat(t.email," ").concat(t.role)).includes(e);return r&&a})},[b,p,g,x]);return i?(0,r.jsx)("div",{className:"tm-attendance-empty-card",children:"Carregando participantes..."}):s||!o?(0,r.jsxs)("div",{className:"tm-attendance-empty-card",children:["Não foi possível carregar os participantes.",(0,r.jsx)("button",{type:"button",className:"btn btn-link p-0 ml-2",onClick:l,children:"Tentar novamente"})]}):(0,r.jsx)("div",{className:"tm-attendance-detail",children:(0,r.jsxs)("div",{className:"tm-attendance-detail-layout row",children:[(0,r.jsxs)("div",{className:"tm-attendance-detail-main col-12",children:[(0,r.jsx)("div",{className:"tm-attendance-toolbar tm-attendance-detail-toolbar",children:(0,r.jsxs)("div",{className:"tm-attendance-filters","aria-label":"Filtros de participantes",children:[(0,r.jsx)(be,{options:G,value:p,onChange:h}),(0,r.jsx)(ye,{value:b,onChange:y,placeholder:"Buscar participante..."})]})}),(0,r.jsx)(ue,{participants:w,totalRows:g.length,validationEndsAt:x,isPhoto:"photo"===o.list.validationModel,onShowPhoto:c,onRemoveParticipant:u,itemsPerPage:d,onItemsPerPageChange:f})]}),(0,r.jsx)("div",{className:"tm-attendance-summary-col col-12",children:(0,r.jsx)(pe,{summary:j,updatedAt:we(g)})})]})})}function ue(e){var t=e.participants,n=e.totalRows,o=e.validationEndsAt,i=e.isPhoto,s=e.onShowPhoto,l=e.onRemoveParticipant,c=e.itemsPerPage,u=e.onItemsPerPageChange,d=z((0,a.useState)(null),2),f=d[0],m=d[1];return(0,r.jsxs)("div",{className:"tm-attendance-table-card",children:[(0,r.jsx)("div",{className:"table-responsive app-table-responsive",children:(0,r.jsxs)("table",{className:"table mb-0 tm-attendance-table",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Participante"}),(0,r.jsx)("th",{children:"Cargo"}),(0,r.jsx)("th",{children:"Evidência"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{children:"Horário"}),(0,r.jsx)("th",{className:"text-center",children:"Ações"})]})}),(0,r.jsxs)("tbody",{children:[t.map(function(e){var t,n,a=je(e,o);return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"tm-attendance-participant-cell",children:[(0,r.jsx)(de,{participant:e}),(0,r.jsxs)("div",{children:[(0,r.jsx)("strong",{children:e.name}),(0,r.jsx)("span",{children:e.email})]})]})}),(0,r.jsx)("td",{children:e.role}),(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"tm-attendance-evidence-cell",children:[(0,r.jsx)("span",{children:e.evidence}),e.evidenceAt&&(0,r.jsx)("small",{children:e.evidenceAt})]})}),(0,r.jsx)("td",{children:(0,r.jsx)(xe,{status:a})}),(0,r.jsx)("td",{children:(null===(t=e.evidenceAt)||void 0===t?void 0:t.slice(11))||(null===(n=e.updatedAt)||void 0===n?void 0:n.slice(11))||"--"}),(0,r.jsx)("td",{children:(0,r.jsx)("div",{className:"tm-attendance-row-actions",children:(0,r.jsxs)("div",{className:"tm-attendance-actions-menu",children:[(0,r.jsx)("button",{type:"button",className:"tm-attendance-action-button","aria-label":"Mais ações",onClick:function(){return m(function(t){return t===e.id?null:e.id})},children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v"})}),f===e.id&&(0,r.jsxs)("div",{className:"tm-attendance-actions-dropdown",children:[i&&e.photoFileId&&(0,r.jsxs)("button",{type:"button",onClick:function(){m(null),s(e)},children:[(0,r.jsx)("i",{className:"far fa-image"}),"Ver foto"]}),e.signatureEvidenceUrl&&(0,r.jsxs)("a",{href:e.signatureEvidenceUrl,target:"_blank",rel:"noreferrer",onClick:function(){return m(null)},children:[(0,r.jsx)("i",{className:"fas fa-signature"}),"Ver evidência"]}),(0,r.jsxs)("button",{type:"button",className:"is-danger",onClick:function(){m(null),l(e)},children:[(0,r.jsx)("i",{className:"far fa-trash-alt"}),"Remover"]})]})]})})})]},e.id)}),0===t.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:6,className:"text-center text-muted py-4",children:"Nenhum participante encontrado para os filtros selecionados."})})]})]})}),(0,r.jsxs)("div",{className:"tm-attendance-table-footer",children:[(0,r.jsxs)("span",{children:["Mostrando ",t.length," de ",n," participantes"]}),(0,r.jsxs)("div",{className:"tm-attendance-pagination","aria-label":"Paginação",children:[(0,r.jsx)("button",{type:"button","aria-label":"Página anterior",children:(0,r.jsx)("i",{className:"fas fa-chevron-left"})}),(0,r.jsx)("span",{children:"1"}),(0,r.jsx)("button",{type:"button","aria-label":"Próxima página",children:(0,r.jsx)("i",{className:"fas fa-chevron-right"})})]}),(0,r.jsxs)("label",{children:["Resultados por página",(0,r.jsx)("select",{value:c,onChange:function(e){return u(Number(e.target.value))},children:[10,20,30,50].map(function(e){return(0,r.jsx)("option",{value:e,children:e},e)})})]})]})]})}function de(e){var t=e.participant,n=t.name.split(" ").filter(Boolean).slice(0,2).map(function(e){return e[0]}).join("").toUpperCase();return t.avatar?(0,r.jsx)("img",{className:"tm-attendance-participant-avatar",src:t.avatar,alt:""}):(0,r.jsx)("span",{className:"tm-attendance-participant-avatar",children:n||"?"})}function fe(e){var t=e.row,n=e.onClose,o=(0,a.useRef)(null),i=z((0,a.useState)(!0),2),s=i[0],l=i[1];if((0,a.useEffect)(function(){t&&l(!0)},[null==t?void 0:t.id]),!t)return null;var c="Foto"===t.method,d="Lista de Assinatura"===t.method,f="/time-management/presence/".concat(t.globalToken,c?"/photo":d?"/signature":"/confirm"),m="/time-management/presence-lists/".concat(t.id,"/qr");return(0,r.jsx)(u.A,{show:!0,onClose:n,title:"QR Code Global — ".concat(t.title),size:"lg",className:"tm-attendance-qr-modal",footer:(0,r.jsx)(u.M,{onCancel:n,onConfirm:n,cancelText:"Fechar",confirmText:"Concluir"}),children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("p",{className:"text-muted mb-2",children:c?"Imprima este QR Code e cole no local do evento. O participante escaneia, faz login e envia a foto para confirmar presença.":d?"Imprima este QR Code e cole no local do evento. O participante escaneia, faz login e assina a própria linha no MetaHuman.":"Imprima este QR Code e cole no local do evento. O participante escaneia, faz login e confirma presença automaticamente."}),(0,r.jsxs)("div",{className:"tm-attendance-qr-frame-wrapper",children:[s&&(0,r.jsxs)("div",{className:"tm-attendance-qr-loading",role:"status","aria-live":"polite",children:[(0,r.jsx)("i",{className:"fas fa-circle-notch fa-spin","aria-hidden":"true"}),(0,r.jsx)("span",{children:"Renderizando QR Code..."})]}),(0,r.jsx)("iframe",{ref:o,title:"QR Code global de ".concat(t.title),src:m,className:"tm-attendance-qr-frame ".concat(s?"is-loading":""),onLoad:function(){return l(!1)}})]}),(0,r.jsxs)("div",{className:"mt-2 tm-attendance-qr-actions",children:[(0,r.jsxs)("a",{href:f,target:"_blank",rel:"noreferrer",className:"btn btn-outline-primary btn-sm mr-2",children:[(0,r.jsx)("i",{className:"fas fa-external-link-alt mr-1"}),d?"Abrir link de assinatura":"Abrir link de presença"]}),d&&t.signatureEditUrl&&(0,r.jsxs)("a",{href:t.signatureEditUrl,target:"_blank",rel:"noreferrer",className:"btn btn-outline-primary btn-sm mr-2",children:[(0,r.jsx)("i",{className:"fas fa-edit mr-1"}),"Visualizar Assinaturas"]}),(0,r.jsxs)("button",{type:"button",className:"btn btn-outline-secondary btn-sm",onClick:function(){var e,t=null===(e=o.current)||void 0===e?void 0:e.contentWindow;if(t)return t.focus(),void t.print();window.open(m,"_blank","noopener,noreferrer")},children:[(0,r.jsx)("i",{className:"fas fa-print mr-1"}),"Imprimir QR Code"]})]})]})})}function me(e){var t=e.participant,n=e.photoUrl,a=e.onClose;return(0,r.jsx)(u.A,{show:null!==t,onClose:a,title:t?"Foto — ".concat(t.name):"Foto",size:"lg",footer:(0,r.jsx)(u.M,{onCancel:a,onConfirm:a,cancelText:"Fechar",confirmText:"Concluir"}),children:t&&n?(0,r.jsxs)("div",{className:"tm-attendance-photo-preview",children:[(0,r.jsx)("iframe",{title:"Foto de ".concat(t.name),src:n,className:"tm-attendance-qr-frame"}),(0,r.jsx)("a",{href:n,target:"_blank",rel:"noreferrer",className:"btn btn-link mt-2 p-0",children:"Abrir foto em nova aba"})]}):(0,r.jsx)("div",{className:"tm-attendance-empty-card",children:"Foto indisponível para este participante."})})}function pe(e){var t=e.summary,n=e.updatedAt,a=Ce(t.present,t.total),o=Ce(t.pending,t.total),i=Ce(t.absent,t.total);return(0,r.jsxs)("aside",{className:"tm-attendance-summary-panel",children:[(0,r.jsx)("h3",{children:"Resumo da lista"}),(0,r.jsx)("span",{children:"Participação geral"}),(0,r.jsxs)("div",{className:"tm-attendance-donut",style:{"--present":"".concat(a,"%"),"--pending":"".concat(a+o,"%")},children:[(0,r.jsxs)("strong",{children:[a,"%"]}),(0,r.jsx)("small",{children:"Presentes"})]}),(0,r.jsxs)("div",{className:"tm-attendance-summary-legend",children:[(0,r.jsx)(he,{label:"Presentes",value:t.present,percent:a,tone:"present"}),(0,r.jsx)(he,{label:"Pendentes",value:t.pending,percent:o,tone:"pending"}),t.absent>0&&(0,r.jsx)(he,{label:"Ausentes",value:t.absent,percent:i,tone:"absent"})]}),(0,r.jsxs)("div",{className:"tm-attendance-summary-updated",children:[(0,r.jsx)("i",{className:"far fa-clock"}),"Última atualização: ",n||"--"]})]})}function he(e){var t=e.label,n=e.value,a=e.percent,o=e.tone;return(0,r.jsxs)("div",{className:"tm-attendance-summary-legend-row",children:[(0,r.jsx)("span",{className:"tm-attendance-summary-dot tm-attendance-summary-dot-".concat(o)}),(0,r.jsx)("span",{children:t}),(0,r.jsxs)("strong",{children:[n," (",a,"%)"]})]})}function ve(e){var t=e.value,n=e.onChange,o=z((0,a.useState)(!1),2),i=o[0],s=o[1],l=(0,a.useRef)(null),c=t.startDate&&t.endDate,u=c?"".concat(ke(t.startDate)," - ").concat(ke(t.endDate)):"Período";return(0,a.useEffect)(function(){if(i){var e=function(e){l.current&&!l.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}},[i]),(0,r.jsxs)("div",{className:"tm-attendance-compact-date",ref:l,children:[(0,r.jsxs)("button",{type:"button",className:"tm-attendance-compact-select tm-attendance-compact-date-button ".concat(c?"is-active":""),"aria-expanded":i,onClick:function(){return s(function(e){return!e})},children:[(0,r.jsx)("span",{children:u}),(0,r.jsx)("i",{className:"fas fa-chevron-down","aria-hidden":"true"})]}),i&&(0,r.jsxs)("div",{className:"tm-attendance-compact-date-dropdown",children:[(0,r.jsxs)("div",{className:"tm-attendance-compact-date-header",children:[(0,r.jsx)("strong",{children:"Selecionar período"}),(0,r.jsx)("button",{type:"button",onClick:function(){return s(!1)},"aria-label":"Fechar período",children:(0,r.jsx)("i",{className:"fas fa-times","aria-hidden":"true"})})]}),(0,r.jsx)(d.A,{initialStartDate:t.startDate,initialEndDate:t.endDate,onChange:n,defaultToLastMonth:!1}),(0,r.jsxs)("div",{className:"tm-attendance-compact-date-footer",children:[(0,r.jsx)("button",{type:"button",onClick:function(){return n({startDate:"",endDate:""})},children:"Limpar período"}),(0,r.jsx)("button",{type:"button",onClick:function(){return s(!1)},children:"Aplicar"})]})]})]})}function be(e){var t,n=e.options,a=e.value,o=e.onChange,i=null!==(t=n.find(function(e){return e.value===a}))&&void 0!==t?t:n[0];return(0,r.jsxs)("label",{className:"tm-attendance-compact-select",children:[(0,r.jsx)("span",{children:i.label}),(0,r.jsx)("select",{value:a,onChange:function(e){return o(e.target.value)},"aria-label":n[0].label,children:n.map(function(e){return(0,r.jsx)("option",{value:e.value,children:e.label},e.value||"all")})}),(0,r.jsx)("i",{className:"fas fa-chevron-down","aria-hidden":"true"})]})}function ye(e){var t=e.value,n=e.onChange,o=e.placeholder,i=void 0===o?"Buscar":o,s=z((0,a.useState)(!1),2),l=s[0],c=s[1];return(0,r.jsxs)("div",{className:"tm-attendance-search ".concat(l||t?"is-expanded":""),children:[(0,r.jsx)("input",{type:"search",value:t,onChange:function(e){return n(e.target.value)},onFocus:function(){return c(!0)},onBlur:function(){return!t&&c(!1)},placeholder:i,"aria-label":"Buscar listas de presença"}),(0,r.jsx)("button",{type:"button",onClick:function(){return c(function(e){return!e})},"aria-label":"Buscar",children:(0,r.jsx)("i",{className:"fas fa-search"})})]})}function ge(e){var t=e.status;return(0,r.jsx)("span",{className:"tm-attendance-status tm-attendance-status-".concat(Ne(t)),children:t})}function xe(e){var t=e.status;return(0,r.jsx)("span",{className:"tm-attendance-status tm-attendance-status-".concat(Ne(t)),children:t})}function je(e,t){return"signed"===e.rawStatus?"Presente":t&&new Date(t).getTime()<Date.now()?"Ausente":"Pendente"}function we(e){var t,n=e.map(function(e){return e.updatedAt}).filter(Boolean).sort();return null!==(t=n[n.length-1])&&void 0!==t?t:""}function Se(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function Ne(e){return Se(e).replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function ke(e){var t=new Date("".concat(e,"T00:00:00"));return Number.isNaN(t.getTime())?e:t.toLocaleDateString("pt-BR",{day:"2-digit",month:"short"}).replace(".","")}function Ce(e,t){return t<=0?0:Math.min(100,Math.max(0,Math.round(e/t*100)))}function Oe(e){if(!e)return"";var t=new Date(e);if(Number.isNaN(t.getTime()))return"";var n=t.getTimezoneOffset();return new Date(t.getTime()-60*n*1e3).toISOString().slice(0,16)}function Ae(e){var t,n=e.match(/(\d{1,2})\s+([a-zç]+)\s+(\d{4})/i);if(!n)return e;var r=z(n,4),a=r[1],o=r[2],i=r[3];return"".concat(a.padStart(2,"0"),"/").concat(null!==(t={jan:"01",fev:"02",mar:"03",abr:"04",mai:"05",jun:"06",jul:"07",ago:"08",set:"09",out:"10",nov:"11",dez:"12"}[o.slice(0,3).toLowerCase()])&&void 0!==t?t:"01","/").concat(i)}},76336(e,t,n){"use strict";function r(){var e=window.PRODUCT_PERMISSIONS||{canView:!1,canEdit:!1,canCreate:!1,canDelete:!1};return{canView:!0===e.canView,canEdit:!0===e.canEdit,canCreate:!0===e.canCreate,canDelete:!0===e.canDelete}}function a(){return!0===window.ACCESS_DENIED}n.d(t,{L:()=>r,v:()=>a})},77332(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>o});n(52675),n(89463),n(28706),n(51629),n(48598),n(62062),n(94490),n(26099),n(23500);var r=n(74848),a=n(1806);function o(e){var t,n,o,i,s=e.isOpen,l=e.onClose,c=e.record;if(!s||!c)return null;var u={totalJornada:c.horas||"00:00",atraso:c.delay||null,hoursDifference:c.hoursDifference||"00:00",isOvertime:c.isOvertime||!1,isMissingHours:c.isMissingHours||!1,missingClockIns:c.missingClockIns||[],expectedHours:c.expectedHours||"00:00"},d=function(){var e=[],t=c.justification;if(e.push("Total de jornada registrada: ".concat(u.totalJornada)),u.isOvertime?e.push("Este membro possui ".concat(u.hoursDifference," de horas extras registradas")):u.isMissingHours?e.push("Devendo ".concat(u.hoursDifference," neste dia")):e.push("Este membro não possui horas extras registradas"),u.missingClockIns.length>0)if(4===u.missingClockIns.length)if(!t||"reason"!==t.type&&"license"!==t.type)e.push("Nenhum ponto registrado e sem justificativa");else{var n=function(e){switch(e){case"license":return"Licença";case"reason":return"Abono";default:return e}}(t.type);e.push("Nenhum ponto registrado com justificativa de: ".concat(n))}else u.missingClockIns.forEach(function(t){e.push("Faltando a marcação obrigatória da ".concat(t))});if(u.atraso&&e.push("Atraso na primeira entrada de ".concat(u.atraso)),t&&"edit"===t.type){var r=t.editReasonLabel||t.editReason,a=t.updatedAt||"data desconhecida";e.push("Registro ajustado manualmente em ".concat(a," por motivos de: ").concat(r))}if(t&&"reason"===t.type){var o;o="other"===t.payOffAbsence&&t.otherText?t.otherText:t.payOffAbsenceLabel||function(e){switch(e){case"medical_certificate":return"Atestado médico";case"child_monitoring":return"Acompanhamento de filho";case"spouse_monitoring":return"Acompanhamento de cônjuge";case"union_activity":return"Atividade sindical";case"weather_delay":return"Atraso por chuva";case"transport_delay":return"Atraso por transporte";case"compensated_time_off":return"Compensação de horas";case"employee_marriage":return"Casamento";case"court_appearance":return"Audiência judicial";case"electoral_service":return"Serviço eleitoral";case"military_service":return"Serviço militar";case"blood_donation":return"Doação de sangue";case"other":return"Outro";default:return e}}(t.payOffAbsence||"");var i=t.timeReason||"todo o dia";e.push("Foram abonadas ".concat(i," neste dia por motivos de: ").concat(o))}if(t&&"license"===t.type){var s;s="other"===t.payOffLicense&&t.description?t.description:t.payOffLicenseLabel||function(e){switch(e){case"maternity_leave":return"Licença maternidade";case"sick_leave":return"Licença médica";case"marriage_leave":return"Casamento";case"other":return"Outro";default:return e}}(t.payOffLicense||"");var l=t.durationFormatted||"0h";t.partialLicense?e.push("Foi aplicada a licença parcial ".concat(s," com duração de ").concat(l)):e.push("Foi aplicada a licença ".concat(s," com duração de ").concat(l))}return e}();return(0,r.jsx)(a.A,{show:s,onClose:l,title:"Visualizando Registro",size:"md",className:"w-75",footer:(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:l,children:"Fechar"}),children:(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"row mb-3",children:[(0,r.jsxs)("div",{className:"col-md-6",children:[(0,r.jsx)("h6",{children:"Primeira Entrada"}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-8",children:(0,r.jsx)("input",{type:"date",className:"form-control",value:c.data?c.data.split("/").reverse().join("-"):""})}),(0,r.jsx)("div",{className:"col-4",children:(0,r.jsx)("input",{type:"text",className:"form-control",value:(null===(t=c.registros)||void 0===t?void 0:t[0])||"Não registrado ainda",readOnly:!0})})]})]}),(0,r.jsxs)("div",{className:"col-md-6",children:[(0,r.jsx)("h6",{children:"Primeira Saída"}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-8",children:(0,r.jsx)("input",{type:"date",className:"form-control",value:c.data?c.data.split("/").reverse().join("-"):"",style:{fontFamily:"Inter",fontSize:"14px"}})}),(0,r.jsx)("div",{className:"col-4",children:(0,r.jsx)("input",{type:"text",className:"form-control",value:(null===(n=c.registros)||void 0===n?void 0:n[1])||"Não registrado ainda",readOnly:!0})})]})]})]}),(0,r.jsxs)("div",{className:"row mb-3",children:[(0,r.jsxs)("div",{className:"col-md-6",children:[(0,r.jsx)("h6",{children:"Segunda Entrada"}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-8",children:(0,r.jsx)("input",{type:"date",className:"form-control",value:c.data?c.data.split("/").reverse().join("-"):"",style:{fontFamily:"Inter",fontSize:"14px"}})}),(0,r.jsx)("div",{className:"col-4",children:(0,r.jsx)("input",{type:"text",className:"form-control",value:(null===(o=c.registros)||void 0===o?void 0:o[2])||"Não registrado ainda",readOnly:!0})})]})]}),(0,r.jsxs)("div",{className:"col-md-6",children:[(0,r.jsx)("h6",{children:"Segunda Saída"}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-8",children:(0,r.jsx)("input",{type:"date",className:"form-control",value:c.data?c.data.split("/").reverse().join("-"):""})}),(0,r.jsx)("div",{className:"col-4",children:(0,r.jsx)("input",{type:"text",className:"form-control",value:(null===(i=c.registros)||void 0===i?void 0:i[3])||"Não registrado ainda",readOnly:!0})})]})]})]}),(0,r.jsxs)("div",{className:"mt-3 pt-3",style:{borderTop:"1px solid #dee2e6"},children:[(0,r.jsx)("h6",{children:"Informações Adicionais"}),(0,r.jsx)("ul",{children:d.map(function(e,t){return(0,r.jsxs)("li",{children:["• ",e]},t)})})]}),c.justification&&"reason"===c.justification.type&&c.justification.description&&(0,r.jsxs)("div",{className:"mt-3 pt-3",style:{borderTop:"1px solid #dee2e6"},children:[(0,r.jsx)("h6",{children:"Observações"}),(0,r.jsx)("textarea",{className:"form-control",value:c.justification.description,readOnly:!0,rows:3})]})]})})}},77770(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>d});n(52675),n(89463),n(2259),n(51629),n(23418),n(64346),n(23792),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(23500),n(62953),n(76031);var r=n(74848),a=n(96540),o=n(1806);function i(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var i=r&&r.prototype instanceof c?r:c,u=Object.create(i.prototype);return s(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(s(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,s(m,"constructor",d),s(d,"constructor",u),u.displayName="GeneratorFunction",s(d,a,"GeneratorFunction"),s(m),s(m,a,"Generator"),s(m,r,function(){return this}),s(m,"toString",function(){return"[object Generator]"}),(i=function(){return{w:o,m:p}})()}function s(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}s=function(e,t,n,r){function o(t,n){s(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},s(e,t,n,r)}function l(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){var t=e.isOpen,n=e.onCapture,s=e.onClose,u=c((0,a.useState)(null),2),d=u[0],f=u[1],m=c((0,a.useState)(null),2),p=m[0],h=m[1],v=c((0,a.useState)(null),2),b=v[0],y=v[1],g=c((0,a.useState)(!1),2),x=g[0],j=g[1],w=(0,a.useRef)(null),S=(0,a.useRef)(null);(0,a.useEffect)(function(){return!t||p||d||(console.log("SelfieModal: Iniciando câmera..."),N()),function(){t||k()}},[t,p,d]);var N=function(){var e,t=(e=i().m(function e(){var t,n,r;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,console.log("SelfieModal: Solicitando acesso à câmera..."),j(!0),y(null),navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){e.n=1;break}throw new Error("Seu navegador não suporta acesso à câmera");case 1:return e.n=2,navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}},audio:!1});case 2:return t=e.v,console.log("SelfieModal: Câmera acessada com sucesso!",t),f(t),e.n=3,new Promise(function(e){return setTimeout(e,100)});case 3:w.current?(console.log("SelfieModal: Conectando stream ao vídeo..."),w.current.srcObject=t,w.current.onloadedmetadata=function(){var e;console.log("SelfieModal: Metadata carregada, iniciando play..."),null===(e=w.current)||void 0===e||e.play().then(function(){console.log("SelfieModal: Vídeo tocando!"),j(!1)}).catch(function(e){console.error("SelfieModal: Erro ao iniciar play:",e),j(!1)})}):(console.warn("SelfieModal: videoRef.current é null!"),j(!1)),e.n=5;break;case 4:e.p=4,r=e.v,console.error("SelfieModal: Erro ao acessar câmera:",r),n="Não foi possível acessar a câmera. Verifique se concedeu as permissões necessárias.","NotAllowedError"===r.name||"PermissionDeniedError"===r.name?n="Permissão de acesso à câmera negada. Por favor, permita o acesso à câmera nas configurações do navegador e tente novamente.":"NotFoundError"===r.name?n="Nenhuma câmera foi encontrada no seu dispositivo.":"NotReadableError"===r.name?n="A câmera está em uso por outro aplicativo. Feche outros aplicativos e tente novamente.":"OverconstrainedError"===r.name?n="A câmera do seu dispositivo não atende aos requisitos necessários.":r.message&&(n=r.message),y(n),j(!1);case 5:return e.a(2)}},e,null,[[0,4]])}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){l(o,r,a,i,s,"next",e)}function s(e){l(o,r,a,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}(),k=function(){d&&(d.getTracks().forEach(function(e){return e.stop()}),f(null))},C=function(){k(),h(null),y(null),s()};return t?(0,r.jsx)(o.A,{show:t,onClose:C,title:"Capturar Selfie",size:"md",footer:p?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:function(){h(null),N()},children:"Tirar Novamente"}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary",onClick:function(){p&&fetch(p).then(function(e){return e.blob()}).then(function(e){n(e),h(null)}).catch(function(e){console.error("Erro ao processar imagem:",e),y("Erro ao processar imagem. Tente novamente.")})},children:"Confirmar"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:C,children:"Cancelar"}),b&&(0,r.jsx)("button",{type:"button",className:"btn btn-warning",onClick:N,children:"Tentar Novamente"}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary",onClick:function(){if(w.current&&S.current){var e=w.current,t=S.current,n=t.getContext("2d");if(n){t.width=e.videoWidth,t.height=e.videoHeight,n.drawImage(e,0,0,t.width,t.height);var r=t.toDataURL("image/jpeg",.8);h(r),k()}}},disabled:x||!!b||!d,children:"Capturar"})]}),children:(0,r.jsxs)("div",{style:{padding:"24px"},children:[b&&(0,r.jsxs)("div",{className:"alert d-flex align-items-center",style:{backgroundColor:"#E6F7F9",borderColor:"#17A2B8",color:"#0C5460",gap:"12px"},children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle",style:{color:"#17A2B8",fontSize:"24px"}}),(0,r.jsx)("div",{style:{flex:1},children:b})]}),x&&(0,r.jsxs)("div",{className:"text-center py-5",children:[(0,r.jsx)("div",{className:"spinner-border text-primary mb-3"}),(0,r.jsx)("p",{className:"text-muted",children:"Iniciando câmera..."}),(0,r.jsx)("button",{type:"button",className:"btn btn-sm btn-link",onClick:N,children:"Clique aqui se a câmera não iniciar"})]}),(0,r.jsx)("div",{className:"text-center",style:{display:b||x?"none":"block"},children:p?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("img",{src:p,alt:"Selfie capturada",className:"w-100 rounded",style:{maxHeight:"400px",objectFit:"cover"}}),(0,r.jsx)("p",{className:"text-success mt-2",children:"Foto capturada com sucesso!"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("video",{ref:w,autoPlay:!0,playsInline:!0,muted:!0,className:"w-100 rounded",style:{maxHeight:"400px",objectFit:"cover",backgroundColor:"#000"}}),(0,r.jsx)("p",{className:"text-muted mt-2",children:"Posicione seu rosto no centro da tela"})]})}),(0,r.jsx)("canvas",{ref:S,style:{display:"none"}})]})}):null}},79724(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>y});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(51629),n(23418),n(74423),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(27495),n(38781),n(21699),n(47764),n(23500),n(62953),n(76031);var r=n(74848),a=n(97665),o=n(57097),i=n(49785),s=n(70038),l=n(96540),c=n(1806);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){m(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function m(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var v=[{n:0,l:"D"},{n:1,l:"S"},{n:2,l:"T"},{n:3,l:"Q"},{n:4,l:"Q"},{n:5,l:"S"},{n:6,l:"S"}],b=["time-management","work-shifts"];function y(e){var t=e.show,n=e.onClose,u=e.editData,d=(0,a.jE)(),m=!!u,h=(0,i.mN)({mode:"onChange",defaultValues:{name:"",description:"",daysOfWeek:[],firstCheckIn:"",firstCheckOut:"",secondCheckIn:"",secondCheckOut:""}}),y=h.register,g=h.handleSubmit,x=h.watch,j=h.setValue,w=h.reset,S=h.trigger,N=h.formState.errors;(0,l.useEffect)(function(){u&&(j("name",u.name,{shouldValidate:!0}),j("description",u.description||"",{shouldValidate:!1}),j("daysOfWeek",u.daysOfWeek||[],{shouldValidate:!1}),j("firstCheckIn",u.firstCheckIn||"",{shouldValidate:!0}),j("firstCheckOut",u.firstCheckOut||"",{shouldValidate:!0}),j("secondCheckIn",u.secondCheckIn||"",{shouldValidate:!0}),j("secondCheckOut",u.secondCheckOut||"",{shouldValidate:!0}),setTimeout(function(){S(["firstCheckIn","firstCheckOut","secondCheckIn","secondCheckOut"])},0))},[u,j,S]),(0,l.useEffect)(function(){t||w()},[t,w]);var k=x("daysOfWeek"),C=x("name"),O=x("firstCheckIn"),A=x("firstCheckOut"),E=x("secondCheckIn"),P=x("secondCheckOut"),F=(0,o.n)({mutationFn:function(e){var t={name:e.name,description:e.description||void 0,daysOfWeek:e.daysOfWeek,firstCheckIn:e.firstCheckIn||null,firstCheckOut:e.firstCheckOut||null,secondCheckIn:e.secondCheckIn||null,secondCheckOut:e.secondCheckOut||null};return m&&null!=u&&u.id?(0,s.zS)(u.id,t):(0,s.z1)(t)},onSuccess:function(){d.invalidateQueries({queryKey:b}),w(),n()}});return(0,r.jsx)(c.A,{show:t,onClose:n,title:m?"Editando Turno":"Criando Turno",size:"md",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:n,children:"Cancelar"}),(0,r.jsx)("button",{type:"submit",form:"workShiftForm",className:"btn text-white px-4",style:{backgroundColor:"#17a2b8"},disabled:F.isPending||!C||0===((null==k?void 0:k.length)||0),children:F.isPending?(0,r.jsx)("i",{className:"fas fa-spinner fa-spin"}):m?"Salvar":"Criar Turno"})]}),children:(0,r.jsxs)("form",{id:"workShiftForm",onSubmit:g(function(e){F.mutate(e)}),children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Nome do Turno"}),(0,r.jsx)("input",f({type:"text",className:"form-control",placeholder:"Digite o nome do turno"},y("name",{required:!0})))]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Descrição"}),(0,r.jsx)("textarea",f({className:"form-control",rows:3,placeholder:"Detalhe mais informações sobre essa atividade"},y("description")))]}),(0,r.jsx)("hr",{className:"my-4"}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Dias da Semana"}),(0,r.jsx)("div",{className:"d-flex justify-content-between",children:v.map(function(e){return(0,r.jsx)("button",{type:"button",className:"btn ".concat(k.includes(e.n)?"text-white":"btn-outline-secondary"),style:f({flex:1,height:"60px",fontSize:"1.1rem",fontWeight:"normal",margin:"0 0.25rem"},k.includes(e.n)?{backgroundColor:"rgb(23, 162, 184)"}:{}),onClick:function(){return t=e.n,void j("daysOfWeek",(n=k||[]).includes(t)?n.filter(function(e){return e!==t}):[].concat(p(n),[t]));var t,n},children:e.l},e.n)})}),(0,r.jsx)("small",{className:"text-muted d-block mt-2",children:"Necessário escolher pelo menos um dia da semana.*"})]}),(0,r.jsx)("hr",{className:"my-4"}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Primeira Entrada"}),(0,r.jsx)("input",f({type:"time",className:"form-control ".concat(N.firstCheckIn?"is-invalid":"")},y("firstCheckIn",{validate:{notEqualToFirstOut:function(e){return!e||!A||(e!==A||"Não pode ser igual à Primeira Saída")}}}))),N.firstCheckIn&&(0,r.jsx)("small",{className:"text-danger d-block mt-1",children:N.firstCheckIn.message})]})}),(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Primeira Saída"}),(0,r.jsx)("input",f({type:"time",className:"form-control ".concat(N.firstCheckOut?"is-invalid":"")},y("firstCheckOut",{validate:{notEqualToFirstIn:function(e){return!e||!O||(e!==O||"Não pode ser igual à Primeira Entrada")},notEqualToSecondIn:function(e){return!e||!E||(e!==E||"Não pode ser igual à Segunda Entrada")}}}))),N.firstCheckOut&&(0,r.jsx)("small",{className:"text-danger d-block mt-1",children:N.firstCheckOut.message})]})})]}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Segunda Entrada"}),(0,r.jsx)("input",f({type:"time",className:"form-control ".concat(N.secondCheckIn?"is-invalid":"")},y("secondCheckIn",{validate:{notEqualToFirstOut:function(e){return!e||!A||(e!==A||"Não pode ser igual à Primeira Saída")},notEqualToSecondOut:function(e){return!e||!P||(e!==P||"Não pode ser igual à Segunda Saída")}}}))),N.secondCheckIn&&(0,r.jsx)("small",{className:"text-danger d-block mt-1",children:N.secondCheckIn.message})]})}),(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group mb-0",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Saída"}),(0,r.jsx)("input",f({type:"time",className:"form-control ".concat(N.secondCheckOut?"is-invalid":"")},y("secondCheckOut",{validate:{notEqualToSecondIn:function(e){return!e||!E||(e!==E||"Não pode ser igual à Segunda Entrada")}}}))),N.secondCheckOut&&(0,r.jsx)("small",{className:"text-danger d-block mt-1",children:N.secondCheckOut.message})]})})]})]})})}},80217(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>f});n(52675),n(89463),n(2259),n(28706),n(33771),n(23418),n(64346),n(23792),n(62062),n(72712),n(34782),n(23288),n(62010),n(2892),n(9868),n(26099),n(27495),n(38781),n(47764),n(62953),n(76031);var r=n(74848),a=n(28482),o=n(72050),i=n(9655),s=n(75548),l=n(96540);function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var d=Math.PI/180;function f(e){e.viewMode,e.onViewModeChange;var t=e.projects,n=void 0===t?[]:t,u=n.length>0?n.map(function(e){return{name:e.name,value:e.hours,color:e.color}}):[{name:"Sem dados",value:0,color:"#E0E0E0"}],f=u.reduce(function(e,t){return e+t.value},0),m=c((0,l.useState)(!0),2),p=m[0],h=m[1];(0,l.useEffect)(function(){var e,t=function(){h(!1),clearTimeout(e),e=setTimeout(function(){h(!0)},100)};return window.addEventListener("resize",t),function(){window.removeEventListener("resize",t),clearTimeout(e)}},[]);return p?(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between",children:[(0,r.jsxs)("div",{style:{width:"60%",height:"280px",position:"relative"},children:[(0,r.jsx)(a.u,{width:"100%",height:"100%",children:(0,r.jsx)(s.r,{children:(0,r.jsx)(i.Fq,{data:u,dataKey:"value",cx:"40%",cy:"50%",innerRadius:60,outerRadius:80,label:function(e){var t=e.cx,n=e.cy,a=e.midAngle,o=e.outerRadius,i=e.fill,s=e.payload,l=(e.percent,Math.sin(-d*a)),c=Math.cos(-d*a),u=Math.abs(1/c)+10,f=t+o*c,m=n+o*l,p=t+(o+u)*c,h=n+(o+u)*l,v=p+20*Number(c.toFixed(1)),b=h,y=c>=0?"start":"end";return(0,r.jsxs)("g",{children:[(0,r.jsx)("path",{d:"M".concat(f,",").concat(m,"L").concat(p,",").concat(h,"L").concat(v,",").concat(b),stroke:i,strokeWidth:"1",fill:"none"}),(0,r.jsx)("text",{x:v+5*(c>=0?1:-1),y:b-6,textAnchor:y,style:{fontSize:"12px",fontWeight:400,fill:"rgba(0, 0, 0, 0.70)",fontFamily:"Inter"},children:s.name}),(0,r.jsx)("text",{x:v+5*(c>=0?1:-1),y:b+6,textAnchor:y,style:{fontSize:"12px",fontWeight:600,fill:i,fontFamily:"Inter"},children:"".concat(s.value,"h")})]})},labelLine:!1,children:u.map(function(e,t){return(0,r.jsx)(o.f,{fill:e.color},"cell-".concat(t))})})})}),(0,r.jsx)("div",{style:{position:"absolute",top:"50%",left:"40%",transform:"translate(-50%, -50%)",textAlign:"center",pointerEvents:"none"},children:(0,r.jsxs)("div",{style:{fontSize:"24px",fontWeight:600,color:"#5C5D5D",fontFamily:"Inter"},children:[f,"h"]})})]}),(0,r.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"12px",paddingRight:"15px",alignItems:"flex-end",justifyContent:"center"},children:u.map(function(e,t){return(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("div",{style:{width:"12px",height:"12px",background:e.color,borderRadius:"2px",marginRight:"8px",flexShrink:0}}),(0,r.jsx)("span",{style:{fontSize:"12px",color:"#5C5D5D",fontWeight:500,fontFamily:"Inter"},children:e.name})]},t)})})]}):(0,r.jsx)("div",{style:{height:"280px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,r.jsx)("span",{style:{color:"#999",fontSize:"12px"},children:"Atualizando..."})})}},80596(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>l});n(52675),n(89463),n(2259),n(28706),n(2008),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(2892),n(26099),n(27495),n(38781),n(47764),n(90744),n(62953);var r=n(74848),a=n(96540),o=n(76336);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e){var t=e.data,n=e.title,i=void 0===n?"Registro de pontos":n,s=e.isLoading,l=void 0!==s&&s,u=e.pagination,d=e.onPageChange,f=e.onItemsPerPageChange,m=(e.onFilterClick,e.onExportClick),p=e.isExporting,h=void 0!==p&&p,v=e.onEditRecord,b=e.onAbonarRecord,y=e.onLicencaRecord,g=e.onViewRecord,x=e.selectedStatus,j=e.onStatusChange,w=(0,o.L)(),S=w.canEdit,N=w.canCreate;return(0,r.jsxs)("div",{className:"card app-card-surface mt-2",children:[(0,r.jsxs)("div",{className:"card-header app-controls-bar tm-controls-bar",children:[(0,r.jsxs)("div",{className:"d-none d-lg-flex align-items-center",children:[(0,r.jsx)("h3",{className:"card-title mb-0",children:i}),(0,r.jsxs)("div",{className:"ml-auto d-flex align-items-center",children:[(0,r.jsx)("button",{className:"app-table-action-btn mr-2",onClick:m,disabled:h||l,type:"button",children:h?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("i",{className:"fas fa-spinner fa-spin mr-1"}),"Exportando..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("i",{className:"fas fa-file-export mr-1"}),"Exportar Tabela"]})}),(0,r.jsx)(c,{selectedStatus:x,onStatusChange:j})]})]}),(0,r.jsxs)("div",{className:"d-lg-none",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between mb-2",children:[(0,r.jsx)("h3",{className:"card-title mb-0",children:i}),(0,r.jsx)(c,{selectedStatus:x,onStatusChange:j})]}),(0,r.jsx)("div",{className:"d-flex flex-column",children:(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsxs)("button",{className:"btn btn-sm btn-default w-100",onClick:m,disabled:h||l,type:"button",title:"Exportar Tabela",children:[(0,r.jsx)("i",{className:"fas ".concat(h?"fa-spinner fa-spin":"fa-file-export"," mr-2")}),h?"Exportando...":"Exportar Tabela"]})})})]})]}),(0,r.jsxs)("div",{className:"card-body",children:[l&&(0,r.jsxs)("div",{className:"text-center py-4",children:[(0,r.jsx)("div",{className:"spinner-border text-primary",role:"status",children:(0,r.jsx)("span",{className:"sr-only",children:"Carregando..."})}),(0,r.jsx)("p",{className:"text-muted mt-2",children:"Carregando registros..."})]}),!l&&(0,r.jsx)("div",{className:"table-responsive app-table-responsive",children:(0,r.jsxs)("table",{className:"table mb-0 app-table",children:[(0,r.jsx)("thead",{className:"thead-light",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{style:{width:"10%"},children:"Data"}),(0,r.jsx)("th",{style:{width:"20%"},className:"text-center",children:"Nome do Membro"}),(0,r.jsx)("th",{style:{width:"22%"},className:"text-center",children:"Registros (Entrada e Saída)"}),(0,r.jsx)("th",{style:{width:"20%"},className:"text-center",children:"Registros Previstos"}),(0,r.jsx)("th",{style:{width:"10%"},className:"text-center",children:"Horas Trabalhadas"}),(0,r.jsx)("th",{style:{width:"10%"},className:"text-center",children:"Status"}),(0,r.jsx)("th",{style:{width:"8%",textAlign:"right"},children:"Ações"})]})}),(0,r.jsxs)("tbody",{children:[t.map(function(e,t){var n,o,i=e.memberName||"—",s=i.split(/\s+/).filter(Boolean),l="—"!==i?((null===(n=s[0])||void 0===n?void 0:n[0])||"?").toUpperCase():"?",c=["#FF6B6B","#4ECDC4","#45B7D1","#FFA07A","#98D8C8","#F7DC6F","#BB8FCE","#85C1E2"],u=c[i.charCodeAt(0)%c.length];return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"text-muted",children:e.data}),(0,r.jsx)("td",{className:"text-center",children:(0,r.jsx)("div",{className:"rounded-circle d-inline-flex align-items-center justify-content-center text-white",style:{width:36,height:36,backgroundColor:u,fontWeight:700,cursor:"help"},title:i,children:l})}),(0,r.jsx)("td",{className:"text-center",children:(0,r.jsx)("div",{className:"d-flex flex-wrap align-items-center justify-content-center",children:e.registros.map(function(e,t){return(0,r.jsxs)(a.Fragment,{children:[t>0&&(0,r.jsx)("span",{className:"text-muted mx-2",children:"|"}),(0,r.jsx)("span",{className:0===t?"text-primary font-weight-bold":"",children:e})]},t)})})}),(0,r.jsx)("td",{className:"text-muted text-center",children:e.previstos}),(0,r.jsx)("td",{className:"text-center ".concat("success"===e.horasColor?"tm-hours-success":"danger"===e.horasColor?"tm-hours-danger":"tm-hours-secondary"),children:e.horas}),(0,r.jsx)("td",{className:"text-center ".concat("success"===e.statusColor?"tm-status-success":"danger"===e.statusColor?"tm-status-danger":"info"===e.statusColor?"tm-status-info":"tm-status-secondary"),children:e.status}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsx)("div",{className:"d-inline-flex align-items-center",children:(o=[],S&&o.push({key:"edit",label:"Editar Registro",onClick:function(){return null==v?void 0:v(e)}}),N&&(o.push({key:"abonar",label:"Abonar",onClick:function(){return null==b?void 0:b(e)}}),o.push({key:"licenca",label:"Incluir Licença",onClick:function(){return null==y?void 0:y(e)}})),o.push({key:"view",label:"Visualizar Registro",onClick:function(){return null==g?void 0:g(e)}}),1===o.length&&"view"===o[0].key?(0,r.jsx)("button",{className:"btn btn-default btn-sm",title:o[0].label,type:"button",onClick:o[0].onClick,children:(0,r.jsx)("i",{className:"far fa-eye"})}):(0,r.jsxs)("div",{className:"btn-group",children:[(0,r.jsx)("button",{className:"ms-table-occurrences-action-button","data-toggle":"dropdown","aria-expanded":"false",title:"Mais ações",type:"button",children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v ms-table-occurrences-action-icon"})}),(0,r.jsx)("div",{className:"dropdown-menu dropdown-menu-right",role:"menu",children:o.map(function(e,t){return(0,r.jsx)("button",{className:"dropdown-item",onClick:function(t){t.preventDefault(),e.onClick()},children:e.label},"".concat(e.key,"-").concat(t))})})]}))})})]},e.id)}),0===t.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:7,className:"text-center text-muted py-4",children:"Nenhum registro encontrado para o período selecionado"})})]})]})})]}),!l&&u&&(0,r.jsxs)("div",{className:"card-footer app-table-footer",children:[(0,r.jsx)("div",{className:"app-table-footer__left",children:(0,r.jsxs)("small",{className:"text-muted",children:["Mostrando ",t.length," de ",u.total," registros ",u.total_pages>0&&" (Página ".concat(u.current_page," de ").concat(u.total_pages,")")]})}),(0,r.jsx)("nav",{"aria-label":"Navegação da tabela",className:"app-table-footer__center",children:(0,r.jsxs)("ul",{className:"pagination pagination-sm mb-0 app-table-pagination",children:[(0,r.jsx)("li",{className:"page-item ".concat(1===u.current_page?"disabled":""),children:(0,r.jsx)("button",{className:"page-link",onClick:function(){u&&u.current_page>1&&d&&d(u.current_page-1)},disabled:u.current_page<=1,"aria-label":"Anterior",children:(0,r.jsx)("span",{"aria-hidden":"true",children:"‹"})})}),(0,r.jsx)("li",{className:"page-item active",children:(0,r.jsx)("span",{className:"page-link",children:u.current_page})}),(0,r.jsx)("li",{className:"page-item ".concat(u.current_page>=u.total_pages?"disabled":""),children:(0,r.jsx)("button",{className:"page-link",onClick:function(){u&&u.current_page<u.total_pages&&d&&d(u.current_page+1)},disabled:u.current_page>=u.total_pages,"aria-label":"Próxima",children:(0,r.jsx)("span",{"aria-hidden":"true",children:"›"})})})]})}),(0,r.jsxs)("div",{className:"d-flex align-items-center app-table-footer__right",children:[(0,r.jsx)("span",{className:"text-muted mr-2",children:"Resultados por página"}),(0,r.jsx)("select",{className:"custom-select custom-select-sm",style:{width:72},value:u.per_page,onChange:function(e){f&&f(Number(e.target.value))},children:[10,20,30,50,100].map(function(e){return(0,r.jsx)("option",{value:e,children:e},e)})})]})]})]})}function c(e){var t=e.selectedStatus,n=e.onStatusChange,o=i((0,a.useState)(!1),2),s=o[0],l=o[1],c=(0,a.useRef)(null);(0,a.useEffect)(function(){function e(e){if(s){var t=e.target;c.current&&!c.current.contains(t)&&l(!1)}}return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[s]);var u=t&&""!==t;return(0,r.jsxs)("div",{className:"dropdown",ref:c,children:[(0,r.jsx)("button",{className:"app-list-filter-btn ".concat(u?"has-filters":""),type:"button",onClick:function(){return l(!s)},title:u?"Filtros ativos":"Filtros",children:(0,r.jsx)("i",{className:"fas fa-filter"})}),s&&(0,r.jsxs)("div",{className:"dropdown-menu app-filter-dropdown show",style:{right:0},children:[(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Status"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:t||"",onChange:function(e){return null==n?void 0:n(e.target.value)},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"incomplete",children:"Incompleto"}),(0,r.jsx)("option",{value:"missing_hours",children:"Devendo Horas"}),(0,r.jsx)("option",{value:"on_time",children:"Em Dia"}),(0,r.jsx)("option",{value:"overtime",children:"Horas Extras"})]})]}),(0,r.jsxs)("div",{className:"d-flex justify-content-between pt-1",children:[(0,r.jsx)("button",{className:"btn btn-sm text-muted",type:"button",onClick:function(){n&&n(""),l(!1)},children:"Limpar"}),(0,r.jsx)("button",{className:"btn btn-sm btn-primary",type:"button",onClick:function(){l(!1)},children:"Aplicar"})]})]})]})}},81149(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>g});n(52675),n(89463),n(2259),n(23418),n(74423),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(3362),n(27495),n(38781),n(47764),n(25440),n(62953),n(3296),n(27208),n(48408);var r=n(74848),a=n(96540),o=n(97665),i=n(15072),s=n(94034);function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var u=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,57909))}),d=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,23696))}),f=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,14785))}),m=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,75930))}),p=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,43432))}),h=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,41081))}),v=new i.E({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),b=["overview","ponto","timesheet","attendance","settings","permissoes"];function y(e){var t=new URLSearchParams(location.hash.replace(/^#/,"")).get("tab");return t&&b.includes(t)?t:e}function g(e){var t=e.active,n=void 0===t?"overview":t,i=(0,a.useMemo)(function(){return y(n)},[n]),c=l((0,a.useState)(i),2),g=c[0],x=c[1],j=l((0,a.useState)({title:"GESTÃO DE TEMPO"}),2),w=j[0],S=j[1];(0,a.useEffect)(function(){x(y(n))},[n]),(0,a.useEffect)(function(){b.includes(g)||x(y(n))},[n,g]),(0,a.useEffect)(function(){var e,t;e=g,(t=new URL(location.href)).hash="tab=".concat(e),history.replaceState(null,"",t.toString())},[g]),(0,a.useEffect)(function(){"attendance"!==g&&S({title:"GESTÃO DE TEMPO",hideTabs:!1})},[g]),(0,a.useEffect)(function(){var e=function(){return x(y(n))};return window.addEventListener("hashchange",e),function(){return window.removeEventListener("hashchange",e)}},[n]),(0,a.useEffect)(function(){return document.body.classList.add("tm-page-active"),function(){document.body.classList.remove("tm-page-active")}},[]);var N=function(){switch(g){case"overview":default:return(0,r.jsx)(u,{});case"ponto":return(0,r.jsx)(d,{});case"timesheet":return(0,r.jsx)(f,{});case"attendance":return(0,r.jsx)(m,{onHeaderContextChange:S});case"settings":return(0,r.jsx)(p,{});case"permissoes":return(0,r.jsx)(h,{})}}();return(0,r.jsx)(o.Ht,{client:v,children:(0,r.jsxs)("section",{className:"zero-padding",style:{position:"relative"},children:[(0,r.jsx)(s.A,{items:[{key:"overview",label:"Visão Geral"},{key:"ponto",label:"Controle de Ponto"},{key:"timesheet",label:"Timesheet"},{key:"attendance",label:"Presenças"},{key:"settings",label:"Configurações"},{key:"permissoes",label:"Permissões"}],title:w.title,onBack:"attendance"===g?w.onBack:void 0,activeKey:g,onChange:x,hideTabs:w.hideTabs}),(0,r.jsx)("div",{style:{position:"relative",zIndex:1},children:(0,r.jsx)(a.Suspense,{fallback:(0,r.jsx)("div",{className:"p-3",children:"Carregando…"}),children:N})})]})})}},81623(e,t,n){"use strict";n.d(t,{Ay:()=>d,VU:()=>c,Z4:()=>l,jZ:()=>u});n(52675),n(89463),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362);var r=n(69404);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}var l={getActivities:function(e){return s(a().m(function t(){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.get("/api/timesheet-v2/activities/".concat(e));case 1:return n=t.v,o=n.data,t.a(2,o.data)}},t)}))()},getProjects:function(){return s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.u.get("/api/timesheet-v2/projects");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))()},getProjectTasks:function(e){return s(a().m(function t(){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.get("/api/timesheet-v2/projects/".concat(e,"/tasks"));case 1:return n=t.v,o=n.data,t.a(2,o.data)}},t)}))()},getActivityTemplates:function(){return s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.u.get("/api/timesheet-v2/activity-templates");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))()},createActivity:function(e){return s(a().m(function t(){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.post("/api/timesheet-v2/activities",e);case 1:return n=t.v,o=n.data,t.a(2,o.data)}},t)}))()},updateActivity:function(e,t){return s(a().m(function n(){var o,i;return a().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,r.u.put("/api/timesheet-v2/activities/".concat(e),t);case 1:return o=n.v,i=o.data,n.a(2,i.data)}},n)}))()},deleteActivity:function(e){return s(a().m(function t(){return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.delete("/api/timesheet-v2/activities/".concat(e));case 1:return t.a(2)}},t)}))()},finalizeDay:function(e){return s(a().m(function t(){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.post("/api/timesheet-v2/days/".concat(e,"/finalize"));case 1:return n=t.v,o=n.data,t.a(2,o.data)}},t)}))()},getScheduledActivities:function(e){return s(a().m(function t(){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.get("/api/timesheet-v2/scheduled-activities/".concat(e));case 1:return n=t.v,o=n.data,t.a(2,o.data)}},t)}))()},getPlannedActivities:function(e){return s(a().m(function t(){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.get("/api/timesheet-v2/planned-activities/".concat(e));case 1:return n=t.v,o=n.data,t.a(2,o.data)}},t)}))()},getHoursWorkedKPI:function(e){return s(a().m(function t(){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.get("/api/timesheet-v2/kpi/hours-worked/".concat(e));case 1:return n=t.v,o=n.data,t.a(2,o.data)}},t)}))()},getHoursByProject:function(e,t,n){return s(a().m(function o(){var i,s;return a().w(function(a){for(;;)switch(a.n){case 0:return a.n=1,r.u.get("/api/timesheet-v2/kpi/hours-by-project",{params:{start_date:e,end_date:t,member_id:n}});case 1:return i=a.v,s=i.data,a.a(2,s.data)}},o)}))()},getEnergyPeaks:function(e,t,n){return s(a().m(function o(){var i,s;return a().w(function(a){for(;;)switch(a.n){case 0:return a.n=1,r.u.get("/api/timesheet-v2/kpi/energy-peaks",{params:{start_date:e,end_date:t,member_id:n}});case 1:return i=a.v,s=i.data,a.a(2,s.data)}},o)}))()},getWeeklyHours:function(e,t,n){return s(a().m(function o(){var i,s;return a().w(function(a){for(;;)switch(a.n){case 0:return a.n=1,r.u.get("/api/timesheet-v2/kpi/weekly-hours",{params:{start_date:e,end_date:t,member_id:n}});case 1:return i=a.v,s=i.data,a.a(2,s.data)}},o)}))()},getWorkload:function(e){return s(a().m(function t(){var n;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.get("/api/timesheet-v2/workload/".concat(e));case 1:return n=t.v,t.a(2,n.data.workload_hours)}},t)}))()},updateWorkload:function(e,t){return s(a().m(function n(){return a().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,r.u.put("/api/timesheet-v2/workload",{date:e,workload_hours:t});case 1:return n.a(2)}},n)}))()},getHoursControl:function(e,t,n){return s(a().m(function o(){var i,s;return a().w(function(a){for(;;)switch(a.n){case 0:return a.n=1,r.u.get("/api/timesheet-v2/hours-control/",{params:{start_date:e,end_date:t,member_id:n}});case 1:return i=a.v,s=i.data,a.a(2,s.data)}},o)}))()},getMonthInfo:function(e,t,n){return s(a().m(function o(){var i,s;return a().w(function(a){for(;;)switch(a.n){case 0:return a.n=1,r.u.get("/api/timesheet-v2/month-info",{params:{start_date:e,end_date:t,member_id:n}});case 1:return i=a.v,s=i.data,a.a(2,s.data)}},o)}))()},getMonthKPIs:function(e,t,n){return s(a().m(function o(){var i,s;return a().w(function(a){for(;;)switch(a.n){case 0:return a.n=1,r.u.get("/api/timesheet-v2/kpi/month",{params:{start_date:e,end_date:t,member_id:n}});case 1:return i=a.v,s=i.data,a.a(2,s.data)}},o)}))()},getDayKPIs:function(e){return s(a().m(function t(){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.get("/api/timesheet-v2/kpi/day/".concat(e));case 1:return n=t.v,o=n.data,t.a(2,o.data)}},t)}))()}},c=function(){var e=s(a().m(function e(t,n){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.u.put("/api/timesheet-v2/days/".concat(t,"/satisfaction"),{work_satisfaction:n});case 1:return e.a(2)}},e)}));return function(t,n){return e.apply(this,arguments)}}(),u=function(){var e=s(a().m(function e(t){var n,o,i,s,l,c,u;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.u.get("/api/timesheet-v2/days/".concat(t,"/satisfaction"));case 1:return c=e.v,u=c.data,e.a(2,{timesheetDayId:(null===(n=u.data)||void 0===n?void 0:n.id)||null,hasSatisfaction:null!==(null===(o=u.data)||void 0===o?void 0:o.work_satisfaction),isFinalized:2===(null===(i=u.data)||void 0===i?void 0:i.work_period),workSatisfaction:null!==(s=null===(l=u.data)||void 0===l?void 0:l.work_satisfaction)&&void 0!==s?s:null})}},e)}));return function(t){return e.apply(this,arguments)}}();const d=l},82942(e,t,n){"use strict";n.d(t,{AD:()=>a,JC:()=>o,Q8:()=>r,kC:()=>i});n(2008),n(62062),n(26099);function r(e,t){if(!e)return[];var n=e.mode,r=e.validate_points_others,a=t||window.innerWidth<=768;if("none"===n)return[];if("qrcode"===n)return a?["qrcode"]:[];if("flexible"===n){var o=["selfie","geolocation","screenshot"];return a&&o.push("qrcode"),o}return"manual"===n?r.map(function(e){return e.type}).filter(function(e){return!("qrcode"===e&&!a)}):[]}function a(e,t){if(!e)return!1;var n=t||window.innerWidth<=768;return"qrcode"===e.mode&&!n}function o(e){return{selfie:"fas fa-camera",geolocation:"fas fa-map-marker-alt",screenshot:"fas fa-image",qrcode:"fas fa-qrcode",teste:"fas fa-flask"}[e]||"fas fa-check"}function i(e){return{selfie:"Selfie",geolocation:"Localização",screenshot:"Screenshot",qrcode:"QR Code",teste:"Bater Ponto Teste"}[e]||e}},84136(e,t,n){"use strict";n.d(t,{L:()=>r,j:()=>a});var r={ponto_duplicado:"Ponto Duplicado",atraso:"Atraso",ponto_dia_folga:"Ponto em Dia de Folga",ausencia_sem_justificativa:"Ausência sem Justificativa",ausencia_com_justificativa:"Ausência com Justificativa",saida_antecipada:"Saída Antecipada",ponto_adiantado:"Ponto Adiantado"};function a(e){return{leve:"leve",moderado:"atencao",atencao:"atencao",resolvido:"resolvido",pendente:"pendente"}[e]||"leve"}},85231(e,t,n){"use strict";n.d(t,{GB:()=>p,Nb:()=>y,Tp:()=>l,X3:()=>f,bP:()=>v,xP:()=>u});n(52675),n(89463),n(23288),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(38781);var r=n(52354);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}function l(e){return c.apply(this,arguments)}function c(){return(c=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/professional/clock-in/shift",{params:{date:t}});case 1:return n=e.v,o=n.data,e.a(2,o.data)}},e)}))).apply(this,arguments)}function u(e){return d.apply(this,arguments)}function d(){return(d=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/professional/clock-in/occurrences",{params:{date:t}});case 1:return n=e.v,o=n.data,e.a(2,o.data)}},e)}))).apply(this,arguments)}function f(e){return m.apply(this,arguments)}function m(){return(m=s(a().m(function e(t){var n,o,i;return a().w(function(e){for(;;)switch(e.n){case 0:return(n=new FormData).append("device",t.device),n.append("mode",t.mode),t.selfie&&n.append("selfie",t.selfie,"selfie.jpg"),t.location&&(n.append("latitude",t.location.lat.toString()),n.append("longitude",t.location.lng.toString())),t.screenshot&&n.append("screenshot",t.screenshot),t.qrcode&&n.append("qrcode",t.qrcode),t.testTime&&n.append("testTime",t.testTime),e.n=1,r.F.post("/time-management/professional/clock-in",n,{headers:{"Content-Type":"multipart/form-data"}});case 1:return o=e.v,i=o.data,e.a(2,i.data)}},e)}))).apply(this,arguments)}function p(e,t){return h.apply(this,arguments)}function h(){return(h=s(a().m(function e(t,n){var o,i;return a().w(function(e){for(;;)switch(e.n){case 0:return console.log("[addJustification] Enviando requisição..."),console.log("[addJustification] URL:","/time-management/professional/clock-in/occurrences/".concat(t,"/justification")),console.log("[addJustification] Payload:",{justification:n}),e.n=1,r.F.post("/time-management/professional/clock-in/occurrences/".concat(t,"/justification"),{justification:n},{headers:{"Content-Type":"application/json",Accept:"application/json"}});case 1:return o=e.v,i=o.data,console.log("[addJustification] Status da resposta OK"),console.log("[addJustification] response.data:",i),e.a(2,i)}},e)}))).apply(this,arguments)}function v(e,t){return b.apply(this,arguments)}function b(){return(b=s(a().m(function e(t,n){var o,i;return a().w(function(e){for(;;)switch(e.n){case 0:return console.log("[editOccurrenceTime] Enviando requisição..."),console.log("[editOccurrenceTime] URL:","/time-management/professional/clock-in/occurrences/".concat(t,"/edit-time")),console.log("[editOccurrenceTime] Payload:",{time:n}),e.n=1,r.F.patch("/time-management/professional/clock-in/occurrences/".concat(t,"/edit-time"),{time:n},{headers:{"Content-Type":"application/json",Accept:"application/json"}});case 1:return o=e.v,i=o.data,console.log("[editOccurrenceTime] Status da resposta OK"),console.log("[editOccurrenceTime] response.data:",i),e.a(2,i)}},e)}))).apply(this,arguments)}function y(e){return g.apply(this,arguments)}function g(){return(g=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.delete("/time-management/test/clear-point",{params:{date:t},headers:{"Content-Type":"application/json",Accept:"application/json"}});case 1:return n=e.v,o=n.data,e.a(2,o)}},e)}))).apply(this,arguments)}},86628(e,t,n){var r={"./TesteController.tsx":90412};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=86628},88195(e,t,n){"use strict";n.d(t,{A:()=>a});n(62062),n(26099);var r=n(74848);function a(e){var t=e.columns,n=e.data,a=e.renderRow,o=e.emptyMessage,i=void 0===o?"Nenhuma atividade registrada":o,s=e.className,l=void 0===s?"":s;return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"table-responsive app-table-responsive ".concat(l),children:(0,r.jsxs)("table",{className:"table mb-0 table-hover app-table",children:[(0,r.jsx)("thead",{className:"thead-light",children:(0,r.jsx)("tr",{children:t.map(function(e){return(0,r.jsx)("th",{className:"center"===e.align?"text-center":"right"===e.align?"text-right":"",style:{width:e.width},children:e.label},e.key)})})}),(0,r.jsx)("tbody",{children:0===n.length?(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:t.length,className:"text-center text-muted py-4",children:i})}):n.map(function(e,t){return(0,r.jsx)("tr",{className:t%2==1?"bg-light":"",children:a(e,t)},t)})})]})})})}},88821(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>c});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(73638);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var l={container:{padding:"16px",minWidth:"320px",maxWidth:"400px"},header:{fontSize:"14px",fontWeight:600,color:"#5C5D5D",marginBottom:"12px",paddingBottom:"8px",borderBottom:"1px solid #E0E0E0"},textarea:{width:"100%",padding:"10px",border:"1px solid #D1D5DB",borderRadius:"5px",fontSize:"13px",color:"#5C5D5D",minHeight:"100px",resize:"vertical",marginBottom:"12px",boxSizing:"border-box"},buttonGroup:{display:"flex",justifyContent:"flex-end",gap:"8px"},cancelButton:{padding:"8px 16px",border:"1px solid #D1D5DB",borderRadius:"5px",backgroundColor:"#FFF",fontSize:"13px",fontWeight:600,color:"#5C5D5D",cursor:"pointer"},saveButton:{padding:"8px 16px",border:"none",borderRadius:"5px",backgroundColor:"#186073",fontSize:"13px",fontWeight:600,color:"#FFF",cursor:"pointer"}};function c(e){var t=e.show,n=e.onClose,s=e.onSave,c=e.initialComment,u=e.activityName,d=e.triggerRef,f=i((0,a.useState)(c),2),m=f[0],p=f[1];(0,a.useEffect)(function(){p(c)},[c,t]);return(0,r.jsx)(o.A,{show:t,onClose:n,position:"bottom",triggerRef:d,children:(0,r.jsxs)("div",{style:l.container,children:[(0,r.jsxs)("div",{style:l.header,children:["Comentário: ",u]}),(0,r.jsx)("textarea",{style:l.textarea,value:m,onChange:function(e){return p(e.target.value)},placeholder:"Adicione observações sobre a atividade...",autoFocus:!0}),(0,r.jsxs)("div",{style:l.buttonGroup,children:[(0,r.jsx)("button",{type:"button",style:l.cancelButton,onClick:n,children:"Cancelar"}),(0,r.jsx)("button",{type:"button",style:l.saveButton,onClick:function(){s(m)},children:"Salvar"})]})]})})}},90162(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>j});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(51629),n(23418),n(64346),n(23792),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(27495),n(38781),n(47764),n(23500),n(62953);var r,a=n(74848),o=n(49785),i=n(96540),s=n(34559);n(62062),n(5506);function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=l(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==l(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e.FORGETFULNESS="esquecimento",e.DUPLICATE_RECORD="registro_duplicado",e.REQUESTED_ADJUSTMENT="ajuste_solicitado"}(r||(r={}));var f=d(d(d({},r.FORGETFULNESS,"Esquecimento"),r.DUPLICATE_RECORD,"Registro duplicado"),r.REQUESTED_ADJUSTMENT,"Ajuste solicitado");var m=n(1806),p=n(47339);function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach(function(t){y(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=h(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==h(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return x(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?x(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function j(e){var t=e.isOpen,n=e.onClose,r=e.record,l=e.onSave,u=e.isSaving,d=(0,o.mN)({mode:"onChange",defaultValues:{motivo:"",primeiraEntradaData:"",primeiraEntradaHora:"",primeiraSaidaData:"",primeiraSaidaHora:"",segundaEntradaData:"",segundaEntradaHora:"",saidaData:"",saidaHora:""}}),h=d.register,v=d.handleSubmit,y=d.control,x=d.reset,j=d.formState,w=j.errors,S=j.isValid;(0,i.useEffect)(function(){if(r){var e,t,n,a,o=g((r.data||"").split("/"),3),i=o[0],s=o[1],l=o[2],c=l&&s&&i?"".concat(l,"-").concat(s,"-").concat(i):"";x({motivo:"",primeiraEntradaData:c,primeiraEntradaHora:(null===(e=r.registros)||void 0===e?void 0:e[0])||"",primeiraSaidaData:c,primeiraSaidaHora:(null===(t=r.registros)||void 0===t?void 0:t[1])||"",segundaEntradaData:c,segundaEntradaHora:(null===(n=r.registros)||void 0===n?void 0:n[2])||"",saidaData:c,saidaHora:(null===(a=r.registros)||void 0===a?void 0:a[3])||""})}},[r,x]);var N=function(e,t){if(!e||!t)return null;var n=new Date("".concat(e,"T").concat(t));return isNaN(n.getTime())?null:n.getTime()},k=function(){x(),n()};if(!t)return null;var C=Object.entries(f).map(function(e){var t=c(e,2);return{value:t[0],label:t[1]}});return(0,a.jsx)(m.A,{show:t,onClose:k,title:"Editando Registro",size:"md",className:"w-75",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:k,disabled:u,children:"Cancelar"}),(0,a.jsx)("button",{type:"submit",form:"editRecordForm",className:"btn btn-primary",disabled:u||!S,style:{backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:u?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("i",{className:"fas fa-spinner fa-spin mr-1"}),"Salvando..."]}):"Salvar Edição"})]}),children:(0,a.jsx)("form",{id:"editRecordForm",onSubmit:v(function(e){if(e.motivo){for(var t=[{name:"Primeira Entrada",value:N(e.primeiraEntradaData,e.primeiraEntradaHora)},{name:"Primeira Saída",value:N(e.primeiraSaidaData,e.primeiraSaidaHora)},{name:"Segunda Entrada",value:N(e.segundaEntradaData,e.segundaEntradaHora)},{name:"Segunda Saída",value:N(e.saidaData,e.saidaHora)}].filter(function(e){return null!==e.value}),n=1;n<t.length;n++){var r=t[n-1],a=t[n];if(a.value<=r.value)return void p.A.warning('O horário de "'.concat(a.name,'" deve ser posterior a "').concat(r.name,'".'),"Horário inválido")}l(e)}else p.A.warning("Por favor, selecione o motivo.","Campo obrigatório")}),children:(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,a.jsx)("h6",{style:{color:"#5C5D5D",marginBottom:"8px"},children:"Selecione o Motivo"}),(0,a.jsx)("p",{children:"Informe o motivo pelo qual este ponto precisa ser ajustado."}),(0,a.jsx)(o.xI,{name:"motivo",control:y,rules:{required:"Motivo é obrigatório"},render:function(e){var t=e.field;return(0,a.jsx)(s.A,{options:C,value:t.value,placeholder:"Motivo*",size:"md",onChange:t.onChange})}}),w.motivo&&(0,a.jsx)("small",{className:"text-danger d-block mt-1",children:w.motivo.message})]}),(0,a.jsxs)("div",{className:"row mb-3",children:[(0,a.jsxs)("div",{className:"col-md-6",children:[(0,a.jsx)("h6",{style:{color:"#5C5D5D",marginBottom:"8px"},children:"Primeira Entrada"}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("div",{className:"col-8",children:(0,a.jsx)("div",{className:"input-group",children:(0,a.jsx)("input",b(b({},h("primeiraEntradaData")),{},{type:"date",className:"form-control"}))})}),(0,a.jsx)("div",{className:"col-4",children:(0,a.jsx)("input",b(b({},h("primeiraEntradaHora")),{},{type:"time",className:"form-control",placeholder:"--:--"}))})]})]}),(0,a.jsxs)("div",{className:"col-md-6",children:[(0,a.jsx)("h6",{style:{color:"#5C5D5D",marginBottom:"8px"},children:"Primeira Saída"}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("div",{className:"col-8",children:(0,a.jsx)("div",{className:"input-group",children:(0,a.jsx)("input",b(b({},h("primeiraSaidaData")),{},{type:"date",className:"form-control"}))})}),(0,a.jsx)("div",{className:"col-4",children:(0,a.jsx)("input",b(b({},h("primeiraSaidaHora")),{},{type:"time",className:"form-control",placeholder:"12:00"}))})]})]})]}),(0,a.jsxs)("div",{className:"row mb-3",children:[(0,a.jsxs)("div",{className:"col-md-6",children:[(0,a.jsx)("h6",{style:{color:"#5C5D5D",marginBottom:"8px"},children:"Segunda Entrada"}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("div",{className:"col-8",children:(0,a.jsx)("div",{className:"input-group",children:(0,a.jsx)("input",b(b({},h("segundaEntradaData")),{},{type:"date",className:"form-control"}))})}),(0,a.jsx)("div",{className:"col-4",children:(0,a.jsx)("input",b(b({},h("segundaEntradaHora")),{},{type:"time",className:"form-control",placeholder:"13:01"}))})]})]}),(0,a.jsxs)("div",{className:"col-md-6",children:[(0,a.jsx)("h6",{style:{color:"#5C5D5D",marginBottom:"8px"},children:"Segunda Saída"}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("div",{className:"col-8",children:(0,a.jsx)("div",{className:"input-group",children:(0,a.jsx)("input",b(b({},h("saidaData")),{},{type:"date",className:"form-control"}))})}),(0,a.jsx)("div",{className:"col-4",children:(0,a.jsx)("input",b(b({},h("saidaHora")),{},{type:"time",className:"form-control",placeholder:"18:00"}))})]})]})]})]})})})}},90412(){},92268(e,t,n){"use strict";n.d(t,{A:()=>o});n(62062),n(26099),n(11392);var r=n(74848),a=n(73638);function o(e){var t=e.show,n=e.onClose,o=e.options,i=e.onSelect,s=e.position,l=void 0===s?"left":s,c=e.triggerRef;return(0,r.jsx)(a.A,{show:t,onClose:n,position:l,width:"200px",triggerRef:c,children:o.map(function(e){return(0,r.jsxs)("button",{type:"button",className:"dropdown-item d-flex align-items-center",onClick:function(){return t=e.value,i(t),void n();var t},style:{backgroundColor:e.selected?"#F3F3F3":"transparent",color:e.selected?"#5C5D5D":"inherit"},children:[e.icon&&(e.icon.startsWith("/")||e.icon.startsWith("http")?(0,r.jsx)("img",{src:e.icon,alt:"",className:"mr-2",style:{width:"16px",height:"16px"}}):(0,r.jsx)("i",{className:"".concat(e.icon," mr-2")})),e.label]},e.value)})})}},92454(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>s});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s(e){var t=e.isOpen,n=e.onConfirm,i=e.onClose,s=o((0,a.useState)(""),2),l=s[0],c=s[1],u=o((0,a.useState)(null),2),d=u[0],f=u[1];(0,a.useEffect)(function(){t&&(c(""),f(null))},[t]);return t?(0,r.jsx)("div",{className:"modal show d-block",style:{backgroundColor:"rgba(0,0,0,0.5)"},onClick:i,children:(0,r.jsx)("div",{className:"modal-dialog modal-dialog-centered",onClick:function(e){return e.stopPropagation()},children:(0,r.jsxs)("div",{className:"modal-content",children:[(0,r.jsxs)("div",{className:"modal-header",children:[(0,r.jsxs)("h5",{className:"modal-title",children:[(0,r.jsx)("i",{className:"fas fa-flask mr-2"}),"Bater Ponto Teste"]}),(0,r.jsx)("button",{type:"button",className:"close",onClick:i,"aria-label":"Fechar",children:(0,r.jsx)("span",{"aria-hidden":"true",children:"×"})})]}),(0,r.jsxs)("form",{onSubmit:function(e){(e.preventDefault(),l)?/^([0-1][0-9]|2[0-3]):[0-5][0-9]$/.test(l)?n(l):f("Horário inválido. Use o formato HH:mm (ex: 18:00)"):f("Por favor, informe o horário")},children:[(0,r.jsxs)("div",{className:"modal-body",children:[(0,r.jsx)("p",{className:"text-muted mb-3",children:"Informe o horário que deseja registrar para o ponto de teste:"}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"test-time",children:"Horário (HH:mm)"}),(0,r.jsx)("input",{type:"time",id:"test-time",className:"form-control ".concat(d?"is-invalid":""),value:l,onChange:function(e){var t=e.target.value;c(t),f(null)},onFocus:function(){f(null)},required:!0}),d&&(0,r.jsx)("div",{className:"invalid-feedback",children:d})]})]}),(0,r.jsxs)("div",{className:"modal-footer",children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:i,children:"Cancelar"}),(0,r.jsxs)("button",{type:"submit",className:"btn btn-primary",style:{backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:[(0,r.jsx)("i",{className:"fas fa-check mr-2"}),"Registrar Ponto"]})]})]})]})})}):null}},92801(e,t,n){"use strict";n.d(t,{A:()=>x});n(52675),n(89463),n(2259),n(28706),n(23418),n(74423),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(21699),n(47764),n(68156),n(62953);var r=n(74848),a=n(96540),o=n(33930),i=n(10280),s=n(30588),l=n(73236),c=n(71458),u=n(93628),d=n(42328),f=n(72722),m=n(1125),p=n(81623),h=n(9504),v=n(50860);function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return y(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var g=function(e){var t=e.value,n=e.label,a={container:{background:"#FFF",borderRadius:"3px",border:"1px solid rgba(217, 217, 217, 0.40)",padding:"20px",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",textAlign:"left"},title:{fontSize:"20px",fontWeight:700,color:"#5C5D5D",margin:"0 0 8px 0",lineHeight:"normal"},subtitle:{fontSize:"12px",color:"rgba(92, 93, 93, 0.50)",margin:0,fontWeight:500,lineHeight:"normal"}};return(0,r.jsxs)("div",{style:a.container,children:[(0,r.jsx)("h3",{style:a.title,children:t}),(0,r.jsx)("p",{style:a.subtitle,children:n})]})};function x(e){var t=e.title,n=e.subtitle,y=e.showBackButton,x=void 0!==y&&y,j=e.onBack,w=e.showExportButton,S=void 0!==w&&w,N=(e.onExport,e.userInfo),k=e.memberId,C=b((0,a.useState)(function(){var e=new Date,t=new Date;t.setDate(t.getDate()-30);var n=function(e){var t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(r)};return{startDate:n(t),endDate:n(e)}}()),2),O=C[0],A=C[1],E=b((0,a.useState)(["task"]),2),P=E[0],F=E[1],T=b((0,a.useState)(["timesheet"]),2),D=T[0],_=T[1],I=(0,a.useRef)(null),M=b((0,a.useState)(!1),2),R=M[0],z=M[1],L=function(e){A(e)},q=(0,o.I)({queryKey:["month-kpis",O.startDate,O.endDate,k],queryFn:function(){return p.Z4.getMonthKPIs(O.startDate,O.endDate,k)},staleTime:6e4}),B=q.data,G=q.isLoading,H=B?{totalRegistered:B.total_registered_formatted,dailyAverage:B.daily_average_formatted,extraHours:B.extra_hours_formatted,missingHours:B.missing_hours_formatted}:{totalRegistered:"00:00h",dailyAverage:"00:00h",extraHours:"0h",missingHours:"00:00h"},W=(0,o.I)({queryKey:["month-info",O.startDate,O.endDate,k],queryFn:function(){return p.Z4.getMonthInfo(O.startDate,O.endDate,k)},staleTime:6e4}),U=W.data,V=W.isLoading,Q=U?{diasRegistrados:{value:"".concat(U.dias_registrados," de ").concat(U.total_dias_mes),label:"Dias Registrados no Mês"},diasTrabalhados:{value:"".concat(U.dias_trabalhados),label:"Trabalhados"},atividadesRegistradas:{value:"".concat(U.atividades_registradas),label:"Quantidade de Atividades Registradas"}}:{diasRegistrados:{value:"0 de 0",label:"Dias Registrados no Mês"},diasTrabalhados:{value:"0",label:"Trabalhados"},atividadesRegistradas:{value:"0",label:"Quantidade de Atividades Registradas"}},K=(0,o.I)({queryKey:["hours-control",O.startDate,O.endDate,k],queryFn:function(){return p.Z4.getHoursControl(O.startDate,O.endDate,k)},staleTime:6e4}),$=K.data,J=K.isLoading,Y=$?[{type:"Horas Regulares",value:$.regular_hours},{type:"Horas Extras",value:$.extra_hours},{type:"Horas Noturnas",value:$.night_hours}]:[],Z=$?Math.max(20,4*Math.ceil(($.workload_hours+$.extra_hours)/4)):20,X=function(e){return{"Horas Regulares":"#186073","Horas Extras":"#17A1B7","Horas Noturnas":"#02D6C7"}[e]||"#186073"},ee=(0,o.I)({queryKey:["hours-by-project",O.startDate,O.endDate,k],queryFn:function(){return p.Z4.getHoursByProject(O.startDate,O.endDate,k)},staleTime:6e4}),te=ee.data,ne=ee.isLoading,re=(0,o.I)({queryKey:["energy-peaks",O.startDate,O.endDate,k],queryFn:function(){return p.Z4.getEnergyPeaks(O.startDate,O.endDate,k)},enabled:D.includes("timesheet"),staleTime:6e4}),ae=re.data,oe=re.isLoading,ie=(0,o.I)({queryKey:["weekly-hours",O.startDate,O.endDate,k],queryFn:function(){return p.Z4.getWeeklyHours(O.startDate,O.endDate,k)},enabled:P.includes("task"),staleTime:6e4}),se=ie.data,le=ie.isLoading;return(0,r.jsx)("div",{ref:I,children:(0,r.jsxs)(v.A,{children:[(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between mb-4",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[x&&(0,r.jsx)("button",{onClick:j,className:"btn btn-link p-0 mr-3",style:{color:"#5C5D5D",fontSize:"20px",textDecoration:"none"},title:"Voltar",children:(0,r.jsx)("i",{className:"fas fa-arrow-left"})}),(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[N&&(0,r.jsx)("div",{className:"rounded-circle d-flex align-items-center justify-content-center text-white mr-3",style:{width:48,height:48,fontSize:"20px",fontWeight:700,background:N.avatarBg},children:N.initials}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"title_main mb-1",style:{color:"#5C5D5D",fontSize:"20px",fontWeight:600,margin:0},children:t}),n&&(0,r.jsx)("p",{className:"subtitle_main",style:{color:"#5C5D5D",fontSize:"12px",fontWeight:400,margin:0},children:n})]})]})]}),(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{gap:"12px"},children:[S&&(0,r.jsxs)("button",{onClick:function(){(0,h.vl)({dashboardRef:I,dateRange:O,setIsExporting:z})},disabled:R,className:"btn",style:{backgroundColor:"#186073",color:"#fff",border:"none",borderRadius:"8px",padding:"10px 20px",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",cursor:R?"not-allowed":"pointer",opacity:R?.7:1,transition:"all 0.2s ease"},onMouseEnter:function(e){R||(e.currentTarget.style.backgroundColor="#134A5A")},onMouseLeave:function(e){e.currentTarget.style.backgroundColor="#186073"},children:[(0,r.jsx)("i",{className:"fas fa-download"}),R?"Exportando...":"Exportar em PDF"]}),(0,r.jsx)(s.A,{initialStartDate:O.startDate,initialEndDate:O.endDate,onChange:L,maxDays:365})]})]}),(0,r.jsxs)("div",{className:"row mb-4",children:[(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(i.A,{value:H.totalRegistered,label:"Total de Horas Registradas",variant:"teal-dark",isLoading:G,className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(i.A,{value:H.dailyAverage,label:"Média Diária",variant:"cyan",isLoading:G,className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(i.A,{value:H.extraHours,label:"Total de Horas Extras",variant:"turquoise",isLoading:G,className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(i.A,{value:H.missingHours,label:"Total de Horas Faltantes",variant:"salmon",isLoading:G,className:"h-100"})})]}),(0,r.jsx)("div",{className:"d-flex align-items-center justify-content-between mb-3",children:(0,r.jsx)(s.A,{initialStartDate:O.startDate,initialEndDate:O.endDate,onChange:L,maxDays:365})}),(0,r.jsx)(l.A,{title:"Horas Trabalhadas na Semana",className:"mb-3",headerActions:(0,r.jsx)(f.A,{options:[{value:"task",label:"Referência Por Task"},{value:"attendance",label:"Referência Por Registro de Ponto"}],selectedValues:P,onChange:F,placeholder:"Selecione os filtros"}),children:le?(0,r.jsx)(m.A,{message:"Carregando dados..."}):(0,r.jsx)(c.A,{selectedFilters:P,weeklyData:se||[]})}),(0,r.jsx)(l.A,{title:"Horas Trabalhadas Por Projetos",className:"mb-3",children:ne?(0,r.jsx)(m.A,{message:"Carregando projetos..."}):te&&te.length>0?(0,r.jsx)(u.A,{projects:te}):(0,r.jsxs)("div",{className:"text-center py-5",children:[(0,r.jsx)("i",{className:"fas fa-inbox mr-2",style:{fontSize:"48px",color:"#D6DBED"}}),(0,r.jsx)("p",{className:"text-muted mt-3",children:"Nenhum projeto com horas registradas neste período"})]})}),V?(0,r.jsx)("div",{className:"row mb-3",children:(0,r.jsx)("div",{className:"col-12",children:(0,r.jsx)(m.A,{message:"Carregando informações do mês..."})})}):(0,r.jsxs)("div",{className:"row mb-3",children:[(0,r.jsx)("div",{className:"col-12 col-md-4 mb-3",children:(0,r.jsx)(g,{value:Q.diasRegistrados.value,label:Q.diasRegistrados.label})}),(0,r.jsx)("div",{className:"col-12 col-md-4 mb-3",children:(0,r.jsx)(g,{value:Q.diasTrabalhados.value,label:Q.diasTrabalhados.label})}),(0,r.jsx)("div",{className:"col-12 col-md-4 mb-3",children:(0,r.jsx)(g,{value:Q.atividadesRegistradas.value,label:Q.atividadesRegistradas.label})})]}),(0,r.jsx)(l.A,{title:"Picos de Energia - Horas Registradas",className:"mb-3",headerActions:(0,r.jsx)(f.A,{options:[{value:"timesheet",label:"Por Timesheet"},{value:"attendance",label:"Por Registro de Ponto"}],selectedValues:D,onChange:_,placeholder:"Selecione os filtros"}),children:oe?(0,r.jsx)(m.A,{message:"Carregando dados de energia..."}):(0,r.jsx)(d.A,{selectedFilters:D,timesheetData:D.includes("timesheet")&&ae||[],attendanceData:[]})}),(0,r.jsx)(l.A,{title:"Controle de Horas Trabalhadas",className:"mb-3",children:J?(0,r.jsx)(m.A,{message:"Carregando controle de horas..."}):Y.length>0?(0,r.jsxs)("div",{style:{width:"100%"},children:[(0,r.jsx)("div",{style:{display:"flex",justifyContent:"space-between",paddingLeft:"20px",paddingRight:"30px",marginBottom:"10px"},children:Array.from({length:6},function(e,t){return Math.round(Z/5*t)}).map(function(e){return(0,r.jsx)("span",{style:{color:"#5C5D5D",fontSize:"12px",fontWeight:400},children:e},e)})}),(0,r.jsx)("div",{style:{paddingLeft:"20px",paddingRight:"30px"},children:Y.map(function(e,t){return(0,r.jsx)("div",{style:{marginBottom:"12px"},children:(0,r.jsx)("div",{style:{width:"100%",height:"40px",background:"#F5F5F5",borderRadius:"4px",position:"relative",overflow:"hidden"},children:(0,r.jsx)("div",{style:{width:"".concat(e.value/Z*100,"%"),height:"100%",background:X(e.type),borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"flex-end",paddingRight:"10px",transition:"width 0.3s ease"},children:(0,r.jsxs)("span",{style:{color:"#FFF",fontSize:"12px",fontWeight:600},children:[e.value,"h"]})})})},t)})}),(0,r.jsx)("div",{style:{display:"flex",justifyContent:"center",gap:"20px",marginTop:"20px"},children:Y.map(function(e){return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,r.jsx)("div",{style:{width:"12px",height:"12px",background:X(e.type),borderRadius:"2px"}}),(0,r.jsx)("span",{style:{color:"#5C5D5D",fontSize:"12px",fontWeight:400},children:e.type})]},e.type)})})]}):(0,r.jsxs)("div",{className:"text-center py-5",children:[(0,r.jsx)("i",{className:"fas fa-clock mr-2",style:{fontSize:"48px",color:"#D6DBED"}}),(0,r.jsx)("p",{className:"text-muted mt-3",children:"Nenhuma hora registrada neste período"})]})})]})})}},93628(e,t,n){"use strict";n.d(t,{A:()=>y});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(27495),n(38781),n(47764),n(23500),n(62953);var r=n(74848),a=n(28482),o=n(72050),i=n(5614),s=n(69107),l=n(46668),c=n(77984),u=n(23495),d=n(88224);function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function h(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=f(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==f(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e){var t=e.projects,n=t.length>0?Math.max.apply(Math,v(t.map(function(e){return e.hours}))):0,f=n>0?Math.ceil(1.2*n):10,m=function(e){if(e<=0)return[0];if(e<=5)return[0,Math.ceil(e)];if(e<=10)return[0,Math.ceil(e/2),Math.ceil(e)];if(e<=20){var t=Math.ceil(e/4);return[0,t,2*t,3*t,Math.ceil(e)]}for(var n=5*Math.ceil(e/4/5),r=[0],a=n;a<=e;a+=n)r.push(a);return r}(f),h=t.map(function(e){return p(p({},e),{},{background:f-e.hours})});return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{children:(0,r.jsx)(a.u,{width:"100%",height:220,children:(0,r.jsxs)(d.E,{data:h,layout:"vertical",margin:{top:10,right:60,left:10,bottom:10},barSize:28,children:[(0,r.jsx)(s.d,{strokeDasharray:"3 3",horizontal:!1,stroke:"#E0E0E0"}),(0,r.jsx)(c.W,{type:"number",domain:[0,f],ticks:m,axisLine:!1,tickLine:!1,tick:{fill:"#5C5D5D",fontSize:12}}),(0,r.jsx)(u.h,{type:"category",dataKey:"name",axisLine:!1,tickLine:!1,tick:!1,width:0}),(0,r.jsxs)(l.yP,{dataKey:"hours",stackId:"project",radius:[0,0,0,0],children:[h.map(function(e,t){return(0,r.jsx)(o.f,{fill:e.color},"cell-".concat(t))}),(0,r.jsx)(i.Ze,{dataKey:"hours",position:"right",formatter:function(e){return"".concat(e,"h")},style:{fill:"#5C5D5D",fontSize:12,fontWeight:600}})]}),(0,r.jsx)(l.yP,{dataKey:"background",stackId:"project",fill:"rgba(214, 219, 237, 0.40)",radius:[0,4,4,0]})]})})}),(0,r.jsx)("div",{className:"d-flex align-items-center justify-content-center flex-wrap gap-3 mt-3",children:t.map(function(e,t){return(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{paddingRight:"12px"},children:[(0,r.jsx)("div",{style:{width:"12px",height:"12px",background:e.color,borderRadius:"2px",marginRight:"8px"}}),(0,r.jsx)("span",{style:{fontSize:"12px",color:"#5C5D5D"},children:e.name})]},t)})})]})}},93794(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>N});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(94170),n(62010),n(2892),n(59904),n(67945),n(84185),n(83851),n(81278),n(40875),n(79432),n(10287),n(26099),n(3362),n(27495),n(38781),n(31415),n(47764),n(23500),n(62953);var r=n(74848),a=n(33930),o=n(97665),i=n(57097),s=n(19619),l=n(55801),c=n(96540),u=n(76336);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function f(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach(function(t){v(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function v(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=d(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==d(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return y(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(y(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,y(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,y(d,"constructor",c),y(c,"constructor",l),l.displayName="GeneratorFunction",y(c,a,"GeneratorFunction"),y(d),y(d,a,"Generator"),y(d,r,function(){return this}),y(d,"toString",function(){return"[object Generator]"}),(b=function(){return{w:o,m:f}})()}function y(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}y=function(e,t,n,r){function o(t,n){y(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},y(e,t,n,r)}function g(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function x(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){g(o,r,a,i,s,"next",e)}function s(e){g(o,r,a,i,s,"throw",e)}i(void 0)})}}var j=[{label:"Selfie",type:"selfie",description:{enabled:"Exige selfie.",disabled:"Não é exigida"}},{label:"Geolocalização",type:"geolocation",description:{enabled:"Cerca exigida.",disabled:"Cerca não exigida."}},{label:"Print da Tela",type:"screenshot",description:{enabled:"Exige Print",disabled:"Print não é exigida"}},{label:"Escanear QR Code",type:"qrcode",description:{enabled:"Escâner exigido",disabled:"Não é exigida"}}],w=[{id:"sem",title:"Sem validação",note:"Para equipes autônomas e confiáveis, com controle de ponto simplificado.",defaults:{}},{id:"flex",title:"Flexível",note:"Ideal para monitorar equipes externas. Permite várias soluções de validação",defaults:{selfie:!0,geolocation:!0,screenshot:!0,qrcode:!0}},{id:"qr",title:"Por QR Code",note:"Permite validação presencial ou digital por escaneamento de QR Code.",defaults:{qrcode:!0}},{id:"manual",title:"Faça você mesmo",note:"Personalize as verificações conforme a necessidade da sua equipe.",defaults:{}}],S=["time-management","validation"];function N(){var e,t,n,d=(0,u.L)().canEdit,m=(0,o.jE)(),p=(0,a.I)({queryKey:S,queryFn:l.G8,staleTime:6e4,refetchOnWindowFocus:!1}),v=p.data,y=p.isFetching,g=p.isLoading,N=v?s.c[v.mode]:null,k=(0,c.useMemo)(function(){var e;return new Set(null!==(e=null==v?void 0:v.others)&&void 0!==e?e:[])},[v]),C=y||g,O=(0,i.n)({mutationFn:function(e){return(0,l.iY)(s.w[e])},onMutate:(e=x(b().m(function e(t){var n,r;return b().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,m.cancelQueries({queryKey:S});case 1:return(n=m.getQueryData(S))&&(r={mode:s.w[t],others:"manual"===t?n.others:[]},m.setQueryData(S,r)),e.a(2,{prev:n})}},e)})),function(t){return e.apply(this,arguments)}),onError:function(e,t,n){null!=n&&n.prev&&m.setQueryData(S,n.prev)},onSuccess:function(e){m.setQueryData(S,e)}}),A=(0,i.n)({mutationFn:function(e){return(0,l.Tt)(e)},onMutate:(t=x(b().m(function e(t){var n,r;return b().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,m.cancelQueries({queryKey:S});case 1:return(n=m.getQueryData(S))&&(r=h(h({},n),{},{others:Array.from(new Set([].concat(f(n.others),[t])))}),m.setQueryData(S,r)),e.a(2,{prev:n})}},e)})),function(e){return t.apply(this,arguments)}),onError:function(e,t,n){null!=n&&n.prev&&m.setQueryData(S,n.prev)}}),E=(0,i.n)({mutationFn:function(e){return(0,l.kc)(e)},onMutate:(n=x(b().m(function e(t){var n,r;return b().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,m.cancelQueries({queryKey:S});case 1:return(n=m.getQueryData(S))&&(r=h(h({},n),{},{others:n.others.filter(function(e){return e!==t})}),m.setQueryData(S,r)),e.a(2,{prev:n})}},e)})),function(e){return n.apply(this,arguments)}),onError:function(e,t,n){null!=n&&n.prev&&m.setQueryData(S,n.prev)}}),P=O.isPending||A.isPending||E.isPending;return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"row",children:w.map(function(e){var t=N===e.id;return(0,r.jsx)("div",{className:"col-12 col-lg-3 mb-3",children:(0,r.jsx)("div",{className:"card h-100 tm-card-mobile-auto ".concat(t?"border-primary bg-primary-soft":"border"),children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center mb-2",children:[(0,r.jsxs)("div",{className:"custom-control custom-checkbox",children:[(0,r.jsx)("input",{id:"chk-".concat(e.id),type:"checkbox",className:"custom-control-input",checked:!!t,disabled:P||C,onChange:function(){return t=e.id,void(d&&N!==t&&O.mutate(t));var t}}),(0,r.jsx)("label",{className:"custom-control-label",htmlFor:"chk-".concat(e.id)})]}),(0,r.jsx)("label",{htmlFor:"chk-".concat(e.id),className:"mb-0 ml-2 ".concat(t?"text-primary":""),style:{cursor:"pointer"},children:e.title}),(P||C)&&(0,r.jsx)("i",{className:"fas fa-spinner fa-spin ml-auto text-muted"})]}),(0,r.jsx)("small",{className:"text-muted d-block mb-2",children:e.note}),(0,r.jsx)("ul",{className:"list-unstyled mb-0",children:j.map(function(n){var a=!!e.defaults[n.type],o="manual"===e.id?k.has(n.type):a,i="manual"===e.id,s=P||C;return(0,r.jsxs)("li",{className:"d-flex align-items-start mb-3",children:[i?(0,r.jsxs)("div",{className:"custom-control custom-checkbox mr-2",children:[(0,r.jsx)("input",{id:"op-".concat(e.id,"-").concat(n.type),type:"checkbox",className:"custom-control-input",checked:o,disabled:s,onChange:function(){return e=n.type,void(d&&"manual"===N&&(k.has(e)?E.mutate(e):A.mutate(e)));var e}}),(0,r.jsx)("label",{className:"custom-control-label",htmlFor:"op-".concat(e.id,"-").concat(n.type)})]}):(0,r.jsx)("i",{className:"fas ".concat(o?"fa-check ".concat(t?"text-primary":"text-success"):"fa-times text-muted"," mr-2 mt-1"),style:{fontSize:"1.2rem",minWidth:"20px"}}),(0,r.jsxs)("div",{style:{minHeight:"2.5rem"},children:[(0,r.jsx)("div",{className:"".concat(i||o?"":"text-muted"),children:n.label}),i?(0,r.jsx)("small",{className:"text-muted",style:{visibility:"hidden"},children:" "}):(0,r.jsx)("small",{className:"text-muted",children:o?n.description.enabled:n.description.disabled})]})]},n.type)})})]})})},e.id)})})})}},94034(e,t,n){"use strict";n.d(t,{A:()=>o});n(51629),n(62062),n(26099);var r=n(74848),a=n(96540);function o(e){var t=e.items,n=e.activeKey,o=e.title,i=e.onChange,s=e.onBack,l=e.backLabel,c=void 0===l?"Voltar":l,u=e.hideTabs,d=void 0!==u&&u,f=(0,a.useRef)(null);return(0,a.useEffect)(function(){var e=f.current;if(e){for(var t=e.parentElement,n=[];t;){var r=window.getComputedStyle(t),a=r.overflow,o=r.overflowY;"hidden"!==a&&"auto"!==a&&"scroll"!==a&&"hidden"!==o&&"auto"!==o&&"scroll"!==o||(t.style.setProperty("overflow","visible","important"),t.style.setProperty("overflow-y","visible","important"),n.push(t)),t=t.parentElement}var i=e.nextElementSibling;return i&&(i.style.setProperty("position","relative","important"),i.style.setProperty("z-index","1","important")),function(){n.forEach(function(e){e.style.removeProperty("overflow"),e.style.removeProperty("overflow-y")}),i&&(i.style.removeProperty("position"),i.style.removeProperty("z-index"))}}},[]),(0,r.jsxs)("header",{ref:f,className:"modern-header tm-modern-header ".concat(d?"no-tabs":""),children:[(0,r.jsxs)("div",{className:"header-top",children:[s&&(0,r.jsx)("button",{type:"button",className:"btn d-flex align-items-center justify-content-center",style:{borderRadius:5,padding:"5px 10px",height:40,width:40},onClick:s,"aria-label":c,title:c,children:(0,r.jsx)("i",{className:"fas fa-chevron-left","aria-hidden":"true"})}),(0,r.jsx)("h1",{className:"header-title",children:o})]}),!d&&(0,r.jsx)("div",{className:"app-tabs-bar",children:(0,r.jsx)("div",{className:"app-tabs",role:"tablist",children:(0,r.jsx)("div",{className:"d-flex flex-nowrap nav mhs-tabs-nav app-tabs-inner-row",children:t.map(function(e){var t=e.key===n;return e.href?(0,r.jsx)("a",{className:"app-tab-link ".concat(t?"active":""),href:e.href,role:"tab","aria-selected":t,children:e.label},e.key):(0,r.jsx)("button",{type:"button",className:"app-tab-link ".concat(t?"active":""),role:"tab","aria-selected":t,onClick:function(){return null==i?void 0:i(e.key)},children:e.label},e.key)})})})})]})}},95226(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>v});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(33930),o=n(97665),i=n(57097),s=n(70038),l=n(96540),c=n(79724),u=n(14011),d=n(76336),f=n(47339);function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var h=["time-management","work-shifts"];function v(){var e=(0,d.L)(),t=e.canCreate,n=e.canEdit,p=e.canDelete,v=m((0,l.useState)(!1),2),b=v[0],y=v[1],g=m((0,l.useState)(null),2),x=g[0],j=g[1],w=m((0,l.useState)(!1),2),S=w[0],N=w[1],k=m((0,l.useState)(null),2),C=k[0],O=k[1],A=(0,o.jE)(),E=(0,l.useRef)(null),P=(0,l.useRef)(null),F=(0,l.useRef)(null),T=m((0,l.useState)(0),2),D=T[0],_=T[1],I=(0,a.I)({queryKey:h,queryFn:s.hY}),M=I.data,R=void 0===M?[]:M,z=I.isFetching,L=(0,i.n)({mutationFn:s.b1,onSuccess:function(){A.invalidateQueries({queryKey:h})}}),q=(0,i.n)({mutationFn:function(e){var t=e.workShiftId,n=e.memberIds;return(0,s.nx)(t,n)},onSuccess:function(){A.invalidateQueries({queryKey:h}),A.invalidateQueries({queryKey:["time-management","members"]}),A.invalidateQueries({queryKey:["time-management","members-with-shifts"]}),f.A.success("Membros atribuídos com sucesso!","Sucesso"),B()},onError:function(){f.A.error("Erro ao atribuir membros. Por favor, tente novamente.","Erro")}}),B=function(){N(!1),O(null)},G=(0,l.useMemo)(function(){return 0===R.length},[R]);return(0,l.useEffect)(function(){var e=function(){if(P.current&&F.current){var e=P.current.getBoundingClientRect(),t=F.current.getBoundingClientRect(),n=t.left-e.left+t.width/2;_(n)}};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[R]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("style",{children:"\n .workshift-list-container { overflow: visible !important; overflow-x: visible !important; overflow-y: visible !important; }\n .workshift-list-container .card { overflow: visible !important; }\n .workshift-list-container .card-body { overflow: visible !important; }\n .workshift-list-container .row { overflow: visible !important; }\n .workshift-list { max-height: 360px; overflow-y: auto; padding-right: 6px; }\n .workshift-header-time { min-width: 200px; text-align: right; }\n @media (max-width: 768px) {\n .workshift-card-content {\n flex-direction: column !important;\n align-items: flex-start !important;\n }\n .workshift-icon {\n margin-bottom: 10px;\n }\n .workshift-time {\n margin: 10px 0 !important;\n width: 100%;\n }\n .workshift-actions {\n position: absolute;\n top: 10px;\n right: 10px;\n }\n .workshift-header-time {\n display: none !important;\n }\n }\n "}),(0,r.jsx)("div",{ref:E,className:"position-relative",children:!G&&(0,r.jsx)("div",{style:{position:"absolute",top:-28,left:D,transform:"translateX(-50%)"},className:"text-muted d-none d-md-block",children:"Horário"})}),!G&&(0,r.jsx)("div",{className:"mb-3 workshift-list-container workshift-list",ref:P,style:{overflow:"visible"},children:R.map(function(e,t){return(0,r.jsx)("div",{className:"card mb-3",style:{border:"1px solid #e0e0e0",borderRadius:"8px",position:"relative",overflow:"visible"},children:(0,r.jsx)("div",{className:"card-body py-3",style:{overflow:"visible"},children:(0,r.jsxs)("div",{className:"row no-gutters align-items-center workshift-card-content",style:{overflow:"visible"},children:[(0,r.jsx)("div",{className:"col-auto pr-2 d-flex align-items-center justify-content-center workshift-icon",children:(0,r.jsx)("div",{style:{width:40,height:40},className:"d-flex align-items-center justify-content-center bg-primary-soft rounded",children:(0,r.jsx)("i",{className:"far fa-clock text-primary",style:{fontSize:"1.2rem"}})})}),(0,r.jsx)("div",{className:"col-12 col-md-3 px-2 d-flex",style:{minWidth:0},children:(0,r.jsx)("div",{className:"d-flex align-items-center w-100 my-auto",style:{minWidth:0},children:(0,r.jsx)("span",{className:"font-weight-bold text-truncate",style:{minWidth:0},children:e.name})})}),(0,r.jsx)("div",{className:"col px-2 d-flex",style:{minWidth:0},children:(0,r.jsx)("div",{className:"w-100 my-auto text-muted text-truncate text-center",style:{minWidth:0},children:e.description})}),(0,r.jsx)("div",{ref:0===t?F:void 0,className:"col-auto text-center text-muted workshift-time px-2 my-auto",style:{whiteSpace:"nowrap",fontSize:"0.9rem",width:"240px"},children:(a=e.firstCheckIn,o=e.firstCheckOut,i=e.secondCheckIn,s=e.secondCheckOut,l=function(e){return e?e.slice(0,5):"--:--"},"".concat(l(a)," às ").concat(l(o))+(i||s?" • ".concat(l(i)," às ").concat(l(s)):""))}),(0,r.jsxs)("div",{className:"col-auto pl-2 dropdown workshift-actions ml-auto",style:{flexShrink:0,position:"static"},children:[(0,r.jsx)("button",{className:"btn btn-link text-muted p-0","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{fontSize:"1.2rem"},children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v"})}),(0,r.jsxs)("div",{className:"dropdown-menu dropdown-menu-right",style:{zIndex:2e3},children:[n&&(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(){return function(e){j(e),y(!0)}(e)},disabled:L.isPending,children:[(0,r.jsx)("i",{className:"far fa-edit mr-2"}),"Editar"]}),n&&(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(){return function(e){O(e),N(!0)}(e)},disabled:L.isPending,children:[(0,r.jsx)("i",{className:"fas fa-users mr-2"}),"Membros"]}),p&&(0,r.jsxs)("button",{className:"dropdown-item text-danger",onClick:function(){return function(e){window.confirm('Tem certeza que deseja excluir o turno "'.concat(e.name,'"?'))&&L.mutate(e.id)}(e)},disabled:L.isPending,children:[(0,r.jsx)("i",{className:"far fa-trash-alt mr-2"}),L.isPending?"Excluindo...":"Excluir"]})]})]})]})})},e.id);var a,o,i,s,l})}),t&&(0,r.jsxs)("div",{className:"text-muted d-flex align-items-center",role:"button",onClick:function(){return y(!0)},style:{cursor:"pointer",fontSize:"0.95rem"},children:[(0,r.jsx)("i",{className:"fas fa-plus mr-2"})," Adicionar Turno",z&&(0,r.jsx)("i",{className:"fas fa-spinner fa-spin ml-2"})]}),b&&(0,r.jsx)(c.default,{show:b,onClose:function(){y(!1),j(null)},editData:x}),(0,r.jsx)(u.default,{isOpen:S,onClose:B,workShift:C,onSave:function(e){null!=C&&C.id&&q.mutate({workShiftId:C.id,memberIds:e})},isSaving:q.isPending})]})}},96339(e,t,n){"use strict";n.d(t,{E:()=>u,Z:()=>l});n(52675),n(89463),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362);var r=n(52354);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}function l(){return c.apply(this,arguments)}function c(){return(c=s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/policy");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function u(e){return d.apply(this,arguments)}function d(){return(d=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.put("/time-management/policy",t);case 1:return n=e.v,o=n.data,e.a(2,o.data)}},e)}))).apply(this,arguments)}},96930(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>N});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23792),n(89572),n(94170),n(2892),n(59904),n(67945),n(84185),n(83851),n(81278),n(40875),n(79432),n(10287),n(26099),n(3362),n(47764),n(42762),n(23500),n(62953);var r,a=n(74848),o=n(49785),i=n(97665),s=n(57097),l=n(34559);n(23418),n(64346),n(62062),n(34782),n(23288),n(62010),n(5506),n(27495),n(38781);function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=c(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==c(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e.MARRIAGE_LEAVE="marriage_leave",e.MATERNITY_LEAVE="maternity_leave",e.SICK_LEAVE="sick_leave",e.OTHER="other"}(r||(r={}));var m=f(f(f(f({},r.MARRIAGE_LEAVE,"Casamento"),r.MATERNITY_LEAVE,"Licença maternidade"),r.SICK_LEAVE,"Licença médica"),r.OTHER,"Outro");var p=n(50418),h=n(96540),v=n(1806);function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function x(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=b(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==b(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return w(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(w(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,w(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,w(d,"constructor",c),w(c,"constructor",l),l.displayName="GeneratorFunction",w(c,a,"GeneratorFunction"),w(d),w(d,a,"Generator"),w(d,r,function(){return this}),w(d,"toString",function(){return"[object Generator]"}),(j=function(){return{w:o,m:f}})()}function w(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}w=function(e,t,n,r){function o(t,n){w(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},w(e,t,n,r)}function S(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function N(e){var t,n,c=e.isOpen,d=e.onClose,f=e.record,b=(e.onSave,e.isSaving,(0,i.jE)()),y=(0,o.mN)({mode:"onChange",defaultValues:{isParcial:!1,motivo:"",descricao:"",periodoInicio:"",periodoFim:""}}),x=y.register,w=y.handleSubmit,N=y.control,k=y.watch,C=y.reset,O=y.formState.errors,A=k("isParcial"),E=k("motivo"),P=(0,h.useMemo)(function(){return Object.entries(m).map(function(e){var t=u(e,2);return{value:t[0],label:t[1]}})},[]),F=(0,s.n)({mutationFn:(t=j().m(function e(t){var n;return j().w(function(e){for(;;)switch(e.n){case 0:if(null!=f&&f.id){e.n=1;break}throw new Error("ID do registro (hitTheSpotId) não encontrado");case 1:return n={hitTheSpotId:f.id,payOffLicense:t.motivo,partialLicense:t.isParcial,startPeriod:t.isParcial?t.periodoInicio:void 0,endPeriod:t.isParcial?t.periodoFim:void 0,description:t.motivo===r.OTHER?t.descricao:void 0},e.a(2,(0,p.Qb)(n))}},e)}),n=function(){var e=this,n=arguments;return new Promise(function(r,a){var o=t.apply(e,n);function i(e){S(o,r,a,i,s,"next",e)}function s(e){S(o,r,a,i,s,"throw",e)}i(void 0)})},function(e){return n.apply(this,arguments)}),onSuccess:function(e){b.invalidateQueries({queryKey:["time-management","hit-spot-time-history"]}),alert(e.message||"Licença aplicada com sucesso!"),_()},onError:function(e){var t,n=(null===(t=e.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.error)||"Erro ao aplicar licença";alert(n)}}),T=F.mutate,D=F.isPending,_=function(){C(),d()};return c?(0,a.jsx)(v.A,{show:c,onClose:_,title:"Licença",size:"md",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:_,disabled:D,children:"Cancelar"}),(0,a.jsx)("button",{type:"submit",form:"licencaForm",className:"btn btn-primary",disabled:D,children:D?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("i",{className:"fas fa-spinner fa-spin mr-1"}),"Salvando..."]}):"Aplicar Licença"})]}),children:(0,a.jsxs)("form",{id:"licencaForm",onSubmit:w(function(e){e.motivo?e.motivo!==r.OTHER||e.descricao.trim()?!e.isParcial||e.periodoInicio&&e.periodoFim?T(e):alert("Por favor, preencha o período de início e finalização."):alert("Por favor, descreva o motivo."):alert("Por favor, selecione o motivo.")}),children:[(0,a.jsxs)("div",{className:"d-flex align-items-center justify-content-between mb-4",children:[(0,a.jsx)("label",{htmlFor:"toggleParcial",style:{fontWeight:"normal"},children:"A licença é parcial?"}),(0,a.jsxs)("div",{className:"custom-control custom-switch",style:{marginRight:0},children:[(0,a.jsx)("input",g(g({},x("isParcial")),{},{type:"checkbox",className:"custom-control-input",id:"toggleParcial"})),(0,a.jsx)("label",{className:"custom-control-label",htmlFor:"toggleParcial",style:{cursor:"pointer"}})]})]}),A&&(0,a.jsxs)("div",{className:"row mb-4",children:[(0,a.jsxs)("div",{className:"col-6",children:[(0,a.jsx)("h6",{children:"Período de Início"}),(0,a.jsxs)("div",{className:"input-group",children:[(0,a.jsx)("input",g(g({},x("periodoInicio",{required:!!A&&"Data de início obrigatória"})),{},{type:"date",className:"form-control",placeholder:"Data"})),(0,a.jsx)("div",{className:"input-group-append",children:(0,a.jsx)("span",{className:"input-group-text",children:(0,a.jsx)("i",{className:"far fa-calendar-alt"})})})]}),O.periodoInicio&&(0,a.jsx)("small",{className:"text-danger d-block mt-1",children:O.periodoInicio.message})]}),(0,a.jsxs)("div",{className:"col-6",children:[(0,a.jsx)("h6",{children:"Período de Finalização"}),(0,a.jsxs)("div",{className:"input-group",children:[(0,a.jsx)("input",g(g({},x("periodoFim",{required:!!A&&"Data de fim obrigatória"})),{},{type:"date",className:"form-control",placeholder:"Data"})),(0,a.jsx)("div",{className:"input-group-append",children:(0,a.jsx)("span",{className:"input-group-text",children:(0,a.jsx)("i",{className:"far fa-calendar-alt"})})})]}),O.periodoFim&&(0,a.jsx)("small",{className:"text-danger d-block mt-1",children:O.periodoFim.message})]})]}),(0,a.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,a.jsx)("h6",{children:"Motivo"}),(0,a.jsx)("p",{children:"Informe o motivo da licença"}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsxs)("div",{className:E===r.OTHER?"col-4":"col-12",children:[(0,a.jsx)(o.xI,{name:"motivo",control:N,rules:{required:"Motivo é obrigatório"},render:function(e){var t=e.field;return(0,a.jsx)(l.A,{options:P,value:t.value,placeholder:"Motivo*",size:"md",onChange:function(e){t.onChange(e),e!==r.OTHER&&C(function(e){return g(g({},e),{},{descricao:""})})}})}}),O.motivo&&(0,a.jsx)("small",{className:"text-danger d-block mt-1",children:O.motivo.message})]}),E===r.OTHER&&(0,a.jsxs)("div",{className:"col-8",children:[(0,a.jsx)("input",g(g({},x("descricao",{required:E===r.OTHER&&"Descrição é obrigatória"})),{},{type:"text",className:"form-control",placeholder:"Descreva o motivo*"})),O.descricao&&(0,a.jsx)("small",{className:"text-danger d-block mt-1",children:O.descricao.message})]})]})]})]})}):null}},97677(e,t,n){var r={"./PermissionGuard.tsx":19066,"./Professional/index.tsx":49791,"./Professional/tabs/focusmode/index.tsx":52558,"./Professional/tabs/focusmode/partials/FocusBackgroundPicker.tsx":69794,"./Professional/tabs/focusmode/partials/FocusFullscreen.tsx":26723,"./Professional/tabs/focusmode/partials/FocusMethodInfo.tsx":97839,"./Professional/tabs/focusmode/partials/FocusTimerCard.tsx":18851,"./Professional/tabs/point/index.tsx":18098,"./Professional/tabs/point/modals/ConfirmationPopover.tsx":2799,"./Professional/tabs/point/modals/EditPointModal.tsx":18752,"./Professional/tabs/point/modals/GeolocationModal.tsx":5380,"./Professional/tabs/point/modals/JustificationModal.tsx":67784,"./Professional/tabs/point/modals/QRCodeModal.tsx":39576,"./Professional/tabs/point/modals/ScreenshotModal.tsx":2698,"./Professional/tabs/point/modals/SelfieModal.tsx":77770,"./Professional/tabs/point/modals/TestModal.tsx":92454,"./Professional/tabs/point/partials/ClockCard.tsx":68925,"./Professional/tabs/point/partials/MobileClockCard.tsx":69511,"./Professional/tabs/point/partials/MobileOccurrencesTable.tsx":25149,"./Professional/tabs/point/partials/MobileOptionsModal.tsx":72810,"./Professional/tabs/point/partials/MobileTimeline.tsx":46550,"./Professional/tabs/point/partials/NoShiftAssigned.tsx":15186,"./Professional/tabs/point/partials/OccurrencesTable.tsx":31475,"./Professional/tabs/point/partials/PointCardContainer.tsx":8596,"./Professional/tabs/point/partials/ShiftTable.tsx":13359,"./Professional/tabs/timesheet/index.tsx":65342,"./Professional/tabs/timesheet/partials/CommentPopover.tsx":88821,"./Professional/tabs/timesheet/partials/CounterSection.tsx":75842,"./Professional/tabs/timesheet/partials/DeleteActivityModal.tsx":39618,"./Professional/tabs/timesheet/partials/ManualTimeModal.tsx":14463,"./Professional/tabs/timesheet/partials/PlannedActivitiesCard.tsx":48592,"./Professional/tabs/timesheet/partials/ProjectActivityCard.tsx":49293,"./Professional/tabs/timesheet/partials/ProjectSelector.tsx":59261,"./Professional/tabs/timesheet/partials/ScheduledActivitiesCard.tsx":36279,"./Professional/tabs/timesheet/partials/WorkSatisfactionModal.tsx":17649,"./Professional/tabs/timesheet/partials/shared-activity-utils.ts":33384,"./Tenant/index.tsx":81149,"./Tenant/tabs/attendance/index.tsx":75930,"./Tenant/tabs/overview/index.tsx":57909,"./Tenant/tabs/overview/partials/HistoryTable.tsx":73215,"./Tenant/tabs/overview/partials/OccurrenceTable.tsx":72210,"./Tenant/tabs/overview/partials/modals/HistoryDetailsModal.tsx":61909,"./Tenant/tabs/overview/partials/modals/HistoryFilterModal.tsx":195,"./Tenant/tabs/overview/partials/modals/JustificationModal.tsx":50455,"./Tenant/tabs/overview/partials/modals/OccurrenceFilterModal.tsx":22956,"./Tenant/tabs/permissions/index.tsx":41081,"./Tenant/tabs/pointControl/index.tsx":23696,"./Tenant/tabs/pointControl/partials/PointControlTable.tsx":80596,"./Tenant/tabs/pointControl/partials/modals/AbonarModal.tsx":64466,"./Tenant/tabs/pointControl/partials/modals/EditRecordModal.tsx":90162,"./Tenant/tabs/pointControl/partials/modals/FilterModal.tsx":34773,"./Tenant/tabs/pointControl/partials/modals/LicencaModal.tsx":96930,"./Tenant/tabs/pointControl/partials/modals/ViewRecordModal.tsx":77332,"./Tenant/tabs/settings/index.tsx":43432,"./Tenant/tabs/settings/partials/ChannelsCardRow.tsx":19782,"./Tenant/tabs/settings/partials/LocationSection.tsx":17147,"./Tenant/tabs/settings/partials/NotificationCards.tsx":7440,"./Tenant/tabs/settings/partials/PolicyCards.tsx":52798,"./Tenant/tabs/settings/partials/QRCodeLinkSection.tsx":47034,"./Tenant/tabs/settings/partials/SettingsSection.tsx":46265,"./Tenant/tabs/settings/partials/TimesheetLimitCards.tsx":26071,"./Tenant/tabs/settings/partials/ValidationModes.tsx":93794,"./Tenant/tabs/settings/partials/WorkShiftsSection .tsx":95226,"./Tenant/tabs/settings/partials/modals/AssignMembersModal.tsx":14011,"./Tenant/tabs/settings/partials/modals/LocationModal.tsx":30786,"./Tenant/tabs/settings/partials/modals/QRCodeLinkModal.tsx":42415,"./Tenant/tabs/settings/partials/modals/WorkShiftModal.tsx":79724,"./Tenant/tabs/timesheet/index.tsx":14785,"./Tenant/tabs/timesheet/partials/ProjectBudgetScatter.tsx":4818,"./Tenant/tabs/timesheet/partials/ProjectDistributionPie.tsx":80217,"./Tenant/tabs/timesheet/partials/TeamHoursBar.tsx":49299,"./Tenant/tabs/timesheet/partials/TeamSummaryTable.tsx":65207};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=97677},97839(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>a});var r=n(74848);function a(e){var t=e.method,n=function(){switch(t){case"pomodoro":return{title:"Pomodoro",text:"Ciclos de 25 minutos de foco seguidos por 5 minutos de pausa."};case"regra_52_17":return{title:"Regra 52/17",text:"Trabalhe por 52 minutos e faça 17 de pausa, com imersão mais longa."};case"personalizado":return{title:"Personalizado",text:"Defina livremente seus tempos de foco e descanso para seu ritmo."};default:return null}}();return n?(0,r.jsx)("div",{className:"mb-3",children:(0,r.jsxs)("div",{className:"p-3",style:{background:"#FFED99",borderRadius:8,color:"#222"},children:[(0,r.jsxs)("strong",{className:"d-block mb-1",children:[n.title,":"]}),(0,r.jsx)("span",{children:n.text})]})}):null}}},e=>{e.O(0,[169,768],()=>{return t=54958,e(e.s=t);var t});e.O()}]);
File: public/js/chat/features/chat-conversations-list.js
Match lines: 7
894| } else if (typeof window.openOffCanvasCall === 'function') {
895| window.openOffCanvasCall(userId, currentUserName, currentUserAvatar);
925| if (typeof window.openOffCanvasSearch === 'function') {
926| window.openOffCanvasSearch();
928| console.error('❌ window.openOffCanvasSearch is not a function');
1203| if (typeof window.openOffCanvasSearch === 'function') {
1204| window.openOffCanvasSearch();
File: public/js/chat/features/chat-message-actions.js
Match lines: 2
1307| if (typeof window.openOffCanvasFixadas === 'function') {
1308| window.openOffCanvasFixadas();
File: public/js/chat/features/chat-offcanvas-call.js
Match lines: 1
373| * Inicializa a UI da chamada (chamada por openOffCanvasCall para evitar recursão)
File: public/js/chat/features/chat-offcanvas-openers.js
Match lines: 14
27| function openOffCanvasFiles() {
68| function openOffCanvasFixadas() {
124| function openOffCanvasSearch() {
219| function openOffCanvasFavoritadas() {
253| function openOffCanvasMembers(entityId, entityType) {
278| function openOffCanvasInfo(entityId, entityType) {
304| function openOffCanvasCall(userId, userName, userAvatar) {
388| window.openOffCanvasFiles = openOffCanvasFiles;
389| window.openOffCanvasFixadas = openOffCanvasFixadas;
390| window.openOffCanvasSearch = openOffCanvasSearch;
391| window.openOffCanvasFavoritadas = openOffCanvasFavoritadas;
392| window.openOffCanvasMembers = openOffCanvasMembers;
393| window.openOffCanvasInfo = openOffCanvasInfo;
394| window.openOffCanvasCall = openOffCanvasCall;
File: public/js/chat/features/chat-offcanvas-pinned.js
Match lines: 1
14| * Carrega mensagens fixadas - será chamada pela função openOffCanvasFixadas
File: public/js/chat/features/chat-offcanvas-user.js
Match lines: 5
404| if (typeof window.openOffCanvasFiles === 'function') {
405| window.openOffCanvasFiles();
407| console.error('❌ openOffCanvasFiles não disponível');
424| if (typeof window.openOffCanvasSearch === 'function') {
425| window.openOffCanvasSearch();
File: public/js/chat/features/chat-webrtc-integration.js
Match lines: 3
282| if (typeof openOffCanvasCall === 'function') {
283| openOffCanvasCall(callUserId, callUserName, callUserAvatar);
285| console.error('❌ openOffCanvasCall function not found - opening offcanvas manually');
File: public/js/chat/ui/chat-offcanvas-manager.js
Match lines: 8
106| if (typeof window.openOffCanvasFixadas === 'function') {
107| window.openOffCanvasFixadas();
109| console.error('❌ openOffCanvasFixadas não está disponível');
112| if (typeof window.openOffCanvasFiles === 'function') {
113| window.openOffCanvasFiles();
115| console.error('❌ openOffCanvasFiles não está disponível');
118| if (typeof window.openOffCanvasFavoritadas === 'function') {
119| window.openOffCanvasFavoritadas();
File: public/js/chat/utils/chat-offcanvas-helpers.js
Match lines: 2
15| function openOffCanvas(targetId) {
212| window.openOffCanvas = openOffCanvas;
File: public/js/create-instance-offcanvas.js
Match lines: 2
6359| if (typeof window.openOffcanvasinstanceoffcanvas === 'function') {
6360| window.openOffcanvasinstanceoffcanvas();
File: public/js/decision_system/risk_intelligence_signals.js
Match lines: 2
1036| openOffcanvas(FILTER_DRAWER_ID);
2902| function openOffcanvas(id) {
File: public/js/goal-adriana-create-modal.js
Match lines: 4
273| if (typeof window.openOffcanvasmetaCollectiveModal === 'function') {
274| window.openOffcanvasmetaCollectiveModal();
289| if (typeof window.openOffcanvasmetaModal === 'function') {
290| window.openOffcanvasmetaModal();
File: public/js/goals-company-offcanvas.js
Match lines: 2
44| if (typeof window.openOffcanvasmetaModal === 'function') {
45| window.openOffcanvasmetaModal();
File: public/js/governance/governance-authorization-view-monitoring.js
Match lines: 2
684| if (typeof window.openOffcanvasautViewMonitoring === 'function') {
685| window.openOffcanvasautViewMonitoring();
File: public/js/governance/governance-cases-control-wizard.js
Match lines: 5
289| function openOffcanvasPanel() {
290| if (typeof window.openOffcanvasgovCasesControlWizard === 'function') {
291| window.openOffcanvasgovCasesControlWizard();
644| openOffcanvasPanel();
660| openOffcanvasPanel();
File: public/js/metahuman-standard/components/_modal_offcanvas.js
Match lines: 1
224| window["openOffcanvas" + fnSuffix] = function () {
File: public/js/metahuman-standard/pages/organizational_structure_index.js
Match lines: 2
894| if (typeof window.openOffcanvasorgAreaDetails === 'function') {
895| window.openOffcanvasorgAreaDetails();
File: public/js/notifications-center.js
Match lines: 1
868| var openName = 'openOffcanvasnotificationsCenter';
File: public/js/offboarding/visualizar_atividades.js
Match lines: 7
2464| openOffcanvasMembroOffboardingTenant(nav, false, membroLogadoId);
2475| openOffcanvasMembroOffboarding(nav);
2480|function openOffcanvasMembroOffboarding(nav) {
2481| console.log('🚀 openOffcanvasMembroOffboarding chamada!');
2726| openOffcanvasMembroOffboardingTenant(nav, isResponsible, loggedCompanyMemberId);
2729|function openOffcanvasMembroOffboardingTenant(nav, isResponsible = false, loggedCompanyMemberId = null) {
2730| console.log('🚀 openOffcanvasMembroOffboardingTenant chamada!');
File: public/js/onboarding/utils.js
Match lines: 1
40| const openFn = window[`openOffcanvas${fnSuffix}`];
File: public/js/people-analytics/chart-detail-filters.js
Match lines: 1
528| var functionName = 'openOffcanvas' + this.modalId.replace(/-/g, '');
File: public/js/spaces_control/buildings/building_form.js
Match lines: 1
146| const openFn = window['openOffcanvas' + formId];
File: public/js/ssma/action_plan_panel.js
Match lines: 2
2253| if (typeof window.openOffcanvasssmaApActionView === 'function') {
2254| window.openOffcanvasssmaApActionView();
File: public/js/ssma/effectiveness.js
Match lines: 2
792| if (typeof window.openOffcanvasEffectivenessActionDetail === 'function') {
793| window.openOffcanvasEffectivenessActionDetail();
File: public/js/ssma/leadership_evaluation.js
Match lines: 4
295| if (typeof window.openOffcanvasleadershipLeaderDetail === 'function') {
296| window.openOffcanvasleadershipLeaderDetail();
300| if (typeof window.openOffcanvasLeadershipLeaderDetail === 'function') {
301| window.openOffcanvasLeadershipLeaderDetail();
File: public/js/webrtc-calls.js
Match lines: 3
659| console.warn('initializeCallUI function not available, trying openOffCanvasCall');
660| if (typeof window.openOffCanvasCall === 'function') {
661| window.openOffCanvasCall(
File: templates/calendar_member/tabs/_permissions_tab.html.twig
Match lines: 2
982| function openOffcanvas(id) {
1082| openOffcanvas($(this).data('id'));
File: templates/candidate_question/list.html.twig
Match lines: 2
256| if (typeof window.openOffcanvascandidateQuestionOffcanvas === 'function') {
257| window.openOffcanvascandidateQuestionOffcanvas();
File: templates/chat/components/adriana_chat.html.twig
Match lines: 4
429| if (typeof openOffCanvasSearch === 'function') {
430| openOffCanvasSearch();
607| if (typeof openOffCanvasSearch === 'function') openOffCanvasSearch();
724| if (typeof openOffCanvasSearch === 'function') openOffCanvasSearch();
File: templates/chat/components/chat_section.html.twig
Match lines: 2
2661| if (typeof openOffCanvasFixadas === 'function') {
2663| openOffCanvasFixadas();
File: templates/chat/components/company_server.html.twig
Match lines: 3
461| openOffCanvasSearch();
614| openOffCanvasSearch();
772| openOffCanvasSearch();
File: templates/chat/components/conversas_privadas.html.twig
Match lines: 6
635| console.error('❌ [conversas_privadas] window.startCall not found - falling back to openOffCanvasCall');
637| if (typeof openOffCanvasCall === 'function') {
638| openOffCanvasCall(userId, currentUserName, currentUserAvatar);
640| console.error('❌ [conversas_privadas] openOffCanvasCall not found either!');
760| openOffCanvasSearch();
883| openOffCanvasSearch();
File: templates/chat/components/grupos.html.twig
Match lines: 1
218| openOffCanvasSearch();
File: templates/chat/components/offCanva/offcanvas_call.html.twig
Match lines: 1
554|// Initialize call UI (called by openOffCanvasCall to avoid recursion)
File: templates/chat/components/suporte_meta.html.twig
Match lines: 4
289| openOffCanvasSearch();
389| openOffCanvasSearch();
697| openOffCanvasSearch();
821| openOffCanvasSearch();
File: templates/chat/components/suporte_meta_admin.html.twig
Match lines: 1
306| openOffCanvasSearch();
File: templates/chat/layout.html.twig
Match lines: 3
3608| if (typeof openOffCanvasCall === 'function') {
3610| openOffCanvasCall(userId, userName, userAvatar);
3612| console.error('❌ openOffCanvasCall function not found - opening offcanvas manually');
File: templates/communication_center/partials/_modal_create_demand.html.twig
Match lines: 1
722| openOffcanvascreateDemandModal();
File: templates/company/_autorizacoes_javascript.html.twig
Match lines: 2
234| if (typeof window.openOffcanvasmodalAplicarAutorizacao === 'function') {
235| window.openOffcanvasmodalAplicarAutorizacao();
File: templates/company/components/memberOffCanvas.html.twig
Match lines: 4
333| const openOffcanvasBtns = document.querySelectorAll('.open-offcanvas-btn');
339| function openOffcanvas(memberId) {
396| openOffcanvasBtns.forEach((button) => {
399| openOffcanvas(memberId); // Abre o offcanvas com os dados do membro
File: templates/company/components/memberOffCanvas2.html.twig
Match lines: 2
272| function openOffcanvas() {
335| openOffcanvas(); // Exibe o offcanvas
File: templates/company/crm/getLeads/index_leads_view.html.twig
Match lines: 4
489| <a href="#" class="dropdown-item" id="openOffcanvas"></i> Cadastrar Lead</a>
3618| const openOffcanvasEl = document.getElementById('openOffcanvas');
3619| if (openOffcanvasEl) {
3620| openOffcanvasEl.addEventListener('click', function(e) {
File: templates/company/crm/leads/defaultCrmView.html.twig
Match lines: 4
6756| openOffcanvas();
6797| function openOffcanvas() {
6815| openOffcanvas();
7982| openOffcanvas();
File: templates/company/members.html.twig
Match lines: 2
1607| function openOffcanvas() {
1674| openOffcanvas(); // Exibe o offcanvas
File: templates/company/members_v2.html.twig
Match lines: 2
3006| function openOffcanvas() {
3073| openOffcanvas(); // Exibe o offcanvas
File: templates/company/teams_permissions.html.twig
Match lines: 3
919| const openOffcanvasBtns = document.querySelectorAll('.open-offcanvas-btn');
925| function openOffcanvas(memberId) {
984| openOffcanvas(memberId); // Abre o offcanvas com os dados do membro
File: templates/company/teams_permissions_v2.html.twig
Match lines: 3
934| const openOffcanvasBtns = document.querySelectorAll('.open-offcanvas-btn');
940| function openOffcanvas(memberId) {
999| openOffcanvas(memberId); // Abre o offcanvas com os dados do membro
File: templates/components/permissions_tab.html.twig
Match lines: 4
1058| if (config.openOffcanvasCallback) {
1059| config.openOffcanvasCallback(memberId, tabId);
1382|function loadPermissionDataAndOpenOffcanvas(productSlug, memberId, tabId) {
1445| loadPermissionDataAndOpenOffcanvas(productSlug, memberId, tabId);
File: templates/contractor/tabs/_tab_empresas.html.twig
Match lines: 8
1441| if (typeof openOffcanvascontractorCoDetail === 'function') {
1442| openOffcanvascontractorCoDetail();
1842| if (typeof openOffcanvascontractorCoForm === 'function') {
1843| openOffcanvascontractorCoForm();
2164| if (typeof openOffcanvascontractorCoProviders === 'function') {
2165| openOffcanvascontractorCoProviders();
2896| if (typeof openOffcanvascontractorCoDocuments === 'function') {
2897| openOffcanvascontractorCoDocuments();
File: templates/contractor/tabs/_tab_requisitos_documentais.html.twig
Match lines: 2
1616| if (typeof openOffcanvascontractorReqDetail === 'function') {
1617| openOffcanvascontractorReqDetail();
File: templates/decision_system/modals/_candidate_offcanvas.html.twig
Match lines: 2
1115| if (typeof window.openOffcanvascandidateoffcanvas === 'function') {
1116| window.openOffcanvascandidateoffcanvas();
File: templates/decision_system/modals/_edit_stage.html.twig
Match lines: 2
1688| if (typeof window.openOffcanvaseditstagemodal === 'function') {
1689| window.openOffcanvaseditstagemodal();
File: templates/decision_system/modals/_view_record_offcanvas.html.twig
Match lines: 2
1482| if (typeof window.openOffcanvasviewrecordoffcanvas === 'function') {
1483| window.openOffcanvasviewrecordoffcanvas();
File: templates/decision_system/tabs/_gerenciamento.html.twig
Match lines: 3
1195| } else if (typeof window.openOffcanvasinstanceoffcanvas === 'function') {
1197| console.log('🟠 [_gerenciamento] Using component function openOffcanvasinstanceoffcanvas()');
1198| window.openOffcanvasinstanceoffcanvas();
File: templates/decision_system/tabs/_lista.html.twig
Match lines: 2
1189| if (typeof window.openOffcanvascandidateoffcanvas === 'function') {
1190| window.openOffcanvascandidateoffcanvas();
File: templates/evaluation_parent_category/index.html.twig
Match lines: 4
250| if (window.openOffcanvasclusterAddOffcanvas) {
251| window.openOffcanvasclusterAddOffcanvas();
272| if (window.openOffcanvasclusterEditOffcanvas) {
273| window.openOffcanvasclusterEditOffcanvas();
File: templates/free-trial/company_activation_companies.html.twig
Match lines: 1
988| window.openOffcanvascompanyPlanCustomization();
File: templates/governance/authorization/tabs/_tab_authorizations_config.html.twig
Match lines: 2
1096| if (typeof openOffcanvasgovAuthCondDetail === 'function') {
1097| openOffcanvasgovAuthCondDetail();
File: templates/governance/authorization/tabs/_tab_authorizations_create.html.twig
Match lines: 2
979| if (typeof openOffcanvasgovAuthDetail === 'function') {
980| openOffcanvasgovAuthDetail();
File: templates/governance/authorization/tabs/_tab_authorizations_monitoring.html.twig
Match lines: 4
1063| function autApplyOpenOffcanvas() {
1065| if (typeof window.openOffcanvasautApplyMonitoring === 'function') {
1066| window.openOffcanvasautApplyMonitoring();
1684| autApplyOpenOffcanvas();
File: templates/governance/cases/index.html.twig
Match lines: 2
752| if (typeof openOffcanvasgovCasesDetail === 'function') {
753| openOffcanvasgovCasesDetail();
File: templates/job_interview/index.html.twig
Match lines: 4
1236| if (typeof openOffcanvasoffcanvascreateinterviewonline === 'function') {
1237| openOffcanvasoffcanvascreateinterviewonline();
1753| if (typeof openOffcanvasoffcanvascreateinterview === 'function') {
1754| openOffcanvasoffcanvascreateinterview();
File: templates/job_interview/modals/offcanvas_create_interview.html.twig
Match lines: 4
1046| if (typeof openOffcanvasoffcanvascreateinterview === 'function') {
1047| openOffcanvasoffcanvascreateinterview();
1326| if (typeof openOffcanvasoffcanvascreateinterview === 'function') {
1327| openOffcanvasoffcanvascreateinterview();
File: templates/job_interview/modals/offcanvas_create_interview_online.html.twig
Match lines: 4
1046| if (typeof openOffcanvasoffcanvascreateinterviewonline === 'function') {
1047| openOffcanvasoffcanvascreateinterviewonline();
1326| if (typeof openOffcanvasoffcanvascreateinterviewonline === 'function') {
1327| openOffcanvasoffcanvascreateinterviewonline();
File: templates/job_interview/modals/offcanvas_template_details.html.twig
Match lines: 2
747| if (typeof openOffcanvasoffcanvastemplatedetails === 'function') {
748| openOffcanvasoffcanvastemplatedetails();
File: templates/logs/index.html.twig
Match lines: 2
567| if (typeof window.openOffcanvaslogsdetail === 'function') {
568| window.openOffcanvaslogsdetail();
File: templates/manager/lead_qualified_users.html.twig
Match lines: 2
671| if (typeof openOffcanvasuserProfileOffcanvas === 'function') {
672| openOffcanvasuserProfileOffcanvas();
File: templates/marketJob/index.html.twig
Match lines: 2
1271| if (window.openOffcanvasoffcanvasaddmarketjob) {
1272| window.openOffcanvasoffcanvasaddmarketjob();
File: templates/new-goals/components/_goal_detail_offcanvas.html.twig
Match lines: 2
57| if (typeof window.openOffcanvasgoalDetailDrawer === 'function') {
58| window.openOffcanvasgoalDetailDrawer();
File: templates/new-goals/goal_team/goal_team.html.twig
Match lines: 4
1808| if (typeof window.openOffcanvasmetaCollectiveModal === "function") {
1809| window.openOffcanvasmetaCollectiveModal();
3444| if (typeof window.openOffcanvasmetaCollectiveModal === 'function') {
3445| window.openOffcanvasmetaCollectiveModal();
File: templates/new-goals/goal_team/modals_goal_collective/modal_create_meta_colective.html.twig
Match lines: 2
475| if (typeof window.openOffcanvasmetaCollectiveModal === 'function') {
476| window.openOffcanvasmetaCollectiveModal();
File: templates/new-goals/pdi/pdi_permissions.html.twig
Match lines: 6
1150| const openOffcanvasBtns = document.querySelectorAll('.open-offcanvas-btn');
1155| function openOffcanvas(memberId) {
1316| openOffcanvasBtns.forEach(button => {
1319| openOffcanvas(memberId);
1764| const openOffcanvasBtns = document.querySelectorAll('.open-offcanvas-btn');
1765| openOffcanvasBtns.forEach(btn => {
File: templates/notifications_center/_layout_trigger.html.twig
Match lines: 2
45| } else if (typeof window.openOffcanvasnotificationsCenter === 'function') {
46| window.openOffcanvasnotificationsCenter();
File: templates/onboarding/index_user.html.twig
Match lines: 3
313| openOffcanvasMembroUser(nav);
420| function openOffcanvasMembroUser(nav) {
422| openOffcanvasoffcanvasMembro();
File: templates/organograma/company_layout.html.twig
Match lines: 3
9338| // Correção para o método openOffcanvas
9339| openOffcanvas(nodeId) {
11246| OffcanvasController.openOffcanvas(nodeId);
File: templates/organograma/company_layout_js.html.twig
Match lines: 3
4360| // Correção para o método openOffcanvas
4361| openOffcanvas(nodeId) {
6255| OffcanvasController.openOffcanvas(nodeId);
File: templates/permissions_tags/member_tab_permissions.html.twig
Match lines: 3
1253| if (typeof window.openOffcanvasmodalpermissionstagedit !== 'function' && typeof window.setupModalOffcanvas === 'function') {
1256| if (typeof window.openOffcanvasmodalpermissionstagedit === 'function') {
1257| window.openOffcanvasmodalpermissionstagedit();
File: templates/process/_fragment/_modal_interview_roteiro.html.twig
Match lines: 2
335| if (typeof window.openOffcanvasmodalinterviewroteiro === 'function') {
336| window.openOffcanvasmodalinterviewroteiro();
File: templates/process/modal/_modal_selective_process_add_stage.html.twig
Match lines: 4
1692| if (typeof window.openOffcanvasmodalinterviewroteiro === 'function') {
1693| window.openOffcanvasmodalinterviewroteiro();
1702| if (typeof window.openOffcanvasmodalinterviewroteiro === 'function') {
1703| window.openOffcanvasmodalinterviewroteiro();
File: templates/process/new_selective_process.html.twig
Match lines: 2
3014| if (typeof window.openOffcanvasmodalselectiveprocessaddstage === 'function') {
3015| window.openOffcanvasmodalselectiveprocessaddstage();
File: templates/projects2.0/components/off_canvas_task.html.twig
Match lines: 2
1556| if (typeof window.openOffcanvastaskOffcanvas === 'function') {
1557| window.openOffcanvastaskOffcanvas();
File: templates/servicePackages/modals/_modal_new_package.html.twig
Match lines: 2
682| window.openOffcanvasservicePackageForm();
702| window.openOffcanvasservicePackageForm();
File: templates/spaces_control/buildings/tabs/_tab_spaces.html.twig
Match lines: 2
422| if (typeof window.openOffcanvasaddLocation === 'function') {
423| window.openOffcanvasaddLocation();
File: templates/ssma/action_plan/tabs/_tab_action_plan.html.twig
Match lines: 2
1638| if (typeof openOffcanvasSsmaActionPlanViewOffcanvas === 'function') {
1639| openOffcanvasSsmaActionPlanViewOffcanvas();
File: templates/ssma/occurrence/partials/_modal_event.html.twig
Match lines: 4
6562| if (typeof window.openOffcanvasmodalEventNew === 'function') {
6563| window.openOffcanvasmodalEventNew();
7632| * has not registered window.openOffcanvasmodalEventNew yet.
7643| var registryOpener = window.openOffcanvasmodalEventNew;
File: templates/ssma/occurrence/partials/_modal_occurrence.html.twig
Match lines: 8
708| if (typeof window.openOffcanvasmodalEventNew === 'function' &&
709| window.openOffcanvasmodalEventNew !== window.ssmaRevealEventOffcanvas) {
710| window.openOffcanvasmodalEventNew();
716| if (typeof openOffcanvasmodalOccurrenceNew === 'function') {
717| openOffcanvasmodalOccurrenceNew();
722| window.openOffcanvasmodalEventNew();
733| typeof window.openOffcanvasmodalEventNew === 'function') {
761| openOffcanvasmodalOccurrenceNew();
File: templates/ssma/occurrence/tabs/_tab_occurrences.html.twig
Match lines: 1
1919| openOffcanvasmodalOccurrenceNew();
File: templates/ssma/prevention/modals/_modal_approach.html.twig
Match lines: 1
1759| function showOffcanvas() { if (window.openOffcanvasmodalAbordagem) { window.openOffcanvasmodalAbordagem(); } }
File: templates/ssma/prevention/modals/_modal_approach_form.html.twig
Match lines: 2
214| if (typeof window.openOffcanvasmodalSsmaApproachForm === 'function') {
215| window.openOffcanvasmodalSsmaApproachForm();
File: templates/ssma/prevention/modals/_modal_approach_view.html.twig
Match lines: 2
953| if (typeof window.openOffcanvasmodalAbordagemView === 'function') {
954| window.openOffcanvasmodalAbordagemView();
File: templates/ssma/prevention/modals/_modal_inspection.html.twig
Match lines: 4
1877| openOffcanvasmodalInspectionNew();
1988| openOffcanvasmodalInspectionNew();
1997| openOffcanvasmodalInspectionNew();
2010| openOffcanvasmodalInspectionNew();
File: templates/ssma/prevention/modals/_modal_inspection_details.html.twig
Match lines: 1
649| openOffcanvasmodalInspectionDetails();
File: templates/ssma/prevention/partials/_meta_abono_section.html.twig
Match lines: 1
644| var openFn = window['openOffcanvas' + String(modalId).replace(/[-_]/g, '')];
File: templates/ssma/refusal/partials/_modal_register.html.twig
Match lines: 2
369| if (typeof window.openOffcanvasmodalRefusalRegister === 'function') {
370| window.openOffcanvasmodalRefusalRegister();
File: templates/structural_research/structural_research_permission.html.twig
Match lines: 6
1379| const openOffcanvasBtns = document.querySelectorAll('.open-offcanvas-btn');
1384| function openOffcanvas(memberId) {
1426| openOffcanvasBtns.forEach(button => {
1429| openOffcanvas(memberId);
1835| const openOffcanvasBtns = document.querySelectorAll('.open-offcanvas-btn');
1836| openOffcanvasBtns.forEach(btn => {
File: templates/templates/roles.html.twig
Match lines: 2
643| if (typeof window.openOffcanvasoffcanvasaddrole === 'function') {
644| window.openOffcanvasoffcanvasaddrole();
File: templates/time-management/components/Tenant/tabs/permissions/index.tsx
Match lines: 1
186| (window as any).openOffcanvas?.(memberId);
File: templates/tokens/models.html.twig
Match lines: 2
372| if (window.openOffcanvastokensModelOffcanvas) {
373| window.openOffcanvastokensModelOffcanvas();
File: templates/trm/talents_and_communities/partials/_modal_add_community.html.twig
Match lines: 2
270| window.openOffcanvasmodalAddCommunity();
297| window.openOffcanvasmodalAddCommunity();
File: templates/trm/talents_and_communities/partials/_modal_add_talent.html.twig
Match lines: 2
217| window.openOffcanvasmodalAddTalent();
260| window.openOffcanvasmodalAddTalent();
File: templates/trm/talents_and_communities/tabs/_tab_communities.html.twig
Match lines: 1
329| window.openOffcanvasmodalAddCommunity();
File: templates/trm/talents_and_communities/tabs/_tab_talents.html.twig
Match lines: 1
367| window.openOffcanvasmodalAddTalent();
code_search
Show Details
Arguments
{"search_text": "action-view"}
Result
File: public/js/projects/professional_project_popup_tags.js
Match lines: 1
2673| <i class="fas fa-eye action-view-task" data-toggle="tooltip" title="Visualizar"></i>
File: public/js/projects/projects_popup_tags.js
Match lines: 1
2675| <i class="fas fa-eye action-view-task" data-toggle="tooltip" title="Visualizar"></i>
File: public/js/ssma/action_plan_panel.js
Match lines: 9
2234| setText('ssma-ap-action-view-title', title);
2235| setText('ssma-ap-action-view-id', id ? ('#' + id) : '');
2236| setText('ssma-ap-action-view-origin', origin);
2237| setText('ssma-ap-action-view-executors', executors || '—');
2238| setText('ssma-ap-action-view-validators', validators || '—');
2239| setText('ssma-ap-action-view-deadline', deadline);
2240| setText('ssma-ap-action-view-pending', pending);
2241| setText('ssma-ap-action-view-description', description);
2243| var originLink = document.getElementById('ssma-ap-action-view-origin-link');
File: templates/professional_project/components/lista_steps.html.twig
Match lines: 2
139| <i class="fas fa-eye action-view-task" data-toggle="tooltip" title="Visualizar"></i>
843|$(document).on('click', '.action-view-task', function(e) {
File: templates/professional_project/components/projects_home.html.twig
Match lines: 2
1855| <i class="fas fa-eye action-view-task" data-toggle="tooltip" title="Visualizar"></i>
2703| <i class="fas fa-eye action-view-task" data-toggle="tooltip" title="Visualizar"></i>
File: templates/projects2.0/components/lista_steps.html.twig
Match lines: 2
193| <i class="fas fa-eye action-view-task" data-toggle="tooltip" title="Visualizar"></i>
1038|$(document).on('click', '.action-view-task', function(e) {
File: templates/projects2.0/components/projects_home.html.twig
Match lines: 2
2988| <i class="fas fa-eye action-view-task" data-toggle="tooltip" title="Visualizar"></i>
4111| <i class="fas fa-eye action-view-task" data-toggle="tooltip" title="Visualizar"></i>
file_read
Show Details
Arguments
{"end_line": 110, "file_path": "public/js/ssma/action_plan_panel.js", "start_line": 60}
Result
File: public/js/ssma/action_plan_panel.js (Total lines: 2378)
IS_TRUNCATED: false
LINE_RANGE: 60-110
60| try {
61| return JSON.parse(el.textContent);
62| } catch (e) {
63| return null;
64| }
65| }
66|
67| function initPanelConfig() {
68| var config = parsePanelConfig();
69| if (!config) {
70| return;
71| }
72| PANEL_FILTER_URL = config.filterUrl || '';
73| panelState.period = config.defaultPeriod || panelState.period;
74| panelState.overviewPeriod = config.defaultOverviewPeriod || panelState.overviewPeriod;
75| panelState.axis = config.defaultAxis || panelState.axis;
76| }
77|
78| function escapeHtml(value) {
79| return String(value == null ? '' : value)
80| .replace(/&/g, '&')
81| .replace(/</g, '<')
82| .replace(/>/g, '>')
83| .replace(/"/g, '"');
84| }
85|
86| function getSelectValue(id) {
87| var el = document.getElementById(id);
88| return el ? String(el.value || '').trim() : '';
89| }
90|
91| function pad2(value) {
92| return String(value).padStart(2, '0');
93| }
94|
95| function toInputDate(date) {
96| return date.getFullYear() + '-' + pad2(date.getMonth() + 1) + '-' + pad2(date.getDate());
97| }
98|
99| function parseInputDate(value) {
100| var parts = String(value || '').split('-').map(Number);
101| if (parts.length !== 3 || !parts[0] || !parts[1] || !parts[2]) {
102| return null;
103| }
104| return new Date(parts[0], parts[1] - 1, parts[2]);
105| }
106|
107| function formatApPeriodDate(date) {
108| return pad2(date.getDate()) + ' de ' + apPainelMonths[date.getMonth()];
109| }
110|
Request #14
deepseek-v4-flash
P:24.45K C:391 CR:23.17K CW:0
3162ms
Reasoning
Let me continue the review based on the previous review summary and the plan. I need to investigate:
1. The regression of the `refusal` classification in origin chart (pending).
2. Tests presence for permission changes.
3. Impact of applying `mine` outside pending filters.
4. Off-canvas ids/abridor mismatch in action plan form.
Let me first read the relevant files to gather context. Let me start with parallel searches and reads.
Let me look at the SsmaActionPlanPanelService.php to understand the origin chart seeds, refusal handling, etc. Also, I need to check the off-canvas template and its actual opener function registration, and whether ids exist.
Let me do parallel reads/searches.
Tool Calls (3)
code_search
Show Details
Arguments
{"search_text": "presentSeededOriginChart|originCount|overview_origins", "file_patterns": ["src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php"]}
Result
No matches found
code_search
Show Details
Arguments
{"search_text": "refusal|recusa|Direito de Recusa", "file_patterns": ["src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php"]}
Result
No matches found
file_read
Show Details
Arguments
{"file_path": "src/Controller/SsmaController.php", "start_line": 500, "end_line": 560}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 500-560
500| : $unidadeScope['companies'];
501| $dataCompany = $unidadeScope['data_company'];
502|
503| $payload = $this->ssmaActionPlanPanelService->buildFilterPayload(
504| $scopeCompanies,
505| $dataCompany,
506| $view,
507| $period,
508| $axis,
509| $team,
510| $vinculo,
511| $this->getActionTypeMetadata(),
512| $this->resolveActionPlanPanelMemberScope($company),
513| $page,
514| $perPage,
515| trim((string) $request->query->get('management', '')),
516| trim((string) $request->query->get('area', '')),
517| trim((string) $request->query->get('exec_responsible', '')),
518| trim((string) $request->query->get('val_responsible', '')),
519| trim((string) $request->query->get('origin', '')),
520| );
521|
522| if ($request->query->getBoolean('mine')) {
523| $user = $this->getUser();
524| $member = ($user instanceof User) ? $this->getCurrentCompanyMember($company, $user) : null;
525| $mineId = (int) ($member?->getId() ?? 0);
526| if ($mineId > 0) {
527| $payload = $this->ssmaActionPlanPanelService->buildFilterPayload(
528| $scopeCompanies,
529| $dataCompany,
530| $view,
531| $period,
532| $axis,
533| $team,
534| $vinculo,
535| $this->getActionTypeMetadata(),
536| [$mineId => true],
537| $page,
538| $perPage,
539| trim((string) $request->query->get('management', '')),
540| trim((string) $request->query->get('area', '')),
541| trim((string) $request->query->get('exec_responsible', '')),
542| trim((string) $request->query->get('val_responsible', '')),
543| trim((string) $request->query->get('origin', '')),
544| );
545| }
546| }
547|
548| $filterOptions = $this->ssmaActionPlanPanelService->buildFilterOptions($dataCompany);
549| $presented = $this->actionPlanPanelPresenter->presentFilterResponse($payload, $filterOptions);
550|
551| return $this->ssmaJsonResponse(array_merge(['success' => true], $presented));
552| }
553|
554| /** @return array<string, mixed> */
555| private function buildActionPlanPanelViewData(Request $request): array
556| {
557| $company = $this->getSsmaCompany();
558| if (!$company instanceof Company) {
559| return $this->actionPlanPanelPresenter->presentDashboard(
560| ['panel_data' => $this->buildEmptyActionPlanPanelData()],
Request #15
deepseek-v4-flash
P:25.61K C:479 CR:24.83K CW:0
3750ms
Reasoning
The search for refusal/presentSeededOriginChart in SsmaActionPlanPanelService.php returned no matches? That's odd. Wait, my search was on the specific file pattern with the path, but maybe the search tool searches differently. Let me search more broadly for these functions.
Actually, the code_search tool says it searches the current version of files. The path pattern was "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php". But no matches... Perhaps the search is case-sensitive? No, default case-insensitive. Hmm.
Wait — the first search with `presentSeededOriginChart|originCount|overview_origins` returned "No matches found". That's strange because the diff itself shows `presentSeededOriginChart` in that file at line ~1441. Maybe the code_search tool with a regex and these alternation needs use_perl_regexp true. Indeed, `|` alternation requires regex mode. Default is literal text search, so the literal string "presentSeededOriginChart|originCount|overview_origins" isn't found. Let me redo with use_perl_regexp true.
Tool Calls (2)
code_search
Show Details
Arguments
{"file_patterns": ["src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php"], "search_text": "presentSeededOriginChart|originCount|overview_origins|resolveOriginKey|refusal|recusa", "use_perl_regexp": true}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php
Match lines: 19
128| fn (array $action): bool => $this->resolveOriginKey(
214| 'overview_origins' => [
509| if ($originFilter !== '' && $this->resolveOriginKey((string) ($action['origem'] ?? ''), (string) ($action['event_type'] ?? '')) !== $originFilter) {
631| $originCount = [];
689| $originKey = $this->resolveOriginKey((string) ($action['origem'] ?? ''), (string) ($action['event_type'] ?? ''));
724| if (!isset($originCount[$originKey])) {
725| $originCount[$originKey] = ['label' => $originLabel, 'count' => 0];
727| ++$originCount[$originKey]['count'];
776| 'origin_chart' => $this->presentSeededOriginChart($originCount),
1073| $originKey = $this->resolveOriginKey((string) ($action['origem'] ?? ''), (string) ($action['event_type'] ?? ''));
1326| private function resolveOriginKey(string $origem, string $eventType = ''): string
1362| str_contains($value, 'recusa') || str_contains($value, 'refusal') => 'refusal',
1370| return match ($this->resolveOriginKey($origem, $eventType)) {
1378| 'refusal' => 'Direito de Recusa',
1397| 'refusal' => ['icon' => 'fa-hand', 'variant' => 'company', 'title' => 'Direito de Recusa'],
1406| $originKey = $this->resolveOriginKey(
1437| * @param array<string, array{label: string, count: int}> $originCount
1441| private function presentSeededOriginChart(array $originCount): array
1451| foreach ($originCount as $key => $row) {
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "function canManageSsmaOccurrences|function canMutateSsmaActionPlan|ssmaCurrentMemberPermissionTag|function resolveActionPlanPanelMemberScope", "use_perl_regexp": true}
Result
File: src/Controller/SsmaController.php
Match lines: 9
611| private function resolveActionPlanPanelMemberScope(Company $company): ?array
627| $ssmaProductTagName = $this->ssmaCurrentMemberPermissionTag()?->getName();
1350| $tag = $this->ssmaCurrentMemberPermissionTag();
1386| if ($this->ssmaCurrentMemberPermissionTag() !== null) {
1401| private function ssmaCurrentMemberPermissionTag(): ?\App\Entity\PermissionTag
11339| private function canManageSsmaOccurrences(): bool
11368| $tag = $this->ssmaCurrentMemberPermissionTag();
11467| private function canMutateSsmaActionPlan(): bool
11473| $tagName = $this->ssmaCurrentMemberPermissionTag()?->getName();
Request #16
deepseek-v4-flash
P:26.76K C:263 CR:25.98K CW:0
2889ms
Reasoning
Let me read the relevant sections in the service file to examine the origin chart behavior and seed. Also read the section of resolveOriginKey, resolveOriginLabel, originIcons, and presentSeededOriginChart, plus the buildFilterOptions overview_origins/origin.
Let me read the service file around lines 100-260, 480-800, 1060-1100, 1300-1460.
Tool Calls (2)
file_read
Show Details
Arguments
{"file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 100, "end_line": 260}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648)
IS_TRUNCATED: false
LINE_RANGE: 100-260
100| 'view' => 'visao_geral',
101| 'panel_data' => [
102| 'overview' => $this->buildOverviewData(
103| $filtered,
104| $prevFiltered,
105| $allActions,
106| $actionTypeMeta,
107| $meta['members_by_id'],
108| $fromStr,
109| $toStr,
110| $axis,
111| $today,
112| $page,
113| $perPage
114| ),
115| ],
116| 'filters' => $this->buildFilterOptions($dataCompany),
117| 'available_axes' => $availableAxes,
118| 'active_axis' => $axis,
119| ];
120| }
121|
122| // pendencias (default)
123| [$deadlineFrom, $deadlineTo] = $this->resolvePendenciasDeadlineRange($period, $today);
124| $filtered = $this->filterPendenciasByDeadline($allActions, $deadlineFrom, $deadlineTo);
125| if ($originFilter !== '') {
126| $filtered = array_values(array_filter(
127| $filtered,
128| fn (array $action): bool => $this->resolveOriginKey(
129| (string) ($action['origem'] ?? ''),
130| (string) ($action['event_type'] ?? '')
131| ) === $originFilter
132| ));
133| }
134|
135| $availableAxes = $this->resolveAvailableAxes($view, $period);
136| if (!in_array($axis, $availableAxes, true)) {
137| $axis = $availableAxes[0];
138| }
139|
140| $panelData = $this->buildPendenciasData(
141| $filtered,
142| $allActions,
143| $actionTypeMeta,
144| $meta['members_by_id'],
145| $today,
146| $axis,
147| $period,
148| $deadlineTo
149| );
150| $panelData['available_axes'] = $availableAxes;
151| $panelData['active_axis'] = $axis;
152|
153| return [
154| 'view' => 'pendencias',
155| 'panel_data' => $panelData,
156| 'filters' => $this->buildFilterOptions($dataCompany),
157| ];
158| }
159|
160| /**
161| * @return array<string, mixed>
162| */
163| public function buildFilterOptions(Company $company): array
164| {
165| $meta = $this->loadPanelMeta($company);
166| $units = [['value' => '', 'text' => 'Unidade']];
167| $headOffice = $company->getHeadOffice() ?? $company;
168| $isHead = (int) $company->getId() === (int) $headOffice->getId();
169| if ($isHead) {
170| $units[] = ['value' => 'matriz', 'text' => 'Matriz'];
171| $subs = $this->entityManager->getRepository(Company::class)->findBy(['headOffice' => $headOffice]);
172| foreach ($subs as $sub) {
173| $units[] = [
174| 'value' => (string) $sub->getId(),
175| 'text' => $sub->getFantasyName() ?: $sub->getName() ?: ('Unidade #' . $sub->getId()),
176| ];
177| }
178| }
179|
180| $teamOptions = [['value' => '', 'text' => 'Equipe']];
181| foreach ($meta['teams'] as $team) {
182| $teamOptions[] = ['value' => (string) ($team['name'] ?? ''), 'text' => (string) ($team['name'] ?? '')];
183| }
184|
185| $memberOptions = [['value' => '', 'text' => 'Todos']];
186| foreach ($meta['members_by_id'] as $member) {
187| $memberOptions[] = ['value' => (string) $member['id'], 'text' => $member['name']];
188| }
189|
190| return [
191| 'period' => [
192| ['value' => 'next_month', 'text' => 'Próximo mês'],
193| ['value' => 'week', 'text' => 'Próxima semana'],
194| ['value' => 'fortnight', 'text' => 'Próximos 15 dias'],
195| ['value' => 'next_3_months', 'text' => 'Próximos 3 meses'],
196| ['value' => 'all_future', 'text' => 'Todo o futuro'],
197| ],
198| 'team' => $teamOptions,
199| 'bond' => [
200| ['value' => '', 'text' => 'Tipo de Vínculo'],
201| ['value' => PersonTypeEnum::COLABORADOR, 'text' => 'CLT'],
202| ['value' => PersonTypeEnum::PRESTADOR, 'text' => 'PJ / Prestador'],
203| ['value' => PersonTypeEnum::TERCEIRO, 'text' => 'Terceirizado'],
204| ],
205| 'unit' => $units,
206| 'overview_period' => [
207| ['value' => 'last_month', 'text' => 'Mês atual'],
208| ['value' => 'last_3_months', 'text' => 'Últimos 3 meses'],
209| ['value' => 'last_6_months', 'text' => 'Últimos 6 meses'],
210| ['value' => 'last_year', 'text' => 'Último ano'],
211| ['value' => 'total', 'text' => 'Todo o período'],
212| ],
213| 'overview_members' => $memberOptions,
214| 'overview_origins' => [
215| ['value' => '', 'text' => 'Todas'],
216| ['value' => 'accident_personal', 'text' => 'Acidente pessoal'],
217| ['value' => 'accident_material', 'text' => 'Acidente material'],
218| ['value' => 'near_miss', 'text' => 'Quase acidente'],
219| ['value' => 'ros', 'text' => 'ROS'],
220| ['value' => 'inspection', 'text' => 'Inspeção'],
221| ['value' => 'approach', 'text' => 'Abordagem'],
222| ],
223| 'origin' => [
224| ['value' => '', 'text' => 'Origem'],
225| ['value' => 'accident_personal', 'text' => 'Acidente pessoal'],
226| ['value' => 'accident_material', 'text' => 'Acidente material'],
227| ['value' => 'near_miss', 'text' => 'Quase acidente'],
228| ['value' => 'ros', 'text' => 'ROS'],
229| ['value' => 'inspection', 'text' => 'Inspeção'],
230| ['value' => 'approach', 'text' => 'Abordagem'],
231| ],
232| ];
233| }
234|
235| /**
236| * @param list<Company> $companies
237| *
238| * @return list<array<string, mixed>>
239| */
240| public function loadActionsForCompanies(array $companies): array
241| {
242| $all = [];
243| foreach ($companies as $company) {
244| $all = array_merge($all, $this->loadActionsForCompany($company));
245| }
246|
247| return $all;
248| }
249|
250| /**
251| * @return list<array<string, mixed>>
252| */
253| private function loadActionsForCompany(Company $company): array
254| {
255| $conn = $this->entityManager->getConnection();
256| $rows = $conn->executeQuery(
257| 'SELECT a.id, a.title, a.description, a.type, a.deadline, a.solved, a.project_priority,
258| a.responsible_ids, a.origem, a.origem_id, a.validation_status, a.validator_member_id,
259| a.created_at, a.updated_at, a.occurrence_id, a.event_id,
260| e.type AS event_type
file_read
Show Details
Arguments
{"file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 480, "end_line": 540}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648)
IS_TRUNCATED: false
LINE_RANGE: 480-540
480| return array_values(array_filter($actions, static function (array $a) use ($from, $to): bool {
481| $createdAt = (string) ($a['created_at'] ?? '');
482| if ($from !== null && $from !== '' && ($createdAt === '' || $createdAt < $from)) {
483| return false;
484| }
485| if ($to !== null && $to !== '' && $createdAt > $to) {
486| return false;
487| }
488|
489| return true;
490| }));
491| }
492|
493| /**
494| * @param list<array<string, mixed>> $actions
495| * @param array{members_by_id: array<int, array{id: int, name: string, vinculo: string}>} $meta
496| *
497| * @return list<array<string, mixed>>
498| */
499| private function applyOverviewDimensionFilters(
500| array $actions,
501| string $management,
502| string $area,
503| string $execResponsible,
504| string $valResponsible,
505| string $originFilter,
506| array $meta
507| ): array {
508| return array_values(array_filter($actions, function (array $action) use ($execResponsible, $valResponsible, $originFilter): bool {
509| if ($originFilter !== '' && $this->resolveOriginKey((string) ($action['origem'] ?? ''), (string) ($action['event_type'] ?? '')) !== $originFilter) {
510| return false;
511| }
512| if ($execResponsible !== '') {
513| $execId = (int) $execResponsible;
514| $ids = array_map('intval', (array) ($action['responsible_ids'] ?? []));
515| if (!in_array($execId, $ids, true)) {
516| return false;
517| }
518| }
519| if ($valResponsible !== '') {
520| if ((int) ($action['validator_member_id'] ?? 0) !== (int) $valResponsible) {
521| return false;
522| }
523| }
524|
525| return true;
526| }));
527| }
528|
529| /**
530| * @return array{0: string|null, 1: string|null}
531| */
532| private function resolvePendenciasDeadlineRange(string $period, \DateTimeImmutable $today): array
533| {
534| $todayStr = $today->format('Y-m-d');
535| if (str_starts_with($period, 'pend:range:')) {
536| $parts = explode(':', $period);
537| $from = $parts[2] ?? $todayStr;
538| $to = $parts[3] ?? $todayStr;
539| if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $from) && preg_match('/^\d{4}-\d{2}-\d{2}$/', $to)) {
540| return $from <= $to ? [$from, $to] : [$to, $from];
Request #17
deepseek-v4-flash
P:29.86K C:221 CR:27.01K CW:0
2330ms
Reasoning
Let me read the sections in the service for pendencias data build, origin chart, and also the section with the origin URL resolution. And also lines 600-800, 1300-1460.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 800, "file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 600}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648)
IS_TRUNCATED: false
LINE_RANGE: 600-800
600| 'last_week' => ['daily'],
601| 'last_month' => ['daily', 'weekly'],
602| 'last_3_months' => ['weekly', 'monthly'],
603| 'last_6_months' => ['monthly', 'quarterly'],
604| 'last_year' => ['monthly', 'quarterly'],
605| default => ['monthly', 'quarterly'],
606| };
607| }
608|
609| /**
610| * @param list<array<string, mixed>> $filtered
611| * @param list<array<string, mixed>> $allActions
612| * @param array<string, mixed> $actionTypeMeta
613| * @param array<int, array{id: int, name: string}> $membersById
614| *
615| * @return array<string, mixed>
616| */
617| private function buildPendenciasData(
618| array $filtered,
619| array $allActions,
620| array $actionTypeMeta,
621| array $membersById,
622| \DateTimeImmutable $today,
623| string $axis,
624| string $period = 'next_month',
625| ?string $deadlineTo = null
626| ): array {
627| $todayStr = $today->format('Y-m-d');
628| $openCount = $vencidas = $aguardandoVal = 0;
629| $proximoPrazo = null;
630| $bucketData = [];
631| $originCount = [];
632| $normalizedActions = [];
633| $kpiFooters = [
634| 'pending_exec' => 0, 'pending_val' => 0,
635| 'overdue_exec' => 0, 'overdue_val' => 0,
636| 'await_on_time' => 0, 'await_overdue' => 0,
637| ];
638|
639| foreach ($filtered as $action) {
640| if ((bool) ($action['solved'] ?? false)) {
641| continue;
642| }
643|
644| $deadline = $action['deadline'] ?? null;
645| $valStatus = (string) ($action['validation_status'] ?? '');
646| $isVal = $valStatus === 'pending_validation';
647| $isOverdue = $deadline !== null && $deadline < $todayStr;
648|
649| ++$openCount;
650| if ($isOverdue) {
651| ++$vencidas;
652| }
653| if ($isVal) {
654| ++$aguardandoVal;
655| }
656| if ($deadline !== null && $deadline >= $todayStr && ($proximoPrazo === null || $deadline < $proximoPrazo)) {
657| $proximoPrazo = $deadline;
658| }
659|
660| if ($isVal) {
661| ++$kpiFooters['pending_val'];
662| if ($isOverdue) {
663| ++$kpiFooters['overdue_val'];
664| ++$kpiFooters['await_overdue'];
665| } else {
666| ++$kpiFooters['await_on_time'];
667| }
668| } else {
669| ++$kpiFooters['pending_exec'];
670| if ($isOverdue) {
671| ++$kpiFooters['overdue_exec'];
672| }
673| }
674|
675| if ($deadline !== null) {
676| $bkt = $this->resolveChartBucketKey($deadline, $axis, $today, 'pendencias');
677| $key = $bkt['sort_key'];
678| if (!isset($bucketData[$key])) {
679| $bucketData[$key] = ['label' => $bkt['label'], 'execucao' => 0, 'validacao' => 0];
680| }
681| if ($isVal) {
682| ++$bucketData[$key]['validacao'];
683| } else {
684| ++$bucketData[$key]['execucao'];
685| }
686| }
687|
688| $validationMeta = $this->resolveValidationDisplay($valStatus);
689| $originKey = $this->resolveOriginKey((string) ($action['origem'] ?? ''), (string) ($action['event_type'] ?? ''));
690| $origemLabel = $this->resolveOriginLabel((string) ($action['origem'] ?? ''), (string) ($action['event_type'] ?? ''));
691|
692| $normalizedActions[] = [
693| 'id' => (int) ($action['id'] ?? 0),
694| 'title' => (string) ($action['title'] ?? ''),
695| 'action_id' => 'PA-' . substr((string) ($action['created_at'] ?? date('Y')), 2, 2) . '-' . str_pad((string) ($action['id'] ?? 0), 4, '0', STR_PAD_LEFT),
696| 'type_label' => $actionTypeMeta[$action['type'] ?? '']['label'] ?? ($action['type'] ?? ''),
697| 'occurrence_title' => $origemLabel,
698| 'origin' => $originKey,
699| 'management' => '—',
700| 'location' => '—',
701| 'priority' => ucfirst((string) ($action['project_priority'] ?? 'leve')),
702| 'priority_key' => strtolower((string) ($action['project_priority'] ?? 'leve')),
703| 'project_priority' => (string) ($action['project_priority'] ?? ''),
704| 'deadline_label' => $deadline ? (new \DateTimeImmutable($deadline))->format('d/m/Y') : '—',
705| 'deadline' => $deadline ? (new \DateTimeImmutable($deadline))->format('d/m/Y') : '—',
706| 'deadline_sort' => $deadline ? str_replace('-', '', $deadline) : '99999999',
707| 'deadline_overdue' => $isOverdue,
708| 'validation_status' => $valStatus,
709| 'validation_status_label' => $validationMeta['label'],
710| 'validation_status_color' => $validationMeta['color'],
711| 'pending' => $validationMeta['label'] ?: ($isOverdue ? 'Vencida' : 'Em andamento'),
712| 'responsible' => $this->resolveResponsibleDisplay((array) ($action['responsible_ids'] ?? []), $membersById),
713| 'executors' => $this->resolveResponsibleDisplay((array) ($action['responsible_ids'] ?? []), $membersById),
714| 'validators' => $this->resolveResponsibleDisplay(
715| array_values(array_filter([(int) ($action['validator_member_id'] ?? 0)])),
716| $membersById
717| ),
718| 'origin_label' => $origemLabel,
719| 'description' => (string) ($action['description'] ?? $action['title'] ?? ''),
720| 'origin_url' => $this->resolveOriginUrl($action),
721| ];
722|
723| $originLabel = $origemLabel ?: 'Outro';
724| if (!isset($originCount[$originKey])) {
725| $originCount[$originKey] = ['label' => $originLabel, 'count' => 0];
726| }
727| ++$originCount[$originKey]['count'];
728| }
729|
730| usort($normalizedActions, static fn (array $a, array $b): int => strcmp($a['deadline_sort'], $b['deadline_sort']));
731| ksort($bucketData);
732|
733| $totalGlobal = count($allActions);
734| $resolvedGlobal = count(array_filter($allActions, static fn (array $a): bool => (bool) ($a['solved'] ?? false)));
735| $resolutionRate = $totalGlobal > 0 ? (int) round($resolvedGlobal / $totalGlobal * 100) : 0;
736|
737| $figmaKpis = $this->buildPendenciasKpiCounts($allActions, $filtered, $today, $period, $deadlineTo);
738|
739| return [
740| 'kpis' => [
741| 'open_actions' => $openCount,
742| 'created_in_period' => $figmaKpis['created'],
743| 'completed' => $figmaKpis['completed'],
744| 'vencidas' => $vencidas,
745| 'aguardando_validacao' => $aguardandoVal,
746| 'period_end' => $figmaKpis['period_end'],
747| 'proximo_prazo' => $proximoPrazo ? (new \DateTimeImmutable($proximoPrazo))->format('d/m/Y') : '—',
748| 'recommendation' => $this->buildRecommendation($openCount, $resolutionRate),
749| 'trend' => [
750| 'created' => $figmaKpis['created_trend'],
751| 'completed' => $figmaKpis['completed_trend'],
752| 'awaiting' => $figmaKpis['awaiting_trend'],
753| ],
754| 'footer' => [
755| 'pending_to_date' => [
756| ['label' => 'Execução', 'value' => (string) $kpiFooters['pending_exec']],
757| ['label' => 'Validação', 'value' => (string) $kpiFooters['pending_val']],
758| ],
759| 'overdue' => [
760| ['label' => 'Execução', 'value' => (string) $kpiFooters['overdue_exec']],
761| ['label' => 'Validação', 'value' => (string) $kpiFooters['overdue_val']],
762| ],
763| 'awaiting_validation' => [
764| ['label' => 'Em dia', 'value' => (string) $kpiFooters['await_on_time']],
765| ['label' => 'Vencidas', 'value' => (string) $kpiFooters['await_overdue']],
766| ],
767| ],
768| ],
769| 'actions' => $normalizedActions,
770| 'deadline_chart' => [
771| 'labels' => array_column(array_values($bucketData), 'label'),
772| 'execucao' => array_column(array_values($bucketData), 'execucao'),
773| 'validacao' => array_column(array_values($bucketData), 'validacao'),
774| ],
775| 'responsible_chart' => $this->buildResponsibleChart($filtered, $membersById),
776| 'origin_chart' => $this->presentSeededOriginChart($originCount),
777| 'operational_summary' => $this->buildOperationalSummary($filtered, $today),
778| 'origin_icons' => $this->originIconsMap(),
779| ];
780| }
781|
782| /**
783| * @param list<array<string, mixed>> $filtered
784| * @param list<array<string, mixed>> $prevFiltered
785| * @param list<array<string, mixed>> $allActions
786| * @param array<string, mixed> $actionTypeMeta
787| * @param array<int, array{id: int, name: string}> $membersById
788| *
789| * @return array<string, mixed>
790| */
791| private function buildOverviewData(
792| array $filtered,
793| array $prevFiltered,
794| array $allActions,
795| array $actionTypeMeta,
796| array $membersById,
797| ?string $fromStr,
798| ?string $toStr,
799| string $axis,
800| \DateTimeImmutable $today,
file_read
Show Details
Arguments
{"end_line": 1470, "file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 1300}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648)
IS_TRUNCATED: false
LINE_RANGE: 1300-1470
1300| if ($diff <= 14) {
1301| return ['sort_key' => '2', 'label' => 'Semana 2'];
1302| }
1303| if ($diff <= 21) {
1304| return ['sort_key' => '3', 'label' => 'Semana 3'];
1305| }
1306| if ($diff <= 28) {
1307| return ['sort_key' => '4', 'label' => 'Semana 4'];
1308| }
1309|
1310| return ['sort_key' => '5', 'label' => 'Semana 5+'];
1311| }
1312|
1313| /**
1314| * @return array{label: string, color: string}
1315| */
1316| private function resolveValidationDisplay(string $validationStatus): array
1317| {
1318| return match ($validationStatus) {
1319| 'pending_validation' => ['label' => 'Pendência de validação', 'color' => 'warning'],
1320| 'approved' => ['label' => 'Aprovado', 'color' => 'green'],
1321| 'rejected' => ['label' => 'Reprovada', 'color' => 'red'],
1322| default => ['label' => 'Em andamento', 'color' => 'gray'],
1323| };
1324| }
1325|
1326| private function resolveOriginKey(string $origem, string $eventType = ''): string
1327| {
1328| $event = strtoupper(trim($eventType));
1329| if (str_contains($event, 'QUASE') || $event === (defined(SsmaEvent::class . '::TYPE_QUASE_ACIDENTE') ? SsmaEvent::TYPE_QUASE_ACIDENTE : 'QUASE_ACIDENTE')) {
1330| return 'near_miss';
1331| }
1332| if (str_contains($event, 'PESSOAL') || str_contains($event, 'PERSONAL')) {
1333| return 'accident_personal';
1334| }
1335| if (str_contains($event, 'MATERIAL')) {
1336| return 'accident_material';
1337| }
1338| if (str_contains($event, 'ACIDENTE')) {
1339| return 'accident_personal';
1340| }
1341| if ($event === SsmaEvent::TYPE_ROS || str_contains($event, 'ROS')) {
1342| return 'ros';
1343| }
1344|
1345| $normalized = ActionOrigemEnum::normalize($origem);
1346| if ($normalized === ActionOrigemEnum::INSPECAO) {
1347| return 'inspection';
1348| }
1349| if ($normalized === ActionOrigemEnum::ABORDAGEM) {
1350| return 'approach';
1351| }
1352|
1353| $value = mb_strtolower(trim($origem));
1354|
1355| return match (true) {
1356| str_contains($value, 'inspe') => 'inspection',
1357| str_contains($value, 'abord') => 'approach',
1358| str_contains($value, 'quase') => 'near_miss',
1359| str_contains($value, 'material') => 'accident_material',
1360| str_contains($value, 'pessoal') || str_contains($value, 'acidente') => 'accident_personal',
1361| str_contains($value, 'ros') => 'ros',
1362| str_contains($value, 'recusa') || str_contains($value, 'refusal') => 'refusal',
1363| str_contains($value, 'ocorr') => 'accident_personal',
1364| default => 'other',
1365| };
1366| }
1367|
1368| private function resolveOriginLabel(string $origem, string $eventType = ''): string
1369| {
1370| return match ($this->resolveOriginKey($origem, $eventType)) {
1371| 'inspection' => 'Inspeção',
1372| 'approach' => 'Abordagem',
1373| 'accident_personal' => 'Acidente pessoal',
1374| 'accident_material' => 'Acidente material',
1375| 'near_miss' => 'Quase acidente',
1376| 'accident' => 'Acidente pessoal',
1377| 'ros' => 'ROS',
1378| 'refusal' => 'Direito de Recusa',
1379| default => $origem !== '' ? $origem : 'Outro',
1380| };
1381| }
1382|
1383| /**
1384| * @return array<string, array{icon: string, variant: string, title: string}>
1385| */
1386| private function originIconsMap(): array
1387| {
1388| return [
1389| 'inspection' => ['icon' => 'fa-clipboard-check', 'variant' => 'primary', 'title' => 'Inspeção'],
1390| 'approach' => ['icon' => 'fa-users', 'variant' => 'info', 'title' => 'Abordagem'],
1391| 'ros' => ['icon' => 'fa-file-lines', 'variant' => 'warning', 'title' => 'ROS'],
1392| 'accident' => ['icon' => 'fa-triangle-exclamation', 'variant' => 'danger', 'title' => 'Acidente pessoal'],
1393| 'accident_personal' => ['icon' => 'fa-triangle-exclamation', 'variant' => 'danger', 'title' => 'Acidente pessoal'],
1394| 'accident_material' => ['icon' => 'fa-car-burst', 'variant' => 'danger', 'title' => 'Acidente material'],
1395| 'near_miss' => ['icon' => 'fa-bolt', 'variant' => 'warning', 'title' => 'Quase acidente'],
1396| 'occurrence' => ['icon' => 'fa-triangle-exclamation', 'variant' => 'danger', 'title' => 'Ocorrência'],
1397| 'refusal' => ['icon' => 'fa-hand', 'variant' => 'company', 'title' => 'Direito de Recusa'],
1398| ];
1399| }
1400|
1401| /**
1402| * @param array<string, mixed> $action
1403| */
1404| private function resolveOriginUrl(array $action): string
1405| {
1406| $originKey = $this->resolveOriginKey(
1407| (string) ($action['origem'] ?? ''),
1408| (string) ($action['event_type'] ?? '')
1409| );
1410| $origemId = (int) ($action['origem_id'] ?? 0);
1411|
1412| if ($originKey === 'inspection' && $origemId > 0) {
1413| return '/manager/ssma/inspections/' . $origemId . '/view';
1414| }
1415| if ($originKey === 'approach' && $origemId > 0) {
1416| return '/manager/ssma/abordagens/' . $origemId . '/view';
1417| }
1418|
1419| $occurrenceId = (int) ($action['occurrence_id'] ?? 0);
1420| if ($occurrenceId > 0) {
1421| return '/manager/ssma/ocorrencias/' . $occurrenceId;
1422| }
1423|
1424| if ($origemId > 0 && in_array($originKey, ['accident_personal', 'accident_material', 'near_miss', 'ros', 'accident'], true)) {
1425| return '/manager/ssma/ocorrencias/' . $origemId;
1426| }
1427|
1428| $eventId = (int) ($action['event_id'] ?? 0);
1429| if ($eventId > 0) {
1430| return '/manager/ssma/ocorrencias?event=' . $eventId;
1431| }
1432|
1433| return '';
1434| }
1435|
1436| /**
1437| * @param array<string, array{label: string, count: int}> $originCount
1438| *
1439| * @return list<array{label: string, count: int}>
1440| */
1441| private function presentSeededOriginChart(array $originCount): array
1442| {
1443| $seed = [
1444| 'accident_personal' => ['label' => 'Acidente pessoal', 'count' => 0],
1445| 'accident_material' => ['label' => 'Acidente material', 'count' => 0],
1446| 'near_miss' => ['label' => 'Quase acidente', 'count' => 0],
1447| 'inspection' => ['label' => 'Inspeção', 'count' => 0],
1448| 'ros' => ['label' => 'ROS', 'count' => 0],
1449| 'approach' => ['label' => 'Abordagem', 'count' => 0],
1450| ];
1451| foreach ($originCount as $key => $row) {
1452| if (isset($seed[$key])) {
1453| $seed[$key]['count'] = (int) ($row['count'] ?? 0);
1454| continue;
1455| }
1456| if (($row['count'] ?? 0) > 0) {
1457| $seed[$key] = ['label' => (string) ($row['label'] ?? $key), 'count' => (int) $row['count']];
1458| }
1459| }
1460| $total = array_sum(array_map(static fn (array $row): int => (int) $row['count'], $seed));
1461| if ($total === 0) {
1462| return [];
1463| }
1464|
1465| return array_values($seed);
1466| }
1467|
1468| /**
1469| * @param list<array<string, mixed>> $allActions
1470| * @param list<array<string, mixed>> $filteredPendencias
Request #18
deepseek-v4-flash
P:35.5K C:1.74K CR:30.08K CW:0
13568ms
Reasoning
Now I have a fuller picture of the service. Let me now look at the overview origins chart usage of presentSeededOriginChart — where the origin chart is used (both pendencias view and overview?). It's used in buildPendenciasData at line 776 `'origin_chart' => $this->presentSeededOriginChart($originCount)`.
In the overview (visão_geral) case, earlier in the file at lines ~90-120, for view === 'visao_geral', buildOverviewData is called. Where's the origin chart for overview? It seems `presentSeededOriginChart` is only used in pendencias (line 776). Also check what uses 'origin_chart' in overview — need to search for origin_chart usage in templates.
Wait — regarding the review plan item 4 (refusal regression): The seed in presentSeededOriginChart drops 'refusal' from the seed, but the foreach loop at lines 1451-1459 will add any non-seed key with count > 0 into seed (`$seed[$key] = ...`). So refusal with count>0 would still appear in the chart since it's not in the seed; the loop handles other keys. So actually no, refusal is not discarded; it's added dynamically. And 'occurrence' key also handled. So plan item 4's claim that "ações com origem refusal deixam de ser contabilizadas" seems false — presentSeededOriginChart appends non-seed keys when count>0. Actually it preserves them. Hmm wait — the diff changed the seed by removing refusal from it, but since the loop adds unknown keys with count>0, the refusal category still shows. So there isn't a regression on the chart visibility; ordering though might change - refusal will appear at the end after the seeded categories, whereas before it was a fixed position. That's a cosmetic change.
But there is a separate issue: the origin filter dropdown 'origin' and 'overview_origins' no longer include 'refusal'. resolveOriginKey can still return 'refusal', so actions of refusal origin would not be selectable as a filter. But is that an actual regression? Previously there was no origin filter at all — this is a new filter. So not being able to filter by refusal is a "feature gap", not a regression of existing functionality. The `overview_origins` previously had 'refusal' option but that was in the old dropdown. Wait, let's check the old diff: The diff for buildFilterOptions changed `overview_origins` from including 'refusal' to not. Actually the diff shows old overview_origins:
```
'overview_origins' => [
['value' => '', 'text' => 'Origem'],
['value' => 'accident', 'text' => 'Acidente'],
['value' => 'inspection', ...],
['value' => 'approach', ...],
['value' => 'ros', 'text' => 'ROS'],
['value' => 'refusal', 'text' => 'Direito de Recusa'],
],
```
New overview_origins removed refusal (and renamed values). And 'origin' key is new. So for the Visão Geral filter dropdown (overview_origins), previously there was a 'refusal' option that allowed filtering by "Direito de Recusa"; now it's removed. So there could be a regression in the Visão Geral origin dropdown: actions with refusal can no longer be selected/filtered. Hmm, but the filtering by overview_origins is in the Overview view with a dropdown previously already existing? Wait — the branch this PR builds on is feature/ssma-action-plan-panel-pendencias-s2 which depends on #701 (dashboard). In #701 they added overview_origins? The diff shows old overview_origins already had refusal. So Visão Geral has an origin filter with refusal removed. Let me not over-assume; the claim in the review plan says "seed do gráfico" and "filtro novo".
Actually, given presentSeededOriginChart appends non-seed categories, chart visibility is preserved. But the ordering changed. Not a big deal.
The removal of 'refusal' from `overview_origins` dropdown would mean users can no longer filter the overview by "Direito de Recusa", though actions exist. That is a medium/low issue. But wait, let me check how overview_origins was used in #701 — maybe not directly. Let me search the templates for overview_origins usage.
Also there's a subtle issue in `resolveOriginKey`: the ordering matters. Consider event_type for an "acidente de trajeto pessoal"? Actually check TYPE constants. The order: QUASE → PESSOAL/PERSONAL → MATERIAL → ACIDENTE → ROS. But if an event is a ROS that contains "ACIDENTE"? Unlikely.
Hmm, wait: there's a subtle issue: an "acidente material" event probably contains "MATERIAL" but maybe type is 'ACIDENTE_MATERIAL'? That's fine — matched first since we check QUASE first, PESSOAL, MATERIAL, then ACIDENTE. If event contains both 'MATERIAL' and 'ACIDENTE' (e.g., "ACIDENTE_MATERIAL"), MATERIAL check comes before ACIDENTE so returns accident_material. Good. If event is 'ACIDENTE' generic — returns accident_personal. OK.
Now also `occurrence` old key removed? originIconsMap still keeps 'occurrence'. resolveOriginKey never returns 'occurrence' though (the str_contains($value, 'ocorr') returns accident_personal now, was accident before). Hmm. Previously old resolveOriginKey: str_contains($value,'ocorr') => 'accident'. Wait old code in the diff: `str_contains($value, 'ocorr') => 'accident'`. New code: `str_contains($value, 'ocorr') => 'accident_personal'`.
OK.
Now let me focus and confirm the issues from the plan that are actually bugs. Given the previous review summary already flagged 3 issues (2 high, 1 medium) plus the off-canvas id mismatch finding. Let me check if those still hold after reading. Let me not duplicate previous findings; they were marked as identified problems already — but no code_comment output shown in this conversation. As the current review, I need to produce comments. Since the summary says these problems were identified, I should turn them into code_comment outputs (unless they've already been posted?).
Wait — previous_review_summary indicates an ongoing review; those findings were identified, but not necessarily posted as comments. I need to continue and finish. I should post comments for confirmed issues with code_comment tool.
Let me verify each issue carefully.
### Issue 1 (High): canMutateSsmaActionPlan vs UI override for Gestor de Equipe/Área.
Let me read the relevant controller regions to confirm.
Let me read SsmaController around lines 11339-11490 (canManageSsmaOccurrences, canMutateSsmaActionPlan), and lines 12560-12790 (flags), plus 16138-16280 (canCurrentUserEditSsmaAction, resolve). And 611-640 resolveActionPlanPanelMemberScope, 1401 ssmaCurrentMemberPermissionTag, canAccessSsmaSupervisorSurface.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 11490, "file_path": "src/Controller/SsmaController.php", "start_line": 11335}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 11335-11490
11335| ): void {
11336| $this->ssmaNotificationService->notifyOccurrenceRegistrantOnReject($event, $sender, $note);
11337| }
11338|
11339| private function canManageSsmaOccurrences(): bool
11340| {
11341| $user = $this->getUser();
11342| $company = $this->getSsmaCompany() ?? ($user instanceof User ? $user->getCompany() : null);
11343| if ($user instanceof User && $company instanceof Company
11344| && $this->shouldStripSsmaManagementUiForUser($company, $user)) {
11345| return false;
11346| }
11347|
11348| if (
11349| $this->isGranted('ROLE_SUPER_ADMIN')
11350| || $this->isGranted('ROLE_MANAGER')
11351| || $this->isGranted('ROLE_MANAGER_GESTOR')
11352| || $this->isGranted('ROLE_TENANT')
11353| ) {
11354| return true;
11355| }
11356|
11357| $member = null;
11358| if ($user instanceof User) {
11359| $company = $this->getSsmaCompany() ?? $user->getCompany();
11360| if ($company instanceof Company) {
11361| $member = $this->getCurrentCompanyMember($company, $user);
11362| }
11363| }
11364| if ($this->memberIsSsmaGestorAdministrador($member)) {
11365| return true;
11366| }
11367|
11368| $tag = $this->ssmaCurrentMemberPermissionTag();
11369|
11370| $request = $this->requestStack->getCurrentRequest();
11371| if ($request && (
11372| (bool) $request->attributes->get('can_create', false)
11373| || (bool) $request->attributes->get('can_edit', false)
11374| || (bool) $request->attributes->get('can_delete', false)
11375| )) {
11376| return true;
11377| }
11378|
11379| if (!$tag) {
11380| return false;
11381| }
11382|
11383| return (bool) ($tag->getCanCreate() ?? false)
11384| || (bool) ($tag->getCanEdit() ?? false)
11385| || (bool) ($tag->getCanDelete() ?? false);
11386| }
11387|
11388| /**
11389| * Edição no detalhe (UI + API legada createOccurrence edit + updateEvent).
11390| * Tenant/super admin e admin de aprofundamento (Gestor Administrador) editam tudo.
11391| */
11392| private function canEditSsmaOccurrenceDetail(): bool
11393| {
11394| $user = $this->getUser();
11395| $company = $user instanceof User ? $user->getCompany() : null;
11396| if ($user instanceof User && $this->isSsmaAprofundamentoAdmin($company, $user)) {
11397| return true;
11398| }
11399|
11400| return SsmaOccurrenceCreatePermissionService::canEditOccurrenceDetail(
11401| $this->isGranted('ROLE_SUPER_ADMIN'),
11402| $this->isGranted('ROLE_TENANT'),
11403| );
11404| }
11405|
11406| /**
11407| * Permissão padrão do Membro: registrar a PRÓPRIA ocorrência.
11408| *
11409| * Diferente de canManageSsmaOccurrences() (que também habilita editar/excluir/resolver),
11410| * esta capacidade libera apenas a CRIAÇÃO para o membro comum da empresa que tem acesso
11411| * à área de ocorrências. Supervisores (somente leitura) ficam de fora; gestores/admins
11412| * já são cobertos por canManageSsmaOccurrences().
11413| */
11414| private function canMemberRegisterOwnOccurrence(?Company $company, ?User $user): bool
11415| {
11416| if (!$company || !$user) {
11417| return false;
11418| }
11419|
11420| if ($this->canManageSsmaOccurrences()) {
11421| return true;
11422| }
11423|
11424| // Supervisores são somente leitura (planilha SSMA).
11425| if ($this->isSsmaViewer()) {
11426| return false;
11427| }
11428|
11429| return $this->getCurrentCompanyMember($company, $user) !== null;
11430| }
11431|
11432| private function canCreateSsmaOccurrenceType(string $typeKey): bool
11433| {
11434| /** @var \App\Entity\User|null $user */
11435| $user = $this->getUser();
11436| $company = $user?->getCompany();
11437| if (!$user || !$company) {
11438| return false;
11439| }
11440|
11441| $member = $this->getCurrentCompanyMember($company, $user);
11442|
11443| return $this->ssmaOccurrenceCreatePermissionService->canCreateOccurrenceType(
11444| $member,
11445| $user,
11446| $company,
11447| $typeKey,
11448| $this->canManageSsmaOccurrences(),
11449| );
11450| }
11451|
11452| private function canManageSsmaPermissions(): bool
11453| {
11454| return $this->isGranted('ROLE_SUPER_ADMIN') || $this->isGranted('ROLE_MANAGER');
11455| }
11456|
11457| private function canAccessSsmaSupervisorSurface(): bool
11458| {
11459| return $this->canManageSsmaOccurrences() || $this->isSsmaViewer();
11460| }
11461|
11462| /**
11463| * Criar/editar Plano de Ação: gestor/admin.
11464| * Supervisor (viewer ou tag Supervisor*) só visualiza dash/painel — Brenda áudio 6.
11465| * Gestor de Equipe/Área continua podendo mutar.
11466| */
11467| private function canMutateSsmaActionPlan(): bool
11468| {
11469| if ($this->isSsmaViewer()) {
11470| return false;
11471| }
11472|
11473| $tagName = $this->ssmaCurrentMemberPermissionTag()?->getName();
11474| if (in_array($tagName, [
11475| 'Supervisor de Equipe',
11476| 'Supervisor',
11477| SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA,
11478| ], true)) {
11479| return false;
11480| }
11481|
11482| return $this->canManageSsmaOccurrences();
11483| }
11484|
11485| /**
11486| * Abas "Painel" e "Metas" em Prevenção Ativa: apenas perfis de supervisão/gestão na empresa.
11487| * Não usar {@see canAccessSsmaSupervisorSurface()} aqui: ele inclui Membro com can_create na tag
11488| * ssma-prevention (para registrar inspeção/abordagem), e na planilha Membro não acessa Painel/Metas.
11489| */
11490| private function canAccessPreventionDashboardAndMetasTabs(): bool
file_read
Show Details
Arguments
{"end_line": 660, "file_path": "src/Controller/SsmaController.php", "start_line": 600}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 600-660
600| $overviewPayload,
601| $filterOptions
602| );
603| }
604|
605| /**
606| * Restringe ações do painel para membro/stakeholder/supervisor de equipe.
607| * null = sem restrição (gestor/admin).
608| *
609| * @return array<int, true>|null
610| */
611| private function resolveActionPlanPanelMemberScope(Company $company): ?array
612| {
613| $user = $this->getUser();
614| if (!$user instanceof User) {
615| return [];
616| }
617|
618| if ($this->canManageSsmaOccurrences()) {
619| return null;
620| }
621|
622| $member = $this->getCurrentCompanyMember($company, $user);
623| if ($this->memberIsSsmaGestorAdministrador($member)) {
624| return null;
625| }
626|
627| $ssmaProductTagName = $this->ssmaCurrentMemberPermissionTag()?->getName();
628| if (in_array($ssmaProductTagName, ['Supervisor de Equipe', 'Supervisor', 'Gestor de Equipe'], true)) {
629| $teamIds = $this->getSsmaOccurrenceDashboardTeamFilterIds($company, $user);
630| if ($teamIds !== null && $teamIds !== []) {
631| return $this->collectCompanyMemberIdsBelongingToCompanyTeams($company, $teamIds);
632| }
633| }
634|
635| $memberId = (int) ($member?->getId() ?? 0);
636|
637| return $memberId > 0 ? [$memberId => true] : [];
638| }
639|
640| /** @return array<string, mixed> */
641| private function buildEmptyActionPlanPanelData(): array
642| {
643| return [
644| 'kpis' => [
645| 'open_actions' => 0,
646| 'created_in_period' => 0,
647| 'completed' => 0,
648| 'vencidas' => 0,
649| 'aguardando_validacao' => 0,
650| 'period_end' => '—',
651| 'proximo_prazo' => '—',
652| 'recommendation' => '',
653| ],
654| 'actions' => [],
655| 'deadline_chart' => ['labels' => [], 'execucao' => [], 'validacao' => []],
656| 'responsible_chart' => [],
657| 'origin_chart' => [],
658| 'type_chart' => [],
659| 'operational_summary' => [
660| 'rows' => [],
Request #19
deepseek-v4-flash
P:39.81K C:204 CR:37.12K CW:0
2090ms
Reasoning
Now let me check how the UI flags for `ssmaCanCreateLinkedActions`/`ssmaCanMutateActionPlan` are calculated (lines ~12560-12790) and whether Gestor de Equipe/Área override only appears there. Also check whether canManageSsmaOccurrences covers those tags through `memberIsSsmaGestorAdministrador` or request attributes can_create/can_edit/can_delete. Gestor de Equipe probably has a tag with can_create etc.? Let me read around lines 12600-12800.
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 12810, "file_path": "src/Controller/SsmaController.php", "start_line": 12550}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 12550-12810
12550| } else {
12551| $occurrences = $company ? $this->loadOccurrences($company, $allMembers, $teams) : [];
12552| }
12553| if ($occurrences !== []) {
12554| // Sempre anexa cause_tree_id na página atual (UX: botão Causa aparece no SSR).
12555| // Painel/inspeções/horas continuam deferred; só o mapa de árvores volta no hub.
12556| if ($company instanceof Company) {
12557| $itemsForTrees = [];
12558| foreach ($occurrences as $occRow) {
12559| $entityId = (int) ($occRow['id'] ?? 0);
12560| if ($entityId <= 0) {
12561| continue;
12562| }
12563| $itemsForTrees[] = [
12564| 'id' => $entityId,
12565| 'is_ssma_event' => !empty($occRow['is_ssma_event']),
12566| ];
12567| }
12568| if ($itemsForTrees !== []) {
12569| $treeMeta = $this->ssmaCauseTreeService->resolveEntityTreeMetaBatch(
12570| (int) $company->getId(),
12571| $itemsForTrees
12572| );
12573| foreach ($occurrences as $idx => $occRow) {
12574| $entityId = (int) ($occRow['id'] ?? 0);
12575| $key = (!empty($occRow['is_ssma_event']) ? 'e:' : 'o:') . $entityId;
12576| $occurrences[$idx]['cause_tree_id'] = $treeMeta[$key]['cause_tree_id'] ?? null;
12577| }
12578| }
12579| }
12580| $occurrences = $this->enrichOccurrencesCommitteeTriggerFlags($occurrences, $company);
12581| $occurrences = $this->enrichOccurrencesGravityLabels($occurrences);
12582| }
12583| if ($deferOccurrenceHubHeavyData) {
12584| $actionsTaken = [];
12585| $inspections = [];
12586| $horasData = [];
12587| } else {
12588| $actionsTaken = $company ? $this->loadActions($company) : [];
12589| $inspections = $company ? $this->loadInspections($company, $allMembers, $teams) : [];
12590| $horasData = $company ? $this->loadHorasData($company) : [];
12591| }
12592| }
12593| if ($needsPreventionCollections) {
12594| $abordagens = $company ? $this->loadAbordagens($company) : [];
12595| }
12596| $occurrenceUiMeta = $this->getMockOccurrenceMetadata();
12597|
12598| $userTechnicalTypes = $company
12599| ? $this->resolveUserTechnicalTypes($company, $user, $companyMembers ?? [])
12600| : [];
12601| $ssmaCanManageOccurrences = $this->canManageSsmaOccurrences();
12602| $ssmaCanAccessSupervisorSurface = $this->canAccessSsmaSupervisorSurface();
12603| $ssmaCanAccessPreventionPanelAndMetas = $this->canAccessPreventionDashboardAndMetasTabs();
12604| $ssmaCanAccessOccurrencePanel = $ssmaCanManageOccurrences || $this->isSsmaViewer();
12605| // Supervisores veem a aba Automações mas não criam; o botão de criação usa ssmaCanManageOccurrences
12606| $ssmaCanAccessOccurrenceAutomations = $ssmaCanManageOccurrences || $this->isSsmaViewer();
12607| $ssmaCanManageConfig = $this->canManageSsmaConfig();
12608| $ssmaCanManagePermissions = $this->canManageSsmaPermissions();
12609| // ssmaCanCreateLinkedActions: botão "Criar ação" na aba Ocorrências e occurrence_view.
12610| // Brenda: Supervisor só visualiza (dash/painel). Criar/editar fica com gestor/admin
12611| // e Gestor de Equipe (override abaixo). Membro comum não cria.
12612| $ssmaCanCreateLinkedActions = $this->canMutateSsmaActionPlan();
12613| $ssmaCanMutateActionPlan = $ssmaCanCreateLinkedActions;
12614| // ssmaCanCreateCauseTree: Supervisor ?? SOMENTE LEITURA na Árvore de Causas (planilha).
12615| // NÃO incluir isSsmaViewer() aqui. Usa produto ssma-cause-tree (não can_create de ssma-occurrences).
12616| $ssmaCanCreateCauseTree = $this->canCreateSsmaCauseTree();
12617| $ssmaCanCreateAuthorization = $ssmaCanManageOccurrences;
12618| $ssmaCanEditHorasTrabalhadas = $this->canEditSsmaHorasTrabalhadas();
12619|
12620| // Tag SSMA do colaborador — sempre resolve (ROLE_MANAGER de plataforma ≠ perfil SSMA).
12621| $ssmaProductTagName = null;
12622| $memberForTagCheck = null;
12623| $ssmaPreventionProductTagName = null;
12624| if ($company && $user instanceof User) {
12625| $memberForTagCheck = $this->getCurrentCompanyMember($company, $user);
12626| if ($memberForTagCheck) {
12627| $resolvedTag = $this->resolveSsmaProductPermissionTagForMember($memberForTagCheck);
12628| if ($resolvedTag) {
12629| $ssmaProductTagName = $resolvedTag->getName();
12630| }
12631| if ($this->memberIsSsmaGestorAdministrador($memberForTagCheck)) {
12632| $ssmaProductTagName = 'Gestor Administrador';
12633| }
12634| $ssmaPreventionProductTagName = $this->ssmaPreventionHubAccessService
12635| ->resolvePreventionProductTagName($memberForTagCheck);
12636| }
12637| }
12638|
12639| // Membro/Inspetor: visão de pessoa física (matriz de tipos + registrar).
12640| // Só strip se tiver ROLE_USER (Palloma). Conta admin empresa sem ROLE_USER (Aura) mantém abas.
12641| // Tenant / SUPER_ADMIN mantêm abas mesmo com tag Membro (regressão Felipe).
12642| $ssmaIsPlainProductMemberUi = SsmaOccurrenceCreatePermissionService::shouldStripOccurrenceManagementTabsUi(
12643| $ssmaProductTagName,
12644| $this->isGranted('ROLE_SUPER_ADMIN'),
12645| $this->isGranted('ROLE_TENANT'),
12646| $user instanceof User && in_array('ROLE_USER', $user->getRoles(), true)
12647| );
12648| if ($ssmaIsPlainProductMemberUi && !$this->memberIsSsmaGestorAdministrador($memberForTagCheck)) {
12649| $ssmaCanManageOccurrences = false;
12650| $ssmaCanAccessSupervisorSurface = false;
12651| $ssmaCanAccessPreventionPanelAndMetas = false;
12652| $ssmaCanAccessOccurrencePanel = false;
12653| $ssmaCanAccessOccurrenceAutomations = false;
12654| $ssmaCanManageConfig = false;
12655| $ssmaCanManagePermissions = false;
12656| $ssmaCanCreateLinkedActions = false;
12657| $ssmaCanCreateAuthorization = false;
12658| }
12659|
12660| $loggedMemberForCauseTree = ($company && $user instanceof User)
12661| ? $this->getCurrentCompanyMember($company, $user)
12662| : null;
12663|
12664| // Especialistas técnicos (SsmaPermissionTagMember) e gestores/supervisores podem visualizar.
12665| // Membro/Inspetor com acesso só via mapa legado tipo/equipe NÃO recebem o botão na listagem.
12666| $ssmaCanViewCauseTree = $ssmaCanCreateCauseTree
12667| || $this->isSsmaViewer()
12668| || in_array($ssmaProductTagName, ['Gestor Administrador', 'Gestor de Equipe', 'Supervisor de Equipe', 'Supervisor'], true)
12669| || ($loggedMemberForCauseTree && $company && $this->hasSsmaTechnicalCauseTreeAccess($loggedMemberForCauseTree, $company));
12670|
12671| // Hub Ocorrências — botão "Registrar ocorrência" (empty state / FAB): Membro não cria (planilha),
12672| // mesmo com can_create na tag. Só roles de gestão na empresa ou tag Gestor de Equipe / G. Administrador com manage.
12673| // Reutiliza $ssmaProductTagName (já corrigido por memberIsSsmaGestorAdministrador).
12674| $ssmaProductTagNameForRegister = $ssmaProductTagName;
12675| $ssmaCanRegisterNewOccurrence = $this->isGranted('ROLE_SUPER_ADMIN')
12676| || $this->isGranted('ROLE_MANAGER')
12677| || $this->isGranted('ROLE_MANAGER_GESTOR')
12678| || \in_array($ssmaProductTagNameForRegister, ['Gestor de Equipe', 'Gestor Administrador'], true)
12679| // Permissão padrão do Membro: registrar a própria ocorrência.
12680| || $this->canMemberRegisterOwnOccurrence($company, $user);
12681|
12682| $loggedMemberForOccurrence = ($company && $user instanceof User)
12683| ? $this->getCurrentCompanyMember($company, $user)
12684| : null;
12685| $ssmaAllowedCreateTypes = ($company && $user instanceof User)
12686| ? $this->ssmaOccurrenceCreatePermissionService->resolveAllowedCreateTypes(
12687| $loggedMemberForOccurrence,
12688| $user,
12689| $company,
12690| $this->ssmaOccurrenceTypeConfig->getAllowedTypeKeys($company),
12691| $ssmaCanManageOccurrences,
12692| )
12693| : [];
12694| if (!$ssmaCanRegisterNewOccurrence && $ssmaAllowedCreateTypes !== []) {
12695| $ssmaCanRegisterNewOccurrence = true;
12696| }
12697|
12698| $occurrenceTeamFilterIds = $this->getSsmaOccurrenceDashboardTeamFilterIds($company, $user);
12699| $areaScope = $this->getSsmaPreventionAreaScope($company, $user);
12700| $occurrenceAreaFilterIds = $areaScope->isRestricted() ? $areaScope->areaIds() : null;
12701| $viewerTeamIds = $this->getSsmaViewerTeamIds();
12702|
12703| // ── Detecção de Supervisor/Gestor de Equipe via tag SSMA ──────────────────────────────
12704| // Usuários com ROLE_USER + tag SSMA (sem ROLE_MANAGER_VIEWER global) não são detectados pelas
12705| // funções baseadas em role. Identificamos o perfil pelo nome da tag para ajustar flags de UI.
12706| $ssmaIsTagTeamSupervisor = in_array($ssmaProductTagName, ['Supervisor de Equipe', 'Supervisor'], true);
12707| $ssmaIsTagTeamGestor = $ssmaProductTagName === 'Gestor de Equipe';
12708| $ssmaIsTagAreaSupervisor = $ssmaProductTagName === SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA;
12709| $ssmaIsTagAreaGestor = $ssmaProductTagName === SsmaAreaLimitationScope::TAG_GESTOR_AREA;
12710| $ssmaIsPreventionTagTeamSupervisor = in_array($ssmaPreventionProductTagName, ['Supervisor de Equipe', 'Supervisor'], true);
12711| $ssmaIsPreventionTagTeamGestor = $ssmaPreventionProductTagName === 'Gestor de Equipe';
12712|
12713| // Painel + Metas: libera para Sup/G. de Equipe/Área e Gestor Administrador (ocorrências + ssma-prevention)
12714| if (!$ssmaCanAccessPreventionPanelAndMetas
12715| && (
12716| $ssmaIsTagTeamSupervisor
12717| || $ssmaIsTagTeamGestor
12718| || $ssmaIsTagAreaSupervisor
12719| || $ssmaIsTagAreaGestor
12720| || $ssmaProductTagName === 'Gestor Administrador'
12721| || $ssmaIsPreventionTagTeamSupervisor
12722| || $ssmaIsPreventionTagTeamGestor
12723| || $ssmaPreventionProductTagName === 'Gestor Administrador'
12724| )
12725| ) {
12726| $ssmaCanAccessPreventionPanelAndMetas = true;
12727| }
12728|
12729| // Membro/Inspetor (pessoa física / Palloma): não acessa Painel nem Metas.
12730| // Conta admin empresa sem ROLE_USER (Aura), Tenant e SUPER_ADMIN mantêm — mesmo contrato das abas de Ocorrências.
12731| if (SsmaOccurrenceCreatePermissionService::shouldStripOccurrenceManagementTabsUi(
12732| $ssmaProductTagName,
12733| $this->isGranted('ROLE_SUPER_ADMIN'),
12734| $this->isGranted('ROLE_TENANT'),
12735| $user instanceof User && in_array('ROLE_USER', $user->getRoles(), true)
12736| )) {
12737| $ssmaCanAccessPreventionPanelAndMetas = false;
12738| }
12739|
12740| // Modal + Evento: título/status ocultos na criação para todos os perfis (Figma Etapa 0).
12741| // Na edição o JS (evApplyAuraTitleStatusVisibility) reexibe conforme o modo.
12742| $ssmaHideEventTitleStatusOnCreate = true;
12743|
12744| // ssmaIsTeamViewer: true quando o usuário opera com escopo de equipe (via role SSMA OU via tag SSMA)
12745| // Usado para sinalizar ao template que os dados estáo limitados ?? equipe.
12746| $ssmaIsTeamViewerFlag = $viewerTeamIds !== null || $ssmaIsTagTeamSupervisor || $ssmaIsTagTeamGestor
12747| || $ssmaIsTagAreaSupervisor || $ssmaIsTagAreaGestor;
12748|
12749| // ssmaCanCreatePreventionItems: Gestor de Equipe/Área e Gestor Administrador via tag SSMA
12750| // também podem registrar inspeções/abordagens (ssmaCanManageOccurrences = true via tag).
12751| $ssmaCanCreatePreventionItems = (
12752| $this->isGranted('ROLE_SUPER_ADMIN')
12753| || $this->isGranted('ROLE_MANAGER')
12754| || $this->isGranted('ROLE_MANAGER_GESTOR')
12755| || (
12756| $ssmaCanManageOccurrences
12757| && ($ssmaIsTagTeamGestor || $ssmaIsTagAreaGestor || $ssmaProductTagName === 'Gestor Administrador')
12758| )
12759| );
12760|
12761| // ssmaCanEditPreventionContent: controla botões Editar/Finalizar/Deletar em inspeções e abordagens
12762| // e o botão "Configuração" na aba Metas.
12763| // Supervisor registra/edita o próprio conteúdo (can_mutate por item); gestão edita todos.
12764| $ssmaCanEditPreventionContent = $ssmaCanManageOccurrences
12765| && !$this->isSsmaViewer()
12766| && !$ssmaIsTagTeamSupervisor
12767| && !$ssmaIsTagAreaSupervisor;
12768| $ssmaPreventionMutateOwnOnly = false;
12769|
12770| // Configurações da aba Prevenção Ativa: Sup/Gestor de Equipe ou Área não acessam (planilha: "Não acessa")
12771| if ($ssmaIsTagTeamSupervisor || $ssmaIsTagTeamGestor || $ssmaIsTagAreaSupervisor || $ssmaIsTagAreaGestor) {
12772| $ssmaCanManageConfig = false;
12773| }
12774|
12775| // G. Equipe via tag SSMA pode criar ação (Plano de Ação).
12776| // Árvore de causas: {@see canCreateSsmaCauseTree()} já cobre Gestor de Equipe.
12777| if ($ssmaIsTagTeamGestor || $ssmaIsTagAreaGestor) {
12778| $ssmaCanCreateLinkedActions = true;
12779| $ssmaCanMutateActionPlan = true;
12780| }
12781|
12782| // Tabela de metas por pessoa (aba Metas): edição global só para gestão; membro com can_create não gere metas alheias.
12783| $ssmaCanEditPreventionMetasTable = $company && $user instanceof User
12784| && $this->canEditPreventionMetasTableForCurrentUser($company, $user);
12785|
12786| // ssmaPreventionCanCreateLinkedActions: botão "Criar ação" em Inspeções e Abordagem.
12787| // Alinhado com ssmaCanCreateLinkedActions (Plano de Ações): quem não pode criar
12788| // ação no Plano de Ações também não pode criar em inspeção/abordagem/árvore.
12789| $ssmaPreventionCanCreateLinkedActions = $ssmaCanCreateLinkedActions;
12790|
12791| $teamsForEventModal = $teams;
12792| $allMembersForEventPeople = $allMembers;
12793| $gestoresForEventModal = $company
12794| ? $this->buildSsmaEventModalGestores($company, $allMembers, $gestores, null)
12795| : $gestores;
12796|
12797| $ssmaEventFormDefaults = ['manager_id' => null, 'team_id' => null];
12798| $applyTeamEventScope = $occurrenceTeamFilterIds !== null && $occurrenceTeamFilterIds !== [];
12799|
12800| // Supervisor/Gestor de Equipe: filtra modais pelas equipes do cadastro (lista vazia = sem equipe — não zera selects).
12801| if ($applyTeamEventScope) {
12802| $teamIdStrScope = array_map('strval', $occurrenceTeamFilterIds);
12803| $teamsForEventModal = array_values(array_filter(
12804| $teams,
12805| static fn (array $t): bool => in_array((string) ($t['id'] ?? ''), $teamIdStrScope, true)
12806| ));
12807| $allowedMemberMap = $this->collectCompanyMemberIdsBelongingToCompanyTeams($company, $occurrenceTeamFilterIds);
12808| $allMembersForEventPeople = array_values(array_filter(
12809| $allMembers,
12810| static fn (array $m): bool => isset($allowedMemberMap[(int) ($m['id'] ?? 0)])
Request #20
deepseek-v4-flash
P:44.79K C:877 CR:39.94K CW:0
6230ms
Reasoning
Now I have more clarity. The UI flags override for Gestor de Equipe/Área (lines 12775-12780) sets `$ssmaCanMutateActionPlan = true`, but the actual backend endpoints (createAction at ~line 7977-7984, canCurrentUserEditSsmaAction at 16141, resolve at 16272) use `canMutateSsmaActionPlan()`, which:
- viewer → false
- tag 'Supervisor de Equipe'/'Supervisor'/TAG_SUPERVISOR_AREA → false
- else returns canManageSsmaOccurrences()
Does canManageSsmaOccurrences() return true for Gestor de Equipe? Let's see: canManageSsmaOccurrences() checks roles ROLE_SUPER_ADMIN/ROLE_MANAGER/ROLE_MANAGER_GESTOR/ROLE_TENANT; memberIsSsmaGestorAdministrador($member); then request attributes can_create/can_edit/can_delete; then tag->getCanCreate()/getCanEdit()/getCanDelete().
For a Gestor de Equipe tag, does it have can_create/can_edit on tag? Possibly tag can_create=true... but the codebase comments suggest otherwise: e.g., at line 12671-12674: "Só roles de gestão na empresa ou tag Gestor de Equipe / G. Administrador com manage". And line 12678: `\in_array($ssmaProductTagNameForRegister, ['Gestor de Equipe', 'Gestor Administrador'], true)` for ssmaCanRegisterNewOccurrence, which implies Gestor de Equipe is not necessarily caught by canManageSsmaOccurrences alone... Actually note this: `$ssmaCanRegisterNewOccurrence = ... || in_array('Gestor de Equipe', ...)` OR canMemberRegisterOwnOccurrence. Hmm.
Actually, the SSMA product tag 'Gestor de Equipe' may itself have can_create/can_edit/can_delete true on the tag (permission tag per product). The comment at line 12671-12674 says: "Hub Ocorrências — botão Registrar ocorrência ... Membro não cria (planilha), mesmo com can_create na tag. Só roles de gestão na empresa ou tag Gestor de Equipe / G. Administrador com manage." This suggests that can_create on the tag is present but shouldn't give create privileges to Membro for occurrence.
In the previous review, the evidence gathered indicated canManageSsmaOccurrences() could return true for those tags if tag can_create/can_edit/can_delete true; but the UI still has explicit override because it may not cover the tags.
Hmm. Let's be careful about the claim. Let me examine whether there's a divergence risk between `canMutateSsmaActionPlan()` and the UI flags. Consider a Gestor de Equipe who has tag 'Gestor de Equipe' for ssma product. `ssmaCurrentMemberPermissionTag()` returns the tag? Let me look at `ssmaCurrentMemberPermissionTag` implementation and `memberIsSsmaGestorAdministrador`.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 1430, "file_path": "src/Controller/SsmaController.php", "start_line": 1340}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 1340-1430
1340| /**
1341| * Acesso ao Plano de Ação: Supervisor/Gestor de Equipe via can_view, ou Membro executor/validador
1342| * vinculado a ação (SsmaStakeholderActionPermissionService).
1343| */
1344| private function canAccessSsmaActionPlanHub(): bool
1345| {
1346| if ($this->canAccessSsmaSupervisorSurface()) {
1347| return true;
1348| }
1349|
1350| $tag = $this->ssmaCurrentMemberPermissionTag();
1351| if ($tag && ($tag->getCanView() ?? false)) {
1352| return true;
1353| }
1354|
1355| $request = $this->requestStack->getCurrentRequest();
1356| if ($request && (bool) $request->attributes->get('can_view', false)) {
1357| return true;
1358| }
1359|
1360| $company = $this->getSsmaCompany();
1361| $user = $this->getUser();
1362| if (!$company instanceof Company || !$user instanceof User) {
1363| return false;
1364| }
1365|
1366| $member = $this->getCurrentCompanyMember($company, $user);
1367|
1368| return $this->ssmaStakeholderActionPermissionService->hasStakeholderAccess($member, $company);
1369| }
1370|
1371| /**
1372| * Entrada nas telas operacionais SSMA (ocorrência/prevenção): tag do produto, stakeholder ou role de gestão.
1373| * Não passa pelo GlobalPermissionListener.
1374| */
1375| private function canEnterSsmaOperationalArea(): bool
1376| {
1377| if (
1378| $this->isGranted('ROLE_SUPER_ADMIN')
1379| || $this->isGranted('ROLE_MANAGER')
1380| || $this->isGranted('ROLE_MANAGER_GESTOR')
1381| || $this->isGranted('ROLE_MANAGER_VIEWER')
1382| ) {
1383| return true;
1384| }
1385|
1386| if ($this->ssmaCurrentMemberPermissionTag() !== null) {
1387| return true;
1388| }
1389|
1390| $company = $this->getSsmaCompany();
1391| $user = $this->getUser();
1392| if (!$company instanceof Company || !$user instanceof User) {
1393| return false;
1394| }
1395|
1396| $member = $this->getCurrentCompanyMember($company, $user);
1397|
1398| return $this->ssmaStakeholderActionPermissionService->hasStakeholderAccess($member, $company);
1399| }
1400|
1401| private function ssmaCurrentMemberPermissionTag(): ?\App\Entity\PermissionTag
1402| {
1403| $user = $this->getUser();
1404| if (!$user instanceof User) {
1405| return null;
1406| }
1407|
1408| $company = $this->getSsmaCompany() ?? $user->getCompany();
1409| if (!$company instanceof Company) {
1410| return null;
1411| }
1412|
1413| $member = $this->getCurrentCompanyMember($company, $user);
1414| if (!$member) {
1415| return null;
1416| }
1417|
1418| return $this->resolveSsmaProductPermissionTagForMember($member);
1419| }
1420|
1421| /**
1422| * Alterações na Árvore respeitam can_create / can_edit / can_delete do produto ssma-cause-tree
1423| * (rotas ssma_cause_tree_*), sem o bypass global de ROLE_MANAGER_GESTOR de {@see canManageSsmaOccurrences()}.
1424| * Gestor de Equipe (tag em ssma-occurrences) também pode criar — espelha o botão na listagem.
1425| */
1426| private function canMutateSsmaCauseTreeFromProductTag(): bool
1427| {
1428| return $this->canCreateSsmaCauseTree();
1429| }
1430|
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "function memberIsSsmaGestorAdministrador|function isSsmaViewer|TAG_GESTOR_AREA|TAG_SUPERVISOR_AREA", "use_perl_regexp": true}
Result
File: src/Controller/SsmaController.php
Match lines: 12
10090| private function isSsmaViewer(): bool
10667| private function memberIsSsmaGestorAdministrador(?CompanyMembers $member): bool
11477| SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA,
11588| if ($tagNameScoped === 'Supervisor de Equipe' || $tagNameScoped === SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA) {
11592| return $tagPm && in_array($tagPm->getName(), ['Gestor de Equipe', SsmaAreaLimitationScope::TAG_GESTOR_AREA], true);
12708| $ssmaIsTagAreaSupervisor = $ssmaProductTagName === SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA;
12709| $ssmaIsTagAreaGestor = $ssmaProductTagName === SsmaAreaLimitationScope::TAG_GESTOR_AREA;
13117| && $ssmaProductTagName !== SsmaAreaLimitationScope::TAG_GESTOR_AREA
18767| SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA,
18768| SsmaAreaLimitationScope::TAG_GESTOR_AREA,
20076| && in_array($tag->getName(), ['Gestor de Equipe', SsmaAreaLimitationScope::TAG_GESTOR_AREA], true);
20094| && in_array($tag->getName(), ['Supervisor de Equipe', 'Supervisor', SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA], true);
Request #21
deepseek-v4-flash
P:47.13K C:353 CR:45.57K CW:0
2669ms
Reasoning
Let me look at canAccessSsmaActionPlanHub and see how canMutateSsmaActionPlan interacts with Gestor de Equipe tags. Let's read isSsmaViewer at 10090 and memberIsSsmaGestorAdministrador at 10667, and also SsmaAreaLimitationScope constants, plus how Gestor de Equipe / Area gestor tags would have canCreate/canEdit on permission tag. Let me also read lines 20060-20100 (canManageAllPreventionContentForCurrentUser) referenced in previous review.
Tool Calls (3)
file_read
Show Details
Arguments
{"end_line": 10140, "file_path": "src/Controller/SsmaController.php", "start_line": 10090}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 10090-10140
10090| private function isSsmaViewer(): bool
10091| {
10092| $tag = null;
10093| $user = $this->getUser();
10094| $member = null;
10095| if ($user instanceof User) {
10096| $company = $this->getSsmaCompany() ?? $user->getCompany();
10097| $member = $company instanceof Company ? $this->getCurrentCompanyMember($company, $user) : null;
10098| if ($this->memberIsSsmaGestorAdministrador($member)) {
10099| return false;
10100| }
10101| if ($member) {
10102| $tag = $this->resolveSsmaProductPermissionTagForMember($member);
10103| }
10104| }
10105|
10106| // Supervisor global via Symfony role
10107| if ($this->isGranted('ROLE_MANAGER_VIEWER')
10108| && !$this->isGranted('ROLE_MANAGER')
10109| && !$this->isGranted('ROLE_MANAGER_GESTOR')
10110| && !$this->isGranted('ROLE_SUPER_ADMIN')
10111| ) {
10112| return true;
10113| }
10114|
10115| // Supervisor via tag SSMA de produto (can_view=true, sem permissões de escrita).
10116| // Cobre tags como "Supervisor" ou qualquer tag com can_view=1 e can_create/edit/delete=0,
10117| // atribuídas diretamente ao produto SSMA sem alterar a role global do usuário.
10118| //
10119| // IMPORTANTE: verificar a PermissionTag real da DB (não só os request attributes).
10120| // setSsmaTechnicalOccurrenceAttributes() define can_view=true nos attributes para stakeholders/técnicos
10121| // cujo PermissionTag real tem can_view=false. Esses usuários NÃO são viewers reais — são membros
10122| // com acesso técnico especial. Se só checássemos os attributes, eles bypassariam o filtro de membro.
10123| $tag = $member instanceof CompanyMembers
10124| ? $this->resolveSsmaProductPermissionTagForMember($member)
10125| : null;
10126| if ($tag instanceof \App\Entity\PermissionTag) {
10127| if (!($tag->getCanView() ?? false)) {
10128| return false;
10129| }
10130|
10131| return !($tag->getCanCreate() ?? false)
10132| && !($tag->getCanEdit() ?? false)
10133| && !($tag->getCanDelete() ?? false);
10134| }
10135|
10136| $request = $this->requestStack->getCurrentRequest();
10137| if (!$request) {
10138| return false;
10139| }
10140|
file_read
Show Details
Arguments
{"end_line": 10700, "file_path": "src/Controller/SsmaController.php", "start_line": 10660}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 10660-10700
10660| && $tag->getName() === 'Gestor Administrador';
10661| }
10662|
10663| /**
10664| * Gestor Administrador no produto Ocorrências (PTBM), inclusive quando a heurística
10665| * SSMA ainda resolveria Membro por herança/propagação (regressão Mauro/Palloma).
10666| */
10667| private function memberIsSsmaGestorAdministrador(?CompanyMembers $member): bool
10668| {
10669| if (!$member instanceof CompanyMembers) {
10670| return false;
10671| }
10672|
10673| $memberId = (int) $member->getId();
10674| if ($memberId > 0 && array_key_exists($memberId, $this->memberIsSsmaGestorAdministradorCache)) {
10675| return $this->memberIsSsmaGestorAdministradorCache[$memberId];
10676| }
10677|
10678| $isGestorAdministrador = false;
10679| if ($this->isSsmaGestorAdministradorTag($this->resolveSsmaProductPermissionTagForMember($member))) {
10680| $isGestorAdministrador = true;
10681| } else {
10682| try {
10683| $occProduct = $this->resolveSsmaOccurrencesProductForPermission();
10684| if ($occProduct instanceof \App\Entity\Product) {
10685| $occTag = $this->permissionTagByMemberService->getPermissionTag($member, $occProduct);
10686| if ($this->isSsmaGestorAdministradorTag($occTag)) {
10687| $isGestorAdministrador = true;
10688| }
10689| }
10690| } catch (\Throwable) {
10691| }
10692| }
10693|
10694| if ($memberId > 0) {
10695| $this->memberIsSsmaGestorAdministradorCache[$memberId] = $isGestorAdministrador;
10696| }
10697|
10698| return $isGestorAdministrador;
10699| }
10700|
file_read
Show Details
Arguments
{"end_line": 20100, "file_path": "src/Controller/SsmaController.php", "start_line": 20060}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 20060-20100
20060| ) {
20061| return true;
20062| }
20063|
20064| $member = $this->getCurrentCompanyMember($company, $user);
20065| if (!$member instanceof CompanyMembers || !$this->canManageSsmaOccurrences()) {
20066| return false;
20067| }
20068|
20069| if ($this->memberIsSsmaGestorAdministrador($member)) {
20070| return true;
20071| }
20072|
20073| $tag = $this->resolveSsmaProductPermissionTagForMember($member);
20074|
20075| return $tag instanceof \App\Entity\PermissionTag
20076| && in_array($tag->getName(), ['Gestor de Equipe', SsmaAreaLimitationScope::TAG_GESTOR_AREA], true);
20077| }
20078|
20079| private function isSsmaPreventionSupervisorProfile(Company $company, User $user): bool
20080| {
20081| if (
20082| $this->isGranted('ROLE_MANAGER_VIEWER')
20083| && !$this->isGranted('ROLE_MANAGER')
20084| && !$this->isGranted('ROLE_MANAGER_GESTOR')
20085| && !$this->isGranted('ROLE_SUPER_ADMIN')
20086| ) {
20087| return true;
20088| }
20089|
20090| $member = $this->getCurrentCompanyMember($company, $user);
20091| $tag = $member ? $this->resolveSsmaProductPermissionTagForMember($member) : null;
20092|
20093| return $tag instanceof \App\Entity\PermissionTag
20094| && in_array($tag->getName(), ['Supervisor de Equipe', 'Supervisor', SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA], true);
20095| }
20096|
20097| /**
20098| * Pode criar/editar inspeção ou abordagem: gestão, supervisor (próprio registro)
20099| * ou colaborador com meta > 0 no kind — mesmo se a tag SSMA for só can_view.
20100| */
Request #22
deepseek-v4-flash
P:49.31K C:2.35K CR:47.36K CW:0
17732ms
Reasoning
Now the important observation: `isSsmaViewer()` at line 10126-10134 says a tag with can_view=true and can_create/edit/delete=0 is a viewer. `canMutateSsmaActionPlan()` first checks `isSsmaViewer()` then the tag names of supervisors.
For a Gestor de Equipe tag: Is it can_view only (no create/edit/delete)? Given comments at lines 20065-20076 (canManageAllPreventionContentForCurrentUser explicitly checks name 'Gestor de Equipe' / TAG_GESTOR_AREA after canManageSsmaOccurrences), this strongly suggests the tag name itself is used because the Gestor de Equipe tag does NOT grant create/edit/delete in the permission-tag product (e.g., a pure can_view tag with management name). Actually, this particular method returns true for canManageAllPreventionContent via tag name for Gestor de Equipe.
But what does canManageSsmaOccurrences() do for the Gestor de Equipe tag? canManageSsmaOccurrences checks the tag->getCanCreate()/canEdit/canDelete at line 11383-11385. Whether the Gestor de Equipe tag has can_create... unknown. The existing code implies that Gestor de Equipe tags are NOT covered by canManageSsmaOccurrences, since at line 12671-12674 comment: "Hub Ocorrências — botão Registrar ocorrência (empty state / FAB): Membro não cria (planilha), mesmo com can_create na tag. Só roles de gestão na empresa ou tag Gestor de Equipe / G. Administrador com manage." Hmm, actually that comment says "Membro não cria, mesmo com can_create na tag" meaning for Membro, the can_create flag on tag is ignored for registration button. So can_create in tag doesn't equal permission to register.
Also, line 12674: "Reutiliza $ssmaProductTagName (já corrigido por memberIsSsmaGestorAdministrador)". And line 12678: Register new occurrence button includes in_array 'Gestor de Equipe'.
And resolveActionPlanPanelMemberScope (line 618): `if ($this->canManageSsmaOccurrences()) return null;` — a Gestor de Equipe would be... then `memberIsSsmaGestorAdministrador` check. If neither, then tag name in ['Supervisor de Equipe','Supervisor','Gestor de Equipe'] → team filter... So a Gestor de Equipe is treated with team scope by resolveActionPlanPanelMemberScope, not unlimited. That means Gestor de Equipe is NOT caught by canManageSsmaOccurrences() (otherwise they'd return null). Good evidence.
So the divergence stands:
- Backend: `canMutateSsmaActionPlan()` → Gestor de Equipe tag name not in the excluded list, so goes to canManageSsmaOccurrences() → if that returns false for this user (not a gestor/admin by role, not tag can_create/edit/delete, not Gestor Administrador), then returns false. So creating/editing/resolving action would be forbidden on the backend.
- UI: `$ssmaCanMutateActionPlan = true` for Gestor de Equipe/Área (12777-12780), so buttons shown.
Unless Gestor de Equipe tag has can_create/edit/delete true in the permission tag... But then resolveActionPlanPanelMemberScope would have returned null (restricting) — wait no: resolveActionPlanPanelMemberScope at line 618 `canManageSsmaOccurrences()` -> return null — if tag can_create is true for Gestor de Equipe, then the member scope would be null and they'd see everything (not team-filtered). But the code at line 628 explicitly includes 'Gestor de Equipe' in the team scope list, which means Gestor de Equipe does NOT pass canManageSsmaOccurrences() generally (else that branch unreachable). Actually the branch at 628 runs only if not caught by canManageSsmaOccurrences and not Gestor Administrador. So there exists a configuration in which a Gestor de Equipe is not caught by canManageSsmaOccurrences. In that configuration, canMutateSsmaActionPlan() returns false (since tag not in supervisor-excluded list but canManageSsmaOccurrences false). Wait, tag names for Gestor de Equipe aren't in the canMutateSsmaActionPlan exclusion list; exclusion list = ['Supervisor de Equipe', 'Supervisor', TAG_SUPERVISOR_AREA]. So Gestor de Equipe proceeds to canManageSsmaOccurrences which likely returns false → false. UI overrides to true → buttons visible → 403 on submit. Yes divergence. High.
However, is it possible that Gestor de Equipe tags always have can_create/can_edit/can_delete set in the permission tag so that canManageSsmaOccurrences() returns true? If that were true, then there'd be no need for the explicit UI override at 12777 or the name checks at 20076 and 628. The fact the codebase repeatedly adds explicit name-based handling for 'Gestor de Equipe' / TAG_GESTOR_AREA after checking canManageSsmaOccurrences confirms these tags aren't covered by the permission-based method. So the divergence is real in the reachable configuration.
But wait — maybe TAG_GESTOR_AREA and 'Gestor de Equipe' are tags whose can_create etc are set true on ssma-occurrences product... The earlier resolveActionPlanPanelMemberScope explicitly adds 'Gestor de Equipe' to team scope, which runs when !canManageSsmaOccurrences. That means for 'Gestor de Equipe', canManageSsmaOccurrences() = false (at least in the team-gestor case). And ssmaCurrentMemberPermissionTag resolves the product tag for the member — if canManageSsmaOccurrences() returns false for a Gestor de Equipe, then canMutateSsmaActionPlan returns false, backend denies create, but UI flag true. Divergence confirmed → the user sees buttons and gets 403 on save, or (the plan mentions) alternatively menu hidden while backend allows — unlikely.
So Issue 1 stands as a high-priority inconsistency/divergence. But hold on — let me double-check whether the createAction endpoint's guard is `canMutateSsmaActionPlan` in the diff region at 7977. The diff at 7951: `if ($mode !== 'edit' && !$this->canAccessSsmaSupervisorSurface())` → changed to `if ($mode !== 'edit' && !$this->canMutateSsmaActionPlan())`. So creation endpoint now blocks supervisors. For edit mode, presumably guards elsewhere using canCurrentUserEditSsmaAction (line 16141) which now uses canMutateSsmaActionPlan. So the Gestor de Equipe could create? If canMutateSsmaActionPlan false → 403.
But wait — is createAction reachable only through the action plan panel ("Criar ação" linked)? Yes. So UI shows button because of override, backend denies.
However, let me double-check: maybe canManageSsmaOccurrences() returns true for Gestor de Equipe tags because these specific product tags (ssma-occurrences) DO have can_create/can_edit set, and the reason the code has explicit name checks elsewhere is that those methods have extra constraints. For example, canManageAllPreventionContentForCurrentUser (20065): `if (!$member ... || !$this->canManageSsmaOccurrences()) return false;` — then checks Gestor de Equipe name. This method requires canManageSsmaOccurrences() to be TRUE first, and then additionally checks the name to restrict... no wait: If canManageSsmaOccurrences() were true, this method would return true already for all such members (before the name check it returns true in the earlier role checks at 20060-20062; but for the member case, it requires canManageSsmaOccurrences() true AND Gestor de Equipe/Area name...). Hmm, that's interesting: 20065 `if (!$member instanceof CompanyMembers || !$this->canManageSsmaOccurrences()) { return false; }`. Then 20073-20076 checks tag name 'Gestor de Equipe'. So it returns TRUE only when canManageSsmaOccurrences() is true AND name is Gestor de Equipe. That's a restriction to team gestors among managers...? This is confusing — it implies there are members whose canManageSsmaOccurrences() is true and whose tag name is 'Gestor de Equipe' (i.e., their tag grants create/edit/delete). Hmm. So actually canManageSsmaOccurrences() CAN return true for someone whose resolved tag name is 'Gestor de Equipe'? That can only be if that tag has can_create/edit/delete = true.
Wait, then for such users canMutateSsmaActionPlan() would return true as well (isSsmaViewer() false since tag has canCreate, tag name not in excluded supervisor list, canManageSsmaOccurrences true). So in that case no divergence for Gestor de Equipe. Hmm, so the divergence isn't certain. But there could be Gestor de Equipe tags that are view-only? Possibly 'Gestor de Equipe' tag always has can_edit or can_create. Let's check data? Can't query DB.
Given the uncertainty, but there's evidence of two sources of truth (name-based explicit inclusion for UI and permission-based for backend). The safer approach in a code review is to flag divergence risk as a genuine maintainability + authorization-consistency concern (which is already in the summary), and also note `canMutateSsmaActionPlan` excludes TAG names 'Supervisor de Equipe'/'Supervisor'/TAG_SUPERVISOR_AREA, but does NOT exclude 'Supervisor de Área'? SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA maybe is "Supervisor de Área". Let me find those constants.
Let me find the SsmaAreaLimitationScope class file and its constants, and also check for "Supervisor de Equipe" vs team gestor tags used elsewhere in canMutateSsmaCauseTree etc.
Tool Calls (2)
file_find
Show Details
Arguments
{"query_name": "SsmaAreaLimitationScope.php"}
Result
src/Service/Ssma/SsmaAreaLimitationScope.php
code_search
Show Details
Arguments
{"search_text": "TAG_SUPERVISOR_AREA|TAG_GESTOR_AREA", "file_patterns": ["src/Service/Ssma/"]}
Result
No matches found
Request #23
deepseek-v4-flash
P:51.7K C:58 CR:51.58K CW:0
1312ms
Tool Calls (1)
file_read
Show Details
Arguments
{"file_path": "src/Service/Ssma/SsmaAreaLimitationScope.php"}
Result
File: src/Service/Ssma/SsmaAreaLimitationScope.php (Total lines: 167)
IS_TRUNCATED: false
LINE_RANGE: 1-167
1|<?php
2|
3|declare(strict_types=1);
4|
5|namespace App\Service\Ssma;
6|
7|/**
8| * Escopo de limitação por área organizacional no SSMA.
9| *
10| * Quem tem area_limitation vê a própria área e todas as subáreas (qualquer profundidade).
11| * Nunca vê a área pai nem irmãs fora da subárvore.
12| */
13|final class SsmaAreaLimitationScope
14|{
15| public const TAG_SUPERVISOR_AREA = 'Supervisor de Área';
16| public const TAG_GESTOR_AREA = 'Gestor de Área';
17|
18| /**
19| * @return list<string>
20| */
21| public static function namedAreaScopeTags(): array
22| {
23| return [self::TAG_SUPERVISOR_AREA, self::TAG_GESTOR_AREA];
24| }
25|
26| public static function shouldApplyAreaLimitation(
27| ?string $tagName,
28| ?bool $areaLimitation,
29| bool $isPlatformAdmin,
30| ): bool {
31| if ($isPlatformAdmin) {
32| return false;
33| }
34|
35| // Supervisor (empresa) e Gestor Administrador operam sem recorte de área.
36| if (in_array($tagName, ['Gestor Administrador', 'Supervisor'], true)) {
37| return false;
38| }
39|
40| if (in_array($tagName, self::namedAreaScopeTags(), true)) {
41| return true;
42| }
43|
44| return (bool) $areaLimitation;
45| }
46|
47| /**
48| * Inclui as áreas raiz e todos os descendentes. Não sobe para pais.
49| *
50| * @param array<int, int|null> $parentByAreaId id da área => id do pai (null se raiz)
51| * @param list<int> $rootAreaIds
52| *
53| * @return list<int>
54| */
55| public static function expandWithDescendants(array $parentByAreaId, array $rootAreaIds): array
56| {
57| $childrenByParent = [];
58| foreach ($parentByAreaId as $areaId => $parentId) {
59| $areaId = (int) $areaId;
60| if ($areaId <= 0) {
61| continue;
62| }
63| $parentId = $parentId !== null ? (int) $parentId : 0;
64| if ($parentId > 0) {
65| $childrenByParent[$parentId][] = $areaId;
66| }
67| }
68|
69| $allowed = [];
70| $queue = [];
71| foreach ($rootAreaIds as $rootId) {
72| $rootId = (int) $rootId;
73| if ($rootId > 0) {
74| $queue[] = $rootId;
75| }
76| }
77|
78| while ($queue !== []) {
79| $id = array_shift($queue);
80| if (isset($allowed[$id])) {
81| continue;
82| }
83| $allowed[$id] = true;
84| foreach ($childrenByParent[$id] ?? [] as $childId) {
85| $queue[] = $childId;
86| }
87| }
88|
89| return array_keys($allowed);
90| }
91|
92| /**
93| * Inspeção entra no recorte de área se a equipe está no recorte.
94| *
95| * Quando a equipe tem área conhecida fora do recorte, o registro fica escondido mesmo que
96| * uma pessoa da área participe — é isso que preserva a interseção com a limitação de equipe.
97| * O fallback por pessoa vale só quando a equipe não informa área: sem equipe, ou equipe
98| * listada em `$teamIdsWithoutArea` (sem `process_department`).
99| *
100| * @param list<array<string, mixed>> $inspections
101| * @param list<int> $allowedTeamIds
102| * @param array<int, true> $allowedMemberIds
103| * @param list<int> $teamIdsWithoutArea
104| *
105| * @return list<array<string, mixed>>
106| */
107| public static function filterInspectionsForAreaScope(
108| array $inspections,
109| array $allowedTeamIds,
110| array $allowedMemberIds,
111| array $teamIdsWithoutArea,
112| ): array {
113| $teamIdStr = array_map('strval', $allowedTeamIds);
114| $withoutAreaStr = array_map('strval', $teamIdsWithoutArea);
115|
116| return array_values(array_filter(
117| $inspections,
118| static function (array $inspection) use ($teamIdStr, $allowedMemberIds, $withoutAreaStr): bool {
119| $teamId = $inspection['team_id'] ?? null;
120| $hasTeam = $teamId !== null && $teamId !== '';
121| if ($hasTeam && in_array((string) $teamId, $teamIdStr, true)) {
122| return true;
123| }
124| if ($hasTeam && !in_array((string) $teamId, $withoutAreaStr, true)) {
125| return false;
126| }
127|
128| foreach ([
129| (int) ($inspection['created_by_id'] ?? 0),
130| (int) ($inspection['safety_responsible_id'] ?? 0),
131| ] as $memberId) {
132| if ($memberId > 0 && isset($allowedMemberIds[$memberId])) {
133| return true;
134| }
135| }
136|
137| foreach ((array) ($inspection['participants_ids'] ?? []) as $participantId) {
138| if (isset($allowedMemberIds[(int) $participantId])) {
139| return true;
140| }
141| }
142|
143| return false;
144| }
145| ));
146| }
147|
148| /**
149| * @param list<array<string, mixed>> $abordagens
150| * @param array<int, true> $allowedMemberIds
151| *
152| * @return list<array<string, mixed>>
153| */
154| public static function filterAbordagensByMemberIds(array $abordagens, array $allowedMemberIds): array
155| {
156| return array_values(array_filter(
157| $abordagens,
158| static function (array $abordagem) use ($allowedMemberIds): bool {
159| $observadorId = (int) ($abordagem['observador_id'] ?? 0);
160|
161| return $observadorId > 0 && isset($allowedMemberIds[$observadorId]);
162| }
163| ));
164| }
165|
166|}
167|
Request #24
deepseek-v4-flash
P:53.48K C:1.05K CR:51.71K CW:0
8886ms
Reasoning
OK. Now let me check the actual handling of supervisors tags. In canMutateSsmaActionPlan, excluded: 'Supervisor de Equipe', 'Supervisor', 'Supervisor de Área' (TAG_SUPERVISOR_AREA). It doesn't exclude 'Gestor de Equipe' or 'Gestor de Área' by name, leaving them to canManageSsmaOccurrences(). UI overrides force mutate true for Gestor de Equipe/Área regardless. This is the divergence to document.
But wait — there is an inconsistency concern too: isSsmaViewer() at line 10126 returns true when tag has can_view true and can_create/edit/delete false. But the explicit name check in canMutateSsmaActionPlan for the Supervisor names is because those tags may have can_view true but also, e.g., can_create true on some other product? Actually they resolved product tag via resolveSsmaProductPermissionTagForMember; a 'Supervisor de Equipe' tag likely has can_create false so isSsmaViewer() would catch it anyway, unless the member also has another tag with write permission on the same product (the resolve may combine). Anyway.
The critical thing: two sources of truth for Gestor de Equipe/Área. This is a real risk worth flagging (it's already flagged in summary as high). I should post a code comment about the divergence.
However — before posting, let me confirm the earlier "offcanvas ids mismatch" finding and the "mine filter empty list" finding. Let me also confirm the off-canvas template ids. Also, let me inspect how the mine filter interacts with `buildFilterPayload`'s memberScope param, i.e., that param semantics (map memberId=>true) and whether passing `[$mineId => true]` in the initial buildFilterPayload vs overriding with the mine override. It calls buildFilterPayload twice - first with resolveActionPlanPanelMemberScope($company), and if mine=1 & mineId>0, overrides with [$mineId=>true]. The mine filter would restrict even further, which is fine. If mineId=0, it silently returns the first (unrestricted or scope-based) payload — matches plan issue 2.
Now issue 2 severity: If a user is not a company member but has SSMA access via request attribute can_view (stakeholder/técnico), getCurrentCompanyMember returns null → mine=1 → filter ignored entirely → returns full scope. This is a minor issue because the initial scope filter may already restrict. But if the user is gestor/admin (no member? Actually gestor/admin typically has member). A user with no member but access to panel would be... hmm canAccessSsmaActionPlanHub returns true via canAccessSsmaSupervisorSurface (role-based manager etc). Manager roles have a member record presumably. But there could be edge cases where getCurrentCompanyMember returns null even though isGranted ROLE_MANAGER. Then mine filter silently doesn't apply and returns everything in scope, exposing actions the user marked to see "Minhas ações". For manager that's fine (they can see all anyway). But for a plain member (stakeholder) with access only through stakeholder service? hasStakeholderAccess requires member. So member exists. Actually member is required for most paths. This seems to be medium/low. I'll frame as: when member can't be resolved, the checkbox gives no protection and the request returns the full set; better return empty list (consistent with "negar por padrão").
Now issue 3 from the plan — mine filter only matches executor, not validator. We saw in the previous summary: "get_function_info(SsmaActionPlanPanelService.filterByMemberScope): confirmado que o filtro por membro considera tanto validator_member_id quanto responsible_ids — o escopo da questão 3 do plano não é um bug." Good — so skip.
Let me verify this quickly by reading the code that uses the member scope parameter (the arg that receives `[$mineId=>true]`). Let me search within the service for the parameter used for member filter.
Tool Calls (2)
code_search
Show Details
Arguments
{"file_patterns": ["src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php"], "search_text": "memberScope|responsible_ids|validator_member_id|filterByMember|member", "use_perl_regexp": true}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php
Match lines: 90
8|use App\Entity\CompanyMembers;
32| * @param array<int, true>|null $memberScopeIds null = sem restrição por membro
45| ?array $memberScopeIds,
58| if ($memberScopeIds !== null) {
59| $allActions = $this->filterByMemberScope($allActions, $memberScopeIds);
107| $meta['members_by_id'],
144| $meta['members_by_id'],
185| $memberOptions = [['value' => '', 'text' => 'Todos']];
186| foreach ($meta['members_by_id'] as $member) {
187| $memberOptions[] = ['value' => (string) $member['id'], 'text' => $member['name']];
213| 'overview_members' => $memberOptions,
258| a.responsible_ids, a.origem, a.origem_id, a.validation_status, a.validator_member_id,
278| 'responsible_ids' => json_decode((string) ($row['responsible_ids'] ?? '[]'), true) ?? [],
283| 'validator_member_id' => (int) ($row['validator_member_id'] ?? 0),
296| * @return array{teams: list<array<string, mixed>>, members_by_id: array<int, array{id: int, name: string, vinculo: string}>, member_vinculo: array<int, string>}
303| $teams[] = ['id' => $team->getId(), 'name' => $team->getName(), 'members' => []];
306| $teamMembersMap = [];
307| $memberRows = $conn->executeQuery(
308| 'SELECT id, teams FROM company_members WHERE company_id = ? AND is_removed = 0 AND teams IS NOT NULL AND teams != ""',
311| foreach ($memberRows as $mr) {
314| $teamMembersMap[$tid][] = (int) $mr['id'];
319| $teams[$i]['members'] = $teamMembersMap[(string) $team['id']] ?? [];
322| $membersById = [];
323| $memberVinculo = [];
324| $members = $this->entityManager->getRepository(CompanyMembers::class)
326| foreach ($members as $member) {
327| if (!$member instanceof CompanyMembers) {
330| $name = trim($member->getUser()?->getProfile()?->getFirstName() . ' ' . $member->getUser()?->getProfile()?->getLastName());
332| $name = (string) ($member->getEmail() ?? '');
337| $vinculo = $this->resolveMemberVinculoCode($member);
338| $membersById[$member->getId()] = ['id' => $member->getId(), 'name' => $name, 'vinculo' => $vinculo];
339| $memberVinculo[$member->getId()] = $vinculo;
344| 'members_by_id' => $membersById,
345| 'member_vinculo' => $memberVinculo,
349| private function resolveMemberVinculoCode(CompanyMembers $member): string
351| if ($member->isAssistant()) {
354| if ($member->getTreeType() === 'partner' || $member->isPartner()) {
363| * @param array<int, true> $memberScopeIds
367| private function filterByMemberScope(array $actions, array $memberScopeIds): array
369| if ($memberScopeIds === []) {
373| return array_values(array_filter($actions, function (array $action) use ($memberScopeIds): bool {
374| $validatorId = (int) ($action['validator_member_id'] ?? 0);
375| if ($validatorId > 0 && isset($memberScopeIds[$validatorId])) {
378| foreach ((array) ($action['responsible_ids'] ?? []) as $id) {
379| if (isset($memberScopeIds[(int) $id])) {
390| * @param array{teams: list<array<string, mixed>>, member_vinculo: array<int, string>} $meta
396| $teamMemberIds = null;
398| $teamMemberIds = [];
401| foreach ($t['members'] ?? [] as $mid) {
402| $teamMemberIds[(int) $mid] = true;
409| return array_values(array_filter($actions, function (array $action) use ($teamMemberIds, $vinculo, $meta): bool {
410| $ids = array_values(array_filter(array_map('intval', (array) ($action['responsible_ids'] ?? []))));
411| $validatorId = (int) ($action['validator_member_id'] ?? 0);
419| if ($teamMemberIds !== null) {
422| if (isset($teamMemberIds[$id])) {
435| if (($meta['member_vinculo'][$id] ?? '') === $vinculo) {
495| * @param array{members_by_id: array<int, array{id: int, name: string, vinculo: string}>} $meta
514| $ids = array_map('intval', (array) ($action['responsible_ids'] ?? []));
520| if ((int) ($action['validator_member_id'] ?? 0) !== (int) $valResponsible) {
613| * @param array<int, array{id: int, name: string}> $membersById
621| array $membersById,
712| 'responsible' => $this->resolveResponsibleDisplay((array) ($action['responsible_ids'] ?? []), $membersById),
713| 'executors' => $this->resolveResponsibleDisplay((array) ($action['responsible_ids'] ?? []), $membersById),
715| array_values(array_filter([(int) ($action['validator_member_id'] ?? 0)])),
716| $membersById
775| 'responsible_chart' => $this->buildResponsibleChart($filtered, $membersById),
787| * @param array<int, array{id: int, name: string}> $membersById
796| array $membersById,
830| $allDetails = $this->buildOverviewActionDetails($filtered, $membersById);
887| 'average_execution_by_person' => $this->buildAverageTimeByPerson($filtered, $membersById),
966| * @param array<int, array{id: int, name: string}> $membersById
970| private function buildResponsibleChart(array $filtered, array $membersById): array
978| $responsibleIds = array_values(array_filter(array_map('intval', (array) ($action['responsible_ids'] ?? []))));
982| foreach ($responsibleIds as $memberId) {
983| if (!isset($counts[$memberId])) {
984| $name = $memberId === 0 ? 'Sem responsável' : (string) ($membersById[$memberId]['name'] ?? 'Membro #' . $memberId);
985| $counts[$memberId] = ['name' => $name, 'execution' => 0, 'validation' => 0];
988| ++$counts[$memberId]['validation'];
990| ++$counts[$memberId]['execution'];
1052| * @param array<int, array{id: int, name: string}> $membersById
1056| private function buildOverviewActionDetails(array $filtered, array $membersById): array
1074| $respId = (int) (((array) ($action['responsible_ids'] ?? []))[0] ?? 0);
1086| 'responsible' => (string) ($membersById[$respId]['name'] ?? '—'),
1157| * @param array<int, array{id: int, name: string}> $membersById
1161| private function buildAverageTimeByPerson(array $filtered, array $membersById): array
1168| $respId = (int) (((array) ($action['responsible_ids'] ?? []))[0] ?? 0);
1169| $label = (string) ($membersById[$respId]['name'] ?? 'Sem responsável');
1242| * @param array<int, array{id: int, name: string}> $membersById
1246| private function resolveResponsibleDisplay(array $responsibleIds, array $membersById): array
1250| $name = (string) ($membersById[$id]['name'] ?? ('M' . $id));
code_search
Show Details
Arguments
{"search_text": "ssma-ap-action-view|ssmaApActionView|openOffcanvas", "use_perl_regexp": true}
Result
Note: The results have been truncated. Only showing first 100 results.
File: docs/ChatPrincipal/meet/MAPEAMENTO_FLUXO_LIGACAO_ADMIN_YANN.md
Match lines: 2
30| - `openOffCanvasCall()` (em `chat-offcanvas-openers.js`) abre `#offCanvasCall` e chama `window.initializeCallUI(...)`.
51| - abre o offcanvas imediatamente (`openOffCanvasCall`);
File: public/assets/controllers/file-management/advanced-search.js
Match lines: 2
321| if (typeof window.openOffcanvasfmAdvancedSearchOffcanvas === 'function') {
322| window.openOffcanvasfmAdvancedSearchOffcanvas();
File: public/build/time_management.3cae872e.js
Match lines: 1
2|(self.webpackChunk=self.webpackChunk||[]).push([[550],{195(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>d});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23418),n(64346),n(23792),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(27495),n(38781),n(47764),n(23500),n(62953);var r=n(74848),a=n(96540);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){var t=e.isOpen,n=e.onClose,o=e.currentFilters,i=e.onApply,l=e.onClear,u=c((0,a.useState)(o),2),d=u[0],f=u[1];(0,a.useEffect)(function(){f(o)},[o]);return t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"modal-backdrop fade show",style:{zIndex:1040},onClick:function(e){e.stopPropagation(),n()}}),(0,r.jsx)("div",{className:"modal fade show d-block",style:{zIndex:1050},tabIndex:-1,onClick:function(e){e.target===e.currentTarget&&n()},children:(0,r.jsx)("div",{className:"modal-dialog modal-dialog-centered",style:{maxWidth:"400px"},children:(0,r.jsxs)("div",{className:"modal-content",onClick:function(e){return e.stopPropagation()},children:[(0,r.jsxs)("div",{className:"modal-header",children:[(0,r.jsx)("h5",{className:"modal-title",style:{fontFamily:"Inter",fontSize:"18px",fontWeight:600,color:"#5C5D5D"},children:"Filtros"}),(0,r.jsx)("button",{type:"button",className:"close",onClick:function(e){e.preventDefault(),e.stopPropagation(),n()},"aria-label":"Fechar",children:(0,r.jsx)("span",{"aria-hidden":"true",children:"×"})})]}),(0,r.jsxs)("div",{className:"modal-body",children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"recordType",className:"mb-2",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:400,color:"rgba(92, 93, 93, 0.60)"},children:"Tipo de Registro"}),(0,r.jsxs)("select",{id:"recordType",className:"form-control",value:d.recordType,onChange:function(e){return f(s(s({},d),{},{recordType:e.target.value}))},style:{fontFamily:"Inter",fontSize:"14px"},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"first_check_in",children:"Primeira Entrada"}),(0,r.jsx)("option",{value:"first_check_out",children:"Primeira Saída"}),(0,r.jsx)("option",{value:"second_check_in",children:"Segunda Entrada"}),(0,r.jsx)("option",{value:"second_check_out",children:"Segunda Saída"})]})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"validatedBy",className:"mb-2",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:400,color:"rgba(92, 93, 93, 0.60)"},children:"Tipo de Validação"}),(0,r.jsxs)("select",{id:"validatedBy",className:"form-control",value:d.validatedBy,onChange:function(e){return f(s(s({},d),{},{validatedBy:e.target.value}))},style:{fontFamily:"Inter",fontSize:"14px"},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"selfie",children:"Selfie"}),(0,r.jsx)("option",{value:"screenshot",children:"Screenshot"}),(0,r.jsx)("option",{value:"geolocation",children:"Geolocalização"}),(0,r.jsx)("option",{value:"manual",children:"Manual"})]})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"channel",className:"mb-2",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:400,color:"rgba(92, 93, 93, 0.60)"},children:"Canal"}),(0,r.jsxs)("select",{id:"channel",className:"form-control",value:d.channel,onChange:function(e){return f(s(s({},d),{},{channel:e.target.value}))},style:{fontFamily:"Inter",fontSize:"14px"},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"mobile",children:"App"}),(0,r.jsx)("option",{value:"web",children:"Navegador"}),(0,r.jsx)("option",{value:"sistema",children:"Sistema"})]})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"mode",className:"mb-2",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:400,color:"rgba(92, 93, 93, 0.60)"},children:"Modo"}),(0,r.jsxs)("select",{id:"mode",className:"form-control",value:d.mode,onChange:function(e){return f(s(s({},d),{},{mode:e.target.value}))},style:{fontFamily:"Inter",fontSize:"14px"},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"individual",children:"Individual"}),(0,r.jsx)("option",{value:"coletivo",children:"Coletivo"})]})]})]}),(0,r.jsxs)("div",{className:"modal-footer",children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel btn-sm",onClick:function(){f({recordType:"",validatedBy:"",channel:"",mode:""}),l(),n()},style:{fontFamily:"Inter"},children:"Limpar Filtros"}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary btn-sm",onClick:function(){i(d),n()},style:{fontFamily:"Inter",backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:"Aplicar"})]})]})})})]}):null}},1125(e,t,n){"use strict";n.d(t,{A:()=>a});var r=n(74848);function a(e){var t=e.message,n=void 0===t?"Carregando...":t;return(0,r.jsxs)("div",{className:"d-flex justify-content-center align-items-center",style:{padding:"40px"},children:[(0,r.jsx)("div",{className:"spinner-border text-primary",role:"status",children:(0,r.jsx)("span",{className:"sr-only",children:n})}),(0,r.jsx)("span",{style:{marginLeft:"10px",color:"#5C5D5D"},children:n})]})}},1806(e,t,n){"use strict";n.d(t,{A:()=>s,M:()=>l});var r=n(74848),a=n(96540),o=n(40961),i={sm:"modal-sm-custom",md:"",lg:"modal-lg",xl:"modal-xl"};function s(e){var t=e.show,n=e.onClose,s=e.title,l=e.children,c=e.footer,u=e.size,d=void 0===u?"md":u,f=e.className,m=void 0===f?"":f;if((0,a.useEffect)(function(){if(t)return document.body.classList.add("mhs-modal-open"),function(){document.body.classList.remove("mhs-modal-open")}},[t]),!t)return null;var p="sm"===d?"16px":"24px",h=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"modal fade show d-block mhs-modal-base",tabIndex:-1,role:"dialog","aria-modal":"true",onClick:n,children:(0,r.jsx)("div",{className:"modal-dialog modal-dialog-centered mhs-modal-dialog ".concat(i[d]),role:"document",onClick:function(e){return e.stopPropagation()},children:(0,r.jsxs)("div",{className:"modal-content mhs-modal-content ".concat(m),children:[(0,r.jsxs)("div",{className:"modal-header mhs-modal-header",style:{padding:p},children:[(0,r.jsx)("h4",{className:"modal-title mhs-modal-title",children:s}),(0,r.jsx)("button",{type:"button",className:"close mhs-modal-close","aria-label":"Close",onClick:n,children:(0,r.jsx)("span",{className:"mhs-modal-close-icon","aria-hidden":"true",children:"×"})})]}),(0,r.jsx)("div",{className:"modal-body mhs-modal-body",style:{padding:p},children:l}),c&&(0,r.jsx)("div",{className:"modal-footer mhs-modal-footer",style:{padding:"16px ".concat(p)},children:c})]})})}),(0,r.jsx)("div",{className:"modal-backdrop fade show mhs-modal-backdrop",onClick:n})]});return(0,o.createPortal)(h,document.body)}var l=function(e){var t=e.onCancel,n=e.onConfirm,a=e.cancelText,o=void 0===a?"Fechar":a,i=e.confirmText,s=void 0===i?"Confirmar":i,l=e.confirmDisabled,c=void 0!==l&&l;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mhs-btn-cancel",onClick:t,children:o}),(0,r.jsx)("button",{type:"button",className:"btn mhs-btn-primary",onClick:n,disabled:c,children:s})]})}},2698(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>l});n(52675),n(89463),n(2259),n(23418),n(74423),n(64346),n(23792),n(34782),n(23288),n(62010),n(9868),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(1806);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e){var t=e.isOpen,n=e.onUpload,s=e.onClose,l=i((0,a.useState)(null),2),c=l[0],u=l[1],d=i((0,a.useState)(null),2),f=d[0],m=d[1],p=i((0,a.useState)(null),2),h=p[0],v=p[1],b=i((0,a.useState)(!1),2),y=b[0],g=b[1],x=(0,a.useRef)(null),j=["image/png","image/jpeg","image/jpg"],w=function(e){var t=function(e){return j.includes(e.type)?e.size>5242880?"Arquivo muito grande. Máximo: 5MB.":null:"Formato inválido. Use PNG, JPG ou JPEG."}(e);if(t)v(t);else{v(null),u(e);var n=new FileReader;n.onload=function(e){var t;m(null===(t=e.target)||void 0===t?void 0:t.result)},n.readAsDataURL(e)}},S=function(){var e;null===(e=x.current)||void 0===e||e.click()},N=function(){u(null),m(null),v(null),x.current&&(x.current.value="")},k=function(){N(),s()};return t?(0,r.jsx)(o.A,{show:t,onClose:k,title:"Upload de Screenshot",size:"lg",footer:c?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:N,children:"Selecionar Outra"}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary",onClick:function(){c&&(n(c),N())},children:"Confirmar"})]}):(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:k,children:"Cancelar"}),children:(0,r.jsxs)("div",{style:{padding:"24px"},children:[h&&(0,r.jsxs)("div",{className:"alert d-flex align-items-center",style:{backgroundColor:"#E6F7F9",borderColor:"#17A2B8",color:"#0C5460",gap:"12px"},children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle",style:{color:"#17A2B8",fontSize:"24px"}}),(0,r.jsx)("div",{style:{flex:1},children:h})]}),c?(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsxs)("div",{className:"position-relative d-inline-block",children:[(0,r.jsx)("img",{src:f||"",alt:"Preview",className:"img-fluid rounded shadow",style:{maxHeight:"400px"}}),(0,r.jsx)("button",{type:"button",className:"btn btn-sm btn-danger position-absolute top-0 end-0 m-2",onClick:N,title:"Remover imagem",children:(0,r.jsx)("i",{className:"fas fa-times"})})]}),(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsx)("p",{className:"mb-1",children:(0,r.jsx)("strong",{children:c.name})}),(0,r.jsxs)("p",{className:"text-muted small",children:[(c.size/1024/1024).toFixed(2)," MB"]})]}),(0,r.jsx)("div",{className:"alert alert-success mt-3",children:"Imagem selecionada com sucesso!"})]}):(0,r.jsxs)("div",{className:"border border-2 rounded p-5 text-center ".concat(y?"border-primary bg-light":"border-dashed"),style:{borderStyle:"dashed",minHeight:"300px",display:"flex",flexDirection:"column",justifyContent:"center",cursor:"pointer"},onDragEnter:function(e){e.preventDefault(),e.stopPropagation(),g(!0)},onDragLeave:function(e){e.preventDefault(),e.stopPropagation(),g(!1)},onDragOver:function(e){e.preventDefault(),e.stopPropagation()},onDrop:function(e){e.preventDefault(),e.stopPropagation(),g(!1);var t=e.dataTransfer.files[0];t&&w(t)},onClick:S,children:[(0,r.jsx)("i",{className:"fas fa-cloud-upload-alt fa-4x mb-3 ".concat(y?"text-primary":"text-muted")}),(0,r.jsx)("h5",{className:"mb-2",children:y?"Solte a imagem aqui":"Arraste uma imagem ou clique para selecionar"}),(0,r.jsxs)("p",{className:"text-muted mb-3",children:["Formatos aceitos: PNG, JPG, JPEG",(0,r.jsx)("br",{}),"Tamanho máximo: 5MB"]}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary",onClick:function(e){e.stopPropagation(),S()},children:"Selecionar Arquivo"}),(0,r.jsx)("input",{ref:x,type:"file",accept:"image/png,image/jpeg,image/jpg",onChange:function(e){var t,n=null===(t=e.target.files)||void 0===t?void 0:t[0];n&&w(n)},style:{display:"none"}})]})]})}):null}},2799(e,t,n){"use strict";function r(){return null}n.r(t),n.d(t,{default:()=>r})},4818(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>c});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(48598),n(62062),n(34782),n(23288),n(62010),n(9868),n(26099),n(3362),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540);function o(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||s(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||s(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e){var t=e.projects,s=void 0===t?[]:t,l=i((0,a.useState)(null),2),c=l[0],u=l[1],d=i((0,a.useState)(0),2),f=d[0],m=d[1];(0,a.useEffect)(function(){"undefined"!=typeof window&&n.e(416).then(n.bind(n,59416)).then(function(e){u(function(){return e.default})}).catch(function(e){console.error("Erro ao carregar ApexCharts:",e)})},[]),(0,a.useEffect)(function(){s.length>0&&m(function(e){return e+1})},[s]);var p=(0,a.useMemo)(function(){return 0===s.length?[{name:"Sem dados",data:[[0,0,0]],color:"#E0E0E0"}]:s.map(function(e){return{name:e.name,data:e.data||[[0,0,0]],color:e.color||"#186073"}})},[s]),h=(0,a.useMemo)(function(){if(0===s.length)return{maxBudget:100,minBudget:0,yAxisMax:110,yAxisMin:0,yTickAmount:4,xAxisMax:100,xAxisMin:0,xTickAmount:10};var e=s.map(function(e){return e.budget}),t=Math.max.apply(Math,o(e)),n=Math.min.apply(Math,o(e)),r=Math.ceil(1.2*t),a=Math.max(0,Math.floor(.8*n)),i=.1*t;if(r-a<i){var l=(t+n)/2;a=Math.max(0,l-i/2),r=l+i/2}var c=r>1e3?5:4,u=s.map(function(e){return e.timeSpentPercent||0}),d=Math.max.apply(Math,o(u)),f=Math.min.apply(Math,o(u)),m=Math.min(100,Math.ceil(1.2*d)),p=Math.max(0,Math.floor(.8*f));if(m-p<5){var h=(d+f)/2;p=Math.max(0,h-2.5),m=Math.min(100,h+2.5)}var v=m-p;return{maxBudget:t,minBudget:n,yAxisMax:r,yAxisMin:a,yTickAmount:c,xAxisMax:m,xAxisMin:p,xTickAmount:v>50?10:v>20?5:v>5?4:3}},[s]),v=(h.maxBudget,h.minBudget,h.yAxisMax),b=h.yAxisMin,y=h.yTickAmount,g=h.xAxisMax,x=h.xAxisMin,j=h.xTickAmount,w=(0,a.useMemo)(function(){return{chart:{height:320,type:"bubble",toolbar:{show:!1},zoom:{enabled:!1},id:"project-budget-scatter-".concat(f),animations:{enabled:!0,easing:"easeinout",speed:800}},dataLabels:{enabled:!0,formatter:function(e,t){return t&&t.series&&t.series[t.seriesIndex]?t.series[t.seriesIndex].name:t&&t.w&&t.w.globals&&t.w.globals.seriesNames&&t.w.globals.seriesNames[t.seriesIndex]?t.w.globals.seriesNames[t.seriesIndex]:""},style:{fontSize:"12px",fontFamily:"Inter",fontWeight:500,colors:["#5C5D5D"]}},colors:p.map(function(e){return e.color||"#186073"}),xaxis:{title:{text:"Tempo Gasto (%)",offsetY:6,style:{color:"#5C5D5D",fontSize:"12px",fontFamily:"Inter",fontWeight:400}},min:x,max:g,tickAmount:j,labels:{style:{colors:"#5C5D5D",fontSize:"12px",fontFamily:"Inter"}},axisBorder:{show:!1},axisTicks:{show:!1}},yaxis:{title:{text:"Orçamento (R$)",rotate:-90,offsetX:0,style:{color:"#5C5D5D",fontSize:"12px",fontFamily:"Inter",fontWeight:400}},min:b,max:v,tickAmount:y,labels:{style:{colors:"#5C5D5D",fontSize:"12px",fontFamily:"Inter"},formatter:function(e){return e>=1e3?"".concat((e/1e3).toFixed(0),"k"):e.toFixed(0)}},axisBorder:{show:!1},axisTicks:{show:!1}},grid:{borderColor:"#E0E0E0",strokeDashArray:3,padding:{bottom:24},xaxis:{lines:{show:!0}},yaxis:{lines:{show:!0}}},tooltip:{enabled:!0,custom:function(e){var t=e.seriesIndex,n=e.dataPointIndex,r=e.w,a=r.globals.seriesNames[t],o=r.globals.initialSeries[t].data[n],i=o[0].toFixed(2),s=o[1],l=o[2],c=s.toLocaleString("pt-BR",{minimumFractionDigits:2,maximumFractionDigits:2});return'\n\t\t\t\t\t<div style="background: white; border: 1px solid #ccc; padding: 10px; border-radius: 4px; font-size: 12px;">\n\t\t\t\t\t\t<p style="margin: 0; font-weight: 600; color: '.concat(r.config.colors[t],';">').concat(a,'</p>\n\t\t\t\t\t\t<p style="margin: 4px 0 0 0; color: #5C5D5D;">Tempo Gasto: ').concat(i,'%</p>\n\t\t\t\t\t\t<p style="margin: 4px 0 0 0; color: #5C5D5D;">Orçamento: R$ ').concat(c,'</p>\n\t\t\t\t\t\t<p style="margin: 4px 0 0 0; color: #5C5D5D;">Membros: ').concat(l,"</p>\n\t\t\t\t\t</div>\n\t\t\t\t")}},legend:{show:!0,position:"bottom",horizontalAlign:"center",offsetY:14,fontSize:"12px",fontFamily:"Inter",fontWeight:400,labels:{colors:"#5C5D5D"},markers:{size:10,shape:"circle"},itemMargin:{horizontal:12,vertical:8}},plotOptions:{bubble:{minBubbleRadius:15,maxBubbleRadius:60,zScaling:!0}},fill:{opacity:.8}}},[p,v,b,y,g,x,j,f]);return c?(0,r.jsx)("div",{style:{width:"100%",marginTop:"10px"},children:(0,r.jsx)(c,{options:w,series:p,type:"bubble",height:320},"project-budget-".concat(f,"-").concat(s.length>0?s.map(function(e){return e.name}).join("-"):"empty"))}):(0,r.jsx)("div",{style:{width:"100%",height:"320px",display:"flex",alignItems:"center",justifyContent:"center",color:"#5C5D5D",fontFamily:"Inter",fontSize:"14px"},children:"Carregando gráfico..."})}},5380(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>d});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(62953),n(76031);var r=n(74848),a=n(96540),o=n(1806);function i(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var i=r&&r.prototype instanceof c?r:c,u=Object.create(i.prototype);return s(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(s(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,s(m,"constructor",d),s(d,"constructor",u),u.displayName="GeneratorFunction",s(d,a,"GeneratorFunction"),s(m),s(m,a,"Generator"),s(m,r,function(){return this}),s(m,"toString",function(){return"[object Generator]"}),(i=function(){return{w:o,m:p}})()}function s(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}s=function(e,t,n,r){function o(t,n){s(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},s(e,t,n,r)}function l(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){var t=e.isOpen,n=e.onConfirm,s=e.onClose,u=e.distanceToleranceKm,d=void 0===u?0:u,f=c((0,a.useState)(null),2),m=f[0],p=f[1],h=c((0,a.useState)(!1),2),v=h[0],b=h[1],y=c((0,a.useState)(null),2),g=y[0],x=y[1],j=(0,a.useRef)(null),w=(0,a.useRef)(null),S=(0,a.useRef)(null);(0,a.useEffect)(function(){t&&!m&&N()},[t]),(0,a.useEffect)(function(){if(m&&j.current){var e=function(){var e,n=(e=i().m(function e(){var n,r;return i().w(function(e){for(;;)switch(e.n){case 0:if(!window.L){e.n=1;break}return t(),e.a(2);case 1:(n=document.createElement("link")).rel="stylesheet",n.href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",n.integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=",n.crossOrigin="",document.head.appendChild(n),(r=document.createElement("script")).src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js",r.integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=",r.crossOrigin="",r.onload=function(){return t()},document.body.appendChild(r);case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){l(o,r,a,i,s,"next",e)}function s(e){l(o,r,a,i,s,"throw",e)}i(void 0)})});return function(){return n.apply(this,arguments)}}(),t=function(){var e=window.L;if(e&&j.current){w.current&&w.current.remove(),delete e.Icon.Default.prototype._getIconUrl,e.Icon.Default.mergeOptions({iconRetinaUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/images/marker-icon-2x.png",iconUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/images/marker-icon.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/images/marker-shadow.png"});var t=e.map(j.current).setView([m.lat,m.lng],16);w.current=t,e.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:"© OpenStreetMap contributors",maxZoom:19}).addTo(t),e.marker([m.lat,m.lng]).addTo(t),S.current&&t.removeLayer(S.current);var n=d>0?1e3*d:50,r=e.circle([m.lat,m.lng],{color:"#17A2B8",fillColor:"#17A2B8",fillOpacity:.2,radius:n}).addTo(t);S.current=r,t.fitBounds(r.getBounds(),{padding:[20,20]})}};return e(),function(){w.current&&(w.current.remove(),w.current=null)}}},[m,d]);var N=function(){if(navigator.geolocation){b(!0),x(null);var e=setTimeout(function(){b(!1),x("Tempo esgotado ao tentar obter localização. Tente novamente.")},5e3);navigator.geolocation.getCurrentPosition(function(t){clearTimeout(e);var n={lat:t.coords.latitude,lng:t.coords.longitude};p(n),b(!1)},function(t){switch(clearTimeout(e),b(!1),t.code){case t.PERMISSION_DENIED:x("Permissão de localização negada. Por favor, habilite nas configurações.");break;case t.POSITION_UNAVAILABLE:x("Informações de localização não disponíveis.");break;case t.TIMEOUT:x("Tempo esgotado ao tentar obter localização.");break;default:x("Erro desconhecido ao obter localização.")}},{enableHighAccuracy:!0,timeout:5e3,maximumAge:0})}else x("Geolocalização não é suportada pelo seu navegador.")},k=function(){p(null),x(null),N()},C=function(){p(null),x(null),s()};return t?(0,r.jsx)(o.A,{show:t,onClose:C,title:"Localização",size:"md",footer:g?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:C,children:"Cancelar"}),(0,r.jsxs)("button",{type:"button",className:"btn btn-primary",onClick:k,children:[(0,r.jsx)("i",{className:"fas fa-redo me-2"}),"Tentar Novamente"]})]}):m?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:k,children:"Capturar Novamente"}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary",style:{backgroundColor:"#17A2B8",borderColor:"#17A2B8"},onClick:function(){m&&(n(m),p(null))},children:"Confirmar"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:C,children:"Cancelar"}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary",onClick:N,disabled:v,style:{backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:"Capturar Localização"})]}),children:(0,r.jsxs)("div",{style:{padding:"24px"},children:[g&&(0,r.jsxs)("div",{className:"alert d-flex align-items-center",style:{backgroundColor:"#E6F7F9",borderColor:"#17A2B8",color:"#0C5460",gap:"12px"},children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle",style:{color:"#17A2B8",fontSize:"24px"}}),(0,r.jsx)("div",{style:{flex:1},children:g})]}),v&&!g&&(0,r.jsxs)("div",{className:"text-center py-5",children:[(0,r.jsx)("div",{className:"spinner-border text-primary mb-3"}),(0,r.jsx)("p",{className:"text-muted",children:"Obtendo sua localização..."}),(0,r.jsx)("small",{className:"text-muted",children:"Isso pode levar alguns segundos"})]}),m&&!g&&(0,r.jsx)("div",{className:"text-center",children:(0,r.jsx)("div",{ref:j,className:"border rounded mb-3",style:{height:"300px",width:"100%",zIndex:0}})}),!v&&!m&&!g&&(0,r.jsx)("div",{className:"text-center py-4",children:(0,r.jsx)("p",{className:"text-muted",children:'Clique em "Capturar Localização" para obter suas coordenadas GPS'})})]})}):null}},7440(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>x});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(58940),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(97665),o=n(33930),i=n(57097),s=(n(94170),n(59904),n(84185),n(40875),n(10287),n(3362),n(52354));function l(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return c(u,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var i={};function s(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(c(t={},r,function(){return this}),t),m=d.prototype=s.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,c(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,c(m,"constructor",d),c(d,"constructor",u),u.displayName="GeneratorFunction",c(d,a,"GeneratorFunction"),c(m),c(m,a,"Generator"),c(m,r,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),(l=function(){return{w:o,m:p}})()}function c(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}c=function(e,t,n,r){function o(t,n){c(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},c(e,t,n,r)}function u(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){u(o,r,a,i,s,"next",e)}function s(e){u(o,r,a,i,s,"throw",e)}i(void 0)})}}function f(){return m.apply(this,arguments)}function m(){return(m=d(l().m(function e(){var t,n;return l().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,s.F.get("/time-management/notification");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function p(){return(p=d(l().m(function e(t){var n,r;return l().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,s.F.put("/time-management/notification",t);case 1:return n=e.v,r=n.data,e.a(2,r.data)}},e)}))).apply(this,arguments)}var h=n(96540),v=n(76336);function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return y(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var g=["time-management","notification"];function x(){var e=(0,v.L)().canEdit,t=(0,a.jE)(),n=b((0,h.useState)(!1),2),s=n[0],l=n[1],c=b((0,h.useState)(!1),2),u=c[0],d=c[1],m=b((0,h.useState)(10),2),y=m[0],x=m[1],j=b((0,h.useState)(5),2),w=j[0],S=j[1],N=(0,o.I)({queryKey:g,queryFn:f}),k=N.data;N.isFetching;(0,h.useEffect)(function(){k&&(l(k.enableCheckIn),d(k.enableCheckOut),x(k.notificationCheckIn||10),S(k.notificationCheckOut||5))},[k]);var C=(0,i.n)({mutationFn:function(e){return function(e){return p.apply(this,arguments)}(e)},onSuccess:function(){t.invalidateQueries({queryKey:g})}}),O=function(){k&&C.mutate({enableCheckIn:s,enableCheckOut:u,notificationCheckIn:s?y:0,notificationCheckOut:u?w:0})};return(0,h.useEffect)(function(){k&&O()},[s,u]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-12 col-md-6 mb-3",children:(0,r.jsx)("div",{className:"card h-100 tm-card-mobile-auto ".concat(s?"border-primary bg-primary-soft":""),style:{border:"1px solid #e0e0e0",borderRadius:"8px"},children:(0,r.jsxs)("div",{className:"card-body d-flex flex-column",children:[(0,r.jsxs)("div",{className:"custom-control custom-checkbox mb-2",children:[(0,r.jsx)("input",{type:"checkbox",id:"notif-checkin",className:"custom-control-input",checked:s,onChange:function(e){return l(e.target.checked)},disabled:!e}),(0,r.jsxs)("label",{className:"custom-control-label ".concat(s?"text-primary":""),htmlFor:"notif-checkin",children:["Enviar notificação antes de",!e&&(0,r.jsx)("i",{className:"fas fa-lock ml-2 text-muted",style:{fontSize:"0.7rem"}})]})]}),(0,r.jsx)("small",{className:"text-muted d-block mb-2",style:{fontSize:"0.85rem"},children:"Defina com quantos minutos de antecedência o colaborador receberá uma notificação lembrando da hora de entrada."}),(0,r.jsxs)("div",{className:"input-group mt-auto",children:[(0,r.jsx)("input",{type:"number",className:"form-control",value:y,onChange:function(e){return x(parseInt(e.target.value)||0)},onBlur:O,disabled:!s||!e,min:"0"}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("span",{className:"input-group-text",children:"min"})})]})]})})}),(0,r.jsx)("div",{className:"col-12 col-md-6 mb-3",children:(0,r.jsx)("div",{className:"card h-100 tm-card-mobile-auto ".concat(u?"border-primary bg-primary-soft":""),style:{border:"1px solid #e0e0e0",borderRadius:"8px"},children:(0,r.jsxs)("div",{className:"card-body d-flex flex-column",children:[(0,r.jsxs)("div",{className:"custom-control custom-checkbox mb-2",children:[(0,r.jsx)("input",{type:"checkbox",id:"notif-checkout",className:"custom-control-input",checked:u,onChange:function(e){return d(e.target.checked)},disabled:!e}),(0,r.jsxs)("label",{className:"custom-control-label ".concat(u?"text-primary":""),htmlFor:"notif-checkout",children:["Enviar notificação antes de",!e&&(0,r.jsx)("i",{className:"fas fa-lock ml-2 text-muted",style:{fontSize:"0.7rem"}})]})]}),(0,r.jsx)("small",{className:"text-muted d-block mb-2",style:{fontSize:"0.85rem"},children:"Defina com quantos minutos de antecedência o colaborador receberá uma notificação lembrando da hora de saída."}),(0,r.jsxs)("div",{className:"input-group mt-auto",children:[(0,r.jsx)("input",{type:"number",className:"form-control",value:w,onChange:function(e){return S(parseInt(e.target.value)||0)},onBlur:O,disabled:!u||!e,min:"0"}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("span",{className:"input-group-text",children:"min"})})]})]})})})]}),C.isPending&&(0,r.jsxs)("div",{className:"text-muted mt-2",children:[(0,r.jsx)("i",{className:"fas fa-spinner fa-spin mr-2"}),"Salvando..."]})]})}},8596(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>i});n(64346);var r=n(74848),a=n(68925),o=n(13359);function i(e){var t=e.onRegister,n=e.availableOptions,i=e.onSelectOption,s=e.isNoneMode,l=e.disabled,c=e.shift,u=e.selectedDate,d=e.onDateChange,f=e.shiftError;return(0,r.jsx)("div",{className:"card app-card-surface mt-2",children:(0,r.jsx)("div",{className:"card-body p-0",children:(0,r.jsxs)("div",{className:"row g-0",children:[(0,r.jsx)("div",{className:"col-12 col-sm-6 col-md-5 col-lg-5 col-xl-3 col-xxl-3 ms-point-card-left",children:(0,r.jsx)("div",{className:"p-5 h-100",children:(0,r.jsx)(a.default,{onRegister:t,availableOptions:n,onSelectOption:i,isNoneMode:s,disabled:l})})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-md-7 col-lg-7 col-xl-9 col-xxl-9",children:(0,r.jsx)("div",{className:"p-2 h-100",children:f?(0,r.jsxs)("div",{className:"text-center text-danger py-4",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle me-2"}),"Erro ao carregar dados do turno"]}):c&&c.rows&&Array.isArray(c.rows)?(0,r.jsx)(o.default,{shift:c,selectedDate:u,onDateChange:d}):(0,r.jsxs)("div",{className:"text-center text-muted py-4",children:[(0,r.jsx)("i",{className:"fas fa-info-circle me-2"}),"Nenhum dado disponível para exibir"]})})})]})})})}},9504(e,t,n){"use strict";n.d(t,{vl:()=>c});n(52675),n(89463),n(28706),n(51629),n(74423),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(21699),n(23500),n(76031),n(74848);var r=n(20354),a=n.n(r);function o(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function s(n,r,a,o){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return i(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(i(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,i(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,i(m,"constructor",d),i(d,"constructor",u),u.displayName="GeneratorFunction",i(d,a,"GeneratorFunction"),i(m),i(m,a,"Generator"),i(m,r,function(){return this}),i(m,"toString",function(){return"[object Generator]"}),(o=function(){return{w:s,m:p}})()}function i(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}i=function(e,t,n,r){function o(t,n){i(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},i(e,t,n,r)}function s(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function l(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){s(o,r,a,i,l,"next",e)}function l(e){s(o,r,a,i,l,"throw",e)}i(void 0)})}}var c=function(){var e=l(o().m(function e(t){var n,r,i,s;return o().w(function(e){for(;;)switch(e.n){case 0:if(n=t.dashboardRef,r=t.dateRange,i=t.setIsExporting,n.current){e.n=1;break}return console.error("Elemento do dashboard não encontrado"),e.a(2);case 1:try{i(!0),(s=document.createElement("div")).style.position="fixed",s.style.top="0",s.style.left="0",s.style.width="100%",s.style.height="100%",s.style.backgroundColor="rgba(0,0,0,0.5)",s.style.display="flex",s.style.justifyContent="center",s.style.alignItems="center",s.style.zIndex="9999",s.innerHTML='<div style="background: white; padding: 20px; border-radius: 5px;">Gerando imagem do dashboard...</div>',document.body.appendChild(s),setTimeout(l(o().m(function e(){var t,l,c,u;return o().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,a()(n.current,{background:"#FFFFFF",logging:!0,useCORS:!0,allowTaint:!0,onclone:function(e){e.querySelectorAll("button").forEach(function(e){var t;null!==(t=e.textContent)&&void 0!==t&&t.includes("Exportar")&&(e.style.display="none")});var t=e.querySelector("section");t&&(t.style.backgroundColor="#FFFFFF"),e.querySelectorAll(".card").forEach(function(e){e.style.backgroundColor="#FFFFFF"}),e.querySelectorAll(".card-header").forEach(function(e){e.style.backgroundColor="#FFFFFF"}),e.querySelectorAll(".card-body").forEach(function(e){e.style.backgroundColor="#FFFFFF"}),e.querySelectorAll("svg").forEach(function(e){e.querySelectorAll('rect[fill="#F5F6FA"], rect[fill="#f5f6fa"], rect[fill="rgb(245, 246, 250)"]').forEach(function(e){e.setAttribute("fill","#FFFFFF")})}),e.querySelectorAll(".card-header button").forEach(function(e){e.querySelector(".fa-chevron-down")&&(e.style.backgroundColor="#FFFFFF")}),e.querySelectorAll('[style*="background"]').forEach(function(e){var t=e.style,n=t.background||t.backgroundColor;n&&(n.includes("#F5F6FA")||n.includes("#f5f6fa")||n.includes("rgb(245, 246, 250)")||n.includes("rgba(245, 246, 250"))&&(e.style.backgroundColor="#FFFFFF")})}});case 1:t=e.v,l=t.toDataURL("image/png"),(c=document.createElement("a")).href=l,c.download="dashboard-".concat(r.startDate,"-a-").concat(r.endDate,".png"),document.body.appendChild(c),c.click(),document.body.removeChild(c),console.log("Dashboard exportado com sucesso!"),e.n=3;break;case 2:e.p=2,u=e.v,console.error("Erro ao capturar screenshot:",u),alert("Erro ao exportar dashboard. Tente novamente.");case 3:return e.p=3,document.body.removeChild(s),i(!1),e.f(3);case 4:return e.a(2)}},e,null,[[0,2,3,4]])})),500)}catch(e){console.error("Erro ao iniciar exportação:",e),alert("Erro ao iniciar exportação. Tente novamente."),i(!1)}case 2:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}()},10280(e,t,n){"use strict";n.d(t,{A:()=>d});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(51629),n(23418),n(74423),n(64346),n(23792),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(58940),n(27495),n(38781),n(47764),n(23500),n(62953);var r=n(74848),a=n(96540);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){var t=e.value,n=e.label,o=e.variant,i=void 0===o?"white":o,l=e.iconClass,u=e.className,d=void 0===u?"":u,f=e.backgroundColor,m=e.isLoading,p=void 0!==m&&m,h=e.editable,v=void 0!==h&&h,b=e.onValueChange,y=e.isInteger,g=void 0!==y&&y,x=c((0,a.useState)(!1),2),j=x[0],w=x[1],S=c((0,a.useState)(String(t)),2),N=S[0],k=S[1],C=(0,a.useRef)(null),O=function(e){switch(e){case"green":return{boxClass:"bg-teal",textClass:"text-white",borderClass:"border-0"};case"blue":return{boxClass:"bg-info",textClass:"text-white",borderClass:"border-0"};case"red":return{boxClass:"bg-danger",textClass:"text-white",borderClass:"border-0"};case"white":return{boxClass:"bg-white",textClass:"text-muted",borderClass:"border"};case"blue-light":return{boxClass:"bg-success",textClass:"text-white",borderClass:"border"};case"gray":return{boxClass:"bg-light",textClass:"text-muted",borderClass:"border",extraStyle:{backgroundColor:"#898989"}};case"teal-dark":return{boxClass:"bg-primary",textClass:"text-white",borderClass:"border-0",extraStyle:{backgroundColor:"#186073"}};case"cyan":return{boxClass:"bg-info",textClass:"text-white",borderClass:"border-0",extraStyle:{backgroundColor:"#17A2B8"}};case"turquoise":return{boxClass:"bg-success",textClass:"text-white",borderClass:"border-0",extraStyle:{backgroundColor:"#02D6C7"}};case"salmon":return{boxClass:"bg-danger",textClass:"text-white",borderClass:"border-0",extraStyle:{backgroundColor:"#FF6D6D"}};case"dark-gray":return{boxClass:"bg-secondary",textClass:"text-white",borderClass:"border-0",extraStyle:{backgroundColor:"#5C5D5D"}};default:return{boxClass:"bg-light",textClass:"text-muted",borderClass:"border"}}}(i),A=O.boxClass,E=O.textClass,P=O.extraStyle,F=O.borderClass,T=f||["green","blue","red","white","gray","teal-dark","cyan","turquoise","salmon","dark-gray"].includes(i);(0,a.useEffect)(function(){k(String(t))},[t]),(0,a.useEffect)(function(){j&&C.current&&(C.current.focus(),C.current.select())},[j]);var D=function(){v&&!p&&w(!0)},_=function(){if(w(!1),b&&N!==String(t))if(g){var e=parseInt(N);!isNaN(e)&&e>=0?b(e):k(String(t))}else b(N)},I=function(e){"Enter"===e.key?_():"Escape"===e.key&&(k(String(t)),w(!1))},M=function(e){if(e.stopPropagation(),g&&b){var n="number"==typeof t?t:parseInt(String(t));isNaN(n)||b(n+1)}},R=function(e){if(e.stopPropagation(),g&&b){var n="number"==typeof t?t:parseInt(String(t));!isNaN(n)&&n>0&&b(n-1)}};if(T){var z=f?"":function(e){switch(e){case"green":default:return"ms-kpi-card-working";case"blue":return"ms-kpi-card-on-break";case"red":return"ms-kpi-card-absences";case"white":return"ms-kpi-card-license";case"gray":return"ms-kpi-card-pending";case"teal-dark":return"ms-kpi-card-teal-dark";case"cyan":return"ms-kpi-card-cyan";case"turquoise":return"ms-kpi-card-turquoise";case"salmon":return"ms-kpi-card-salmon";case"dark-gray":return"ms-kpi-card-dark-gray"}}(i),L=f||void 0;return(0,r.jsxs)("div",{className:"ms-kpi-card ".concat(z," ").concat(v&&!p?"ms-kpi-card-editing":""),style:L?{background:L}:void 0,children:[(0,r.jsxs)("div",{className:"ms-kpi-card-value-container",children:[j?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("input",{ref:C,type:"text",value:N,onChange:function(e){return k(e.target.value)},onBlur:_,onKeyDown:I,className:"ms-kpi-card-input"}),g&&(0,r.jsx)("span",{className:"ms-kpi-card-suffix",children:"h"})]}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("h1",{className:"ms-kpi-card-value",onClick:D,style:{cursor:v&&!p?"pointer":"default"},children:[p?"...":t,v&&g&&!p&&"h"]})}),v&&g&&!p&&!j&&(0,r.jsxs)("div",{className:"ms-kpi-card-controls",children:[(0,r.jsx)("button",{onClick:M,className:"ms-kpi-card-control-button",children:"▲"}),(0,r.jsx)("button",{onClick:R,className:"ms-kpi-card-control-button",children:"▼"})]})]}),(0,r.jsx)("p",{className:"ms-kpi-card-label",children:n})]})}return(0,r.jsxs)("div",{className:"small-box ".concat(A," ").concat(F," ").concat(d),style:s(s({},P),{},{cursor:v&&!p?"pointer":"default",position:"relative"}),children:[(0,r.jsxs)("div",{className:"inner",children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[j?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("input",{ref:C,type:"text",value:N,onChange:function(e){return k(e.target.value)},onBlur:_,onKeyDown:I,className:"form-control",style:{fontSize:"28px",fontWeight:"bold",padding:"0 8px",width:"auto",minWidth:"80px",height:"auto"}}),g&&(0,r.jsx)("span",{className:"mb-1 ".concat(E),style:{fontSize:"28px",fontWeight:"bold"},children:"h"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h3",{className:"mb-1 ".concat(E),onClick:D,style:{cursor:v&&!p?"pointer":"default"},children:p?"...":t}),v&&g&&!p&&(0,r.jsx)("span",{className:"mb-1 ".concat(E),style:{fontSize:"28px",fontWeight:"bold",cursor:"pointer"},onClick:D,children:"h"})]}),v&&g&&!p&&!j&&(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"4px",marginLeft:"4px"},children:[(0,r.jsx)("button",{onClick:M,className:"btn btn-xs",style:{padding:"2px 6px",fontSize:"10px",lineHeight:"1",background:"rgba(255, 255, 255, 0.3)",border:"1px solid rgba(255, 255, 255, 0.5)",color:"white"},children:"▲"}),(0,r.jsx)("button",{onClick:R,className:"btn btn-xs",style:{padding:"2px 6px",fontSize:"10px",lineHeight:"1",background:"rgba(255, 255, 255, 0.3)",border:"1px solid rgba(255, 255, 255, 0.5)",color:"white"},children:"▼"})]})]}),(0,r.jsx)("p",{className:"mb-0 ".concat(E),children:n})]}),l&&(0,r.jsx)("div",{className:"icon",children:(0,r.jsx)("i",{className:l})})]})}},12395(e,t,n){"use strict";n.d(t,{A:()=>o});var r=n(76314),a=n.n(r)()(function(e){return e[1]});a.push([e.id,".date-range-badge {\n\tposition: relative;\n\tdisplay: inline-block;\n}\n\n.date-range-badge__button {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 8px 16px;\n\tbackground: #fff;\n\tborder: 1px solid #d1d5db;\n\tborder-radius: 20px;\n\tfont-size: 14px;\n\tcolor: #5C5D5D;\n\tcursor: pointer;\n\ttransition: all 0.2s ease;\n\toutline: none;\n\twhite-space: nowrap;\n}\n\n.date-range-badge__button:hover {\n\tborder-color: #2196F3;\n\tbox-shadow: 0 2px 8px rgba(33, 150, 243, 0.15);\n}\n\n.date-range-badge__icon {\n\tcolor: #2196F3;\n\tfont-size: 14px;\n}\n\n.date-range-badge__text {\n\tfont-weight: 500;\n\tcolor: #333;\n}\n\n.date-range-badge__clear {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 18px;\n\theight: 18px;\n\tpadding: 0;\n\tmargin-left: 4px;\n\tbackground: #e5e7eb;\n\tborder: none;\n\tborder-radius: 50%;\n\tcolor: #6b7280;\n\tcursor: pointer;\n\ttransition: all 0.2s ease;\n\toutline: none;\n}\n\n.date-range-badge__clear:hover {\n\tbackground: #dc2626;\n\tcolor: #fff;\n}\n\n.date-range-badge__clear i {\n\tfont-size: 10px;\n}\n\n.date-range-badge__dropdown {\n\tposition: absolute;\n\ttop: calc(100% + 8px);\n\tright: 0;\n\tmin-width: 400px;\n\tbackground: #fff;\n\tborder: 1px solid #d1d5db;\n\tborder-radius: 8px;\n\tbox-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);\n\tz-index: 1000;\n\tanimation: fadeInDown 0.2s ease;\n}\n\n@keyframes fadeInDown {\n\tfrom {\n\t\topacity: 0;\n\t\ttransform: translateY(-10px);\n\t}\n\tto {\n\t\topacity: 1;\n\t\ttransform: translateY(0);\n\t}\n}\n\n.date-range-badge__dropdown-header {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 16px 20px;\n\tborder-bottom: 1px solid #e5e7eb;\n\tfont-weight: 600;\n\tfont-size: 15px;\n\tcolor: #333;\n}\n\n.date-range-badge__dropdown-close {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 24px;\n\theight: 24px;\n\tpadding: 0;\n\tbackground: none;\n\tborder: none;\n\tborder-radius: 4px;\n\tcolor: #9ca3af;\n\tcursor: pointer;\n\ttransition: all 0.2s ease;\n\toutline: none;\n}\n\n.date-range-badge__dropdown-close:hover {\n\tbackground: #f3f4f6;\n\tcolor: #ef4444;\n}\n\n.date-range-badge__dropdown-body {\n\tpadding: 20px;\n}\n\n/* Ajustar estilos do DateRangePicker dentro do dropdown */\n.date-range-badge__dropdown-body .date-range-picker__presets-dropdown {\n\tposition: fixed;\n\ttop: auto;\n\tright: auto;\n}\n\n/* Responsivo */\n@media (max-width: 768px) {\n\t.date-range-badge__dropdown {\n\t\tright: 0;\n\t\tleft: auto;\n\t\tmin-width: 320px;\n\t\tmax-width: calc(100vw - 32px);\n\t}\n\t\n\t.date-range-badge__button {\n\t\tfont-size: 13px;\n\t\tpadding: 6px 12px;\n\t}\n}\n\n/* Tema escuro */\n.dark-mode .date-range-badge__button {\n\tbackground-color: #1f2937;\n\tborder-color: #374151;\n\tcolor: #e5e7eb;\n}\n\n.dark-mode .date-range-badge__text {\n\tcolor: #e5e7eb;\n}\n\n.dark-mode .date-range-badge__dropdown {\n\tbackground-color: #1f2937;\n\tborder-color: #374151;\n}\n\n.dark-mode .date-range-badge__dropdown-header {\n\tborder-color: #374151;\n\tcolor: #e5e7eb;\n}\n\n",""]);const o=a},12921(e,t,n){"use strict";n.d(t,{A:()=>d});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(68156),n(62953);var r=n(74848),a=n(96540),o=n(85072),i=n.n(o),s=n(18438),l={insert:"head",singleton:!1};i()(s.A,l);s.A.locals;function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const d=function(e){var t=e.initialStartDate,n=e.initialEndDate,o=e.onChange,i=e.maxDays,s=void 0===i?365:i,l=e.className,u=void 0===l?"":l,d=e.defaultToLastMonth,f=void 0===d||d,m=c((0,a.useState)(t||""),2),p=m[0],h=m[1],v=c((0,a.useState)(n||""),2),b=v[0],y=v[1],g=c((0,a.useState)(""),2),x=g[0],j=g[1],w=c((0,a.useState)(!1),2),S=w[0],N=w[1];(0,a.useEffect)(function(){h(t||""),y(n||""),j("")},[t,n]),(0,a.useEffect)(function(){if(f&&(!t||!n)){var e=new Date,r=new Date;r.setDate(r.getDate()-30);var a=k(r),i=k(e);h(a),y(i),o({startDate:a,endDate:i})}},[]);var k=function(e){var t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(r)},C=function(e,t){if(!e||!t)return"Por favor, selecione ambas as datas";var n=new Date(e),r=new Date(t);if(n>r)return"A data inicial deve ser anterior ou igual à data final";var a=Math.abs(r.getTime()-n.getTime());return Math.ceil(a/864e5)>s?"O intervalo máximo permitido é de ".concat(s," dias"):null},O=[{label:"Última Semana",getValue:function(){var e=new Date,t=new Date;return t.setDate(t.getDate()-7),{startDate:k(t),endDate:k(e)}}},{label:"Últimos 15 Dias",getValue:function(){var e=new Date,t=new Date;return t.setDate(t.getDate()-15),{startDate:k(t),endDate:k(e)}}},{label:"Último Mês",getValue:function(){var e=new Date,t=new Date;return t.setMonth(t.getMonth()-1),{startDate:k(t),endDate:k(e)}}},{label:"Últimos 3 Meses",getValue:function(){var e=new Date,t=new Date;return t.setMonth(t.getMonth()-3),{startDate:k(t),endDate:k(e)}}},{label:"Mês Atual",getValue:function(){var e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return{startDate:k(t),endDate:k(n)}}},{label:"Mês Anterior",getValue:function(){var e=new Date,t=new Date(e.getFullYear(),e.getMonth()-1,1),n=new Date(e.getFullYear(),e.getMonth(),0);return{startDate:k(t),endDate:k(n)}}},{label:"Ano Atual",getValue:function(){var e=new Date,t=new Date(e.getFullYear(),0,1),n=new Date(e.getFullYear(),11,31);return{startDate:k(t),endDate:k(n)}}}],A=function(){if(!p||!b)return 0;var e=new Date(p),t=new Date(b),n=Math.abs(t.getTime()-e.getTime());return Math.ceil(n/864e5)+1};return(0,r.jsxs)("div",{className:"date-range-picker ".concat(u),children:[(0,r.jsxs)("div",{className:"date-range-picker__dates-row",children:[(0,r.jsxs)("div",{className:"date-range-picker__field",children:[(0,r.jsx)("label",{htmlFor:"start-date",className:"date-range-picker__label",children:"Data inicial"}),(0,r.jsx)("input",{type:"date",id:"start-date",className:"date-range-picker__input",value:p,onChange:function(e){var t=e.target.value;h(t);var n=C(t,b);j(n||""),n||o({startDate:t,endDate:b})},max:b||void 0})]}),(0,r.jsxs)("div",{className:"date-range-picker__field",children:[(0,r.jsx)("label",{htmlFor:"end-date",className:"date-range-picker__label",children:"Data final"}),(0,r.jsx)("input",{type:"date",id:"end-date",className:"date-range-picker__input",value:b,onChange:function(e){var t=e.target.value;y(t);var n=C(p,t);j(n||""),n||o({startDate:p,endDate:t})},min:p||void 0})]})]}),(0,r.jsxs)("div",{className:"date-range-picker__bottom-row",children:[(0,r.jsx)("button",{type:"button",className:"date-range-picker__preset-btn",onClick:function(){return N(!S)},title:"Atalhos de período",children:(0,r.jsx)("i",{className:"fas fa-calendar-alt"})}),x?(0,r.jsxs)("div",{className:"date-range-picker__error",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle"}),(0,r.jsx)("span",{children:x})]}):p&&b?(0,r.jsxs)("div",{className:"date-range-picker__info",children:[(0,r.jsx)("i",{className:"fas fa-info-circle"}),(0,r.jsxs)("span",{children:["Período selecionado de ",A()," dia",A()>1?"s":"","."]})]}):null]}),S&&(0,r.jsxs)("div",{className:"date-range-picker__presets-dropdown",children:[(0,r.jsxs)("div",{className:"date-range-picker__presets-header",children:[(0,r.jsx)("span",{children:"Períodos Rápidos"}),(0,r.jsx)("button",{type:"button",className:"date-range-picker__presets-close",onClick:function(){return N(!1)},children:(0,r.jsx)("i",{className:"fas fa-times"})})]}),(0,r.jsx)("div",{className:"date-range-picker__presets-list",children:O.map(function(e,t){return(0,r.jsx)("button",{type:"button",className:"date-range-picker__preset-item",onClick:function(){return function(e){var t=e.getValue(),n=t.startDate,r=t.endDate;h(n),y(r),j(""),N(!1),o({startDate:n,endDate:r})}(e)},children:e.label},t)})})]})]})}},13359(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>f});n(64346),n(62010);var r=n(74848),a=n(88195),o=(n(52675),n(89463),n(2259),n(28706),n(23418),n(23792),n(34782),n(1688),n(23288),n(26099),n(27495),n(38781),n(47764),n(62953),n(76031),n(96540));function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e){if(!e)return"";var t=new Date(e+"T00:00:00"),n=["Dom.","Seg.","Ter.","Qua.","Qui.","Sex.","Sáb."][t.getDay()],r=t.getDate(),a=["Jan.","Fev.","Mar.","Abr.","Mai.","Jun.","Jul.","Ago.","Set.","Out.","Nov.","Dez."][t.getMonth()],o=t.getFullYear();return"".concat(n," ").concat(r," de ").concat(a," ").concat(o)}function c(e){var t=e.selectedDate,n=e.onDateChange,a=e.formatDate,s=void 0===a?l:a,c=e.className,u=void 0===c?"":c,d=i((0,o.useState)(!1),2),f=d[0],m=d[1],p=(0,o.useRef)(null),h=function(e){var r=new Date(t+"T00:00:00");r.setDate(r.getDate()+e);var a=r.toISOString().split("T")[0];n(a)};return(0,r.jsxs)("div",{className:"d-flex align-items-center position-relative ".concat(u),style:{gap:8},children:[(0,r.jsx)("button",{type:"button",className:"btn btn-link text-muted p-1",onClick:function(e){e.stopPropagation(),h(-1)},"aria-label":"Dia anterior",children:(0,r.jsx)("i",{className:"fas fa-chevron-left"})}),(0,r.jsx)("div",{className:"tm-date-trigger",style:{fontFamily:"Inter, sans-serif",fontSize:"14px",fontWeight:400,color:"#186073",userSelect:"none",cursor:"pointer"},onClick:function(){m(!f),setTimeout(function(){var e,t;p.current&&(p.current.focus(),null===(e=(t=p.current).showPicker)||void 0===e||e.call(t))},10)},title:"Clique para selecionar data",children:s(t)}),(0,r.jsx)("button",{type:"button",className:"btn btn-link text-muted p-1",onClick:function(e){e.stopPropagation(),h(1)},"aria-label":"Próximo dia",children:(0,r.jsx)("i",{className:"fas fa-chevron-right"})}),(0,r.jsx)("input",{ref:p,type:"date",value:t,onChange:function(e){var t=e.target.value;t&&(n(t),m(!1))},onBlur:function(){return m(!1)},style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:f?"auto":"none"}})]})}function u(e){var t=e.color;return(0,r.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("circle",{cx:"9",cy:"5",r:"3",stroke:t,strokeWidth:"1.5",fill:"none"}),(0,r.jsx)("path",{d:"M5 16C5 13.7909 6.79086 12 9 12C11.2091 12 13 13.7909 13 16V19H5V16Z",stroke:t,strokeWidth:"1.5",fill:"none"}),(0,r.jsx)("path",{d:"M15 12L19 12M19 12L17 10M19 12L17 14",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function d(e){var t=e.color;return(0,r.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("rect",{x:"3",y:"5",width:"12",height:"10",rx:"1",stroke:t,strokeWidth:"1.5",fill:"none"}),(0,r.jsx)("path",{d:"M6 15L6 17L12 17L12 15",stroke:t,strokeWidth:"1.5",strokeLinecap:"round"}),(0,r.jsx)("path",{d:"M16 10L20 10M20 10L18 8M20 10L18 12",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function f(e){var t=e.shift,n=e.selectedDate,o=e.onDateChange;if(!t||!t.rows||!Array.isArray(t.rows))return(0,r.jsxs)("div",{className:"text-center text-muted py-4",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle me-2"}),"Dados do turno não disponíveis"]});return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between mb-3",children:[(0,r.jsxs)("span",{children:[(0,r.jsx)("strong",{children:"Turno:"})," ",t.name]}),(0,r.jsx)(c,{selectedDate:n,onDateChange:o})]}),(0,r.jsx)(a.A,{columns:[{key:"icon",label:"",width:"50px",align:"center"},{key:"horario",label:"Horário",width:"auto",align:"left"},{key:"dispositivo",label:"Dispositivo",width:"auto",align:"left"},{key:"canal",label:"Canal",width:"100px",align:"center"}],data:t.rows,emptyMessage:"Nenhum registro encontrado",renderRow:function(e,t){var n=t%2==0,a=e.muted?"#9ca3af":"#000000";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"ms-table-cell-center align-middle",children:n?(0,r.jsx)(u,{color:a}):(0,r.jsx)(d,{color:a})}),(0,r.jsx)("td",{className:"ms-table-cell ".concat(e.muted?"text-muted":""),children:e.label}),(0,r.jsx)("td",{className:"ms-table-cell ".concat(e.muted?"text-muted":""),style:{textTransform:"capitalize"},children:e.device||(0,r.jsx)("span",{className:"text-muted",children:"—"})}),(0,r.jsx)("td",{className:"ms-table-cell-center ".concat(e.muted?"text-muted":""),style:{textTransform:"capitalize"},children:e.mode||(0,r.jsx)("span",{className:"text-muted",children:"—"})})]})}})]})}},14011(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>u});n(52675),n(89463),n(2259),n(28706),n(2008),n(51629),n(23418),n(74423),n(64346),n(23792),n(62062),n(34782),n(26910),n(23288),n(62010),n(26099),n(58940),n(27495),n(38781),n(31415),n(21699),n(47764),n(25440),n(42762),n(23500),n(62953);var r=n(74848),a=n(96540),o=n(33930),i=n(14305),s=n(1806);function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e){var t=e.isOpen,n=e.onClose,c=e.workShift,u=e.onSave,d=e.isSaving,f=void 0!==d&&d,m=l((0,a.useState)(""),2),p=m[0],h=m[1],v=l((0,a.useState)(""),2),b=v[0],y=v[1],g=l((0,a.useState)(new Set),2),x=g[0],j=g[1],w=l((0,a.useState)(!1),2),S=(w[0],w[1]),N=l((0,a.useState)(!1),2),k=N[0],C=N[1],O=(0,a.useRef)(null),A=(0,o.I)({queryKey:["time-management","members-with-shifts"],queryFn:i.bM,staleTime:0,enabled:t}),E=A.data,P=void 0===E?[]:E,F=A.isFetching,T=A.refetch;(0,a.useEffect)(function(){t&&null!=c&&c.id&&T()},[t,null==c?void 0:c.id,T]),(0,a.useEffect)(function(){if(t&&null!=c&&c.id&&0!==P.length){var e=P.filter(function(e){return e.workShiftId===c.id}).map(function(e){return String(e.id)});j(new Set(e)),S(!0)}},[t,null==c?void 0:c.id,P]),(0,a.useEffect)(function(){t||(S(!1),h(""),y(""),C(!1))},[t]),(0,a.useEffect)(function(){t&&null!=c&&c.id&&(S(!1),C(!1))},[null==c?void 0:c.id]);var D=(0,a.useMemo)(function(){return P.filter(function(e){if(e.isRemoved||!e.enabled)return!1;var t=e.workShiftId===(null==c?void 0:c.id);if(!(null===e.workShiftId)&&!t)return!1;var n="".concat(e.firstName||""," ").concat(e.lastName||"").trim().toLowerCase(),r=!p||n.includes(p.toLowerCase()),a=e.teams?e.teams.split(",").map(function(e){return e.trim()}):[],o=!b||a.includes(b);return r&&o})},[P,p,b,null==c?void 0:c.id]),_=(0,a.useMemo)(function(){var e=new Set;return P.forEach(function(t){t.teams&&t.teams.split(",").forEach(function(t){var n=t.trim();n&&e.add(n)})}),Array.from(e).sort()},[P]),I=function(e){C(!0);var t=String(e),n=new Set(x);n.has(t)?n.delete(t):n.add(t),j(n)},M=k&&D.length>0&&x.size>0&&x.size===D.length,R=k&&x.size>0&&x.size<D.length;(0,a.useEffect)(function(){O.current&&(O.current.indeterminate=R)},[R]);var z=function(){h(""),y(""),j(new Set),S(!1),C(!1),n()},L=["#17A2B8","#28A745","#FFC107","#DC3545","#6C757D","#007BFF"];return t?(0,r.jsxs)(s.A,{show:t,onClose:z,title:"".concat((null==c?void 0:c.name)||"Turno"," - Selecionar Membros"),size:"md",className:"assign-members-modal",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:z,disabled:f,style:{fontFamily:"Inter",fontSize:"14px"},children:"Voltar"}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary",onClick:function(){u(Array.from(x)),z()},disabled:0===x.size||f,style:{fontFamily:"Inter",fontSize:"14px",backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:f?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("i",{className:"fas fa-spinner fa-spin mr-1"}),"Atribuindo..."]}):"Atribuir Membro"})]}),children:[(0,r.jsx)("style",{children:"\n\t\t\t\t.assign-members-modal {\n\t\t\t\t\tborder-radius: 8px;\n\t\t\t\t}\n\t\t\t\t.assign-members-modal .table {\n\t\t\t\t\tborder-collapse: collapse;\n\t\t\t\t\tborder-spacing: 0;\n\t\t\t\t}\n\t\t\t\t.assign-members-modal .table thead tr th {\n\t\t\t\t\tpadding: 8px 8px 1px 8px !important;\n\t\t\t\t\tmargin: 0 !important;\n\t\t\t\t\tborder-bottom: 1px solid #dee2e6;\n\t\t\t\t}\n\t\t\t\t.assign-members-modal .table tbody tr td {\n\t\t\t\t\tpadding: 8px !important;\n\t\t\t\t\tmargin: 0 !important;\n\t\t\t\t}\n\t\t\t\t.assign-members-modal .table tbody tr:first-child td {\n\t\t\t\t\tpadding-top: 1px !important;\n\t\t\t\t}\n\t\t\t\t.custom-control-input:checked ~ .custom-control-label::before {\n\t\t\t\t\tbackground-color: #17A2B8;\n\t\t\t\t\tborder-color: #17A2B8;\n\t\t\t\t}\n\t\t\t\t.custom-control-input:checked ~ .custom-control-label::after {\n\t\t\t\t\tbackground-image: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3e%3c/svg%3e\");\n\t\t\t\t}\n\t\t\t\t.custom-control-input:indeterminate ~ .custom-control-label::before {\n\t\t\t\t\tbackground-color: #17A2B8;\n\t\t\t\t\tborder-color: #17A2B8;\n\t\t\t\t}\n\t\t\t\t.custom-control-input:indeterminate ~ .custom-control-label::after {\n\t\t\t\t\tbackground-image: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 4'%3e%3cpath stroke='%23fff' d='M 0 2 L 4 2'/%3e%3c/svg%3e\");\n\t\t\t\t}\n\t\t\t"}),(0,r.jsx)("div",{style:{padding:"24px",overflowX:"hidden"},children:(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsx)("h6",{style:{fontFamily:"Inter",fontSize:"16px",fontWeight:600,color:"#5C5D5D",marginBottom:"8px"},children:"Atribuir Membros"}),(0,r.jsx)("p",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:400,color:"#6c757d",marginBottom:"16px"},children:"Adicione os membros que utilizarão esse turno como referência para bater o ponto."}),(0,r.jsxs)("div",{className:"row",style:{marginBottom:"20px"},children:[(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"input-group",children:[(0,r.jsx)("div",{className:"input-group-prepend",children:(0,r.jsx)("span",{className:"input-group-text",children:(0,r.jsx)("i",{className:"fas fa-search"})})}),(0,r.jsx)("input",{type:"text",className:"form-control",placeholder:"Buscar por Nome",value:p,onChange:function(e){return h(e.target.value)},style:{fontFamily:"Inter",fontSize:"14px"}})]})}),(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("select",{className:"form-control",value:b,onChange:function(e){return y(e.target.value)},style:{fontFamily:"Inter",fontSize:"14px"},children:[(0,r.jsx)("option",{value:"",children:"Filtrar por Equipe"}),_.map(function(e){return(0,r.jsx)("option",{value:e,children:e},e)})]})})]}),(0,r.jsx)("div",{style:{maxHeight:"350px",overflowY:"auto",overflowX:"hidden",border:"1px solid #dee2e6",borderRadius:"4px",marginTop:0},children:(0,r.jsxs)("table",{className:"table table-hover mb-0",style:{tableLayout:"fixed",width:"100%",marginBottom:0},children:[(0,r.jsx)("thead",{style:{position:"sticky",top:0,backgroundColor:"#f8f9fa",zIndex:1},children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{style:{width:"50px",fontFamily:"Inter",fontSize:"14px",textAlign:"center",verticalAlign:"middle",padding:"8px",margin:0},children:(0,r.jsxs)("div",{className:"custom-control custom-checkbox",style:{display:"inline-block"},children:[(0,r.jsx)("input",{type:"checkbox",className:"custom-control-input",id:"select-all-members",checked:M,ref:O,onChange:function(){if(C(!0),x.size===D.length)j(new Set);else{var e=D.map(function(e){return String(e.id)});j(new Set(e))}}}),(0,r.jsx)("label",{className:"custom-control-label",htmlFor:"select-all-members"})]})}),(0,r.jsx)("th",{style:{width:"55%",fontFamily:"Inter",fontSize:"14px",fontWeight:600,color:"#5C5D5D",marginBottom:1},children:"Membro"}),(0,r.jsx)("th",{style:{width:"40%",fontFamily:"Inter",fontSize:"14px",fontWeight:600,color:"#5C5D5D",marginBottom:1},children:"Equipe"})]})}),(0,r.jsx)("tbody",{style:{margin:0,padding:0},children:F?(0,r.jsx)("tr",{children:(0,r.jsxs)("td",{colSpan:3,className:"text-center py-4",style:{padding:"8px"},children:[(0,r.jsx)("i",{className:"fas fa-spinner fa-spin mr-2"}),"Carregando membros..."]})}):0===D.length?(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:3,className:"text-center py-4 text-muted",children:"Nenhum membro encontrado"})}):D.map(function(e){var t,n,a,o=String(e.id),i=x.has(o),s="".concat(e.firstName||""," ").concat(e.lastName||"").trim(),l=e.email||"",c=(t=e.firstName,n=e.lastName,t&&t.length>0?t[0].toUpperCase():n&&n.length>0?n[0].toUpperCase():"U"),u=(a=parseInt(o.replace(/\D/g,""))%L.length,L[a]);return(0,r.jsxs)("tr",{style:{cursor:"pointer"},onClick:function(){return I(o)},children:[(0,r.jsx)("td",{onClick:function(e){return e.stopPropagation()},style:{textAlign:"center",verticalAlign:"middle",margin:0},children:(0,r.jsxs)("div",{className:"custom-control custom-checkbox",style:{display:"inline-block"},children:[(0,r.jsx)("input",{type:"checkbox",className:"custom-control-input",id:"member-".concat(o),checked:i,onChange:function(){return I(o)}}),(0,r.jsx)("label",{className:"custom-control-label",htmlFor:"member-".concat(o)})]})}),(0,r.jsx)("td",{style:{overflow:"hidden",padding:"8px",margin:0},children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsxs)("div",{style:{position:"relative",marginRight:"12px",flexShrink:0},children:[e.hasCrown&&(0,r.jsx)("img",{src:"/images/employee-advocacy/image.png",alt:"Crown",style:{position:"absolute",top:"-9px",left:"50%",transform:"translateX(-50%)",width:"13px",height:"13px",zIndex:2}}),(0,r.jsx)("div",{className:"rounded-circle d-flex align-items-center justify-content-center text-white",style:{width:"30px",height:"30px",backgroundColor:u,fontSize:"12px",fontWeight:600,border:e.hasCrown?"2px solid #FFD700":"none",boxShadow:e.hasCrown?"0 0 6px rgba(255, 215, 0, 0.5)":"none"},children:c})]}),(0,r.jsxs)("div",{style:{overflow:"hidden",minWidth:0},children:[(0,r.jsx)("div",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:500,color:"#5C5D5D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s||"Sem nome"}),l&&(0,r.jsx)("div",{style:{fontFamily:"Inter",fontSize:"12px",color:"#6c757d",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l})]})]})}),(0,r.jsx)("td",{style:{overflow:"hidden",padding:"8px",margin:0},children:(0,r.jsx)("div",{className:"d-flex flex-wrap",style:{maxWidth:"100%"},children:e.teams?e.teams.split(",").map(function(e,t){return(0,r.jsx)("span",{className:"badge badge-info mr-1 mb-1",style:{fontFamily:"Inter",fontSize:"11px",fontWeight:500,backgroundColor:"#17A2B8",padding:"4px 8px"},children:e.trim()},t)}):null})})]},e.id)})})]})})]})})]}):null}},14305(e,t,n){"use strict";n.d(t,{LW:()=>v,Nq:()=>y,ZD:()=>p,bM:()=>f,iT:()=>u});n(52675),n(89463),n(25276),n(23792),n(23288),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(38781),n(47764),n(42762),n(62953),n(48408);var r=n(52354),a=["hitTheSpotId"];function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function i(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var i=r&&r.prototype instanceof c?r:c,u=Object.create(i.prototype);return s(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(s(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,s(m,"constructor",d),s(d,"constructor",u),u.displayName="GeneratorFunction",s(d,a,"GeneratorFunction"),s(m),s(m,a,"Generator"),s(m,r,function(){return this}),s(m,"toString",function(){return"[object Generator]"}),(i=function(){return{w:o,m:p}})()}function s(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}s=function(e,t,n,r){function o(t,n){s(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},s(e,t,n,r)}function l(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function c(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){l(o,r,a,i,s,"next",e)}function s(e){l(o,r,a,i,s,"throw",e)}i(void 0)})}}function u(e){return d.apply(this,arguments)}function d(){return(d=c(i().m(function e(t){var n,a,o,s,l,c;return i().w(function(e){for(;;)switch(e.n){case 0:return n=new URLSearchParams,a=t&&""!==String(t).trim()?String(t):"0",n.append("work_shift_id",a),o=n.toString(),s="/time-management/members/company".concat(o?"?".concat(o):""),e.n=1,r.F.get(s);case 1:return l=e.v,c=l.data,e.a(2,c.data)}},e)}))).apply(this,arguments)}function f(){return m.apply(this,arguments)}function m(){return(m=c(i().m(function e(){var t,n;return i().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/members/with-shifts");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function p(e){return h.apply(this,arguments)}function h(){return(h=c(i().m(function e(t){var n,a,o,s,l;return i().w(function(e){for(;;)switch(e.n){case 0:return n=new URLSearchParams,null!=t&&t.start_date&&""!==t.start_date.trim()&&n.append("start_date",t.start_date),null!=t&&t.end_date&&""!==t.end_date.trim()&&n.append("end_date",t.end_date),null!=t&&t.work_shift_id&&""!==t.work_shift_id.trim()&&n.append("work_shift_id",t.work_shift_id),null!=t&&t.member_name&&""!==t.member_name.trim()&&n.append("member_name",t.member_name),null!=t&&t.status&&""!==t.status.trim()&&n.append("status",t.status),null!=t&&t.page&&t.page>0&&n.append("page",t.page.toString()),null!=t&&t.limit&&t.limit>0&&n.append("limit",t.limit.toString()),a=n.toString(),o="/time-management/hit-spot-time/history".concat(a?"?".concat(a):""),e.n=1,r.F.get(o);case 1:return s=e.v,l=s.data,e.a(2,l)}},e)}))).apply(this,arguments)}function v(e){return b.apply(this,arguments)}function b(){return(b=c(i().m(function e(t){var n,a,o,s;return i().w(function(e){for(;;)switch(e.n){case 0:return n=new URLSearchParams,null!=t&&t.start_date&&""!==t.start_date.trim()&&n.append("start_date",t.start_date),null!=t&&t.end_date&&""!==t.end_date.trim()&&n.append("end_date",t.end_date),null!=t&&t.work_shift_id&&""!==t.work_shift_id.trim()&&n.append("work_shift_id",t.work_shift_id),null!=t&&t.member_name&&""!==t.member_name.trim()&&n.append("member_name",t.member_name),null!=t&&t.status&&""!==t.status.trim()&&n.append("status",t.status),a=n.toString(),o="/time-management/hit-spot-time/history/export".concat(a?"?".concat(a):""),e.n=1,r.F.get(o,{responseType:"blob",headers:{Accept:"text/csv"}});case 1:return s=e.v,e.a(2,s.data)}},e)}))).apply(this,arguments)}function y(e){return g.apply(this,arguments)}function g(){return(g=c(i().m(function e(t){var n,s,l,c;return i().w(function(e){for(;;)switch(e.n){case 0:return n=t.hitTheSpotId,s=o(t,a),e.n=1,r.F.put("/time-management/hit-the-spot/".concat(n,"/edit"),s);case 1:return l=e.v,c=l.data,e.a(2,c.data)}},e)}))).apply(this,arguments)}},14463(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>m});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(62010),n(2892),n(9868),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(78459),n(27495),n(38781),n(47764),n(23500),n(62953);var r=n(74848),a=n(96540),o=n(1806);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==i(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var f={formGroup:{marginBottom:"20px"},label:{display:"block",fontSize:"13px",fontWeight:600,color:"#5C5D5D",marginBottom:"8px"},input:{width:"100%",padding:"10px",border:"1px solid #D1D5DB",borderRadius:"5px",fontSize:"14px",color:"#5C5D5D"},inputGroup:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"15px"},textarea:{width:"100%",padding:"10px",border:"1px solid #D1D5DB",borderRadius:"5px",fontSize:"14px",color:"#5C5D5D",minHeight:"80px",resize:"vertical"},modeToggle:{display:"flex",gap:"10px",marginBottom:"20px"},modeButton:{flex:1,padding:"10px",border:"1px solid #D1D5DB",borderRadius:"5px",backgroundColor:"#FFF",fontSize:"14px",fontWeight:600,color:"#5C5D5D",cursor:"pointer",transition:"all 0.2s"},modeButtonActive:{backgroundColor:"#186073",color:"#FFF",borderColor:"#186073"},infoText:{fontSize:"12px",color:"#6B7280",marginTop:"5px"}};function m(e){var t=e.show,n=e.onClose,i=e.onSubmit,s=e.selectedProject,c=e.selectedActivity,d=e.selectedTask,m=void 0===d?"":d,p=e.workloadHours,h=void 0===p?8:p,v=e.prefilledData,b=void 0===v?null:v,y=e.isReadOnly,g=void 0!==y&&y,x=e.allowProjectSelection,j=void 0!==x&&x,w=e.projectOptions,S=void 0===w?[]:w,N=e.activityOptions,k=void 0===N?[]:N,C=e.selectedProjectId,O=void 0===C?null:C,A=e.selectedActivityId,E=void 0===A?null:A,P=e.suggestedProjectName,F=e.suggestedActivityName,T=e.onProjectChange,D=e.onActivityChange,_=e.alreadyRegisteredMinutes,I=void 0===_?0:_,M=e.dailyLimitHours,R=void 0===M?null:M,z=u((0,a.useState)("time"),2),L=z[0],q=z[1],B=u((0,a.useState)(""),2),G=B[0],H=B[1],W=u((0,a.useState)(""),2),U=W[0],V=W[1],Q=u((0,a.useState)(""),2),K=Q[0],$=Q[1],J=u((0,a.useState)(""),2),Y=J[0],Z=J[1],X=u((0,a.useState)(!1),2),ee=X[0],te=X[1];(0,a.useEffect)(function(){t&&b?(q("time"),H(b.startTime),V(b.endTime),$(b.percentage.toFixed(2)),Z(b.comment||"")):t||(q("time"),H(""),V(""),$(""),Z(""))},[t,b]);var ne=function(e,t){if(!e||!t)return 0;var n=u(e.split(":").map(Number),2),r=n[0],a=n[1],o=u(t.split(":").map(Number),2);return 60*o[0]+o[1]-(60*r+a)},re=function(e,t){var n=ne(e,t),r=60*h;return r>0?n/r*100:0},ae=function(e){return!!R&&I+e>60*R};(0,a.useEffect)(function(){if("time"===L&&G&&U){var e=ne(G,U);te(ae(e))}else if("percentage"===L&&K){var t=60*h,n=Math.round(parseFloat(K)/100*t);te(ae(n))}else te(!1)},[L,G,U,K,I,R]);var oe,ie,se,le;return(0,r.jsxs)(o.A,{show:t,onClose:n,title:g?"Finalizar Contador Automático":"Adicionar Tempo Manual",size:"md",footer:(0,r.jsx)(o.M,{onCancel:n,onConfirm:function(){if("time"===L){if(!G||!U)return void alert("Por favor, preencha horário de início e fim");var e=ne(G,U);if(e<=0)return void alert("Horário de término deve ser maior que horário de início");var t=re(G,U);i({startTime:G,endTime:U,percentage:t,duration:e,comment:Y})}else{if(!K||parseFloat(K)<=0)return void alert("Por favor, informe uma porcentagem válida");var n=parseFloat(K);if(n>100)return void alert("Porcentagem não pode ser maior que 100%");var r=60*h,a=Math.round(n/100*r);i({startTime:"00:00",endTime:"00:00",percentage:n,duration:a,comment:Y})}},cancelText:"Cancelar",confirmText:"Salvar"}),children:[(0,r.jsxs)("div",{style:l(l({},f.formGroup),{},{backgroundColor:"#F8F9FA",padding:"12px",borderRadius:"5px"}),children:[j?(0,r.jsxs)("div",{style:{marginBottom:"12px"},children:[(0,r.jsx)("label",{style:l(l({},f.label),{},{marginBottom:"6px"}),children:"Projeto"}),(0,r.jsxs)("select",{style:l(l({},f.input),{},{backgroundColor:"#FFF"}),value:null!=O?O:"",onChange:function(e){var t=e.target.value,n=t?Number(t):null;null==T||T(n)},disabled:g,children:[(0,r.jsx)("option",{value:"",children:"Selecione um projeto"}),S.map(function(e){return(0,r.jsx)("option",{value:e.id,children:e.name},e.id)})]}),P&&!O&&(0,r.jsxs)("p",{style:l(l({},f.infoText),{},{marginTop:"6px"}),children:["Sugestão original: ",(0,r.jsx)("strong",{children:P})]})]}):(0,r.jsxs)("div",{style:{marginBottom:"5px"},children:[(0,r.jsx)("strong",{style:{fontSize:"13px",color:"#5C5D5D"},children:"Projeto:"})," ",(0,r.jsx)("span",{style:{fontSize:"13px",color:"#5C5D5D"},children:s||"Nenhum"})]}),m&&(0,r.jsxs)("div",{style:{marginBottom:"5px"},children:[(0,r.jsx)("strong",{style:{fontSize:"13px",color:"#5C5D5D"},children:"Tarefa:"})," ",(0,r.jsx)("span",{style:{fontSize:"13px",color:"#5C5D5D"},children:m})]}),j?(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{style:l(l({},f.label),{},{marginBottom:"6px"}),children:"Atividade"}),(0,r.jsxs)("select",{style:l(l({},f.input),{},{backgroundColor:"#FFF"}),value:null!=E?E:"",onChange:function(e){var t=e.target.value,n=t?Number(t):null;null==D||D(n)},disabled:g,children:[(0,r.jsx)("option",{value:"",children:"Selecione uma atividade"}),k.map(function(e){return(0,r.jsx)("option",{value:e.id,children:e.name},e.id)})]}),F&&!E&&(0,r.jsxs)("p",{style:l(l({},f.infoText),{},{marginTop:"6px"}),children:["Sugestão original: ",(0,r.jsx)("strong",{children:F})]})]}):c&&(0,r.jsxs)("div",{children:[(0,r.jsx)("strong",{style:{fontSize:"13px",color:"#5C5D5D"},children:"Atividade:"})," ",(0,r.jsx)("span",{style:{fontSize:"13px",color:"#5C5D5D"},children:c})]})]}),!g&&(0,r.jsxs)("div",{style:f.modeToggle,children:[(0,r.jsx)("button",{type:"button",style:l(l({},f.modeButton),"time"===L?f.modeButtonActive:{}),onClick:function(){return q("time")},children:"Horário Início/Fim"}),(0,r.jsx)("button",{type:"button",style:l(l({},f.modeButton),"percentage"===L?f.modeButtonActive:{}),onClick:function(){return q("percentage")},children:"% do Dia"})]}),"time"===L?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{style:f.inputGroup,children:[(0,r.jsxs)("div",{style:f.formGroup,children:[(0,r.jsx)("label",{style:f.label,children:"Hora de Início"}),(0,r.jsx)("input",{type:"time",style:l(l({},f.input),g?{backgroundColor:"#F3F4F6",cursor:"not-allowed"}:{}),value:G,onChange:function(e){return H(e.target.value)},disabled:g})]}),(0,r.jsxs)("div",{style:f.formGroup,children:[(0,r.jsx)("label",{style:f.label,children:"Hora de Término"}),(0,r.jsx)("input",{type:"time",style:l(l({},f.input),g?{backgroundColor:"#F3F4F6",cursor:"not-allowed"}:{}),value:U,onChange:function(e){return V(e.target.value)},disabled:g})]})]}),G&&U&&ne(G,U)>0&&(0,r.jsxs)("div",{style:{marginTop:"15px",padding:"12px",backgroundColor:"#E8F4F8",borderRadius:"5px",borderLeft:"3px solid #186073"},children:[(0,r.jsx)("div",{style:{fontSize:"13px",color:"#5C5D5D",marginBottom:"5px"},children:(0,r.jsx)("strong",{children:"Resumo:"})}),(0,r.jsxs)("div",{style:{fontSize:"12px",color:"#5C5D5D",lineHeight:"1.6"},children:[(0,r.jsxs)("div",{children:["Duração: ",(0,r.jsxs)("strong",{children:[Math.floor(ne(G,U)/60),"h ",ne(G,U)%60,"min"]})]}),(0,r.jsxs)("div",{children:["Porcentagem: ",(0,r.jsxs)("strong",{children:[re(G,U).toFixed(2),"%"]})," do dia"]}),(0,r.jsxs)("div",{children:["Base: ",h,"h de carga horária"]})]})]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{style:f.formGroup,children:[(0,r.jsx)("label",{style:f.label,children:"Porcentagem do Dia (%)"}),(0,r.jsx)("input",{type:"number",style:l(l({},f.input),g?{backgroundColor:"#F3F4F6",cursor:"not-allowed"}:{}),value:K,onChange:function(e){return $(e.target.value)},placeholder:"Ex: 25",min:"0",max:"100",step:"0.01",disabled:g}),(0,r.jsxs)("p",{style:f.infoText,children:["Base: ",h,"h por dia (100% = ",60*h," minutos)"]})]}),K&&parseFloat(K)>0&&parseFloat(K)<=100&&(0,r.jsxs)("div",{style:{marginTop:"15px",padding:"12px",backgroundColor:"#E8F4F8",borderRadius:"5px",borderLeft:"3px solid #186073"},children:[(0,r.jsx)("div",{style:{fontSize:"13px",color:"#5C5D5D",marginBottom:"5px"},children:(0,r.jsx)("strong",{children:"Resumo:"})}),(0,r.jsx)("div",{style:{fontSize:"12px",color:"#5C5D5D",lineHeight:"1.6"},children:(oe=60*h,ie=Math.round(parseFloat(K)/100*oe),se=Math.floor(ie/60),le=ie%60,(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{children:["Porcentagem: ",(0,r.jsxs)("strong",{children:[parseFloat(K).toFixed(2),"%"]})," do dia"]}),(0,r.jsxs)("div",{children:["Duração: ",(0,r.jsxs)("strong",{children:[se,"h ",le,"min"]})," (",ie," minutos)"]}),(0,r.jsxs)("div",{children:["Base: ",h,"h de carga horária"]})]}))})]})]}),(0,r.jsxs)("div",{style:f.formGroup,children:[(0,r.jsx)("label",{style:f.label,children:"Comentário (opcional)"}),(0,r.jsx)("textarea",{style:f.textarea,value:Y,onChange:function(e){return Z(e.target.value)},placeholder:"Adicione observações sobre a atividade..."})]}),ee&&R&&function(){var e=0;if("time"===L&&G&&U)e=ne(G,U);else if("percentage"===L&&K){var t=60*h;e=Math.round(parseFloat(K)/100*t)}var n=I+e,a=function(e){var t=Math.floor(e/60),n=e%60;return n>0?"".concat(t,"h").concat(n,"min"):"".concat(t,"h")};return(0,r.jsx)("div",{className:"alert alert-danger",role:"alert",children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-triangle mr-2"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("strong",{children:"Atenção: Limite de horas excedido!"}),(0,r.jsxs)("div",{className:"mt-2",style:{fontSize:"0.95rem"},children:["• Já registrado hoje: ",(0,r.jsx)("strong",{children:a(I)}),(0,r.jsx)("br",{}),"• Tentando adicionar: ",(0,r.jsx)("strong",{children:a(e)}),(0,r.jsx)("br",{}),"• Total seria: ",(0,r.jsx)("strong",{children:a(n)}),(0,r.jsx)("br",{}),"• Limite diário: ",(0,r.jsxs)("strong",{children:[R,"h"]})]}),(0,r.jsxs)("div",{className:"mt-2 small text-danger",children:[(0,r.jsx)("i",{className:"fas fa-ban mr-1"}),"Esta atividade será bloqueada ao tentar salvar."]})]})]})})}()]})}},14785(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>U});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(68156),n(62953);var r=n(74848),a=n(96540),o=n(33930),i=n(10280);n(45700),n(2008),n(51629),n(89572),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(23500);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==s(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){var t=e.label,n=e.isActive,a=e.onClick,o=e.width,i=void 0===o?"80.56px":o,s=e.className,l=void 0===s?"":s;return(0,r.jsx)("button",{onClick:a,className:"btn ".concat(n?"text-white":"btn-outline-info"," ").concat(l),style:c({width:i},n?{backgroundColor:"rgb(23, 162, 184)"}:{}),children:t})}var f=n(30588),m=n(73236),p=(n(94170),n(59904),n(40875),n(10287),n(3362),n(52354));function h(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return v(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(v(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,v(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,v(d,"constructor",c),v(c,"constructor",l),l.displayName="GeneratorFunction",v(c,a,"GeneratorFunction"),v(d),v(d,a,"Generator"),v(d,r,function(){return this}),v(d,"toString",function(){return"[object Generator]"}),(h=function(){return{w:o,m:f}})()}function v(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}v=function(e,t,n,r){function o(t,n){v(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},v(e,t,n,r)}function b(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function y(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){b(o,r,a,i,s,"next",e)}function s(e){b(o,r,a,i,s,"throw",e)}i(void 0)})}}function g(){return(g=y(h().m(function e(t,n){var r,a,o;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/kpis?start_date=".concat(t,"&end_date=").concat(n));case 1:return r=e.v,a=r.data.data,e.a(2,{totalRegistered:{hours:a.total_registered_formatted||"0h",label:"Total de Horas Registradas",source:"timesheet"},dailyAverage:{hours:a.daily_average_formatted||"0h",label:"Média Diária",source:"timesheet"},extraHours:{count:a.extra_hours_formatted||"0h",label:"Total de Horas Extras",source:"timesheet"},missingHours:{hours:a.missing_hours_formatted||"0h",label:"Total de Horas Faltantes",source:"timesheet"}});case 2:return e.p=2,o=e.v,console.error("Erro ao buscar KPIs do Tenant:",o),e.a(2,{totalRegistered:{hours:"...",label:"Total de Horas Registradas",source:"timesheet"},dailyAverage:{hours:"...",label:"Média Diária",source:"timesheet"},extraHours:{count:"...",label:"Total de Horas Extras",source:"timesheet"},missingHours:{hours:"...",label:"Total de Horas Faltantes",source:"timesheet"}})}},e,null,[[0,2]])}))).apply(this,arguments)}function x(){return(x=y(h().m(function e(t,n){var r,a;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/weekly-hours?start_date=".concat(t,"&end_date=").concat(n));case 1:return r=e.v,e.a(2,r.data.data||{timesheet:[],attendance:[]});case 2:return e.p=2,a=e.v,console.error("Erro ao buscar Weekly Hours do Tenant:",a),e.a(2,{timesheet:[],attendance:[]})}},e,null,[[0,2]])}))).apply(this,arguments)}function j(){return(j=y(h().m(function e(t,n){var r,a;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/projects/distribution?start_date=".concat(t,"&end_date=").concat(n));case 1:return r=e.v,e.a(2,r.data.data||[]);case 2:return e.p=2,a=e.v,console.error("Erro ao buscar distribuição de projetos do Tenant:",a),e.a(2,[])}},e,null,[[0,2]])}))).apply(this,arguments)}function w(){return(w=y(h().m(function e(t,n,r,a){var o,i,s;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,o="team"===r?"team_id":"group_id",e.n=1,p.F.get("/api/timesheet-v2/tenant/projects/distribution-pie?start_date=".concat(t,"&end_date=").concat(n,"&").concat(o,"=").concat(a));case 1:return i=e.v,e.a(2,{data:i.data.data||[],filter:i.data.filter||{type:r,id:a,member_count:0}});case 2:return e.p=2,s=e.v,console.error("Erro ao buscar distribuição de projetos por equipe/time:",s),e.a(2,{data:[],filter:{type:r,id:String(a),member_count:0}})}},e,null,[[0,2]])}))).apply(this,arguments)}function S(){return N.apply(this,arguments)}function N(){return(N=y(h().m(function e(){var t,n;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/teams");case 1:return t=e.v,e.a(2,t.data.data||[]);case 2:return e.p=2,n=e.v,console.error("Erro ao buscar equipes:",n),e.a(2,[])}},e,null,[[0,2]])}))).apply(this,arguments)}function k(){return C.apply(this,arguments)}function C(){return(C=y(h().m(function e(){var t,n;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/groups");case 1:return t=e.v,e.a(2,t.data.data||[]);case 2:return e.p=2,n=e.v,console.error("Erro ao buscar times:",n),e.a(2,[])}},e,null,[[0,2]])}))).apply(this,arguments)}function O(){return(O=y(h().m(function e(t,n){var r,a;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/energy-peaks?start_date=".concat(t,"&end_date=").concat(n));case 1:return r=e.v,e.a(2,r.data.data||{timesheet:[],attendance:[]});case 2:return e.p=2,a=e.v,console.error("Erro ao buscar picos de energia do Tenant:",a),e.a(2,{timesheet:[],attendance:[]})}},e,null,[[0,2]])}))).apply(this,arguments)}function A(){return(A=y(h().m(function e(t,n){var r,a;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/projects/budget-map?start_date=".concat(t,"&end_date=").concat(n));case 1:return r=e.v,e.a(2,r.data.data||[]);case 2:return e.p=2,a=e.v,console.error("Erro ao buscar mapa de projetos:",a),e.a(2,[])}},e,null,[[0,2]])}))).apply(this,arguments)}function E(){return(E=y(h().m(function e(t,n,r){var a,o;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/teams/summary?start_date=".concat(t,"&end_date=").concat(n,"&type=").concat(r));case 1:return a=e.v,e.a(2,a.data.data||[]);case 2:return e.p=2,o=e.v,console.error("Erro ao buscar resumo de equipes:",o),e.a(2,[])}},e,null,[[0,2]])}))).apply(this,arguments)}function P(){return(P=y(h().m(function e(t,n,r,a){var o,i,s;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/teams/kpis?start_date=".concat(t,"&end_date=").concat(n,"&type=").concat(r,"&filter_id=").concat(a));case 1:if(o=e.v,!(i=o.data.data)||!("total_registered_formatted"in i)){e.n=2;break}return e.a(2,{totalHoursWorked:{hours:i.total_registered_hours||0,minutes:i.total_registered_minutes||0,formatted:i.total_registered_formatted||"0h00"},totalMissingHours:{hours:i.missing_hours_hours||0,minutes:i.missing_hours_minutes||0,formatted:i.missing_hours_formatted||"0h00"},totalExtraHours:{hours:i.extra_hours_hours||0,minutes:i.extra_hours_minutes||0,formatted:i.extra_hours_formatted||"0h"},workOverload:i.work_overload||0,memberCount:i.member_count||0});case 2:return e.a(2,i||{totalHoursWorked:{hours:0,minutes:0,formatted:"0h00"},totalMissingHours:{hours:0,minutes:0,formatted:"0h00"},totalExtraHours:{hours:0,minutes:0,formatted:"0h00"},workOverload:0,memberCount:0});case 3:return e.p=3,s=e.v,console.error("Erro ao buscar KPIs de equipe:",s),e.a(2,{totalHoursWorked:{hours:0,minutes:0,formatted:"0h00"},totalMissingHours:{hours:0,minutes:0,formatted:"0h00"},totalExtraHours:{hours:0,minutes:0,formatted:"0h00"},workOverload:0,memberCount:0})}},e,null,[[0,3]])}))).apply(this,arguments)}function F(){return(F=y(h().m(function e(t,n){var r,a;return h().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,p.F.get("/api/timesheet-v2/tenant/members/summary?start_date=".concat(t,"&end_date=").concat(n));case 1:return r=e.v,e.a(2,r.data.data||[]);case 2:return e.p=2,a=e.v,console.error("Erro ao buscar resumo de membros:",a),e.a(2,[])}},e,null,[[0,2]])}))).apply(this,arguments)}var T=n(71458),D=n(93628),_=n(80217),I=n(65207),M=n(42328),R=n(49299),z=n(4818),L=n(92801),q=n(72722),B=n(9504),G=n(50860);function H(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return W(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?W(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function W(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function U(){var e,t,n,s,l,c,u,p,h,v,b,y,N,C,W=H((0,a.useState)(function(){var e=new Date,t=new Date;t.setDate(t.getDate()-30);var n=function(e){var t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(r)};return{startDate:n(t),endDate:n(e)}}()),2),U=W[0],V=W[1],Q=H((0,a.useState)("times"),2),K=Q[0],$=Q[1],J=H((0,a.useState)("equipes"),2),Y=J[0],Z=J[1],X=H((0,a.useState)(["task","attendance"]),2),ee=X[0],te=X[1],ne=H((0,a.useState)(["timesheet","attendance"]),2),re=ne[0],ae=ne[1],oe=H((0,a.useState)(null),2),ie=oe[0],se=oe[1],le=(0,a.useRef)(null),ce=H((0,a.useState)(!1),2),ue=ce[0],de=ce[1],fe=(0,o.I)({queryKey:["time-management","teams"],queryFn:S,staleTime:3e5}).data,me=void 0===fe?[]:fe,pe=(0,o.I)({queryKey:["time-management","groups"],queryFn:k,staleTime:3e5}).data,he=void 0===pe?[]:pe,ve="equipes"===K?(null===(e=me[0])||void 0===e?void 0:e.id)||null:(null===(t=he[0])||void 0===t?void 0:t.id)||null,be="equipes"===Y?(null===(n=me[0])||void 0===n?void 0:n.id)||null:(null===(s=he[0])||void 0===s?void 0:s.id)||null,ye=(0,o.I)({queryKey:["time-management","timesheet","projects-distribution",U.startDate,U.endDate],queryFn:function(){return function(e,t){return j.apply(this,arguments)}(U.startDate,U.endDate)},staleTime:6e4,refetchOnWindowFocus:!1}),ge=ye.data,xe=(0,o.I)({queryKey:["time-management","timesheet","projects-distribution-pie",U.startDate,U.endDate,K,ve],queryFn:function(){return ve?function(e,t,n,r){return w.apply(this,arguments)}(U.startDate,U.endDate,"equipes"===K?"team":"group",ve):{data:[],filter:{type:K,id:"",member_count:0}}},enabled:!!ve,staleTime:6e4,refetchOnWindowFocus:!1}),je=xe.data,we=(0,o.I)({queryKey:["time-management","timesheet","weekly-hours",U.startDate,U.endDate],queryFn:function(){return function(e,t){return x.apply(this,arguments)}(U.startDate,U.endDate)},staleTime:6e4,refetchOnWindowFocus:!1}),Se=we.data,Ne=(0,o.I)({queryKey:["time-management","timesheet","energy-peaks",U.startDate,U.endDate],queryFn:function(){return function(e,t){return O.apply(this,arguments)}(U.startDate,U.endDate)},staleTime:6e4,refetchOnWindowFocus:!1}),ke=Ne.data,Ce=(0,o.I)({queryKey:["time-management","timesheet","projects-budget-map",U.startDate,U.endDate],queryFn:function(){return function(e,t){return A.apply(this,arguments)}(U.startDate,U.endDate)},staleTime:6e4,refetchOnWindowFocus:!1}),Oe=Ce.data,Ae=(0,o.I)({queryKey:["time-management","timesheet","teams-summary",U.startDate,U.endDate,Y],queryFn:function(){return function(e,t,n){return E.apply(this,arguments)}(U.startDate,U.endDate,"equipes"===Y?"team":"group")},staleTime:6e4,refetchOnWindowFocus:!1}),Ee=Ae.data,Pe=(0,o.I)({queryKey:["time-management","timesheet","general-kpis",U.startDate,U.endDate],queryFn:function(){return function(e,t){return g.apply(this,arguments)}(U.startDate,U.endDate)},staleTime:6e4,refetchOnWindowFocus:!1}),Fe=Pe.data,Te=(0,o.I)({queryKey:["time-management","timesheet","teams-kpis",U.startDate,U.endDate,Y,be],queryFn:function(){return be?function(e,t,n,r){return P.apply(this,arguments)}(U.startDate,U.endDate,"equipes"===Y?"team":"group",be):null},enabled:!!be,staleTime:6e4,refetchOnWindowFocus:!1}),De=Te.data,_e=(0,o.I)({queryKey:["time-management","timesheet","members-summary",U.startDate,U.endDate],queryFn:function(){return function(e,t){return F.apply(this,arguments)}(U.startDate,U.endDate)},staleTime:6e4,refetchOnWindowFocus:!1}),Ie=_e.data;return ie?(0,r.jsx)(L.A,{title:"Dashboard - ".concat(ie.name),subtitle:"Visão detalhada das horas trabalhadas e performance individual",showBackButton:!0,onBack:function(){return se(null)},showExportButton:!0,onExport:function(){return console.log("Exportar dashboard do colaborador")},userInfo:{name:ie.name,initials:ie.initials,avatarBg:ie.avatarBg},memberId:ie.id}):(0,r.jsxs)("section",{ref:le,className:"options-section-project",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between mb-4 mt-3",children:[(0,r.jsxs)("button",{onClick:function(){(0,B.vl)({dashboardRef:le,dateRange:U,setIsExporting:de})},disabled:ue,className:"btn ml-4",style:{backgroundColor:"#186073",color:"#fff",border:"none",borderRadius:"8px",padding:"10px 20px",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",cursor:ue?"not-allowed":"pointer",opacity:ue?.7:1,transition:"all 0.2s ease"},onMouseEnter:function(e){ue||(e.currentTarget.style.backgroundColor="#134A5A")},onMouseLeave:function(e){e.currentTarget.style.backgroundColor="#186073"},children:[(0,r.jsx)("i",{className:"fas fa-download"}),ue?"Exportando...":"Exportar"]}),(0,r.jsx)(f.A,{initialStartDate:U.startDate,initialEndDate:U.endDate,onChange:function(e){V(e)},maxDays:365,className:"mr-4"})]}),(0,r.jsxs)(G.A,{title:"",subtitle:"",children:[(0,r.jsxs)("div",{className:"row mb-4",children:[(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(i.A,{value:(null==Fe||null===(l=Fe.totalRegistered)||void 0===l?void 0:l.hours)||"",label:"Total de Horas Registradas",variant:"teal-dark",className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(i.A,{value:(null==Fe||null===(c=Fe.dailyAverage)||void 0===c?void 0:c.hours)||"",label:"Média Diária",variant:"cyan",className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(i.A,{value:(null==Fe||null===(u=Fe.extraHours)||void 0===u?void 0:u.count)||"",label:"Total de Horas Extras",variant:"turquoise",className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(i.A,{value:(null==Fe||null===(p=Fe.missingHours)||void 0===p?void 0:p.hours)||"",label:"Total de Horas Faltantes",variant:"salmon",className:"h-100"})})]}),(0,r.jsx)(m.A,{title:"Horas Trabalhadas na Semana",className:"mt-3",headerActions:(0,r.jsx)(q.A,{options:[{value:"task",label:"Referência Por Task"},{value:"attendance",label:"Referência Por Registro de Ponto"}],selectedValues:ee,onChange:te,placeholder:"Selecione os filtros",dropdownStyle:{right:0,left:"auto"}}),children:(0,r.jsx)(T.A,{selectedFilters:ee,weeklyData:(null==Se?void 0:Se.timesheet)||[],attendanceData:(null==Se?void 0:Se.attendance)||[]})}),(0,r.jsx)(m.A,{title:"Horas trabalhadas por projeto",className:"mt-3",children:(0,r.jsx)(D.A,{projects:ge||[]})}),(0,r.jsxs)("div",{className:"row mt-3",children:[(0,r.jsx)("div",{className:"col-12 col-lg-4 mb-3",children:(0,r.jsxs)(m.A,{title:"Distribuição de Horas por Projeto",className:"h-100",children:[(0,r.jsx)("div",{className:"mb-3 d-flex justify-content-end",children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)(d,{label:"Equipe",isActive:"equipes"===K,onClick:function(){return $("equipes")},width:"80.56px",className:"mr-2"}),(0,r.jsx)(d,{label:"Time",isActive:"times"===K,onClick:function(){return $("times")},width:"89.68px"})]})}),(0,r.jsx)(_.default,{viewMode:K,onViewModeChange:$,projects:(null==je?void 0:je.data)||[]})]})}),(0,r.jsx)("div",{className:"col-12 col-lg-8 mb-3",children:(0,r.jsx)(m.A,{title:"Picos de Energia - Horas Registradas por Dia",className:"h-100",headerActions:(0,r.jsx)(q.A,{options:[{value:"timesheet",label:"Por Timesheet"},{value:"attendance",label:"Por Registro de Ponto"}],selectedValues:re,onChange:ae,placeholder:"Selecione os filtros"}),children:(0,r.jsx)(M.A,{selectedFilters:re,timesheetData:(null==ke?void 0:ke.timesheet)||[],attendanceData:(null==ke?void 0:ke.attendance)||[]})})})]}),(0,r.jsx)("div",{className:"mt-4",children:(0,r.jsx)(m.A,{title:"Mapa de Projetos: Orçamento (R$) e Tempo Gasto (%)",children:(0,r.jsx)(z.default,{projects:Oe||[]})})}),(0,r.jsxs)("div",{className:"mt-4",children:[(0,r.jsx)("h3",{className:"tm-section-title mb-3",children:"Resumo de Horas Trabalhadas por Equipe & Times"}),(0,r.jsx)(m.A,{title:"Controle de Horas Trabalhadas",className:"",headerActions:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)(d,{label:"Equipe",isActive:"equipes"===Y,onClick:function(){return Z("equipes")},width:"80.56px",className:"mr-2"}),(0,r.jsx)(d,{label:"Time",isActive:"times"===Y,onClick:function(){return Z("times")},width:"89.68px"})]}),children:(0,r.jsx)(R.default,{teams:Ee||[]})})]}),(0,r.jsx)("div",{className:"mt-3",children:(0,r.jsx)(I.default,{onCollaboratorClick:se,kpis:De&&(((null===(h=De.totalHoursWorked)||void 0===h?void 0:h.hours)||0)>0||((null===(v=De.totalHoursWorked)||void 0===v?void 0:v.minutes)||0)>0||((null===(b=De.totalMissingHours)||void 0===b?void 0:b.hours)||0)>0||((null===(y=De.totalMissingHours)||void 0===y?void 0:y.minutes)||0)>0||((null===(N=De.totalExtraHours)||void 0===N?void 0:N.hours)||0)>0||((null===(C=De.totalExtraHours)||void 0===C?void 0:C.minutes)||0)>0)?De:Fe?{totalHoursWorked:{hours:0,minutes:0,formatted:Fe.totalRegistered.hours},totalMissingHours:{hours:0,minutes:0,formatted:Fe.missingHours.hours},totalExtraHours:{hours:0,minutes:0,formatted:Fe.extraHours.count},workOverload:0,memberCount:0}:void 0,members:Ie||[]})})]})]})}},15186(e,t,n){"use strict";n.r(t),n.d(t,{NoShiftAssigned:()=>a});var r=n(74848),a=function(){return(0,r.jsxs)("div",{className:"d-flex flex-column align-items-center justify-content-center",style:{minHeight:"500px",padding:"40px 20px"},children:[(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)("img",{src:"/images/time_management/clock.png",alt:"Relógio",style:{width:"120px",height:"120px",objectFit:"contain"}})}),(0,r.jsx)("h4",{style:{fontFamily:"Inter",fontSize:"20px",fontWeight:600,color:"#5C5D5D",marginBottom:"12px",textAlign:"center"},children:"Nenhum turno vinculado"}),(0,r.jsx)("p",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:400,color:"rgba(92, 93, 93, 0.70)",textAlign:"center",maxWidth:"450px",lineHeight:"1.5",margin:0},children:"Parece que você ainda não está associado a um turno. Procure seu gestor ou RH para habilitar o ponto."})]})}},17147(e,t,n){"use strict";n.r(t),n.d(t,{LocationSection:()=>v});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(26099),n(78459),n(27495),n(38781),n(47764),n(62953),n(76031);var r=n(74848),a=n(33930),o=n(97665),i=n(57097),s=n(55278),l=n(96540),c=n(30786),u=n(76336);function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var m=["time-management","location"],p=["time-management","can-view-maps"];function h(e){var t=e.location,n=(0,l.useRef)(null),a=(0,l.useRef)(null),o=d((0,l.useState)(!1),2),i=o[0],s=o[1];return(0,l.useEffect)(function(){if(n.current&&t.latitude&&t.longitude&&void 0!==window.google)try{var e=parseFloat(t.latitude),r=parseFloat(t.longitude);if(isNaN(e)||isNaN(r))return void console.error("Coordenadas inválidas:",t.latitude,t.longitude);var o={lat:e,lng:r},i=new window.google.maps.Map(n.current,{zoom:15,center:o,disableDefaultUI:!0,draggable:!1,scrollwheel:!1,disableDoubleClickZoom:!0,zoomControl:!1,mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!1,gestureHandling:"none"});new window.google.maps.Marker({position:o,map:i}),a.current=i,s(!0);var l=function(){a.current&&(window.google.maps.event.trigger(a.current,"resize"),a.current.setCenter(o))};return window.addEventListener("resize",l),function(){window.removeEventListener("resize",l)}}catch(e){console.error("Erro ao criar mapa:",e)}},[t]),t.latitude&&t.longitude?(0,r.jsxs)("div",{style:{width:"100%",height:"150px",position:"relative"},children:[!i&&(0,r.jsx)("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f5f5f5",borderRadius:"0 0 8px 8px",borderTop:"1px solid #e0e0e0"},children:(0,r.jsx)("i",{className:"fas fa-spinner fa-spin text-muted"})}),(0,r.jsx)("div",{ref:n,style:{width:"100%",height:"100%",borderRadius:"0 0 8px 8px",cursor:"pointer",borderTop:"1px solid #e0e0e0"},onClick:function(){return window.open(t.google_url,"_blank")},title:"Clique para abrir no Google Maps"})]}):(0,r.jsx)("div",{style:{width:"100%",height:"150px",borderRadius:"0 0 8px 8px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f5f5f5",borderTop:"1px solid #e0e0e0"},children:(0,r.jsx)("small",{className:"text-muted",children:"Sem coordenadas"})})}function v(){var e=(0,u.L)(),t=e.canCreate,n=e.canEdit,f=e.canDelete,v=d((0,l.useState)(!1),2),b=v[0],y=v[1],g=d((0,l.useState)(null),2),x=g[0],j=g[1],w=d((0,l.useState)(!1),2),S=w[0],N=w[1],k=(0,o.jE)(),C=(0,a.I)({queryKey:m,queryFn:s.Eq}),O=C.data,A=void 0===O?[]:O,E=C.isFetching,P=(0,a.I)({queryKey:p,queryFn:s.vD,staleTime:6e4,refetchOnWindowFocus:!1}).data,F=void 0!==P&&P;(0,l.useEffect)(function(){if(F)if(void 0===window.google){var e=window.GOOGLE_MAPS_API_KEY;if(e){if(document.querySelector('script[src*="maps.googleapis.com"]')){var t=setInterval(function(){void 0!==window.google&&(N(!0),clearInterval(t))},100);return function(){return clearInterval(t)}}var n=document.createElement("script");n.src="https://maps.googleapis.com/maps/api/js?key=".concat(e,"&libraries=places"),n.async=!0,n.onload=function(){return N(!0)},document.head.appendChild(n)}else console.error("Google Maps API key não encontrada")}else N(!0)},[F]);var T=(0,i.n)({mutationFn:s.zR,onSuccess:function(){k.invalidateQueries({queryKey:m})}}),D=(0,l.useMemo)(function(){return 0===A.length},[A]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("style",{children:"\n .location-list-scroll { overflow-x: visible !important; }\n .location-list-scroll .card { overflow: visible !important; }\n .location-list-scroll .card-body { overflow: visible !important; }\n .location-list-scroll .d-flex { overflow: visible !important; }\n .location-list-scroll::-webkit-scrollbar {\n width: 6px;\n }\n .location-list-scroll::-webkit-scrollbar-track {\n background: #f1f1f1;\n border-radius: 10px;\n }\n .location-list-scroll::-webkit-scrollbar-thumb {\n background: #888;\n border-radius: 10px;\n }\n .location-list-scroll::-webkit-scrollbar-thumb:hover {\n background: #555;\n }\n "}),!D&&(0,r.jsx)("div",{className:"mb-3 location-list-scroll",style:{maxHeight:"600px",overflowY:"auto",overflowX:"visible",paddingRight:"8px"},children:A.map(function(e){return(0,r.jsx)("div",{className:"card mb-3",style:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"visible"},children:(0,r.jsxs)("div",{className:"card-body py-3",style:{overflow:"visible"},children:[(0,r.jsxs)("div",{className:"row no-gutters align-items-center",style:{overflow:"visible"},children:[(0,r.jsx)("div",{className:"col-auto pr-2 d-flex align-items-center justify-content-center",children:(0,r.jsx)("div",{style:{width:40,height:40,backgroundColor:"rgba(23, 162, 184, 0.1)"},className:"d-flex align-items-center justify-content-center rounded",title:"Localização",children:(0,r.jsx)("i",{className:"fas fa-map-marker-alt",style:{fontSize:"1.2rem",color:"#17A2B8"}})})}),(0,r.jsx)("div",{className:"col-12 col-md-4 px-2 d-flex",style:{minWidth:0},children:(0,r.jsxs)("div",{className:"d-flex flex-column justify-content-center w-100",style:{minWidth:0},children:[(0,r.jsxs)("span",{className:"font-weight-bold text-truncate",style:{minWidth:0},children:[e.address,e.number&&", ".concat(e.number)]}),e.neighborhood&&(0,r.jsx)("span",{className:"text-muted text-truncate",style:{fontSize:"0.85rem",minWidth:0},children:e.neighborhood})]})}),(0,r.jsx)("div",{className:"col px-2 d-flex",style:{minWidth:0},children:(0,r.jsxs)("div",{className:"w-100 my-auto text-muted text-truncate text-center",style:{minWidth:0,fontSize:"0.9rem"},children:[e.city||"—",e.country&&", ".concat(e.country)]})}),(0,r.jsxs)("div",{className:"col-auto pl-2 dropdown ml-auto",style:{flexShrink:0,position:"static"},children:[(0,r.jsx)("button",{className:"btn btn-link text-muted p-0","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{fontSize:"1.2rem"},children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v"})}),(0,r.jsxs)("div",{className:"dropdown-menu dropdown-menu-right",children:[n&&(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(){return function(e){j(e),y(!0)}(e)},disabled:T.isPending,children:[(0,r.jsx)("i",{className:"far fa-edit mr-2"}),"Editar"]}),(0,r.jsxs)("a",{className:"dropdown-item",href:e.google_url,target:"_blank",rel:"noopener noreferrer",children:[(0,r.jsx)("i",{className:"fas fa-map-marked-alt mr-2"}),"Ver no Google Maps"]}),f&&(0,r.jsxs)("button",{className:"dropdown-item text-danger",onClick:function(){return function(e){window.confirm('Tem certeza que deseja excluir a localização "'.concat(e.address,'"?'))&&T.mutate(e.id)}(e)},disabled:T.isPending,children:[(0,r.jsx)("i",{className:"far fa-trash-alt mr-2"}),T.isPending?"Excluindo...":"Excluir"]})]})]})]}),F&&(0,r.jsx)("div",{className:"mt-3",style:{marginLeft:"-1.25rem",marginRight:"-1.25rem",marginBottom:"-1.25rem"},children:S?(0,r.jsx)(h,{location:e}):(0,r.jsx)("div",{style:{width:"100%",height:"150px",borderRadius:"0 0 8px 8px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f5f5f5"},children:(0,r.jsx)("i",{className:"fas fa-spinner fa-spin text-muted"})})})]})},e.id)})}),t&&(0,r.jsxs)("div",{className:"text-muted d-flex align-items-center",role:"button",onClick:function(){return y(!0)},style:{cursor:"pointer",fontSize:"0.95rem"},children:[(0,r.jsx)("i",{className:"fas fa-plus mr-2"})," Adicionar Localização",E&&(0,r.jsx)("i",{className:"fas fa-spinner fa-spin ml-2"})]}),b&&(0,r.jsx)(c.default,{show:b,onClose:function(){y(!1),j(null)},editData:x})]})}},17649(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>d});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(1806);function i(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var i=r&&r.prototype instanceof c?r:c,u=Object.create(i.prototype);return s(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(s(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,s(m,"constructor",d),s(d,"constructor",u),u.displayName="GeneratorFunction",s(d,a,"GeneratorFunction"),s(m),s(m,a,"Generator"),s(m,r,function(){return this}),s(m,"toString",function(){return"[object Generator]"}),(i=function(){return{w:o,m:p}})()}function s(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}s=function(e,t,n,r){function o(t,n){s(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},s(e,t,n,r)}function l(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){var t=e.show,n=e.onClose,s=e.hasExistingSatisfaction,u=e.initialSatisfaction,d=e.onConfirmFinalize,f=c((0,a.useState)(null),2),m=f[0],p=f[1],h=Array.from({length:5},function(e,t){return t+1});(0,a.useEffect)(function(){p(t?u:null)},[t,u]);var v=function(){var e,t=(e=i().m(function e(){var t;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,d(m);case 1:n(),e.n=3;break;case 2:e.p=2,t=e.v,console.error("Erro ao concluir finalização do dia:",t),alert("Não foi possível concluir a finalização do dia. Por favor, tente novamente.");case 3:return e.a(2)}},e,null,[[0,2]])}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){l(o,r,a,i,s,"next",e)}function s(e){l(o,r,a,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}(),b=!s&&null===m;return(0,r.jsx)(o.A,{show:t,onClose:n,title:"Satisfação com o Trabalho Realizado",size:"md",footer:(0,r.jsx)(o.M,{onCancel:n,onConfirm:v,cancelText:"Fechar",confirmText:"Finalizar Dia",confirmDisabled:b}),children:(0,r.jsxs)("div",{style:{textAlign:"center"},children:[(0,r.jsx)("p",{style:{marginBottom:"20px",color:"#5C5D5D"},children:"Selecione o ponto que melhor representa como você se sente em relação ao trabalho realizado."}),s&&(0,r.jsx)("p",{style:{marginBottom:"20px",color:"#8A8A8A",fontSize:"13px"},children:"A satisfação já foi registrada. Confirme para finalizar ou escolha um novo ponto para atualizar."}),(0,r.jsx)("div",{style:{position:"relative",margin:"30px 0"},children:(0,r.jsxs)("div",{style:{position:"relative",height:"28px",width:"100%",borderRadius:"6px",overflow:"hidden",boxShadow:"inset 0 0 6px rgba(0,0,0,0.2)",border:"1px solid #d9d9d9"},children:[(0,r.jsx)("div",{style:{position:"absolute",inset:0,background:"linear-gradient(to right, #FF4D4D 0%, #FF4D4D 20%, #FF8A65 20%, #FF8A65 40%, #FFCA28 40%, #FFCA28 60%, #8BC34A 60%, #8BC34A 80%, #4CAF50 80%, #4CAF50 100%)"}}),(0,r.jsx)("div",{style:{position:"absolute",inset:0,display:"flex",zIndex:1},children:h.map(function(e,t){var n=m===e;return(0,r.jsx)("button",{type:"button",onClick:function(){return function(e){p(e)}(e)},style:{flex:1,border:n?"2px dashed #ffffff":"1px solid transparent",backgroundColor:n?"rgba(255,255,255,0.16)":"transparent",cursor:"pointer",borderRight:n||t===h.length-1?"none":"1px solid rgba(255,255,255,0.4)",outline:"none",boxSizing:"border-box",borderRadius:0===t?"6px 0 0 6px":t===h.length-1?"0 6px 6px 0":0,transition:"background-color 0.2s ease, border 0.2s ease"},"aria-label":"Satisfação nível ".concat(e)},e)})}),null!==m&&(0,r.jsx)("div",{style:{position:"absolute",top:"-10px",left:"".concat((m-.5)/5*100,"%"),transform:"translateX(-50%)",width:0,height:0,borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:"10px solid #ffffff",zIndex:2}})]})})]})})}},18098(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>G});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(50113),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(94170),n(62010),n(2892),n(59904),n(67945),n(84185),n(83851),n(81278),n(40875),n(79432),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(68156),n(23500),n(62953);var r=n(74848),a=n(96540),o=n(97665),i=n(33930),s=n(57097),l=n(50860),c=n(8596),u=n(31475),d=n(69511),f=n(46550),m=n(25149),p=n(72810),h=n(15186),v=n(77770),b=n(5380),y=n(2698),g=n(39576),x=n(92454),j=n(67784),w=n(18752),S=n(85231);n(15086);function N(e){return e?"Nenhum canal de registro habilitado para o aplicativo.":"Registro via navegador não habilitado. Use o aplicativo."}var k=n(82942);n(74423),n(21699);function C(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return O(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function A(){var e=C((0,a.useState)(!1),2),t=e[0],n=e[1];return(0,a.useEffect)(function(){n(function(){if("undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().includes("metahuman-app"))return!0;if("undefined"!=typeof window&&window.__IS_APP__)return!0;if("undefined"!=typeof window){var e=!!window.Capacitor,t=!!window.cordova;if(e||t)return!0}return!1}())},[]),{isApp:t,isWeb:!t}}var E=n(47339);function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function F(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return T(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(T(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,T(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,T(d,"constructor",c),T(c,"constructor",l),l.displayName="GeneratorFunction",T(c,a,"GeneratorFunction"),T(d),T(d,a,"Generator"),T(d,r,function(){return this}),T(d,"toString",function(){return"[object Generator]"}),(F=function(){return{w:o,m:f}})()}function T(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}T=function(e,t,n,r){function o(t,n){T(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},T(e,t,n,r)}function D(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function _(e){return function(e){if(Array.isArray(e))return R(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||M(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||M(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){if(e){if("string"==typeof e)return R(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(e,t):void 0}}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z(Object(n),!0).forEach(function(t){q(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function q(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=P(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=P(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==P(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function B(e){var t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(r)}function G(){var e,t,n,C,O,P=I((0,a.useState)(B(new Date)),2),T=P[0],M=P[1],R=I((0,a.useState)(null),2),z=R[0],q=R[1],G=I((0,a.useState)(!1),2),H=G[0],W=G[1],U=I((0,a.useState)(!1),2),V=U[0],Q=U[1],K=I((0,a.useState)(null),2),$=K[0],J=K[1],Y=I((0,a.useState)("ponto"),2),Z=Y[0],X=Y[1],ee=I((0,a.useState)(!1),2),te=ee[0],ne=ee[1],re=I((0,a.useState)(!1),2),ae=re[0],oe=re[1],ie=(0,o.jE)();(0,a.useEffect)(function(){var e=function(){var e=window.innerWidth<=768;ne(e)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var se,le,ce,ue=A().isApp,de=(0,i.I)({queryKey:["professional","shift",T],queryFn:function(){return(0,S.Tp)(T)},staleTime:3e5}),fe=de.data,me=de.isLoading,pe=de.error,he=function(e,t){if(!e)return null;if(!e.rows||!Array.isArray(e.rows))return e;if(!e.clock_in_records||!e.clock_in_records[t])return e;var n=e.clock_in_records[t],r={first_check_in:0,first_check_out:1,second_check_in:2,second_check_out:3},a=e.rows.map(function(e,t){var a=Object.keys(r).find(function(e){return r[e]===t});return a&&n[a]?L(L({},e),{},{mode:n[a].mode}):e});return L(L({},e),{},{rows:a})}(fe,T),ve=fe&&null!==fe.name&&null!==fe.rows,be=(0,i.I)({queryKey:["professional","occurrences",T],queryFn:function(){return(0,S.xP)(T)},staleTime:12e4}),ye=be.data,ge=be.isLoading,xe=function(e,t){return!(!e||!Array.isArray(e)||0===e.length)&&(t?e.some(function(e){return"app"===e.type||"qr"===e.type}):e.some(function(e){return"web"===e.type}))}(null==he?void 0:he.channels,ue),je=((null==he||null===(e=he.rows)||void 0===e?void 0:e.filter(function(e){return!e.muted}).length)||0)>=4,we=(0,k.Q8)(null==he?void 0:he.validate_points,ue),Se=[].concat(_(we),["teste"]),Ne=((0,k.AD)(null==he?void 0:he.validate_points,ue),(0,s.n)({mutationFn:S.X3,onSuccess:function(e){ie.invalidateQueries({queryKey:["professional","shift"]}),ie.invalidateQueries({queryKey:["professional","occurrences"]}),q(null),E.A.success(e.message||"Ponto registrado com sucesso!")},onError:function(e){var t,n=null===(t=e.response)||void 0===t?void 0:t.data,r=(null==n?void 0:n.error)||"Erro ao registrar ponto",a=(null==n?void 0:n.details)||(null==n?void 0:n.message)||"Tente novamente.";E.A.error(a,r)}})),ke=(0,s.n)({mutationFn:function(e){var t=e.occurrenceId,n=e.justification;return(0,S.GB)(t,n)},onSuccess:function(e){ie.invalidateQueries({queryKey:["professional","occurrences"]}),W(!1),J(null);var t=(null==e?void 0:e.message)||"Justificativa adicionada com sucesso!";alert(t)},onError:function(e){var t,n,r;console.error("Erro ao adicionar justificativa - erro completo:",e),console.error("Erro response:",e.response),console.error("Erro response data:",null===(t=e.response)||void 0===t?void 0:t.data);var a=(null===(n=e.response)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.error)||(null===(r=e.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.message)||e.message||"Erro ao adicionar justificativa. Tente novamente.";alert(a)}}),Ce=(0,s.n)({mutationFn:function(e){var t=e.occurrenceId,n=e.time;return(0,S.bP)(t,n)},onSuccess:function(e){ie.invalidateQueries({queryKey:["professional","shift"]}),ie.invalidateQueries({queryKey:["professional","occurrences"]}),Q(!1),J(null);var t=(null==e?void 0:e.message)||"Horário editado com sucesso!";alert(t)},onError:function(e){var t,n,r;console.error("Erro ao editar horário - erro completo:",e),console.error("Erro response:",e.response),console.error("Erro response data:",null===(t=e.response)||void 0===t?void 0:t.data);var a=(null===(n=e.response)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.error)||(null===(r=e.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.message)||e.message||"Erro ao editar horário. Tente novamente.";alert(a)}}),Oe=function(){if(ue)return"mobile";var e=navigator.userAgent.toLowerCase(),t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(e),n=window.innerWidth<=768;return t||n?"mobile":"desktop"},Ae=function(){var e,t=(e=F().m(function e(){var t,n,r,a=arguments;return F().w(function(e){for(;;)switch(e.n){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:{},n=B(new Date),!(T<n)){e.n=1;break}return alert("Não é permitido registrar ponto em dias anteriores. Por favor, selecione a data de hoje."),e.a(2);case 1:if(!je){e.n=2;break}return alert("Você já registrou os 4 pontos do dia. Não é possível registrar mais pontos."),e.a(2);case 2:r=L({device:Oe(),mode:"individual"},t),Ne.mutate(r);case 3:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){D(o,r,a,i,s,"next",e)}function s(e){D(o,r,a,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}(),Ee=function(){Ae()},Pe=function(e){xe?"none"!==e?q(e):Ae():alert(N(ue))},Fe=function(e){q(null),Ae({selfie:e})},Te=function(e){q(null),Ae({location:e})},De=function(e){q(null),Ae({screenshot:e})},_e=function(e){q(null),Ae({qrcode:e})},Ie=function(e){q(null),Ae({testTime:e})},Me=function(){q(null)},Re=function(e){M(e)},ze=function(e){J(e),W(!0)},Le=function(e){null!=$&&$.id?ke.mutate({occurrenceId:$.id,justification:e}):alert("Erro: Ocorrência não selecionada")},qe=function(e){J(e),Q(!0)},Be=function(e){null!=$&&$.id?Ce.mutate({occurrenceId:$.id,time:e}):alert("Erro: Ocorrência não selecionada")};return te?me?(0,r.jsxs)("section",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",padding:"40px 20px"},children:[(0,r.jsx)("div",{className:"spinner-border text-info",role:"status"}),(0,r.jsx)("p",{style:{marginTop:"20px",color:"#5C5D5D",fontSize:"14px"},children:"Carregando..."})]}):(0,r.jsxs)("section",{style:{minHeight:"100vh",paddingBottom:"20px"},children:[(0,r.jsx)(d.default,{activeTab:Z,onTabChange:X,selectedDate:T,onDateChange:Re}),"ponto"===Z?(0,r.jsxs)(r.Fragment,{children:[pe?(0,r.jsxs)("div",{className:"p-3 text-center text-danger",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle me-2"}),"Erro ao carregar dados do turno"]}):ve?he&&he.rows?(0,r.jsx)(f.default,{rows:he.rows}):null:(0,r.jsx)(h.NoShiftAssigned,{}),ve&&(0,r.jsx)("div",{className:"p-3 mt-3",children:(0,r.jsxs)("button",{onClick:function(){Se.length>0?oe(!0):Ee()},disabled:T<B(new Date)||je||!xe,className:"btn btn-info btn-lg btn-block",children:[(0,r.jsx)("i",{className:"fas fa-clock mr-2"}),"Registrar Ponto"]})})]}):(0,r.jsx)(r.Fragment,{children:ve?ge?(0,r.jsxs)("div",{className:"py-4 px-3 text-center",children:[(0,r.jsx)("div",{className:"spinner-border spinner-border-sm me-2 text-info",role:"status"}),(0,r.jsx)("span",{children:"Carregando..."})]}):ye?(0,r.jsx)(m.default,{items:ye,editPointEnabled:(null==he||null===(se=he.policy)||void 0===se?void 0:se.editPoint)||!1,onAddJustification:ze,onEditPoint:qe}):(0,r.jsx)("div",{className:"py-4 px-3 text-center text-muted",children:"Erro ao carregar ocorrências"}):(0,r.jsx)(h.NoShiftAssigned,{})}),(0,r.jsx)(p.default,{isOpen:ae,onClose:function(){return oe(!1)},options:Se,onSelectOption:function(e){oe(!1),Pe(e)}}),(0,r.jsx)(v.default,{isOpen:"selfie"===z,onCapture:Fe,onClose:Me}),(0,r.jsx)(b.default,{isOpen:"geolocation"===z,onConfirm:Te,onClose:Me,distanceToleranceKm:null==he||null===(le=he.policy)||void 0===le?void 0:le.distanceToleranceKm}),(0,r.jsx)(y.default,{isOpen:"screenshot"===z,onUpload:De,onClose:Me}),(0,r.jsx)(g.default,{isOpen:"qrcode"===z,onScan:_e,onClose:Me,qrcodes:(null==he?void 0:he.qrcodes)||[]}),(0,r.jsx)(x.default,{isOpen:"teste"===z,onConfirm:Ie,onClose:Me}),(0,r.jsx)(j.default,{isOpen:H,onClose:function(){W(!1),J(null)},onSave:Le,occurrenceTitle:null==$?void 0:$.title,existingJustification:null==$?void 0:$.justify,isSaving:ke.isPending}),(0,r.jsx)(w.default,{isOpen:V,onClose:function(){Q(!1),J(null)},onSave:Be,occurrenceTitle:null==$?void 0:$.title,currentTime:null==$?void 0:$.time,pointType:(null==$||null===(ce=$.hitSpotTime)||void 0===ce?void 0:ce.type)||(null==$?void 0:$.type),isSaving:Ce.isPending})]}):me?(0,r.jsx)("section",{className:"content options-section-project",style:{minHeight:"80vh"},children:(0,r.jsxs)("div",{className:"d-flex flex-column align-items-center justify-content-center py-4",children:[(0,r.jsx)("div",{className:"spinner-border text-info",role:"status"}),(0,r.jsx)("p",{className:"mt-3 text-muted small",children:"Carregando..."})]})}):(0,r.jsxs)(l.A,{children:[ve&&!xe&&(0,r.jsxs)("div",{className:"alert alert-warning d-flex align-items-center mb-3",role:"alert",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-triangle me-2"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("strong",{children:"Atenção!"})," ",N(ue)]})]}),me||pe||ve?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.default,{onRegister:Ee,availableOptions:Se,onSelectOption:Pe,isNoneMode:"none"===(null==he||null===(t=he.validate_points)||void 0===t?void 0:t.mode)&&0===Se.length,disabled:T<B(new Date)||je,shift:he||void 0,selectedDate:T,onDateChange:Re,shiftError:!!pe}),z&&(0,r.jsx)("div",{className:"card app-card-surface mt-3",children:(0,r.jsx)("div",{className:"card-body",children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("i",{className:"".concat((0,k.JC)(z)," me-3"),style:{color:"#17A1B7",fontSize:"24px"}}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("h6",{className:"mb-0",children:["Coletando: ",(0,k.kC)(z)]}),(0,r.jsx)("small",{className:"text-muted",children:"Complete a validação para continuar"})]})]})})}),(0,r.jsxs)("div",{className:"card app-card-surface mt-4",children:[(0,r.jsx)("div",{className:"card-header d-flex align-items-center",children:(0,r.jsx)("h3",{className:"card-title mb-0",children:"Ocorrências"})}),(0,r.jsx)("div",{className:"card-body p-0",children:ge?(0,r.jsxs)("div",{className:"text-center py-4",children:[(0,r.jsx)("div",{className:"spinner-border spinner-border-sm me-2",role:"status"}),(0,r.jsx)("span",{children:"Carregando..."})]}):ye?(0,r.jsx)(u.default,{items:ye,editPointEnabled:(null==he||null===(n=he.policy)||void 0===n?void 0:n.editPoint)||!1,onAddJustification:ze,onEditPoint:qe}):(0,r.jsx)("div",{className:"text-center text-muted py-4",children:"Erro ao carregar ocorrências"})})]})]}):(0,r.jsx)(h.NoShiftAssigned,{}),(0,r.jsx)(v.default,{isOpen:"selfie"===z,onCapture:Fe,onClose:Me}),(0,r.jsx)(b.default,{isOpen:"geolocation"===z,onConfirm:Te,onClose:Me,distanceToleranceKm:null==he||null===(C=he.policy)||void 0===C?void 0:C.distanceToleranceKm}),(0,r.jsx)(y.default,{isOpen:"screenshot"===z,onUpload:De,onClose:Me}),(0,r.jsx)(g.default,{isOpen:"qrcode"===z,onScan:_e,onClose:Me,qrcodes:(null==he?void 0:he.qrcodes)||[]}),(0,r.jsx)(x.default,{isOpen:"teste"===z,onConfirm:Ie,onClose:Me}),(0,r.jsx)(j.default,{isOpen:H,onClose:function(){W(!1),J(null)},onSave:Le,occurrenceTitle:null==$?void 0:$.title,existingJustification:null==$?void 0:$.justify,isSaving:ke.isPending}),(0,r.jsx)(w.default,{isOpen:V,onClose:function(){Q(!1),J(null)},onSave:Be,occurrenceTitle:null==$?void 0:$.title,currentTime:null==$?void 0:$.time,pointType:(null==$||null===(O=$.hitSpotTime)||void 0===O?void 0:O.type)||(null==$?void 0:$.type),isSaving:Ce.isPending})]})}},18438(e,t,n){"use strict";n.d(t,{A:()=>o});var r=n(76314),a=n.n(r)()(function(e){return e[1]});a.push([e.id,".date-range-picker {\n\tposition: relative;\n\tfont-family: inherit;\n}\n\n/* Linha 1: Campos de Data */\n.date-range-picker__dates-row {\n\tdisplay: flex;\n\tgap: 12px;\n\tmargin-bottom: 12px;\n}\n\n.date-range-picker__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n\tflex: 1;\n\tmin-width: 160px;\n}\n\n/* Linha 2: Botão e Info/Erro */\n.date-range-picker__bottom-row {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 12px;\n}\n\n.date-range-picker__label {\n\tfont-size: 13px;\n\tfont-weight: 500;\n\tcolor: #555;\n\tmargin: 0;\n}\n\n.date-range-picker__input {\n\tpadding: 8px 12px;\n\tborder: 1px solid #d1d5db;\n\tborder-radius: 6px;\n\tfont-size: 14px;\n\tcolor: #333;\n\tbackground-color: #fff;\n\ttransition: all 0.2s ease;\n\toutline: none;\n\tcursor: pointer;\n}\n\n.date-range-picker__input:hover {\n\tborder-color: #2196F3;\n}\n\n.date-range-picker__input:focus {\n\tborder-color: #2196F3;\n\tbox-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);\n}\n\n.date-range-picker__preset-btn {\n\tpadding: 10px 14px;\n\tborder: 1px solid #d1d5db;\n\tborder-radius: 8px;\n\tbackground-color: #fff;\n\tcolor: #6b7280;\n\tfont-size: 16px;\n\tcursor: pointer;\n\ttransition: all 0.2s ease;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\toutline: none;\n\tflex-shrink: 0;\n\twidth: 40px;\n\theight: 40px;\n}\n\n.date-range-picker__preset-btn:hover {\n\tbackground-color: #f3f4f6;\n\tborder-color: #2196F3;\n\tcolor: #2196F3;\n}\n\n.date-range-picker__preset-btn:active {\n\ttransform: scale(0.98);\n}\n\n.date-range-picker__error {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 10px 16px;\n\tbackground-color: #fee2e2;\n\tborder: 1px solid #fecaca;\n\tborder-radius: 8px;\n\tfont-size: 14px;\n\tcolor: #dc2626;\n\tflex: 1;\n}\n\n.date-range-picker__error i {\n\tfont-size: 14px;\n\tflex-shrink: 0;\n}\n\n.date-range-picker__error span {\n\tfont-weight: 500;\n}\n\n.date-range-picker__info {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 10px 16px;\n\tbackground-color: #186073;\n\tborder: 1px solid #186073;\n\tborder-radius: 8px;\n\tfont-size: 14px;\n\tcolor: #ffffff;\n\tflex: 1;\n}\n\n.date-range-picker__info i {\n\tcolor: #ffffff;\n\tfont-size: 14px;\n\tflex-shrink: 0;\n}\n\n.date-range-picker__info span {\n\tfont-weight: 500;\n\tcolor: #ffffff;\n}\n\n.date-range-picker__presets-dropdown {\n\tposition: absolute;\n\ttop: calc(100% + 8px);\n\tright: 0;\n\tmin-width: 220px;\n\tbackground-color: #fff;\n\tborder: 1px solid #d1d5db;\n\tborder-radius: 8px;\n\tbox-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);\n\tz-index: 1000;\n\tanimation: fadeInDown 0.2s ease;\n}\n\n@keyframes fadeInDown {\n\tfrom {\n\t\topacity: 0;\n\t\ttransform: translateY(-10px);\n\t}\n\tto {\n\t\topacity: 1;\n\t\ttransform: translateY(0);\n\t}\n}\n\n.date-range-picker__presets-header {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 12px 16px;\n\tborder-bottom: 1px solid #e5e7eb;\n\tfont-weight: 600;\n\tfont-size: 14px;\n\tcolor: #333;\n}\n\n.date-range-picker__presets-close {\n\tpadding: 4px;\n\tborder: none;\n\tbackground: none;\n\tcolor: #9ca3af;\n\tcursor: pointer;\n\tfont-size: 14px;\n\ttransition: color 0.2s ease;\n\toutline: none;\n}\n\n.date-range-picker__presets-close:hover {\n\tcolor: #ef4444;\n}\n\n.date-range-picker__presets-list {\n\tpadding: 8px;\n}\n\n.date-range-picker__preset-item {\n\tdisplay: block;\n\twidth: 100%;\n\tpadding: 10px 12px;\n\tborder: none;\n\tbackground: none;\n\ttext-align: left;\n\tfont-size: 14px;\n\tcolor: #555;\n\tcursor: pointer;\n\tborder-radius: 6px;\n\ttransition: all 0.2s ease;\n\toutline: none;\n}\n\n.date-range-picker__preset-item:hover {\n\tbackground-color: #f3f4f6;\n\tcolor: #2196F3;\n}\n\n.date-range-picker__preset-item:active {\n\tbackground-color: #e5e7eb;\n}\n\n/* Responsivo */\n@media (max-width: 768px) {\n\t.date-range-picker__dates-row {\n\t\tflex-direction: column;\n\t\tgap: 12px;\n\t}\n\n\t.date-range-picker__field {\n\t\twidth: 100%;\n\t\tmin-width: auto;\n\t}\n\n\t.date-range-picker__bottom-row {\n\t\tflex-direction: column;\n\t\talign-items: stretch;\n\t\tgap: 12px;\n\t}\n\n\t.date-range-picker__preset-btn {\n\t\twidth: 100%;\n\t}\n\n\t.date-range-picker__presets-dropdown {\n\t\tright: 0;\n\t\tleft: 0;\n\t\tmin-width: auto;\n\t}\n}\n\n/* Tema Escuro (se necessário) */\n.dark-mode .date-range-picker__input,\n.dark-mode .date-range-picker__preset-btn {\n\tbackground-color: #1f2937;\n\tborder-color: #374151;\n\tcolor: #e5e7eb;\n}\n\n.dark-mode .date-range-picker__input:hover,\n.dark-mode .date-range-picker__preset-btn:hover {\n\tborder-color: #60a5fa;\n}\n\n.dark-mode .date-range-picker__label {\n\tcolor: #d1d5db;\n}\n\n.dark-mode .date-range-picker__presets-dropdown {\n\tbackground-color: #1f2937;\n\tborder-color: #374151;\n}\n\n.dark-mode .date-range-picker__presets-header {\n\tborder-color: #374151;\n\tcolor: #e5e7eb;\n}\n\n.dark-mode .date-range-picker__preset-item {\n\tcolor: #d1d5db;\n}\n\n.dark-mode .date-range-picker__preset-item:hover {\n\tbackground-color: #374151;\n\tcolor: #60a5fa;\n}\n\n.dark-mode .date-range-picker__info {\n\tbackground-color: #186073;\n\tborder-color: #186073;\n}\n\n",""]);const o=a},18752(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>l});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(58940),n(27495),n(38781),n(47764),n(68156),n(62953);var r=n(74848),a=n(96540),o=n(1806);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e){var t=e.isOpen,n=e.onClose,s=e.onSave,l=e.occurrenceTitle,c=void 0===l?"":l,u=e.currentTime,d=void 0===u?null:u,f=e.pointType,m=e.isSaving,p=void 0!==m&&m,h=i((0,a.useState)("00"),2),v=h[0],b=h[1],y=i((0,a.useState)("00"),2),g=y[0],x=y[1],j=i((0,a.useState)("00"),2),w=j[0],S=j[1];(0,a.useEffect)(function(){if(t&&d){var e=d.split(":");e.length>=2&&(b(e[0]||"00"),x(e[1]||"00"),S(e[2]||"00"))}},[t,d]);var N,k=function(){b("00"),x("00"),S("00"),n()};return t?(0,r.jsx)(o.A,{show:t,onClose:k,title:"Editando Ponto",size:"sm",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:k,disabled:p,children:"Fechar"}),(0,r.jsx)("button",{type:"button",className:"btn text-white",onClick:function(){var e=parseInt(v),t=parseInt(g),n=parseInt(w);if(isNaN(e)||e<0||e>23)alert("Hora inválida. Use valores entre 00 e 23.");else if(isNaN(t)||t<0||t>59)alert("Minuto inválido. Use valores entre 00 e 59.");else if(isNaN(n)||n<0||n>59)alert("Segundo inválido. Use valores entre 00 e 59.");else{var r="".concat(String(e).padStart(2,"0"),":").concat(String(t).padStart(2,"0"),":").concat(String(n).padStart(2,"0"));s(r)}},disabled:p,style:{backgroundColor:"rgb(23, 162, 184)"},children:p?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"spinner-border spinner-border-sm me-2"}),"Salvando..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("i",{className:"fas fa-check me-2"}),"Editar Ponto"]})})]}),children:(0,r.jsxs)("div",{style:{padding:"24px"},children:[f&&(0,r.jsxs)("div",{className:"alert alert-info mb-3",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:600,backgroundColor:"#d1ecf1",borderColor:"#bee5eb",color:"#0c5460"},children:[(0,r.jsx)("i",{className:"fas fa-info-circle me-2"}),"Editando: ",(0,r.jsx)("strong",{children:(N=f,{first_check_in:"Primeira Entrada",first_check_out:"Primeira Saída",second_check_in:"Segunda Entrada",second_check_out:"Segunda Saída"}[N||""]||N||"Ponto")})]}),c&&(0,r.jsxs)("p",{className:"text-muted mb-3",style:{fontFamily:"Inter",fontSize:"14px"},children:["Ocorrência: ",(0,r.jsx)("strong",{children:c})]}),(0,r.jsxs)("div",{className:"alert alert-warning mb-3",style:{fontFamily:"Inter",fontSize:"13px",backgroundColor:"#fff3cd",borderColor:"#ffeaa7",color:"#856404"},children:[(0,r.jsx)("i",{className:"fas fa-exclamation-triangle me-2"}),(0,r.jsx)("strong",{children:"Atenção:"})," Ao editar o ponto, a ocorrência será ",(0,r.jsx)("strong",{children:"removida automaticamente"}),"."]}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-4",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:500,color:"#5C5D5D",marginBottom:"8px"},children:"Horas"}),(0,r.jsx)("input",{type:"number",className:"form-control text-center",min:"0",max:"23",value:v,onChange:function(e){return b(e.target.value)},disabled:p,style:{fontFamily:"Inter",fontSize:"16px",fontWeight:600}})]})}),(0,r.jsx)("div",{className:"col-4",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:500,color:"#5C5D5D",marginBottom:"8px"},children:"Minutos"}),(0,r.jsx)("input",{type:"number",className:"form-control text-center",min:"0",max:"59",value:g,onChange:function(e){return x(e.target.value)},disabled:p,style:{fontFamily:"Inter",fontSize:"16px",fontWeight:600}})]})}),(0,r.jsx)("div",{className:"col-4",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:500,color:"#5C5D5D",marginBottom:"8px"},children:"Segundos"}),(0,r.jsx)("input",{type:"number",className:"form-control text-center",min:"0",max:"59",value:w,onChange:function(e){return S(e.target.value)},disabled:p,style:{fontFamily:"Inter",fontSize:"16px",fontWeight:600}})]})})]}),(0,r.jsxs)("div",{className:"text-center mt-3 mb-3",children:[(0,r.jsxs)("div",{style:{fontFamily:"Inter",fontSize:"24px",fontWeight:700,color:"#17A2B8"},children:[String(v).padStart(2,"0"),":",String(g).padStart(2,"0"),":",String(w).padStart(2,"0")]}),(0,r.jsx)("small",{className:"text-muted",children:"Horário que será registrado"})]})]})}):null}},18851(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>o});n(28706),n(68156);var r=n(74848);n(96540);function a(e){return String(e).padStart(2,"0")}function o(e){var t,n,o,i,s=e.title,l=e.seconds,c=e.running,u=e.active,d=e.theme,f=e.onStart,m=e.onPause,p="white"===d?"rgba(255,255,255,0.55)":"rgba(26,26,26,0.31)",h="white"===d?"#101828":"#F2F4F7",v="white"===d?"#344054":"rgba(255,255,255,0.85)";return(0,r.jsxs)("div",{className:"p-4",style:{minWidth:360,width:"100%",maxWidth:520,borderRadius:16,background:p,backdropFilter:"blur(72.95px)",WebkitBackdropFilter:"blur(72.95px)",border:u?"1px solid rgba(24,198,225,.75)":"1px solid rgba(255,255,255,0.18)",boxShadow:u?"0 12px 36px rgba(0,0,0,.28)":"0 8px 24px rgba(0,0,0,.18)",transition:"transform .2s ease, box-shadow .2s ease, border-color .2s ease",transform:u?"scale(1.02)":"scale(0.995)",color:h},children:[(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between mb-1",children:[(0,r.jsx)("div",{className:"font-weight-bold",style:{opacity:.9},children:s}),!u&&(0,r.jsx)("span",{className:"badge badge-light",style:{opacity:.7},children:"inativo"})]}),(0,r.jsxs)("div",{className:"text-center",style:{lineHeight:1.05},children:[(0,r.jsx)("div",{style:{fontWeight:700,fontSize:72,letterSpacing:1},children:(t=l,n=Math.floor(t/3600),o=Math.floor(t%3600/60),i=t%60,n>0?"".concat(a(n),":").concat(a(o),":").concat(a(i)):"".concat(a(o),":").concat(a(i)))}),(0,r.jsx)("div",{style:{color:v,fontSize:13},children:c&&u?"Contando…":u?"Pronto para iniciar":"Selecione para iniciar"})]}),(0,r.jsx)("div",{className:"d-flex align-items-center justify-content-center mt-4",children:u&&c?(0,r.jsxs)("button",{type:"button",className:"btn btn-light px-4",onClick:m,children:[(0,r.jsx)("i",{className:"fas fa-pause mr-2"})," Pausar"]}):(0,r.jsxs)("button",{type:"button",className:"btn btn-primary px-4",onClick:f,children:[(0,r.jsx)("i",{className:"fas fa-play mr-2"})," Iniciar"]})})]})}},19066(e,t,n){"use strict";n.r(t),n.d(t,{PermissionGuard:()=>o,usePermission:()=>i});n(34782);var r=n(74848),a=n(76336);function o(e){var t=e.children,n=e.require,o=e.fallback,i=(0,a.L)();return(0,a.v)()?(0,r.jsxs)("div",{className:"alert alert-danger m-3",role:"alert",children:[(0,r.jsxs)("h4",{className:"alert-heading",children:[(0,r.jsx)("i",{className:"fas fa-ban me-2"}),"Acesso Negado"]}),(0,r.jsx)("p",{children:"Você não tem permissão para visualizar este produto."})]}):n?{view:i.canView,edit:i.canEdit,create:i.canCreate,delete:i.canDelete}[n]?(0,r.jsx)(r.Fragment,{children:t}):o?(0,r.jsx)(r.Fragment,{children:o}):null:(0,r.jsx)(r.Fragment,{children:t})}function i(e){return(0,a.L)()["can".concat(e.charAt(0).toUpperCase()+e.slice(1))]}},19619(e,t,n){"use strict";n.d(t,{c:()=>a,w:()=>r});var r={sem:"none",flex:"flexible",qr:"qrcode",manual:"manual"},a={none:"sem",flexible:"flex",qrcode:"qr",manual:"manual"}},19782(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>C});n(52675),n(89463),n(2259),n(28706),n(2008),n(23418),n(64346),n(23792),n(62062),n(34782),n(15086),n(1688),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(31415),n(47764),n(62953);var r=n(74848),a=n(97665),o=n(33930),i=n(57097),s=n(96540),l=n(52354);function c(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return u(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(u(t={},r,function(){return this}),t),m=d.prototype=s.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,u(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return l.prototype=d,u(m,"constructor",d),u(d,"constructor",l),l.displayName="GeneratorFunction",u(d,a,"GeneratorFunction"),u(m),u(m,a,"Generator"),u(m,r,function(){return this}),u(m,"toString",function(){return"[object Generator]"}),(c=function(){return{w:o,m:p}})()}function u(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}u=function(e,t,n,r){function o(t,n){u(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},u(e,t,n,r)}function d(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function f(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){d(o,r,a,i,s,"next",e)}function s(e){d(o,r,a,i,s,"throw",e)}i(void 0)})}}function m(){return p.apply(this,arguments)}function p(){return(p=f(c().m(function e(){var t,n;return c().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,l.F.get("/time-management/channels");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function h(){return(h=f(c().m(function e(t){var n,r;return c().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,l.F.post("/time-management/channels",{type:t});case 1:return n=e.v,r=n.data,e.a(2,r.data)}},e)}))).apply(this,arguments)}function v(){return(v=f(c().m(function e(t){return c().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,l.F.delete("/time-management/channels/".concat(t));case 1:return e.a(2)}},e)}))).apply(this,arguments)}var b=n(76336);function y(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return g(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(g(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,g(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,g(d,"constructor",c),g(c,"constructor",l),l.displayName="GeneratorFunction",g(c,a,"GeneratorFunction"),g(d),g(d,a,"Generator"),g(d,r,function(){return this}),g(d,"toString",function(){return"[object Generator]"}),(y=function(){return{w:o,m:f}})()}function g(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}g=function(e,t,n,r){function o(t,n){g(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},g(e,t,n,r)}function x(e){return function(e){if(Array.isArray(e))return j(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return j(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?j(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function w(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function S(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){w(o,r,a,i,s,"next",e)}function s(e){w(o,r,a,i,s,"throw",e)}i(void 0)})}}var N=[{id:"app",icon:"fas fa-mobile-alt",label:"Aplicativo"},{id:"web",icon:"fas fa-globe",label:"Navegador Web"},{id:"qr",icon:"fas fa-qrcode",label:"QR Code/Link Gerado"}],k=["time-management","channels"];function C(){var e,t,n=(0,b.L)(),l=n.canEdit,c=(n.canCreate,n.canView,n.canDelete,(0,a.jE)()),u=(0,o.I)({queryKey:k,queryFn:m,staleTime:6e4,refetchOnWindowFocus:!1}),d=u.data,f=void 0===d?[]:d,p=u.isLoading,g=u.isFetching,j=(0,i.n)({mutationFn:function(e){return function(e){return h.apply(this,arguments)}(e)},onMutate:(e=S(y().m(function e(t){var n,r;return y().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,c.cancelQueries({queryKey:k});case 1:if(!(r=null!==(n=c.getQueryData(k))&&void 0!==n?n:[]).some(function(e){return e.type===t})){e.n=2;break}return e.a(2,{prev:r});case 2:return c.setQueryData(k,[].concat(x(r),[{id:"temp-".concat(t),settingManagementTimeId:"temp",type:t,createdAt:(new Date).toISOString(),updatedAt:(new Date).toISOString()}])),e.a(2,{prev:r})}},e)})),function(t){return e.apply(this,arguments)}),onError:function(e,t,n){null!=n&&n.prev&&c.setQueryData(k,n.prev)},onSuccess:function(e){c.setQueryData(k,function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(function(t){return t.type!==e.type});return[].concat(x(t),[e])})}}),w=(0,i.n)({mutationFn:function(e){return function(e){return v.apply(this,arguments)}(e)},onMutate:(t=S(y().m(function e(t){var n,r;return y().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,c.cancelQueries({queryKey:k});case 1:return r=null!==(n=c.getQueryData(k))&&void 0!==n?n:[],c.setQueryData(k,r.filter(function(e){return e.type!==t})),e.a(2,{prev:r})}},e)})),function(e){return t.apply(this,arguments)}),onError:function(e,t,n){null!=n&&n.prev&&c.setQueryData(k,n.prev)}}),C=(0,s.useMemo)(function(){return new Set(f.map(function(e){return e.type}))},[f]),O=p||g||j.isPending||w.isPending;return(0,r.jsx)("div",{className:"row",children:N.map(function(e){var t=C.has(e.id);return(0,r.jsx)("div",{className:"col-12 col-md-4 mb-2",children:(0,r.jsxs)("button",{type:"button",disabled:O||!l,onClick:function(){return t=e.id,void(l&&(C.has(t)?w.mutate(t):j.mutate(t)));var t},className:"btn btn-block text-left d-flex align-items-center ".concat(t?"border-primary text-primary bg-primary-soft":"border"),title:l?"":"Sem permissão para editar canais",children:[(0,r.jsx)("i",{className:"".concat(e.icon," mr-2 ").concat(t?"text-primary":"")}),e.label,O&&(0,r.jsx)("i",{className:"fas fa-spinner fa-spin ml-auto"}),!l&&(0,r.jsx)("i",{className:"fas fa-lock ml-auto text-muted",style:{fontSize:"0.8rem"}})]})},e.id)})})}},20826(e,t,n){"use strict";n.d(t,{A:()=>a});n(2008),n(74423),n(48598),n(26099),n(21699),n(11392);var r=n(74848);function a(e){var t=e.label,n=e.icon,a=e.variant,o=e.onClick,i=e.className,s=void 0===i?"":i,l=e.disabled,c=void 0!==l&&l,u=e.style,d=n&&(n.includes("/")||n.includes(".")),f=n&&(n.startsWith("fas ")||n.startsWith("far ")||n.startsWith("fab ")),m=["btn","tm-action-button","tm-action-button-".concat(a),n?"tm-action-button-icon":"",c?"disabled":"",s].filter(Boolean).join(" ");return(0,r.jsxs)("button",{onClick:o,className:m,disabled:c,style:u,children:[d?(0,r.jsx)("img",{src:n,alt:""}):f?(0,r.jsx)("i",{className:n}):null,(0,r.jsx)("span",{className:"tm-action-button-preview-text",style:{display:"block",visibility:"visible"},children:t})]})}},22956(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>h});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(5506),n(83851),n(81278),n(79432),n(26099),n(27495),n(38781),n(47764),n(23500),n(62953);var r=n(74848),a=n(49785),o=n(96540),i=n(84136);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==s(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||m(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||m(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){if(e){if("string"==typeof e)return p(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e){var t=e.isOpen,n=e.onClose,s=e.currentFilters,l=e.onApply,u=e.onClear,m=(0,a.mN)({defaultValues:s}),p=m.register,h=m.handleSubmit,v=m.reset;(0,o.useEffect)(function(){v(s)},[s,v]);if(!t)return null;var b=[{value:"",label:"Todos"}].concat(f(Object.entries(i.L).map(function(e){var t=d(e,2);return{value:t[0],label:t[1]}})));return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"modal-backdrop fade show",style:{zIndex:1040},onClick:function(e){e.stopPropagation(),n()}}),(0,r.jsx)("div",{className:"modal fade show d-block",style:{zIndex:1050},tabIndex:-1,onClick:function(e){e.target===e.currentTarget&&n()},children:(0,r.jsx)("div",{className:"modal-dialog modal-dialog-centered",style:{maxWidth:"500px"},children:(0,r.jsxs)("div",{className:"modal-content",onClick:function(e){return e.stopPropagation()},children:[(0,r.jsxs)("div",{className:"modal-header",children:[(0,r.jsx)("h5",{className:"modal-title",style:{fontFamily:"Inter",fontSize:"18px",fontWeight:600,color:"#5C5D5D"},children:"Filtrar Ocorrências"}),(0,r.jsx)("button",{type:"button",className:"close",onClick:function(e){e.preventDefault(),e.stopPropagation(),n()},"aria-label":"Fechar",children:(0,r.jsx)("span",{"aria-hidden":"true",children:"×"})})]}),(0,r.jsxs)("form",{onSubmit:h(function(e){l(e),n()}),children:[(0,r.jsxs)("div",{className:"modal-body",children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"mb-2",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:500,color:"#5C5D5D"},children:"Tipo de Ocorrência"}),(0,r.jsx)("select",c(c({},p("occurrenceType")),{},{className:"form-control",style:{fontFamily:"Inter",fontSize:"14px"},children:b.map(function(e){return(0,r.jsx)("option",{value:e.value,children:e.label},e.value)})}))]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"mb-2",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:500,color:"#5C5D5D"},children:"Horário do Ponto"}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{className:"col-6",children:[(0,r.jsx)("label",{className:"mb-1",style:{fontFamily:"Inter",fontSize:"12px",fontWeight:400,color:"rgba(92, 93, 93, 0.60)"},children:"Início"}),(0,r.jsx)("input",c(c({type:"time"},p("timeStart")),{},{className:"form-control",style:{fontFamily:"Inter",fontSize:"14px"}}))]}),(0,r.jsxs)("div",{className:"col-6",children:[(0,r.jsx)("label",{className:"mb-1",style:{fontFamily:"Inter",fontSize:"12px",fontWeight:400,color:"rgba(92, 93, 93, 0.60)"},children:"Fim"}),(0,r.jsx)("input",c(c({type:"time"},p("timeEnd")),{},{className:"form-control",style:{fontFamily:"Inter",fontSize:"14px"}}))]})]}),(0,r.jsx)("small",{className:"form-text text-muted",style:{fontFamily:"Inter",fontSize:"12px"},children:"Filtre por período de horário dos pontos registrados"})]}),(0,r.jsxs)("div",{className:"form-group mb-0",children:[(0,r.jsx)("label",{className:"mb-2",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:500,color:"#5C5D5D"},children:"Status da Ocorrência"}),(0,r.jsx)("select",c(c({},p("status")),{},{className:"form-control",style:{fontFamily:"Inter",fontSize:"14px"},children:[{value:"",label:"Todos"},{value:"pendente",label:"Pendente"},{value:"resolvido",label:"Resolvido"},{value:"justificado",label:"Justificado"}].map(function(e){return(0,r.jsx)("option",{value:e.value,children:e.label},e.value)})}))]})]}),(0,r.jsxs)("div",{className:"modal-footer",children:[(0,r.jsxs)("button",{type:"button",className:"btn mh-btn-cancel btn-sm",onClick:function(){v({occurrenceType:"",timeStart:"",timeEnd:"",status:""}),u(),n()},style:{fontFamily:"Inter"},children:[(0,r.jsx)("i",{className:"fas fa-times mr-1"}),"Limpar Filtros"]}),(0,r.jsxs)("button",{type:"submit",className:"btn btn-primary btn-sm",style:{fontFamily:"Inter",backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:[(0,r.jsx)("i",{className:"fas fa-check mr-1"}),"Aplicar"]})]})]})]})})})]})}},23696(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>A});n(52675),n(89463),n(2259),n(28706),n(2008),n(50113),n(23418),n(64346),n(23792),n(48598),n(62062),n(34782),n(15086),n(26910),n(1688),n(23288),n(94170),n(62010),n(36033),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(25440),n(90744),n(42762),n(62953),n(3296),n(27208),n(48408);var r=n(74848),a=n(33930),o=n(34559),i=(n(74423),n(21699),n(96540));function s(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){var t=e.options,n=e.value,a=e.onChange,o=e.placeholder,c=void 0===o?"Selecione...":o,u=e.disabled,d=void 0!==u&&u,f=e.maxHeight,m=void 0===f?300:f,p=l((0,i.useState)(!1),2),h=p[0],v=p[1],b=l((0,i.useState)(""),2),y=b[0],g=b[1],x=l((0,i.useState)(!1),2),j=(x[0],x[1]),w=(0,i.useRef)(null),S=(0,i.useRef)(null),N=(0,i.useMemo)(function(){if(!y.trim())return t;var e=y.toLowerCase().trim().normalize("NFD").replace(/[\u0300-\u036f]/g,"");return t.filter(function(t){return t.label.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").includes(e)})},[t,y]);(0,i.useMemo)(function(){return n.map(function(e){var n;return null===(n=t.find(function(t){return t.value===e}))||void 0===n?void 0:n.label}).filter(Boolean)},[n,t]);(0,i.useEffect)(function(){var e=function(e){w.current&&!w.current.contains(e.target)&&(v(!1),g(""),j(!1))};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]);return(0,r.jsxs)("div",{ref:w,className:"multi-select-container",style:{position:"relative",width:"100%"},children:[(0,r.jsxs)("div",{className:"input-group",children:[(0,r.jsx)("input",{ref:S,type:"text",className:"form-control",placeholder:n.length>0?"".concat(n.length," selecionado(s) - Digite para buscar"):c,value:y,onChange:function(e){g(e.target.value),h||v(!0)},onFocus:function(){d||(v(!0),j(!0))},disabled:d,autoComplete:"off",style:{cursor:d?"not-allowed":"text"}}),n.length>0&&(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("button",{type:"button",onClick:function(e){e.stopPropagation(),e.preventDefault(),a([]),g(""),S.current&&S.current.focus()},className:"btn btn-outline-secondary",style:{border:"1px solid #ced4da",borderLeft:"none",background:"transparent",color:"#6c757d",cursor:"pointer",padding:"0 12px",fontSize:"20px",lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center"},title:"Limpar todos",children:"x"})})]}),h&&(0,r.jsxs)("div",{className:"multi-select-dropdown",onClick:function(e){return e.stopPropagation()},style:{position:"absolute",top:"100%",left:0,right:0,zIndex:9999,backgroundColor:"white",border:"1px solid #ced4da",borderRadius:"4px",marginTop:"4px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",maxWidth:"100%"},children:[(0,r.jsx)("div",{style:{maxHeight:"".concat(m,"px"),overflowY:"auto"},children:N.length>0?N.map(function(e){var t=n.includes(e.value);return(0,r.jsx)("div",{className:"multi-select-option",onClick:function(t){var r;t.stopPropagation(),r=e.value,n.includes(r)?a(n.filter(function(e){return e!==r})):a([].concat(s(n),[r])),g("")},style:{padding:"10px 12px",cursor:"pointer",backgroundColor:t?"#e7f3ff":"white",borderBottom:"1px solid #f0f0f0",fontSize:"14px"},onMouseEnter:function(e){t||(e.currentTarget.style.backgroundColor="#f8f9fa")},onMouseLeave:function(e){t||(e.currentTarget.style.backgroundColor="white")},children:e.label},e.value)}):(0,r.jsx)("div",{style:{padding:"16px",textAlign:"center",color:"#6c757d",fontSize:"14px"},children:y.trim()?(0,r.jsxs)(r.Fragment,{children:['Nenhum resultado para "',(0,r.jsx)("strong",{children:y}),'"',(0,r.jsxs)("div",{style:{fontSize:"12px",marginTop:"8px"},children:["Total de membros disponíveis: ",t.length]})]}):"Nenhuma opção disponível"})}),n.length>0&&(0,r.jsxs)("div",{style:{padding:"8px 12px",borderTop:"1px solid #e9ecef",fontSize:"12px",color:"#6c757d",backgroundColor:"#f8f9fa"},children:[n.length," ",1===n.length?"selecionado":"selecionados"]})]})]})}var f=n(80596),m=n(90162),p=n(64466),h=n(96930),v=n(77332),b=n(14305),y=n(70038),g=n(50860),x=n(47339);function j(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return w(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(w(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,w(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,w(d,"constructor",c),w(c,"constructor",l),l.displayName="GeneratorFunction",w(c,a,"GeneratorFunction"),w(d),w(d,a,"Generator"),w(d,r,function(){return this}),w(d,"toString",function(){return"[object Generator]"}),(j=function(){return{w:o,m:f}})()}function w(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}w=function(e,t,n,r){function o(t,n){w(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},w(e,t,n,r)}function S(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function N(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){S(o,r,a,i,s,"next",e)}function s(e){S(o,r,a,i,s,"throw",e)}i(void 0)})}}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||C(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,t){if(e){if("string"==typeof e)return O(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(e,t):void 0}}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function A(){var e=(new Date).toISOString().split("T")[0],t=k((0,i.useState)([]),2),n=t[0],s=t[1],l=k((0,i.useState)(""),2),c=l[0],u=l[1],w=k((0,i.useState)(e),2),S=w[0],O=w[1],A=k((0,i.useState)(e),2),E=A[0],P=A[1],F=k((0,i.useState)(""),2),T=F[0],D=F[1],_=k((0,i.useState)(!1),2),I=_[0],M=_[1],R=k((0,i.useState)(!1),2),z=R[0],L=R[1],q=k((0,i.useState)(null),2),B=q[0],G=q[1],H=k((0,i.useState)(!1),2),W=H[0],U=H[1],V=k((0,i.useState)(null),2),Q=V[0],K=V[1],$=k((0,i.useState)(!1),2),J=$[0],Y=($[1],k((0,i.useState)(!1),2)),Z=Y[0],X=Y[1],ee=k((0,i.useState)(null),2),te=ee[0],ne=ee[1],re=k((0,i.useState)(!1),2),ae=re[0],oe=(re[1],k((0,i.useState)(!1),2)),ie=oe[0],se=oe[1],le=k((0,i.useState)(null),2),ce=le[0],ue=le[1],de=k((0,i.useState)(1),2),fe=de[0],me=de[1],pe=k((0,i.useState)(30),2),he=pe[0],ve=pe[1],be=k((0,i.useState)(!1),2),ye=be[0],ge=be[1],xe=(0,a.I)({queryKey:["time-management","members",c],queryFn:function(){return(0,b.iT)(c||void 0)},staleTime:6e4,refetchOnWindowFocus:!1}),je=xe.data,we=void 0===je?[]:je,Se=xe.isFetching,Ne=(0,a.I)({queryKey:["time-management","work-shifts"],queryFn:y.hY,staleTime:6e4,refetchOnWindowFocus:!1}),ke=Ne.data,Ce=void 0===ke?[]:ke,Oe=Ne.isFetching,Ae=(0,i.useMemo)(function(){if(0!==n.length)return n.map(function(e){var t=we.find(function(t){return String(t.id)===String(e)});return t?[t.firstName,t.lastName].filter(Boolean).join(" ").trim():null}).filter(Boolean).join(",")},[we,n]),Ee=(0,a.I)({queryKey:["time-management","hit-spot-time-history",{member_name:Ae,work_shift_id:c||void 0,start_date:S,end_date:E,status:T,page:fe,limit:he}],queryFn:function(){return(0,b.ZD)({member_name:Ae,work_shift_id:c?String(c):void 0,start_date:S,end_date:E,status:T||void 0,page:fe,limit:he})},staleTime:3e4,refetchOnWindowFocus:!1}),Pe=Ee.data,Fe=Ee.isFetching,Te=Ee.refetch;function De(e){var t,n=e.map(function(e){var t;if(!e.id)return null;if(!0===e.isRemoved||!1===e.enabled)return null;var n=[e.firstName,e.lastName].filter(Boolean).join(" ").trim(),r=(null!==(t=e.role)&&void 0!==t?t:"").trim(),a=n||r||"#".concat(e.id);return{value:e.id,label:a}}).filter(function(e){return!!e}),r=new Map,a=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=C(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw o}}}}(n);try{for(a.s();!(t=a.n()).done;){var o=t.value;r.set(o.value,o)}}catch(e){a.e(e)}finally{a.f()}return Array.from(r.values()).sort(function(e,t){return e.label.localeCompare(t.label)})}var _e=(0,i.useMemo)(function(){return De(we)},[we]);var Ie=(0,i.useMemo)(function(){return Ce.map(function(e){return{value:e.id,label:e.name}})},[Ce]),Me=(0,i.useMemo)(function(){return 0===n.length?[]:we.filter(function(e){var t=String(e.id);return n.some(function(e){return String(e)===t})})},[we,n]),Re=(0,i.useMemo)(function(){return null!=Pe&&Pe.data?Pe.data.map(function(e){var t,n;if(null==e||!e.id||null==e||!e.date)return console.warn("⚠️ Registro sem ID ou data:",e),null;var r=(null===(t=e.clockTimes)||void 0===t?void 0:t.length)>0?e.clockTimes.map(function(e){return(null==e?void 0:e.slice(0,5))||"--:--"}):["--:--","--:--","--:--","--:--"],a=(null===(n=e.shiftTimes)||void 0===n?void 0:n.length)>0?e.shiftTimes.join(" - "):"-- - -- - -- - --",o=e.date,i=e.workedHours||"00:00",s=e.justificationType,l="",c="secondary",u="secondary";if(s)switch(s){case"reason":l="Abonado",u="info";break;case"license":l="Licença",u="info";break;case"missing_hours":l="Devendo Horas",u="danger",c="danger";break;case"incomplete":l="Incompleto",u="danger",c="danger";break;case"overtime":l="Horas Extras",u="success",c="success";break;case"on_time":l="Em Dia",u="success";break;case"esquecimento":l="Editado - Esquecimento",u="info";break;case"registro_duplicado":l="Editado - Registro Duplicado",u="info";break;case"ajuste_solicitado":l="Editado - Ajuste Solicitado",u="info";break;default:l=s,u="secondary"}else l="-",u="secondary";return{id:e.id,data:o,memberName:e.memberName,registros:r,previstos:a,horas:i,horasColor:c,status:l,statusColor:u,justificationType:e.justificationType,justificationId:e.justificationId,justification:e.justification,expectedHours:e.expectedHours,hoursDifference:e.hoursDifference,isOvertime:e.isOvertime,isMissingHours:e.isMissingHours,delay:e.delay,missingClockIns:e.missingClockIns}}).filter(function(e){return null!==e}):[]},[Pe]),ze=function(e){s(e),me(1)},Le=function(){var e=N(j().m(function e(){var t,n,r,a,o,i,s;return j().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,M(!0),e.n=1,(0,b.LW)({member_name:Ae,work_shift_id:c?String(c):void 0,start_date:S||void 0,end_date:E||void 0,status:T||void 0});case 1:t=e.v,n=new Date,r=n.toISOString().split("T")[0],a=n.toTimeString().split(" ")[0].replace(/:/g,"-"),o="historico_pontos_".concat(r,"_").concat(a,".csv"),i=window.URL.createObjectURL(t),(s=document.createElement("a")).href=i,s.download=o,document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(i),e.n=3;break;case 2:e.p=2,e.v,x.A.error("Erro ao exportar arquivo. Por favor, tente novamente.","Erro na exportação");case 3:return e.p=3,M(!1),e.f(3);case 4:return e.a(2)}},e,null,[[0,2,3,4]])}));return function(){return e.apply(this,arguments)}}(),qe=function(){L(!1),G(null)},Be=function(){var e=N(j().m(function e(t){var n,r,a,o;return j().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,ge(!0),n={hitTheSpotId:B.id,motivo:t.motivo,primeiraEntradaData:t.primeiraEntradaData,primeiraEntradaHora:t.primeiraEntradaHora,primeiraSaidaData:t.primeiraSaidaData,primeiraSaidaHora:t.primeiraSaidaHora,segundaEntradaData:t.segundaEntradaData,segundaEntradaHora:t.segundaEntradaHora,saidaData:t.saidaData,saidaHora:t.saidaHora},e.n=1,(0,b.Nq)(n);case 1:return e.n=2,Te();case 2:qe(),e.n=4;break;case 3:e.p=3,o=e.v,a=(null==o||null===(r=o.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.error)||(null==o?void 0:o.message)||"Erro desconhecido ao salvar edição.",x.A.error(a,"Erro ao salvar edição");case 4:return e.p=4,ge(!1),e.f(4);case 5:return e.a(2)}},e,null,[[0,3,4,5]])}));return function(t){return e.apply(this,arguments)}}(),Ge=function(){var e=N(j().m(function e(t){return j().w(function(e){for(;;)switch(e.n){case 0:U(!1),K(null),Te();case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),He=function(){var e=N(j().m(function e(t){return j().w(function(e){for(;;)switch(e.n){case 0:X(!1),ne(null),Te();case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}();return(0,r.jsxs)(g.A,{children:[(0,r.jsx)("div",{className:"card app-card-surface mt-3",children:(0,r.jsx)("div",{className:"card-body",style:{overflow:"visible"},children:(0,r.jsxs)("div",{className:"form-row",children:[(0,r.jsxs)("div",{className:"form-group col-12 col-lg-4",style:{overflow:"visible"},children:[(0,r.jsx)("label",{className:"mb-1",children:"Turno"}),(0,r.jsx)(o.A,{options:Ie,value:c,placeholder:"Todos os Turnos",size:"md",onChange:function(e){u(e),s([]),me(1)},disabled:Oe,className:"custom-select"})]}),(0,r.jsxs)("div",{className:"form-group col-12 col-lg-4",children:[(0,r.jsx)("label",{className:"mb-1",children:"Membro"}),(0,r.jsx)("div",{className:"input-group",children:(0,r.jsx)(d,{options:_e,value:n,placeholder:"Buscar e Selecionar Membros",onChange:ze,disabled:Se})})]}),(0,r.jsxs)("div",{className:"form-group col-12 col-md-6 col-lg-2",children:[(0,r.jsx)("label",{className:"mb-1",children:"Data Início"}),(0,r.jsx)("input",{type:"date",className:"form-control",value:S,onChange:function(e){O(e.target.value),me(1)},placeholder:"dd/mm/aaaa"})]}),(0,r.jsxs)("div",{className:"form-group col-12 col-md-6 col-lg-2",children:[(0,r.jsx)("label",{className:"mb-1",children:"Data Fim"}),(0,r.jsx)("input",{type:"date",className:"form-control",value:E,onChange:function(e){P(e.target.value),me(1)},placeholder:"dd/mm/aaaa"})]})]})})}),n.length>0&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"mt-3",style:{display:"flex",flexWrap:"wrap",gap:"16px"},children:Me.length>0?Me.map(function(e){var t,a,o,i,s,l,c=[e.firstName,e.lastName].filter(Boolean).join(" ").trim()||"—",u=null!==(t=null!==(a=null!==(o=null==e?void 0:e.email)&&void 0!==o?o:null==e||null===(i=e.user)||void 0===i?void 0:i.email)&&void 0!==a?a:null==e?void 0:e.contactEmail)&&void 0!==t?t:"—",d=c.split(/\s+/).filter(Boolean),f=[null===(s=d[0])||void 0===s?void 0:s[0],null===(l=d[d.length-1])||void 0===l?void 0:l[0]].filter(Boolean).join("").toUpperCase()||"U",m=["#FF6B6B","#4ECDC4","#45B7D1","#FFA07A","#98D8C8","#F7DC6F","#BB8FCE","#85C1E2"],p=m[c.charCodeAt(0)%m.length];return(0,r.jsx)("div",{className:"card",style:{flex:"0 0 auto",minWidth:"300px",maxWidth:"400px",border:"1px solid #dee2e6",borderRadius:"8px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",position:"relative"},children:(0,r.jsx)("div",{className:"card-body p-3",children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsxs)("div",{style:{position:"relative",marginRight:"12px",flexShrink:0},children:[e.hasCrown&&(0,r.jsx)("img",{src:"/images/employee-advocacy/image.png",alt:"Crown",style:{position:"absolute",top:"-10px",left:"50%",transform:"translateX(-50%)",width:"15px",height:"15px",zIndex:2}}),(0,r.jsx)("div",{className:"rounded-circle d-flex align-items-center justify-content-center text-white",style:{width:48,height:48,backgroundColor:p,fontWeight:700,fontSize:"18px",border:e.hasCrown?"2px solid #FFD700":"none",boxShadow:e.hasCrown?"0 0 8px rgba(255, 215, 0, 0.5)":"none"},"aria-label":"Avatar de ".concat(c),title:c,children:f})]}),(0,r.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,r.jsx)("div",{className:"font-weight-bold text-dark",style:{fontSize:"15px",marginBottom:"2px"},children:c}),(0,r.jsx)("div",{className:"text-muted",style:{fontSize:"13px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u})]}),(0,r.jsx)("button",{type:"button",onClick:function(){return ze(n.filter(function(t){return String(t)!==String(e.id)}))},style:{position:"absolute",top:"8px",right:"8px",background:"transparent",border:"none",width:"24px",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:"#6c757d",fontSize:"20px",lineHeight:"1",padding:"0",transition:"color 0.2s"},onMouseEnter:function(e){e.currentTarget.style.color="#dc3545"},onMouseLeave:function(e){e.currentTarget.style.color="#6c757d"},title:"Remover ".concat(c),children:"x"})]})})},e.id)}):(0,r.jsx)("div",{className:"alert alert-info",style:{width:"100%"},children:"Nenhum membro encontrado para exibir."})})}),(0,r.jsx)(f.default,{data:Re,isLoading:Fe,pagination:null==Pe?void 0:Pe.pagination,onPageChange:function(e){me(e)},onItemsPerPageChange:function(e){ve(e),me(1)},onExportClick:Le,isExporting:I,onEditRecord:function(e){G(e),L(!0)},onAbonarRecord:function(e){K(e),U(!0)},onLicencaRecord:function(e){ne(e),X(!0)},onViewRecord:function(e){ue(e),se(!0)},selectedStatus:T,onStatusChange:function(e){D(e),me(1)}}),(0,r.jsx)(m.default,{isOpen:z,onClose:qe,record:B,onSave:Be,isSaving:ye}),(0,r.jsx)(p.default,{isOpen:W,onClose:function(){U(!1),K(null)},record:Q,onSave:Ge,isSaving:J}),(0,r.jsx)(h.default,{isOpen:Z,onClose:function(){X(!1),ne(null)},record:te,onSave:He,isSaving:ae}),(0,r.jsx)(v.default,{isOpen:ie,onClose:function(){se(!1),ue(null)},record:ce})]})}},25149(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>o});n(74423),n(62062),n(26099);var r=n(74848),a=function(e){switch(e){case"leve":return"#28A745";case"moderado":return"#FFC107";case"atencao":return"#17A2B8";case"grave":return"#DC3545";default:return"#6B7280"}};function o(e){var t=e.items,n=e.editPointEnabled,o=e.onAddJustification,i=e.onEditPoint;return t&&0!==t.length?(0,r.jsxs)("div",{style:{padding:"0 20px",paddingBottom:"100px"},children:[(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 70px 60px 80px",gap:"8px",padding:"12px 0",borderBottom:"1px solid #E5E7EB",fontSize:"13px",fontWeight:600,color:"#6B7280",fontFamily:"Inter"},children:[(0,r.jsx)("div",{children:"Ocorrências"}),(0,r.jsx)("div",{style:{textAlign:"center"},children:"Horário"}),(0,r.jsx)("div",{style:{textAlign:"center"},children:"Status"}),(0,r.jsx)("div",{style:{textAlign:"center"},children:"Ações"})]}),t.map(function(e,s){var l,c=n&&(!!(l=e.type)&&["ponto_dia_folga","ponto_duplicado"].includes(l));return(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 70px 60px 80px",gap:"8px",padding:"16px 0",borderBottom:s<t.length-1?"1px solid #F3F4F6":"none",alignItems:"center"},children:[(0,r.jsx)("div",{style:{fontSize:"14px",fontWeight:500,color:"#1F2937",fontFamily:"Inter"},children:e.title}),(0,r.jsx)("div",{style:{fontSize:"13px",color:"#6B7280",textAlign:"center",fontFamily:"Inter"},children:e.time}),(0,r.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:(0,r.jsx)("div",{style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:a(e.status)}})}),(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"center",gap:"8px"},children:[(0,r.jsx)("button",{onClick:function(){return o(e)},style:{padding:"6px 8px",border:"none",background:"none",cursor:"pointer",color:"#6B7280"},title:"Adicionar Justificativa",children:(0,r.jsx)("i",{className:"fas fa-comment",style:{fontSize:"14px"}})}),c&&(0,r.jsx)("button",{onClick:function(){return i(e)},style:{padding:"6px 8px",border:"none",background:"none",cursor:"pointer",color:"#6B7280"},title:"Editar Ponto",children:(0,r.jsx)("i",{className:"fas fa-pencil-alt",style:{fontSize:"14px"}})})]})]},e.id||s)})]}):(0,r.jsx)("div",{style:{padding:"40px 20px",textAlign:"center"},children:(0,r.jsx)("p",{style:{color:"#9CA3AF",fontSize:"14px",fontFamily:"Inter"},children:"Nenhuma ocorrência registrada"})})}},26071(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>b});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23418),n(64346),n(23792),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(58940),n(27495),n(38781),n(47764),n(23500),n(62953);var r=n(74848),a=n(33930),o=n(97665),i=n(57097),s=n(96339),l=n(96540),c=n(76336);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){m(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function m(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var v=["time-management","policy"];function b(){var e=(0,c.L)().canEdit,t=(0,o.jE)(),n=p((0,l.useState)(!1),2),u=n[0],d=n[1],m=p((0,l.useState)(8),2),h=m[0],b=m[1],y=(0,a.I)({queryKey:v,queryFn:s.Z}),g=y.data;y.isFetching;(0,l.useEffect)(function(){var e,t;g&&(d(null!==(e=g.blockOvertimeTimesheet)&&void 0!==e&&e),b(null!==(t=g.dailyHoursLimit)&&void 0!==t?t:8))},[g]);var x=(0,i.n)({mutationFn:function(e){return(0,s.E)(e)},onSuccess:function(){t.invalidateQueries({queryKey:v})}}),j=function(){g&&x.mutate(f(f({},g),{},{blockOvertimeTimesheet:u,dailyHoursLimit:u?h:8}))};return(0,l.useEffect)(function(){g&&j()},[u]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"row",children:(0,r.jsx)("div",{className:"col-12 col-md-6 col-xl-4 mb-3",children:(0,r.jsx)("div",{className:"card h-100 tm-card-mobile-auto ".concat(u?"border-primary bg-primary-soft":""),style:{border:"1px solid #e0e0e0",borderRadius:"8px"},children:(0,r.jsxs)("div",{className:"card-body d-flex flex-column",children:[(0,r.jsxs)("div",{className:"custom-control custom-checkbox mb-2",children:[(0,r.jsx)("input",{type:"checkbox",id:"timesheet-block",className:"custom-control-input",checked:u,onChange:function(e){return d(e.target.checked)},disabled:!e}),(0,r.jsxs)("label",{className:"custom-control-label ".concat(u?"text-primary":""),htmlFor:"timesheet-block",children:["Bloquear horas extras no timesheet",!e&&(0,r.jsx)("i",{className:"fas fa-lock ml-2 text-muted",style:{fontSize:"0.7rem"}})]})]}),(0,r.jsx)("small",{className:"text-muted d-block mb-2",style:{fontSize:"0.85rem"},children:"Quando ativado, o sistema impedirá que o membro registre no timesheet mais horas que o limite diário estabelecido. Use isso para controlar horas extras."}),(0,r.jsxs)("div",{className:"input-group mt-auto",children:[(0,r.jsx)("input",{type:"number",className:"form-control",value:h,onChange:function(e){return b(parseInt(e.target.value)||8)},onBlur:j,disabled:!u||!e,min:"1",max:"24"}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("span",{className:"input-group-text",children:"horas"})})]})]})})})}),x.isPending&&(0,r.jsxs)("div",{className:"text-muted mt-2",children:[(0,r.jsx)("i",{className:"fas fa-spinner fa-spin mr-2"}),"Salvando..."]})]})}},26723(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>c});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(62953),n(76031);var r=n(74848),a=n(96540),o=n(40961),i=n(18851);function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e){var t=e.open,n=e.onClose,l=(e.clock,e.background),c=e.workMinutes,u=e.breakMinutes,d=s(a.useState("focus"),2),f=d[0],m=d[1],p=s(a.useState(!1),2),h=p[0],v=p[1],b=s(a.useState(60*c),2),y=b[0],g=b[1],x=a.useRef(null);if(a.useEffect(function(){if(t){m("focus"),v(!1),g(60*c);var e=document.body.style.overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=e}}},[t,c,u]),a.useEffect(function(){if(t&&h)return x.current=window.setInterval(function(){g(function(e){if(e>0)return e-1;var t="focus"===f?"break":"focus";return m(t),60*("focus"===t?c:u)})},1e3),function(){x.current&&window.clearInterval(x.current)}},[t,h,f,c,u]),!t)return null;var j="blue"===l?"/images/tenant/blue_background.png":"white"===l?"/images/tenant/white_background.png":"/images/tenant/black_background.png",w="white"===l?"#0b1520":"#f2f4f7",S="focus"===f?"Foco":"Descanso curto",N=(0,r.jsxs)("div",{className:"position-fixed",style:{inset:0,zIndex:9999,backgroundImage:"url(".concat(j,")"),backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundColor:"#000",pointerEvents:"auto"},role:"dialog","aria-modal":"true",children:[(0,r.jsxs)("div",{style:{position:"fixed",top:12,right:12,display:"flex",gap:8,zIndex:1e4},children:[(0,r.jsx)("button",{type:"button",className:"btn btn-sm btn-light",onClick:function(){return v(function(e){return!e})},"aria-label":h?"Pausar":"Iniciar",children:h?(0,r.jsx)("i",{className:"fas fa-pause"}):(0,r.jsx)("i",{className:"fas fa-play"})}),(0,r.jsx)("button",{type:"button",className:"btn btn-sm btn-light",onClick:n,"aria-label":"Fechar modo foco",children:(0,r.jsx)("i",{className:"fas fa-times"})})]}),(0,r.jsx)("div",{className:"d-flex align-items-center justify-content-center text-center",style:{position:"absolute",inset:0,color:w,padding:16,textShadow:"white"===l?"none":"0 1px 12px rgba(0,0,0,.35)"},children:(0,r.jsxs)("div",{style:{maxWidth:560,width:"100%"},children:[(0,r.jsxs)("div",{className:"mb-2",style:{fontSize:18,opacity:.9},children:["Modo Foco ","break"===f?"– Em descanso":""]}),(0,r.jsx)(i.default,{title:S,seconds:y,running:h,active:!0,theme:l,onStart:function(){return v(!0)},onPause:function(){return v(!1)}})]})})]});return(0,o.createPortal)(N,document.body)}},30588(e,t,n){"use strict";n.d(t,{A:()=>f});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(12921),i=n(85072),s=n.n(i),l=n(12395),c={insert:"head",singleton:!1};s()(l.A,c);l.A.locals;function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const f=function(e){var t=e.initialStartDate,n=e.initialEndDate,i=e.onChange,s=e.maxDays,l=void 0===s?365:s,c=e.className,d=void 0===c?"":c,f=u((0,a.useState)({startDate:t||"",endDate:n||""}),2),m=f[0],p=f[1],h=u((0,a.useState)(!1),2),v=h[0],b=h[1],y=(0,a.useRef)(null),g=function(e){if(!e)return"";var t=new Date(e+"T00:00:00"),n=t.getDate(),r=["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"][t.getMonth()];return"".concat(n," de ").concat(r)};(0,a.useEffect)(function(){var e=function(e){y.current&&!y.current.contains(e.target)&&b(!1)};return v&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[v]);var x=m.startDate&&m.endDate?"".concat(g(m.startDate)," à ").concat(g(m.endDate)):"Selecionar período";return(0,r.jsxs)("div",{className:"date-range-badge ".concat(d),ref:y,children:[(0,r.jsxs)("button",{type:"button",className:"date-range-badge__button",onClick:function(){return b(!v)},children:[(0,r.jsx)("i",{className:"fas fa-calendar-alt date-range-badge__icon"}),(0,r.jsx)("span",{className:"date-range-badge__text",children:x})]}),v&&(0,r.jsxs)("div",{className:"date-range-badge__dropdown",children:[(0,r.jsxs)("div",{className:"date-range-badge__dropdown-header",children:[(0,r.jsx)("span",{children:"Selecionar Período"}),(0,r.jsx)("button",{type:"button",className:"date-range-badge__dropdown-close",onClick:function(){return b(!1)},children:(0,r.jsx)("i",{className:"fas fa-times"})})]}),(0,r.jsx)("div",{className:"date-range-badge__dropdown-body",children:(0,r.jsx)(o.A,{initialStartDate:m.startDate,initialEndDate:m.endDate,onChange:function(e){p(e),i(e)},maxDays:l})})]})]})}},30786(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>m});n(52675),n(89463),n(2259),n(28706),n(51629),n(23418),n(74423),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(78459),n(27495),n(38781),n(21699),n(47764),n(23500),n(62953),n(76031);var r=n(74848),a=n(97665),o=n(57097),i=n(49785),s=n(55278),l=n(96540),c=n(1806);function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var f=["time-management","location"];function m(e){var t=e.show,n=e.onClose,d=e.editData,m=(0,a.jE)(),p=!!d,h=(0,l.useRef)(null),v=u((0,l.useState)(null),2),b=v[0],y=v[1],g=u((0,l.useState)(null),2),x=g[0],j=g[1],w=u((0,l.useState)(null),2),S=(w[0],w[1]),N=(0,l.useRef)(null),k=(0,l.useRef)(null),C=(0,i.mN)({defaultValues:{address:"",neighborhood:"",number:"",complement:"",reference:"",city:"",country:"",latitude:"",longitude:""}}),O=(C.register,C.handleSubmit),A=C.watch,E=C.setValue,P=C.reset;C.formState.errors;(0,l.useEffect)(function(){d&&(E("address",d.address||""),E("neighborhood",d.neighborhood||""),E("number",d.number||""),E("complement",d.complement||""),E("reference",d.reference||""),E("city",d.city||""),E("country",d.country||""),E("latitude",d.latitude||""),E("longitude",d.longitude||""))},[d,E]);var F=(0,l.useCallback)(function(e){var t,n="",r="",a="",o="",i="";console.log("Address components:",e.address_components),null===(t=e.address_components)||void 0===t||t.forEach(function(e){var t=e.types;t.includes("street_number")&&(i=e.long_name),!n&&(t.includes("sublocality")||t.includes("neighborhood")||t.includes("sublocality_level_1"))&&(n=e.long_name),r||!t.includes("locality")&&!t.includes("administrative_area_level_2")||(r=e.long_name),t.includes("administrative_area_level_1")&&(a=e.short_name),t.includes("country")&&(o=e.long_name)}),!r&&a&&console.warn("Cidade não encontrada, usando estado:",a),console.log("Componentes extraídos:",{neighborhood:n,city:r,state:a,country:o,number:i}),E("neighborhood",n),E("city",r),E("country",o),i&&E("number",i)},[E]),T=(0,l.useCallback)(function(e,t){void 0!==window.google&&(new window.google.maps.Geocoder).geocode({location:{lat:e,lng:t}},function(n,r){"OK"===r&&n[0]&&(E("address",n[0].formatted_address),E("latitude",e.toString()),E("longitude",t.toString()),F(n[0]))})},[E,F]);(0,l.useEffect)(function(){if(t&&h.current){var e=function(){if(void 0!==window.google){var e=null!=d&&d.latitude?parseFloat(d.latitude):-23.5505,t=null!=d&&d.longitude?parseFloat(d.longitude):-46.6333,n=new window.google.maps.Map(h.current,{zoom:15,center:{lat:e,lng:t},mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!1}),r=new window.google.maps.Marker({map:n,draggable:!0,position:{lat:e,lng:t}});if(window.google.maps.event.addListener(r,"dragend",function(){var e=r.getPosition();T(e.lat(),e.lng())}),window.google.maps.event.addListener(n,"click",function(e){var t=e.latLng.lat(),n=e.latLng.lng();r.setPosition({lat:t,lng:n}),T(t,n)}),y(n),j(r),N.current){var a=new window.google.maps.places.Autocomplete(N.current,{types:["address"]});a.addListener("place_changed",function(){var e=a.getPlace();if(e.geometry&&e.geometry.location){var t=e.geometry.location;n.setCenter(t),r.setPosition(t),E("latitude",t.lat().toString()),E("longitude",t.lng().toString()),E("address",e.formatted_address||""),F(e)}}),S(a)}}else console.error("Google Maps não carregado")};if(void 0!==window.google)e();else{var n=window.GOOGLE_MAPS_API_KEY;if(!n)return void console.error("Google Maps API key não encontrada");var r=document.createElement("script");r.src="https://maps.googleapis.com/maps/api/js?key=".concat(n,"&libraries=places"),r.async=!0,r.onload=e,document.head.appendChild(r)}}},[t,d,T]);var D=A("address");(0,l.useEffect)(function(){if(D&&b&&x&&!(D.length<5))return k.current&&clearTimeout(k.current),k.current=setTimeout(function(){void 0!==window.google&&(new window.google.maps.Geocoder).geocode({address:D},function(e,t){if("OK"===t&&e[0]){var n=e[0].geometry.location;b.setCenter(n),x.setPosition(n),E("latitude",n.lat().toString()),E("longitude",n.lng().toString()),F(e[0])}})},1e3),function(){k.current&&clearTimeout(k.current)}},[D,b,x,E]);var _=(0,o.n)({mutationFn:function(e){var t={name:e.address,address:e.address,neighborhood:e.neighborhood||"",number:e.number||"",complement:e.complement||"",reference:e.reference||"",city:e.city,country:e.country,latitude:e.latitude,longitude:e.longitude,google_url:"https://www.google.com/maps?q=".concat(e.latitude,",").concat(e.longitude)};return p&&null!=d&&d.id?(0,s.Nt)(d.id,t):(0,s.yJ)(t)},onSuccess:function(){m.invalidateQueries({queryKey:f}),P(),n()}});return(0,r.jsx)(c.A,{show:t,onClose:n,title:p?"Editando Localização":"Cadastrar Localização",size:"md",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:n,children:"Cancelar"}),(0,r.jsx)("button",{type:"submit",form:"locationForm",className:"btn text-white px-4",style:{backgroundColor:"#17a2b8"},disabled:_.isPending||!D,children:_.isPending?(0,r.jsx)("i",{className:"fas fa-spinner fa-spin"}):p?"Salvar":"Adicionar Localização"})]}),children:(0,r.jsxs)("form",{id:"locationForm",onSubmit:O(function(e){_.mutate(e)}),children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Endereço da Localização"}),(0,r.jsx)("input",{ref:N,type:"text",className:"form-control",placeholder:"Rua Rosariio Sansalone, 285",value:A("address"),onChange:function(e){return E("address",e.target.value)}}),(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between mt-2",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("i",{className:"fas fa-search text-muted",style:{fontSize:"0.9rem"}}),(0,r.jsx)("small",{className:"text-muted ml-2",children:"Digite o endereço ou selecione no mapa"})]}),(0,r.jsxs)("small",{className:"text-info",children:[(0,r.jsx)("i",{className:"fas fa-info-circle mr-1"}),"Clique no mapa ou arraste o marcador"]})]})]}),(0,r.jsx)("div",{ref:h,style:{width:"100%",height:"300px",borderRadius:"8px",marginBottom:"20px",cursor:"crosshair",border:"2px solid #e0e0e0"}})]})})}},30970(e,t,n){"use strict";n.d(t,{A:()=>v});n(52675),n(89463),n(2259),n(45700),n(23792),n(89572),n(94170),n(2892),n(59904),n(84185),n(40875),n(10287),n(26099),n(60825),n(47764),n(62953);var r,a=n(96540),o=n(40961),i=n(52891);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==s(t)?t:t+""}function u(e,t,n){return t=f(t),function(e,t){if(t&&("object"==s(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,d()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}var p=o;r=p.createRoot,p.hydrateRoot;var h=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this.propsValue?this.propsValue:null;if(this.dispatchEvent("connect",{component:this.componentValue,props:e}),!this.componentValue)throw new Error("No component specified.");var t=window.resolveReactComponent(this.componentValue);this._renderReactElement(a.createElement(t,e,null)),this.dispatchEvent("mount",{componentName:this.componentValue,component:t,props:e})}},{key:"disconnect",value:function(){this.element.root.unmount(),this.dispatchEvent("unmount",{component:this.componentValue,props:this.propsValue?this.propsValue:null})}},{key:"_renderReactElement",value:function(e){var t=this.element;t.root||(t.root=r(this.element)),t.root.render(e)}},{key:"dispatchEvent",value:function(e,t){this.dispatch(e,{detail:t,prefix:"react"})}}])&&l(n.prototype,o),i&&l(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,i}(i.xI);h.values={component:String,props:Object};const v={"symfony--ux-react--react":h}},31475(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>i});n(74423),n(62062),n(26099);var r=n(74848);function a(e){return"leve"===e?"Leve":"moderado"===e?"Moderado":"atencao"===e?"Atenção":"Grave"}function o(e){if(!e)return!1;return["ponto_dia_folga","ponto_duplicado"].includes(e)}function i(e){var t=e.items,n=e.editPointEnabled,i=void 0!==n&&n,s=e.onAddJustification,l=e.onEditPoint;return(0,r.jsx)("div",{className:"ms-table-occurrences-wrapper",children:(0,r.jsxs)("table",{className:"ms-table-occurrences",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Ocorrências"}),(0,r.jsx)("th",{children:"Horário"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"ms-text-right",children:"Ações"})]})}),(0,r.jsx)("tbody",{children:0===t.length?(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:4,className:"ms-table-occurrences-empty",children:"Sem ocorrências"})}):t.map(function(e){return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:e.title}),(0,r.jsx)("td",{children:e.time}),(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"ms-table-occurrences-status",children:[(0,r.jsx)("span",{className:"ms-table-occurrences-status-dot",style:{backgroundColor:(t=e.status,"leve"===t?"#01D6C5":"moderado"===t?"#FFE524":"atencao"===t?"#17A2B8":"#DC3545")}}),(0,r.jsx)("span",{children:a(e.status)})]})}),(0,r.jsx)("td",{className:"ms-text-right",children:(0,r.jsxs)("div",{className:"btn-group",children:[(0,r.jsx)("button",{className:"ms-table-occurrences-action-button","data-toggle":"dropdown",type:"button",title:"Ações",children:(0,r.jsx)("i",{className:"fas fa-pencil-alt ms-table-occurrences-action-icon"})}),(0,r.jsxs)("div",{className:"dropdown-menu dropdown-menu-right",children:[(0,r.jsxs)("a",{className:"dropdown-item",href:"#",onClick:function(t){t.preventDefault(),null==s||s(e)},children:[(0,r.jsx)("i",{className:"far fa-comment-dots mr-2"})," Justificativa"]}),i&&o(e.type)&&(0,r.jsxs)("a",{className:"dropdown-item",href:"#",onClick:function(t){t.preventDefault(),null==l||l(e)},children:[(0,r.jsx)("i",{className:"far fa-edit mr-2"})," Editar Ponto"]})]})]})})]},e.id);var t})})]})})}},33384(e,t,n){"use strict";n.r(t),n.d(t,{extractPercentage:()=>d,findActivityByName:()=>p,findProjectByName:()=>m,normalizeName:()=>f,parseDurationToMinutes:()=>u,submitActivityFromCard:()=>h});n(52675),n(89463),n(2259),n(28706),n(50113),n(23418),n(74423),n(64346),n(23792),n(62062),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(78459),n(58940),n(3362),n(27495),n(38781),n(21699),n(47764),n(25440),n(42762),n(62953);var r=n(81623),a=n(47339);function o(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function s(n,r,a,o){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return i(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(i(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,i(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,i(m,"constructor",d),i(d,"constructor",u),u.displayName="GeneratorFunction",i(d,a,"GeneratorFunction"),i(m),i(m,a,"Generator"),i(m,r,function(){return this}),i(m,"toString",function(){return"[object Generator]"}),(o=function(){return{w:s,m:p}})()}function i(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}i=function(e,t,n,r){function o(t,n){i(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},i(e,t,n,r)}function s(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var u=function(e){if(!e)return 0;var t=l(e.split(":").map(function(e){return parseInt(e,10)||0}),2);return 60*t[0]+t[1]},d=function(e){return e&&parseFloat(e.replace("%",""))||0},f=function(e){return e?e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/\s+/g," ").trim():""},m=function(e,t){if(e){var n=f(e);if(n)return t.find(function(e){return f(e.name)===n})||t.find(function(e){return f(e.name).includes(n)})||t.find(function(e){return n.includes(f(e.name))})}},p=function(e,t){if(e){var n=f(e);if(n)return t.find(function(e){return f(e.name)===n})||t.find(function(e){return f(e.name).includes(n)})||t.find(function(e){return n.includes(f(e.name))})}},h=function(){var e,t=(e=o().m(function e(t,n,i,s,l,c,u,d,f,h,v){var b,y,g,x;return o().w(function(e){for(;;)switch(e.n){case 0:if(b=n&&d.find(function(e){return e.id===n})||s&&m(s,d)||c&&m(c,d)){e.n=1;break}throw a.o.error("Selecione um projeto válido para registrar a atividade."),new Error("Projeto não encontrado");case 1:if(y=i&&f.find(function(e){return e.id===i})||l&&p(l,f)||u&&p(u,f)){e.n=2;break}throw a.o.error("Selecione uma atividade válida para registrar."),new Error("Atividade não encontrada");case 2:return g=60*v,x={date:h,project_id:b.id,activity_template_id:y.id,start_time:t.startTime&&"00:00"!==t.startTime?"".concat(h," ").concat(t.startTime,":00"):void 0,end_time:t.endTime&&"00:00"!==t.endTime?"".concat(h," ").concat(t.endTime,":00"):void 0,percentage:t.percentage||void 0,duration:t.duration||0,comment:t.comment||"",activity_name_legacy:y.name,workload_minutes:g},e.n=3,r.Z4.createActivity(x);case 3:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){s(o,r,a,i,l,"next",e)}function l(e){s(o,r,a,i,l,"throw",e)}i(void 0)})});return function(e,n,r,a,o,i,s,l,c,u,d){return t.apply(this,arguments)}}()},34559(e,t,n){"use strict";n.d(t,{A:()=>a});n(28706),n(62062),n(2892),n(26099);var r=n(74848);function a(e){var t=e.options,n=e.value,a=e.placeholder,o=void 0===a?"Selecione uma opção":a,i=e.className,s=void 0===i?"":i,l=e.onChange,c=e.loading,u=void 0!==c&&c,d=e.disabled,f=void 0!==d&&d,m=e.size,p=void 0===m?"md":m,h="sm"===p?"form-control-sm":"lg"===p?"form-control-lg":"";return(0,r.jsxs)("select",{className:"form-control ".concat(h," ").concat(s),value:null!=n?n:"",onChange:function(e){var t=e.target.value;if(l)if(""===t)l("");else{var n=Number(t);l(isNaN(n)?t:n)}},disabled:f||u,children:[(0,r.jsx)("option",{value:"",children:u?"Carregando...":o}),t.map(function(e){return(0,r.jsx)("option",{value:e.value,disabled:e.disabled,children:e.label},e.value)})]})}},34595(e,t,n){"use strict";n.d(t,{Pg:()=>u,SP:()=>v,k1:()=>l,og:()=>f,uQ:()=>p});n(52675),n(89463),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362);var r=n(52354);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}function l(){return c.apply(this,arguments)}function c(){return(c=s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/generated-links");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function u(e){return d.apply(this,arguments)}function d(){return(d=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.post("/time-management/generated-links",t);case 1:return n=e.v,o=n.data,e.a(2,o.data)}},e)}))).apply(this,arguments)}function f(e,t){return m.apply(this,arguments)}function m(){return(m=s(a().m(function e(t,n){var o,i;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.put("/time-management/generated-links/".concat(t),n);case 1:return o=e.v,i=o.data,e.a(2,i.data)}},e)}))).apply(this,arguments)}function p(e){return h.apply(this,arguments)}function h(){return(h=s(a().m(function e(t){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.delete("/time-management/generated-links/".concat(t));case 1:return e.a(2)}},e)}))).apply(this,arguments)}function v(e){return b.apply(this,arguments)}function b(){return(b=s(a().m(function e(t){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.delete("/spaces-control/api/floors/qrcode/".concat(t));case 1:return e.a(2)}},e)}))).apply(this,arguments)}},34773(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>u});n(52675),n(89463),n(2259),n(45700),n(2008),n(50113),n(51629),n(23792),n(62062),n(89572),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(47764),n(23500),n(62953);var r=n(74848),a=n(49785),o=n(96540);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==i(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e){var t,n=e.isOpen,i=e.onClose,s=e.selectedStatus,c=e.onApply,u=e.onClear,d=(0,a.mN)({defaultValues:{status:s}}),f=d.register,m=d.handleSubmit,p=d.watch,h=d.reset;(0,o.useEffect)(function(){h({status:s})},[s,h]);var v=p("status");if(!n)return null;var b=[{value:"",label:"Todos"},{value:"overtime",label:"Horas Extras"},{value:"missing_hours",label:"Devendo Horas"},{value:"on_time",label:"Em Dia"},{value:"incomplete",label:"Incompleto"}],y={overtime:"#28A745",missing_hours:"#DC3545",on_time:"#17A2B8",incomplete:"#6C757D"};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"modal-backdrop fade show",style:{zIndex:1040},onClick:function(e){e.stopPropagation(),i()}}),(0,r.jsx)("div",{className:"modal fade show d-block",style:{zIndex:1050},tabIndex:-1,onClick:function(e){e.target===e.currentTarget&&i()},children:(0,r.jsx)("div",{className:"modal-dialog modal-dialog-centered",style:{maxWidth:"400px"},children:(0,r.jsxs)("div",{className:"modal-content",onClick:function(e){return e.stopPropagation()},children:[(0,r.jsxs)("div",{className:"modal-header",children:[(0,r.jsx)("h5",{className:"modal-title",style:{fontFamily:"Inter",fontSize:"18px",fontWeight:600,color:"#5C5D5D"},children:"Filtros"}),(0,r.jsx)("button",{type:"button",className:"close",onClick:function(e){e.preventDefault(),e.stopPropagation(),i()},"aria-label":"Fechar",children:(0,r.jsx)("span",{"aria-hidden":"true",children:"×"})})]}),(0,r.jsxs)("form",{onSubmit:m(function(e){c(e.status),i()}),children:[(0,r.jsx)("div",{className:"modal-body",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"mb-2",style:{fontFamily:"Inter",fontSize:"14px",fontWeight:400,color:"rgba(92, 93, 93, 0.60)"},children:"Filtrar por Status"}),(0,r.jsx)("select",l(l({},f("status")),{},{className:"form-control",style:{fontFamily:"Inter",fontSize:"14px"},children:b.map(function(e){return(0,r.jsx)("option",{value:e.value,style:{color:e.value?y[e.value]:void 0},children:e.label},e.value)})})),v&&(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)("small",{className:"d-inline-block px-2 py-1 rounded",style:{backgroundColor:"".concat(y[v],"20"),color:y[v],fontFamily:"Inter",fontSize:"12px",fontWeight:500},children:null===(t=b.find(function(e){return e.value===v}))||void 0===t?void 0:t.label})})]})}),(0,r.jsxs)("div",{className:"modal-footer",children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel btn-sm",onClick:function(){h({status:""}),u(),i()},style:{fontFamily:"Inter"},children:"Limpar Filtros"}),(0,r.jsx)("button",{type:"submit",className:"btn btn-primary btn-sm",style:{fontFamily:"Inter",backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:"Aplicar"})]})]})]})})})]})}},36279(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>p});n(52675),n(89463),n(2259),n(50113),n(23418),n(64346),n(23792),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(88195),i=n(14463),s=n(47339),l=n(33384);function c(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return u(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(u(t={},r,function(){return this}),t),m=d.prototype=s.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,u(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return l.prototype=d,u(m,"constructor",d),u(d,"constructor",l),l.displayName="GeneratorFunction",u(d,a,"GeneratorFunction"),u(m),u(m,a,"Generator"),u(m,r,function(){return this}),u(m,"toString",function(){return"[object Generator]"}),(c=function(){return{w:o,m:p}})()}function u(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}u=function(e,t,n,r){function o(t,n){u(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},u(e,t,n,r)}function d(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function p(e){var t=e.activities,n=e.projetos,u=e.atividadesDisponiveis,m=e.currentDate,p=e.workloadHours,h=e.onActivityAdded,v=f((0,a.useState)(!1),2),b=v[0],y=v[1],g=f((0,a.useState)(null),2),x=g[0],j=g[1],w=f((0,a.useState)(null),2),S=w[0],N=w[1],k=f((0,a.useState)(null),2),C=k[0],O=k[1],A=f((0,a.useState)(""),2),E=A[0],P=A[1],F=f((0,a.useState)(""),2),T=F[0],D=F[1],_=f((0,a.useState)(""),2),I=_[0],M=_[1],R=f((0,a.useState)(""),2),z=R[0],L=R[1],q=function(){y(!1),j(null),N(null),O(null),P(""),D(""),M(""),L("")},B=function(){var e,t=(e=c().m(function e(t){var r,a,o,i;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,(0,l.submitActivityFromCard)(t,S,C,E,T,I,z,n,u,m,p);case 1:s.o.success("Atividade adicionada com sucesso!"),q(),h&&h(),e.n=3;break;case 2:e.p=2,i=e.v,console.error("Erro ao adicionar atividade a partir da atividade prevista:",i),o=(null==i||null===(r=i.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.message)||(null==i||null===(a=i.response)||void 0===a||null===(a=a.data)||void 0===a?void 0:a.error)||"Erro ao adicionar atividade",s.o.error(o);case 3:return e.a(2)}},e,null,[[0,2]])}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){d(o,r,a,i,s,"next",e)}function s(e){d(o,r,a,i,s,"throw",e)}i(void 0)})});return function(e){return t.apply(this,arguments)}}();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"card app-card-surface mt-3",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsx)("h5",{className:"tm-section-title mb-2",children:"Atividades Previstas"}),(0,r.jsx)(o.A,{columns:[{key:"projeto",label:"Projeto",width:"11%"},{key:"atividade",label:"Atividade",width:"11%"},{key:"inicio",label:"Início",width:"11%",align:"center"},{key:"fim",label:"Fim",width:"11%",align:"center"},{key:"percentDia",label:"% do dia",width:"11%",align:"center"},{key:"status",label:"Status",width:"11%",align:"center"},{key:"prioridade",label:"Prioridade",width:"11%",align:"center"},{key:"duracao",label:"Duração",width:"11%",align:"center"},{key:"acoes",label:"Ações",width:"11%",align:"center"}],data:t,renderRow:function(e){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"ms-table-cell",title:e.projeto,children:e.projeto}),(0,r.jsx)("td",{className:"ms-table-cell",title:e.atividade,children:e.atividade}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.inicio}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.fim}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.percentDia}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:(0,r.jsx)("span",{className:"ms-table-badge ".concat("Em Andamento"===e.status?"ms-table-badge-status-em-andamento":"ms-table-badge-status-a-fazer"),children:e.status})}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:(0,r.jsx)("span",{className:"ms-table-badge ".concat("Alta"===e.prioridade?"ms-table-badge-prioridade-alta":"Média"===e.prioridade?"ms-table-badge-prioridade-media":"ms-table-badge-prioridade-baixa"),children:e.prioridade})}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.duracao}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:(0,r.jsx)("button",{className:"app-icon-button",onClick:function(){return function(e){var t,r,a,o,i=(0,l.findProjectByName)(e.projeto,n),s=(0,l.findActivityByName)(e.atividade,u);M(e.projeto),L(e.atividade),N(null!==(t=null==i?void 0:i.id)&&void 0!==t?t:null),O(null!==(r=null==s?void 0:s.id)&&void 0!==r?r:null),P(null!==(a=null==i?void 0:i.name)&&void 0!==a?a:""),D(null!==(o=null==s?void 0:s.name)&&void 0!==o?o:"");var c={startTime:e.inicio||"00:00",endTime:e.fim||"00:00",percentage:(0,l.extractPercentage)(e.percentDia),duration:(0,l.parseDurationToMinutes)(e.duracao),comment:""};j(c),y(!0)}(e)},title:"Registrar atividade planejada",children:(0,r.jsx)("i",{className:"fas fa-check ms-table-action-icon","aria-hidden":"true"})})})]})},emptyMessage:"Nenhuma atividade prevista para hoje"})]})}),(0,r.jsx)(i.default,{show:b,onClose:q,onSubmit:B,selectedProject:E||I,selectedActivity:T||z,workloadHours:p,prefilledData:x,allowProjectSelection:!0,projectOptions:n,activityOptions:u,selectedProjectId:S,selectedActivityId:C,suggestedProjectName:I,suggestedActivityName:z,onProjectChange:function(e){var t,r;if(null===e)return N(null),void P("");var a=n.find(function(t){return t.id===e});N(null!==(t=null==a?void 0:a.id)&&void 0!==t?t:null),P(null!==(r=null==a?void 0:a.name)&&void 0!==r?r:"")},onActivityChange:function(e){var t,n;if(null===e)return O(null),void D("");var r=u.find(function(t){return t.id===e});O(null!==(t=null==r?void 0:r.id)&&void 0!==t?t:null),D(null!==(n=null==r?void 0:r.name)&&void 0!==n?n:"")}})]})}},39576(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>f});n(52675),n(89463),n(2259),n(28706),n(50113),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(71761),n(23500),n(62953);var r=n(74848),a=n(96540),o=n(62495),i=n(1806);function s(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return l(u,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var i={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(l(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,l(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,l(m,"constructor",d),l(d,"constructor",u),u.displayName="GeneratorFunction",l(d,a,"GeneratorFunction"),l(m),l(m,a,"Generator"),l(m,r,function(){return this}),l(m,"toString",function(){return"[object Generator]"}),(s=function(){return{w:o,m:p}})()}function l(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}l=function(e,t,n,r){function o(t,n){l(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},l(e,t,n,r)}function c(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e){var t=e.isOpen,n=e.onScan,l=e.onClose,d=e.qrcodes,f=void 0===d?[]:d,m=u((0,a.useState)(null),2),p=m[0],h=m[1],v=u((0,a.useState)(""),2),b=v[0],y=v[1],g=(0,a.useRef)(null),x=(0,a.useRef)(null),j=(0,a.useRef)(!1);(0,a.useEffect)(function(){return t?(w(),j.current=!1):S(),function(){S()}},[t]);var w=function(){var e,t=(e=s().m(function e(){var t,n,r;return s().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,console.log("[QRCodeModal] 🚀 Iniciando ZXing scanner..."),console.log("[QRCodeModal] QR Codes autorizados:",f.length),f.forEach(function(e,t){console.log("[QRCodeModal] ".concat(t+1,". ").concat(e.name," (ID: ").concat(e.id,")"))}),h(null),y(""),t=new o.BrowserQRCodeReader,x.current=t,e.n=1,t.decodeFromVideoDevice(null,g.current,function(e,t){if(e&&!j.current){var n=e.getText();console.log("[QRCodeModal] 🎉 QR CODE DETECTADO!"),console.log("[QRCodeModal] Dados:",n),y(n),N(n)}});case 1:console.log("[QRCodeModal] ✅ Scanner ativo e esperando QR Code!"),e.n=3;break;case 2:e.p=2,r=e.v,console.error("[QRCodeModal] ❌ Erro ao iniciar scanner:",r),n="Erro ao acessar câmera. Verifique as permissões.","NotAllowedError"===r.name||"PermissionDeniedError"===r.name?n="Permissão de acesso à câmera negada. Por favor, permita o acesso à câmera nas configurações do navegador e tente novamente.":"NotFoundError"===r.name?n="Nenhuma câmera foi encontrada no seu dispositivo.":"NotReadableError"===r.name?n="A câmera está em uso por outro aplicativo. Feche outros aplicativos e tente novamente.":r.message&&(n=r.message),h(n);case 3:return e.a(2)}},e,null,[[0,2]])}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){c(o,r,a,i,s,"next",e)}function s(e){c(o,r,a,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}(),S=function(){console.log("[QRCodeModal] Parando scanner..."),x.current&&(x.current.reset(),x.current=null),j.current=!1},N=function(e){if(j.current)console.log("[QRCodeModal] Já processado, ignorando...");else{j.current=!0,console.log("[QRCodeModal] ========================================"),console.log("[QRCodeModal] Processando QR Code detectado"),console.log("[QRCodeModal] Dados:",e);var t=k(e);if(console.log("[QRCodeModal] ID extraído:",t),!t)return console.error("[QRCodeModal] ❌ Falha ao extrair ID"),h("QR Code inválido. Formato não reconhecido."),void(j.current=!1);var r=f.find(function(e){return e.id===t});r?(console.log("[QRCodeModal] ✅ QR Code VÁLIDO!"),console.log("[QRCodeModal] Nome:",r.name),S(),n(t)):(console.error("[QRCodeModal] ❌ ID não autorizado!"),console.error("[QRCodeModal] ID lido:",t),console.error("[QRCodeModal] IDs autorizados:",f.map(function(e){return e.id})),h("ID ".concat(t.substring(0,8),"... não autorizado.")),j.current=!1)}},k=function(e){try{var t=e.match(/([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})/i);return t&&t[1]?t[1]:null}catch(e){return console.error("[extractQRCodeId] Erro:",e),null}},C=function(){S(),h(null),l()};return t?(0,r.jsx)(i.A,{show:t,onClose:C,title:"Ler QR Code",size:"md",footer:(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:C,children:"Cancelar"}),children:(0,r.jsxs)("div",{style:{padding:"24px"},children:[p&&(0,r.jsxs)("div",{className:"alert d-flex align-items-center mb-3",style:{backgroundColor:"#E6F7F9",borderColor:"#17A2B8",color:"#0C5460",gap:"12px"},children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle",style:{color:"#17A2B8",fontSize:"24px"}}),(0,r.jsx)("div",{style:{flex:1},children:p})]}),0===f.length?(0,r.jsxs)("div",{className:"text-center py-5",children:[(0,r.jsx)("i",{className:"fas fa-qrcode fa-4x text-muted mb-3"}),(0,r.jsx)("h5",{className:"text-muted",children:"Nenhum QR Code disponível"}),(0,r.jsx)("p",{className:"text-muted mb-0",children:"Não há QR Codes configurados para registro de ponto."})]}):(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("p",{style:{fontFamily:"Inter",fontSize:"14px",color:"#5C5D5D",marginBottom:"16px"},children:"Aponte a câmera para o QR Code"}),(0,r.jsx)("div",{style:{position:"relative",width:"100%",maxWidth:"500px",margin:"0 auto",borderRadius:"8px",overflow:"hidden",backgroundColor:"#000"},children:(0,r.jsx)("video",{ref:g,style:{width:"100%",height:"auto"}})}),(0,r.jsxs)("div",{className:"alert alert-info mt-3 mb-0",children:[(0,r.jsx)("div",{children:"Posicione o QR Code na frente da câmera"}),f.length>0&&(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsxs)("small",{className:"text-muted",children:[(0,r.jsx)("strong",{children:f.length})," QR Code(s) autorizado(s)"]})}),b&&(0,r.jsxs)("div",{className:"mt-2 p-2",style:{background:"#d4edda",border:"1px solid #28a745",borderRadius:"4px",fontSize:"11px",wordBreak:"break-all"},children:[(0,r.jsx)("strong",{style:{color:"#155724"},children:"✅ Detectado:"}),(0,r.jsx)("br",{}),(0,r.jsxs)("code",{style:{fontSize:"10px"},children:[b.substring(0,60),"..."]})]})]})]})]})}):null}},39618(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>i});var r=n(74848),a=n(1806),o={warningIcon:{fontSize:"56px",color:"#FF6D6D",textAlign:"center",marginBottom:"20px"},message:{fontSize:"16px",color:"#5C5D5D",textAlign:"center",marginBottom:"24px",lineHeight:"1.8"},warningText:{fontSize:"14px",fontWeight:600,color:"#DC2626",textAlign:"center",marginTop:"8px"},activityInfo:{backgroundColor:"#F8F9FA",padding:"16px",borderRadius:"8px",marginBottom:"16px",border:"1px solid #E5E7EB"},infoLabel:{fontSize:"13px",fontWeight:600,color:"#6B7280",marginBottom:"6px"},infoValue:{fontSize:"14px",fontWeight:500,color:"#1F2937"}};function i(e){var t=e.show,n=e.onClose,i=e.onConfirm,s=e.activityName,l=e.projectName;return(0,r.jsxs)(a.A,{show:t,onClose:n,title:"Confirmar Exclusão",size:"md",footer:(0,r.jsx)(a.M,{onCancel:n,onConfirm:i,cancelText:"Cancelar",confirmText:"Excluir"}),children:[(0,r.jsx)("div",{style:o.warningIcon,children:(0,r.jsx)("i",{className:"fas fa-exclamation-triangle"})}),(0,r.jsx)("div",{style:o.message,children:"Tem certeza que deseja excluir esta atividade?"}),(0,r.jsx)("div",{style:o.warningText,children:"⚠️ Esta ação não pode ser desfeita"}),(0,r.jsxs)("div",{style:o.activityInfo,children:[(0,r.jsxs)("div",{style:{marginBottom:"12px"},children:[(0,r.jsx)("div",{style:o.infoLabel,children:"Projeto"}),(0,r.jsx)("div",{style:o.infoValue,children:l})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{style:o.infoLabel,children:"Atividade"}),(0,r.jsx)("div",{style:o.infoValue,children:s})]})]})]})}},41081(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>p});n(52675),n(89463),n(2259),n(51629),n(23418),n(64346),n(23792),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(5506),n(40875),n(79432),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(42762),n(23500),n(62953),n(76031);var r=n(74848),a=n(96540),o=n(76336);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function s(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(i(e)+" is not iterable")}function l(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return c(u,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var i={};function s(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(c(t={},r,function(){return this}),t),m=d.prototype=s.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,c(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,c(m,"constructor",d),c(d,"constructor",u),u.displayName="GeneratorFunction",c(d,a,"GeneratorFunction"),c(m),c(m,a,"Generator"),c(m,r,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),(l=function(){return{w:o,m:p}})()}function c(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}c=function(e,t,n,r){function o(t,n){c(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},c(e,t,n,r)}function u(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(){var e,t=document.getElementById("time-management-permissions-template");return t instanceof HTMLTemplateElement?t.innerHTML.trim():(null===(e=document.getElementById("permissoes-content"))||void 0===e?void 0:e.innerHTML.trim())||""}function p(){var e=(0,a.useRef)(null),t=(0,o.L)(),n=(0,o.v)(),i=d((0,a.useState)(m),1)[0];return(0,a.useEffect)(function(){var e=[];return["/css/time-management/index.css","https://cdn.datatables.net/1.13.4/css/dataTables.dataTables.css","https://cdn.datatables.net/responsive/2.4.0/css/responsive.dataTables.css"].forEach(function(t){if(!document.querySelector('link[href="'.concat(t,'"]'))){var n=document.createElement("link");n.rel="stylesheet",n.href=t,document.head.appendChild(n),e.push(n)}}),function(){e.forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)})}},[]),(0,a.useEffect)(function(){var e=["https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js","https://cdn.datatables.net/responsive/2.4.0/js/dataTables.responsive.min.js"],t=[],n=function(){var n,r=(n=l().m(function n(){var r,a,o;return l().w(function(n){for(;;)switch(n.n){case 0:r=l().m(function e(){var n;return l().w(function(e){for(;;)switch(e.n){case 0:if(n=o[a],!document.querySelector('script[src="'.concat(n,'"]'))){e.n=1;break}return e.a(2,1);case 1:return e.n=2,new Promise(function(e,r){var a=document.createElement("script");a.src=n,a.async=!1,a.onload=function(){return e()},a.onerror=function(){return r(new Error("Erro ao carregar ".concat(n)))},document.head.appendChild(a),t.push(a)});case 2:return e.a(2)}},e)}),a=0,o=e;case 1:if(!(a<o.length)){n.n=4;break}return n.d(s(r()),2);case 2:if(!n.v){n.n=3;break}return n.a(3,3);case 3:a++,n.n=1;break;case 4:return n.a(2)}},n)}),function(){var e=this,t=arguments;return new Promise(function(r,a){var o=n.apply(e,t);function i(e){u(o,r,a,i,s,"next",e)}function s(e){u(o,r,a,i,s,"throw",e)}i(void 0)})});return function(){return r.apply(this,arguments)}}();return n().catch(function(e){console.error("Erro ao carregar scripts do DataTables:",e)}),function(){t.forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)})}},[]),(0,a.useEffect)(function(){if(i&&e.current){new Promise(function(e){var t=function(){void 0!==window.$&&void 0!==window.$.fn.DataTable?e():setTimeout(t,100)};t()}).then(function(){e.current&&(e.current.querySelectorAll("script").forEach(function(e){var t,n=document.createElement("script");Array.from(e.attributes).forEach(function(e){n.setAttribute(e.name,e.value)}),e.src?n.src=e.src:n.textContent=e.textContent,null===(t=e.parentNode)||void 0===t||t.replaceChild(n,e)}),window.setTimeout(function(){var e,t,n,r,a,o;null===(e=(t=window).initAllCustomSelectWrappers)||void 0===e||e.call(t),null===(n=(r=window).initCustomSelects)||void 0===n||n.call(r),null===(a=(o=window).setupDynamicTables)||void 0===a||a.call(o),document.dispatchEvent(new CustomEvent("tabShown"))},50),setTimeout(function(){var e=window.$;if(e&&e.fn.DataTable){var t=window.PRODUCT_SLUG||"time-management";fetch("/permission-tab/data/".concat(t)).then(function(e){return e.json()}).then(function(e){"success"===e.status&&(window.permissionTabMembers={},window.permissionTabTags=e.data.permissionTags,e.data.membersTag.forEach(function(e){window.permissionTabMembers[e.id]=e}))}).catch(function(e){console.error("Erro ao buscar dados de permissões:",e)});var n=setInterval(function(){var e=window.permissionTabMembers;(e?Object.keys(e).length:0)>0&&(clearInterval(n),r())},200);setTimeout(function(){clearInterval(n),r()},2e4)}function r(){document.querySelectorAll(".open-offcanvas-btn").forEach(function(e){var t,n=e.cloneNode(!0);null===(t=e.parentNode)||void 0===t||t.replaceChild(n,e),n.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation();var t=this.getAttribute("data-id");if(t){var n=window.permissionTabMembers;if(n&&n[t]){var r=document.getElementById("overlay"),a=document.getElementById("customOffcanvas");if(r&&a){var o=n[t],i=document.getElementById("offcanvasAvatar");if(i){var s=o.avatar?"/uploads/photos/".concat(o.avatar):"/images/user-default.png";i.style.backgroundImage="url(".concat(s,")")}var l=document.getElementById("offcanvasName"),c=document.getElementById("offcanvasEmail"),u=document.getElementById("offcanvasRole"),f=document.getElementById("offcanvasStatus"),m=document.getElementById("offcanvasIsRegistered");l&&(l.textContent=o.name||"Não informado"),c&&(c.textContent=o.email||"Não informado"),u&&(u.textContent=o.role||"Sem função atribuída"),f&&(f.className="status-indicator "+(o.active?"active":"inactive")),m&&(m.textContent=o.isRegistered?"Membro Registrado":"Membro Não Registrado");var p=document.getElementById("offcanvasTeams");if(p&&(p.innerHTML="",o.compiled_teams))for(var h=0,v=Object.entries(o.compiled_teams);h<v.length;h++){var b=d(v[h],2),y=(b[0],b[1]),g=document.createElement("span");g.className="team-tag",g.textContent=y,p.appendChild(g)}"function"==typeof window.renderGlobalPermission&&window.renderGlobalPermission(o),"function"==typeof window.renderCustomPermissions&&window.renderCustomPermissions(o),r.style.display="block",a.classList.add("open"),document.body.classList.add("no-scroll"),setTimeout(function(){!function(e){window.positionDropdown=function(e,t){if(e&&t)try{e.style.position="absolute",e.style.top="100%",e.style.right="0",e.style.left="auto",e.style.zIndex="2100",e.style.marginTop="5px"}catch(e){}},window.positionOffcanvasDropdown=function(e,t){if(e&&t)try{e.style.position="absolute",e.style.right="0",e.style.top="100%",e.style.left="auto",e.style.zIndex="2100",e.style.marginTop="5px"}catch(e){}},setTimeout(function(){var t=document.querySelector('#offcanvasGlobalTagPermission button[data-bs-toggle="dropdown"]');if(t||(t=document.querySelector("#offcanvasGlobalTagPermission .tag")),t){var n,r=t.cloneNode(!0);null===(n=t.parentNode)||void 0===n||n.replaceChild(r,t),r.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation();var n=this.nextElementSibling;if(n){var r=n.classList.contains("show");document.querySelectorAll("#customOffcanvas .permissions-dropdown-menu.show").forEach(function(e){e!==n&&e.classList.remove("show")}),n.classList.toggle("show"),n.style.position="absolute",n.style.right="0",n.style.top="100%",n.style.left="auto",n.style.zIndex="2100",n.style.display="block",r||setTimeout(function(){!function(e,t){var n=e.querySelectorAll(".change-permission-global, .dropdown-item");n.forEach(function(n){var r,a=n.cloneNode(!0);null===(r=n.parentNode)||void 0===r||r.replaceChild(a,n),a.addEventListener("click",function(n){var r;n.preventDefault(),n.stopPropagation();var a=this.getAttribute("data-member-id")||t.id,o=this.getAttribute("data-permission-id"),i=(null===(r=this.textContent)||void 0===r?void 0:r.trim())||this.getAttribute("data-permission-name"),s=this.getAttribute("data-permission-color")||this.style.backgroundColor,l=this.getAttribute("data-permission-letter-color")||this.style.color,c=e.previousElementSibling;"function"==typeof window.showSuccessConfirmationModal&&window.showSuccessConfirmationModal("Confirmação de Alteração da Tag de Permissão Global","Essa alteração será aplicada a todos os produtos associados.<br>Você tem certeza?","Confirmar",function(){"function"==typeof window.updateGlobalPermission&&c&&(window.updateGlobalPermission(a,o,c,i,s,l),setTimeout(function(){window.dispatchEvent(new CustomEvent("permissionUpdated"))},1e3))}),e.classList.remove("show")})})}(n,e)},50)}})}},200),setTimeout(function(){document.querySelectorAll("#customPermissionsList .dropdown-toggle").forEach(function(e){var t,n=e.cloneNode(!0);null===(t=e.parentNode)||void 0===t||t.replaceChild(n,e),n.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation();var t=this.nextElementSibling;if(t){t.classList.contains("show");document.querySelectorAll("#customOffcanvas .permissions-dropdown-menu.show").forEach(function(e){e!==t&&e.classList.remove("show")}),t.classList.toggle("show"),t.style.position="absolute",t.style.right="0",t.style.top="100%",t.style.left="auto",t.style.zIndex="2100"}})}),document.querySelectorAll("#customOffcanvas .change-permission").forEach(function(e){var t,n=e.cloneNode(!0);null===(t=e.parentNode)||void 0===t||t.replaceChild(n,e),n.addEventListener("click",function(e){var t;e.preventDefault(),e.stopPropagation();var n=this.getAttribute("data-member-id"),r=this.getAttribute("data-product-id"),a=this.getAttribute("data-permission-id"),o=this.getAttribute("data-permission-name"),i=this.getAttribute("data-permission-color"),s=this.getAttribute("data-permission-letter-color"),l=null===(t=this.closest(".dropdown"))||void 0===t?void 0:t.querySelector("button");l&&"function"==typeof window.updateCustomPermission&&(window.updateCustomPermission(n,r,a,l,o,i,s),setTimeout(function(){window.dispatchEvent(new CustomEvent("customPermissionUpdated"))},1e3));var c=this.closest(".permissions-dropdown-menu");c&&c.classList.remove("show")})})},100);var t=function(e){e.target.closest("#customOffcanvas .permissions-manager")||document.querySelectorAll("#customOffcanvas .permissions-dropdown-menu.show").forEach(function(e){e.classList.remove("show")})};document.removeEventListener("click",t),document.addEventListener("click",t)}(o)},300)}}else"function"==typeof window.loadGoalsPermissionData&&(window.loadGoalsPermissionData(),setTimeout(function(){var e,n,r;null!==(e=window.permissionTabMembers)&&void 0!==e&&e[t]&&(null===(n=(r=window).openOffcanvas)||void 0===n||n.call(r,t))},1500))}})});var e=document.getElementById("closeOffcanvas"),t=document.getElementById("overlay");if(e){var n,r=e.cloneNode(!0);null===(n=e.parentNode)||void 0===n||n.replaceChild(r,e),r.addEventListener("click",function(){var e=document.getElementById("customOffcanvas"),t=document.getElementById("overlay");e&&e.classList.remove("open"),t&&(t.style.display="none"),document.body.classList.remove("no-scroll")})}if(t){var a,o=t.cloneNode(!0);null===(a=t.parentNode)||void 0===a||a.replaceChild(o,t),o.addEventListener("click",function(){var e=document.getElementById("customOffcanvas");e&&e.classList.remove("open"),this.style.display="none",document.body.classList.remove("no-scroll")})}}},1e3))})}},[i]),n||!t.canView?(0,r.jsxs)("div",{className:"alert alert-danger m-3",role:"alert",children:[(0,r.jsxs)("h4",{className:"alert-heading",children:[(0,r.jsx)("i",{className:"fas fa-ban me-2"}),"Acesso Negado"]}),(0,r.jsx)("p",{children:"Você não tem permissão para visualizar as permissões deste produto."}),(0,r.jsx)("hr",{}),(0,r.jsxs)("p",{className:"mb-0",children:[(0,r.jsx)("strong",{children:"Permissões necessárias:"})," Visualizar"]})]}):i?(0,r.jsx)("div",{ref:e,dangerouslySetInnerHTML:{__html:i||""}}):(0,r.jsxs)("div",{className:"alert alert-danger m-3",role:"alert",children:[(0,r.jsxs)("h4",{className:"alert-heading",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-triangle me-2"}),"Erro ao renderizar permissões"]}),(0,r.jsx)("p",{className:"mb-0",children:"Conteúdo de permissões não encontrado no template da página."})]})}},42328(e,t,n){"use strict";n.d(t,{A:()=>h});n(52675),n(89463),n(2259),n(28706),n(50113),n(23418),n(74423),n(64346),n(23792),n(62062),n(34782),n(26910),n(23288),n(62010),n(9868),n(26099),n(27495),n(38781),n(31415),n(21699),n(47764),n(62953);var r=n(74848),a=n(8194),o=n(46539),i=n(28482),s=n(69107),l=n(69786),c=n(77984),u=n(23495),d=n(45721);function f(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var p=function(e){var t=e.active,n=e.payload,a=e.label;if(t&&n&&n.length){var o,i=null===(o=n[0])||void 0===o?void 0:o.payload,s=(null==i?void 0:i.label)||"Período ".concat(a);return(0,r.jsxs)("div",{style:{backgroundColor:"rgba(255, 255, 255, 0.95)",border:"1px solid #ccc",borderRadius:"6px",padding:"6px 10px",boxShadow:"0 1px 4px rgba(0,0,0,0.1)",fontSize:"11px",lineHeight:"1.4",minWidth:"auto",maxWidth:"180px"},children:[(0,r.jsx)("div",{style:{fontWeight:600,marginBottom:"3px",fontSize:"11px",color:"#333"},children:s}),n.map(function(e,t){var n;return(0,r.jsxs)("div",{style:{margin:"2px 0",color:e.color,fontSize:"10px"},children:[e.name,": ",(0,r.jsxs)("strong",{children:[null===(n=e.value)||void 0===n?void 0:n.toFixed(1),"h"]})]},t)})]})}return null};function h(e){var t,n,m=e.selectedFilters,h=e.timesheetData,v=e.attendanceData,b=m.includes("timesheet"),y=m.includes("attendance"),g="Período";switch((null===(t=h[0])||void 0===t?void 0:t.type)||(null===(n=v[0])||void 0===n?void 0:n.type)||"day"){case"day":g="Dia do Mês";break;case"week":g="Semana";break;case"month":g="Mês"}var x=[].concat(f(h.map(function(e){return e.period})),f(v.map(function(e){return e.period}))),j=Array.from(new Set(x)).sort(function(e,t){return e-t}).map(function(e){var t=h.find(function(t){return t.period===e}),n=v.find(function(t){return t.period===e}),r=(null==t?void 0:t.label)||(null==n?void 0:n.label)||"".concat(e);return{period:e,label:r,timesheetHours:t?t.hours:0,attendanceHours:n?n.hours:0}}),w=Math.max.apply(Math,f(j.map(function(e){return Math.max(e.timesheetHours,e.attendanceHours)})).concat([10])),S=[0,10*Math.ceil(w/10)],N=Array.from({length:4},function(e,t){return Math.round(S[1]/3*t)});return(0,r.jsx)("div",{style:{userSelect:"none",transform:"none",transition:"none"},children:(0,r.jsx)(i.u,{width:"100%",height:300,style:{transform:"none"},children:(0,r.jsxs)(d.b,{data:j,margin:{top:10,right:30,left:0,bottom:30},style:{cursor:"default"},onMouseMove:function(e){var t;return null==e||null===(t=e.stopPropagation)||void 0===t?void 0:t.call(e)},onMouseDown:function(e){var t;return null==e||null===(t=e.stopPropagation)||void 0===t?void 0:t.call(e)},onMouseUp:function(e){var t;return null==e||null===(t=e.stopPropagation)||void 0===t?void 0:t.call(e)},onClick:function(e){var t;return null==e||null===(t=e.stopPropagation)||void 0===t?void 0:t.call(e)},children:[(0,r.jsx)(s.d,{strokeDasharray:"3 3",stroke:"#E0E0E0"}),(0,r.jsx)(c.W,{dataKey:"label",axisLine:!1,tickLine:!1,tick:{fill:"#5C5D5D",fontSize:11},angle:j.length>15?-45:0,textAnchor:j.length>15?"end":"middle",height:j.length>15?60:40,interval:j.length>20?Math.floor(j.length/15):0,label:{value:g,position:"insideBottom",offset:j.length>15?-20:-5,style:{fill:"#5C5D5D",fontSize:12}}}),(0,r.jsx)(u.h,{ticks:N,domain:S,axisLine:!1,tickLine:!1,tick:{fill:"#5C5D5D",fontSize:12},tickFormatter:function(e){return"".concat(e,"h")},label:{value:"Horas Trabalhadas",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"#5C5D5D",fontSize:12,fontWeight:600}}}),(0,r.jsx)(o.m,{content:(0,r.jsx)(p,{})}),(0,r.jsx)(a.s,{verticalAlign:"bottom",height:36,iconType:"line",wrapperStyle:{paddingTop:"20px",fontSize:"12px"},formatter:function(e){return(0,r.jsx)("span",{style:{color:"#5C5D5D",fontSize:"12px"},children:e})}}),b&&(0,r.jsx)(l.N1,{type:"monotone",dataKey:"timesheetHours",name:"Por Timesheet",stroke:"#186073",strokeWidth:2,dot:{fill:"#FFFFFF",r:4,stroke:"#186073",strokeWidth:2},activeDot:{r:5,fill:"#FFFFFF",stroke:"#186073",strokeWidth:2},isAnimationActive:!1}),y&&(0,r.jsx)(l.N1,{type:"monotone",dataKey:"attendanceHours",name:"Por Registro de Ponto",stroke:"#17A1B7",strokeWidth:2,dot:{fill:"#FFFFFF",r:4,stroke:"#17A1B7",strokeWidth:2},activeDot:{r:5,fill:"#FFFFFF",stroke:"#17A1B7",strokeWidth:2},isAnimationActive:!1})]})})})}},42415(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>x});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23418),n(64346),n(23792),n(34782),n(89572),n(23288),n(94170),n(62010),n(2892),n(59904),n(67945),n(84185),n(83851),n(81278),n(40875),n(79432),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(23500),n(62953),n(76031),n(3296),n(27208),n(48408);var r=n(74848),a=n(97665),o=n(57097),i=n(49785),s=n(34595),l=n(96540),c=n(1806);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){m(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function m(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return h(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(h(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,h(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,h(d,"constructor",c),h(c,"constructor",l),l.displayName="GeneratorFunction",h(c,a,"GeneratorFunction"),h(d),h(d,a,"Generator"),h(d,r,function(){return this}),h(d,"toString",function(){return"[object Generator]"}),(p=function(){return{w:o,m:f}})()}function h(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}h=function(e,t,n,r){function o(t,n){h(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},h(e,t,n,r)}function v(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return y(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var g=["time-management","qrcodes"];function x(e){var t=e.show,u=e.onClose,d=e.editData,m=(0,a.jE)(),h=!!d,y=b((0,l.useState)(!1),2),x=y[0],j=y[1],w=b((0,l.useState)(null),2),S=w[0],N=w[1],k=(0,i.mN)({defaultValues:{name:"",description:"",type:"qrcode",temporary:!1,requireLogin:!1,startDate:"",startTime:"",endDate:"",endTime:""}}),C=k.register,O=k.handleSubmit,A=k.watch,E=k.setValue,P=k.reset;k.formState.errors;(0,l.useEffect)(function(){d&&(E("name",d.name),E("description",d.description||""),E("type",d.type),E("temporary",d.temporary),E("requireLogin",d.requireLogin),E("startDate",d.startDate||""),E("startTime",d.startTime||""),E("endDate",d.endDate||""),E("endTime",d.endTime||""))},[d,E]);var F=A("type"),T=A("name"),D=A("temporary"),_=(0,o.n)({mutationFn:function(e){var t={name:e.name,description:e.description||"",type:e.type,temporary:e.temporary,requireLogin:e.requireLogin,startDate:e.temporary?e.startDate:void 0,startTime:e.temporary?e.startTime:void 0,endDate:e.temporary?e.endDate:void 0,endTime:e.temporary?e.endTime:void 0};return h&&null!=d&&d.id?(0,s.og)(d.id,t):(0,s.Pg)(t)},onSuccess:function(e){m.invalidateQueries({queryKey:g}),N(e),j(!0)}}),I=function(){j(!1),N(null),P(),u()},M=function(){var e,t=(e=p().m(function e(){var t,r,a,o,i,s,l;return p().w(function(e){for(;;)switch(e.p=e.n){case 0:if(null==S||!S.url||"qrcode"!==S.type){e.n=8;break}return e.p=1,e.n=2,n.e(583).then(n.t.bind(n,87583,19));case 2:return t=e.v,e.n=3,t.toDataURL(S.url,{width:512,margin:2,color:{dark:"#000000",light:"#FFFFFF"},errorCorrectionLevel:"H"});case 3:return r=e.v,e.n=4,fetch(r);case 4:return a=e.v,e.n=5,a.blob();case 5:o=e.v,i=window.URL.createObjectURL(o),(s=document.createElement("a")).href=i,s.download="".concat(S.name||"qrcode",".png"),document.body.appendChild(s),s.click(),setTimeout(function(){document.body.removeChild(s),window.URL.revokeObjectURL(i)},100),e.n=7;break;case 6:e.p=6,l=e.v,console.error("Erro ao baixar QR Code:",l),alert("Erro ao gerar QR Code para download");case 7:e.n=9;break;case 8:null!=S&&S.url&&"link"===S.type&&(navigator.clipboard.writeText(S.url),alert("Link copiado para a área de transferência!"));case 9:return e.a(2)}},e,null,[[1,6]])}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){v(o,r,a,i,s,"next",e)}function s(e){v(o,r,a,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}();return x?(0,r.jsx)(c.A,{show:t,onClose:I,title:"Gerador",size:"md",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:I,children:"Cancelar"}),(0,r.jsx)("button",{type:"button",className:"btn text-white px-4",style:{backgroundColor:"#17a2b8"},onClick:I,children:"Feito"})]}),children:(0,r.jsxs)("div",{className:"text-center",style:{padding:"40px"},children:[(0,r.jsx)("h3",{className:"mb-4",style:{color:"#666",fontWeight:600},children:"Prontinho!"}),(0,r.jsxs)("div",{className:"p-5 mb-3",style:{border:"2px dashed #ddd",borderRadius:"12px",backgroundColor:"#fafafa",cursor:"pointer"},onClick:M,children:[(0,r.jsx)("i",{className:"fas fa-qrcode",style:{fontSize:"4rem",color:"#ccc",marginBottom:"20px"}}),(0,r.jsx)("h5",{className:"font-weight-bold mb-2",children:"qrcode"===F?"QR Code Gerado com Sucesso!":"Link Gerado com Sucesso!"}),(0,r.jsx)("p",{className:"text-muted mb-0",children:"Clique aqui para fazer o download"})]})]})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.A,{show:t,onClose:u,title:"Gerador",size:"md",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:u,children:"Cancelar"}),(0,r.jsx)("button",{type:"submit",form:"qrcodeForm",className:"btn text-white px-4",style:{backgroundColor:"#17a2b8"},disabled:_.isPending||!T,children:_.isPending?(0,r.jsx)("i",{className:"fas fa-spinner fa-spin"}):"Gerar ".concat("qrcode"===F?"QR Code":"Link")})]}),children:(0,r.jsxs)("form",{id:"qrcodeForm",onSubmit:O(function(e){_.mutate(e)}),children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark mb-3",children:"Gerar"}),(0,r.jsxs)("div",{className:"d-flex",children:[(0,r.jsxs)("div",{className:"form-check mr-4",children:[(0,r.jsx)("input",f(f({className:"form-check-input",type:"radio",value:"qrcode"},C("type",{required:!0})),{},{id:"typeQRCode"})),(0,r.jsx)("label",{className:"form-check-label",htmlFor:"typeQRCode",children:"QR Code"})]}),(0,r.jsxs)("div",{className:"form-check",children:[(0,r.jsx)("input",f(f({className:"form-check-input",type:"radio",value:"link"},C("type",{required:!0})),{},{id:"typeLink"})),(0,r.jsx)("label",{className:"form-check-label",htmlFor:"typeLink",children:"Link"})]})]})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsxs)("label",{className:"font-weight-normal text-dark",children:["Nome do ","qrcode"===F?"QR Code":"Link"]}),(0,r.jsx)("input",f({type:"text",className:"form-control",placeholder:"Digite o nome do ".concat("qrcode"===F?"QR Code":"Link")},C("name",{required:!0})))]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Descrição"}),(0,r.jsx)("textarea",f({className:"form-control",rows:3,placeholder:"Detalhe mais informações sobre esse ".concat("qrcode"===F?"QR Code":"Link")},C("description")))]}),(0,r.jsx)("hr",{className:"my-4"}),(0,r.jsx)("div",{className:"form-group",children:(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark mb-0",children:"Necessário login para validação?"}),(0,r.jsx)("i",{className:"far fa-question-circle ml-2 text-muted",style:{fontSize:"0.9rem"},"data-toggle":"tooltip","data-placement":"top",title:"Se ativado, o usuário precisará estar logado para bater ponto"})]}),(0,r.jsxs)("label",{className:"switch mb-0",children:[(0,r.jsx)("input",f({type:"checkbox"},C("requireLogin"))),(0,r.jsx)("span",{className:"slider round"})]})]})}),(0,r.jsx)("div",{className:"form-group",children:(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark mb-0",children:"Gerar Temporariamente?"}),(0,r.jsxs)("label",{className:"switch mb-0",children:[(0,r.jsx)("input",f({type:"checkbox"},C("temporary"))),(0,r.jsx)("span",{className:"slider round"})]})]})}),D&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Período de Início"}),(0,r.jsx)("input",f({type:"date",className:"form-control",placeholder:"dd/mm/aaaa"},C("startDate",{required:D})))]})}),(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:" "}),(0,r.jsx)("input",f({type:"time",className:"form-control",placeholder:"Horas"},C("startTime",{required:D})))]})})]}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Período de Finalização"}),(0,r.jsx)("input",f({type:"date",className:"form-control",placeholder:"dd/mm/aaaa"},C("endDate",{required:D})))]})}),(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:" "}),(0,r.jsx)("input",f({type:"time",className:"form-control",placeholder:"Horas"},C("endTime",{required:D})))]})})]})]})]})}),(0,r.jsx)("style",{children:'\n .switch {\n position: relative;\n display: inline-block;\n width: 50px;\n height: 24px;\n }\n\n .switch input {\n opacity: 0;\n width: 0;\n height: 0;\n }\n\n .slider {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: #ccc;\n transition: .4s;\n }\n\n .slider:before {\n position: absolute;\n content: "";\n height: 18px;\n width: 18px;\n left: 3px;\n bottom: 3px;\n background-color: white;\n transition: .4s;\n }\n\n input:checked + .slider {\n background-color: #17a2b8;\n }\n\n input:checked + .slider:before {\n transform: translateX(26px);\n }\n\n .slider.round {\n border-radius: 24px;\n }\n\n .slider.round:before {\n border-radius: 50%;\n }\n '})]})}},43432(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>w});n(23792),n(26099),n(31415),n(47764),n(62953);var r=n(74848),a=n(33930),o=n(97665),i=n(57097),s=n(96540),l=n(19782),c=n(7440),u=n(52798),d=n(26071),f=n(46265),m=n(93794),p=n(95226),h=n(47034),v=n(55801),b=n(19619),y=n(17147),g=n(70038),x=n(55278),j=n(50860);function w(){var e,t=(0,o.jE)(),n=(0,a.I)({queryKey:["time-management","validation"],queryFn:v.G8,staleTime:6e4,refetchOnWindowFocus:!1}).data,w=n?b.c[n.mode]:null,S=(0,s.useMemo)(function(){var e;return new Set(null!==(e=null==n?void 0:n.others)&&void 0!==e?e:[])},[n]),N="flex"===w||"manual"===w&&S.has("geolocation"),k="flex"===w||"qr"===w||"manual"===w&&S.has("qrcode"),C=(0,a.I)({queryKey:["time-management","work-shifts"],queryFn:g.hY,staleTime:6e4,refetchOnWindowFocus:!1}).data,O=void 0===C?[]:C,A=(e=null==O?void 0:O.length,(0,a.I)({queryKey:["time-management","can-view-maps"],queryFn:x.vD,staleTime:6e4,refetchOnWindowFocus:!1}).data),E=void 0!==A&&A,P=(0,i.n)({mutationFn:function(e){return(0,x.xD)(e)},onSuccess:function(e){t.setQueryData(["time-management","can-view-maps"],e)}});return(0,r.jsxs)(j.A,{children:[(0,r.jsx)(f.default,{title:"Canais",subtitle:"Selecione os possíveis canais para registro do ponto.",helpTemplate:'<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner canais-tooltip-inner"></div></div>',help:"<p><strong>Aplicativo Móvel</strong><br/>Os membros da equipe devem utilizar o aplicativo oficial MetaHuman para iOS ou Android para registrar seus pontos. O registro de entrada e saída não é permitido por navegador móvel.</p>\n<p><strong>Navegador Web</strong><br/>Os membros podem acessar a plataforma MetaHuman através de navegadores em dispositivos autorizados para registrar o ponto, utilizando o ambiente web da empresa.</p>\n<p><strong>Link ou QR Code Gerado</strong><br/>Os membros poderão registrar o ponto utilizando um link ou QR Code disponibilizado pela empresa. O link pode ser configurado como fixo ou temporário e o acesso pode exigir login para validação de identidade.</p>\n<p><strong>Print da Tela</strong><br/>Quando o ponto é registrado através do navegador web, pode ser exigida a captura automática de uma imagem (print da tela) no momento do registro.</p>",children:(0,r.jsx)(l.default,{})}),(0,r.jsx)(f.default,{title:"Validação de Ponto",subtitle:"Defina quais validações serão exigidas para registrar o ponto.",help:"<p>Configura os níveis de segurança exigidos para validar o registro de ponto.</p>\n<p>Você pode escolher entre opções pré-configuradas (Essencial, Balanceada, Completa) ou montar uma configuração personalizada</p>",children:(0,r.jsx)(m.default,{})}),(0,r.jsx)(f.default,{title:"Turnos de Trabalho",help:"<p>Configura os diferentes turnos que os colaboradores podem seguir (ex: comercial, noturno, revezamento). Cada turno tem um horário definido de entrada, saída e, opcionalmente, intervalo.</p>\n<p>Fundamental para cruzar com as marcações e identificar atrasos, horas extras ou faltas.</p>",children:(0,r.jsx)(p.default,{})}),N&&(0,r.jsx)(f.default,{title:"Cadastrar Localização",help:"<p>Permite definir endereços autorizados onde o colaborador poderá bater o ponto.</p>\n<p>O sistema usa geolocalização para validar se o registro foi feito dentro do local cadastrado. Exemplo: sede da empresa, filiais, postos de trabalho externos.</p>",right:(0,r.jsx)("button",{type:"button",className:"btn btn-link p-0",onClick:function(){P.mutate(!E)},disabled:P.isPending,title:E?"Ocultar mapas":"Mostrar mapas",style:{fontSize:"1.2rem",color:"#6c757d",transition:"transform 0.3s ease",transform:E?"rotate(90deg)":"rotate(0deg)"},children:P.isPending?(0,r.jsx)("i",{className:"fas fa-spinner fa-spin"}):(0,r.jsx)("i",{className:"fas fa-chevron-right"})}),children:(0,r.jsx)(y.LocationSection,{})}),k&&(0,r.jsx)(f.default,{title:"Cadastrar QR Code/Link",help:"<p>Permite criar QR Codes ou links para facilitar o registro de ponto em locais específicos. Ideal para times em campo, eventos, ou estações fixas.</p>",children:(0,r.jsx)(h.default,{})}),(0,r.jsx)(f.default,{title:"Política de Ponto",help:"<p>O sistema contabiliza o tempo de adiantamento ou atraso apenas após ultrapassado o tempo de tolerância definido.</p><p>Dentro do limite estabelecido, o registro é considerado normal, sem impactar o saldo de horas ou gerar ocorrências automáticas.</p>",children:(0,r.jsx)(u.default,{})}),(0,r.jsx)(f.default,{title:"Limite de Horas no Timesheet",help:"<p>Controla o limite de horas que podem ser registradas no timesheet por dia.</p><p>Quando ativado, o sistema impedirá que os colaboradores registrem mais horas que o limite estabelecido em uma única atividade diária.</p><p>Ideal para controlar horas extras e evitar registros excessivos.</p>",children:(0,r.jsx)(d.default,{})}),(0,r.jsx)(f.default,{title:"Notificações",help:"<p>Configura alertas automáticos enviados para o colaborador.</p>",children:(0,r.jsx)(c.default,{})})]})}},46265(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>l});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23792),n(89572),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(47764),n(23500),n(62953);var r=n(74848);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=a(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==a(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){var t=e.title,n=e.subtitle,a=e.help,o=e.helpTemplate,s=e.right,l=e.children;return(0,r.jsx)("div",{className:"card app-card-surface mt-3",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("h3",{className:"card-title mb-0",children:t}),a&&(0,r.jsx)("span",i(i({className:"text-muted ml-2","data-toggle":"tooltip","data-placement":"auto","data-html":"true",title:a},o?{"data-template":o}:{}),{},{children:(0,r.jsx)("i",{className:"far fa-question-circle"})}))]}),s&&(0,r.jsx)("div",{className:"ml-3",children:s})]}),n&&(0,r.jsx)("div",{className:"text-muted mt-1",children:n})]}),l]})})}},46550(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>i});n(28706),n(2008),n(62062),n(26099);var r=n(74848);function a(e){var t=e.color;return(0,r.jsxs)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("circle",{cx:"9",cy:"5",r:"3",stroke:t,strokeWidth:"1.5",fill:"none"}),(0,r.jsx)("path",{d:"M5 16C5 13.7909 6.79086 12 9 12C11.2091 12 13 13.7909 13 16V19H5V16Z",stroke:t,strokeWidth:"1.5",fill:"none"}),(0,r.jsx)("path",{d:"M15 12L19 12M19 12L17 10M19 12L17 14",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function o(e){var t=e.color;return(0,r.jsxs)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("rect",{x:"3",y:"5",width:"12",height:"10",rx:"1",stroke:t,strokeWidth:"1.5",fill:"none"}),(0,r.jsx)("path",{d:"M6 15L6 17L12 17L12 15",stroke:t,strokeWidth:"1.5",strokeLinecap:"round"}),(0,r.jsx)("path",{d:"M16 10L20 10M20 10L18 8M20 10L18 12",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function i(e){var t=e.rows,n=t.filter(function(e){return!e.muted}).length,i=t.length,s=n/i*100;return(0,r.jsxs)("div",{className:"mobile-timeline",style:{padding:"20px",position:"relative",minHeight:"400px"},children:[(0,r.jsx)("div",{style:{position:"absolute",left:"28px",top:"24px",width:"4px",height:"350px",backgroundColor:"#E5E7EB",borderRadius:"2px",zIndex:1}}),(0,r.jsx)("div",{style:{position:"absolute",left:"28px",top:"24px",width:"4px",height:"".concat(s/100*350,"px"),backgroundColor:"#17A2B8",borderRadius:"2px",zIndex:2,transition:"height 0.3s ease-in-out"}}),t.map(function(e,t){var n=!e.muted,a=24+t*(350/(i-1));return(0,r.jsx)("div",{style:{position:"absolute",left:"24px",top:"".concat(a-6,"px"),width:"12px",height:"12px",borderRadius:"50%",backgroundColor:n?"#17A2B8":"#E5E7EB",zIndex:3}},"bullet-".concat(t))}),t.map(function(e,n){var i=n%2==0,s=e.muted?"#9ca3af":"#5C5D5D",l=n===t.length-1;return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px",marginBottom:l?"0":"60px",position:"relative",paddingLeft:"48px"},children:[(0,r.jsx)("div",{style:{width:"28px",height:"28px",minWidth:"28px",display:"flex",alignItems:"center",justifyContent:"center"},children:i?(0,r.jsx)(a,{color:s}):(0,r.jsx)(o,{color:s})}),(0,r.jsxs)("div",{style:{flex:1,paddingTop:"2px"},children:[(0,r.jsx)("div",{style:{fontSize:"15px",fontWeight:e.muted?400:500,color:e.muted?"#9CA3AF":"#5C5D5D",fontFamily:"Inter",lineHeight:"1.5",marginBottom:"2px"},children:e.label}),!e.muted&&(e.device||e.mode)&&(0,r.jsx)("div",{style:{fontSize:"11px",color:"#9CA3AF",fontFamily:"Inter",fontWeight:400},children:e.device&&e.mode?"".concat(e.device.toLowerCase()," - ").concat(e.mode.toLowerCase()):(e.device||e.mode||"").toLowerCase()})]})]},n)})]})}},47034(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>b});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(25440),n(11392),n(62953),n(76031),n(3296),n(27208),n(48408);var r=n(74848),a=n(33930),o=n(97665),i=n(57097),s=n(34595),l=n(96540),c=n(42415),u=n(76336);function d(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return f(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(f(t={},r,function(){return this}),t),m=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,f(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return l.prototype=c,f(m,"constructor",c),f(c,"constructor",l),l.displayName="GeneratorFunction",f(c,a,"GeneratorFunction"),f(m),f(m,a,"Generator"),f(m,r,function(){return this}),f(m,"toString",function(){return"[object Generator]"}),(d=function(){return{w:o,m:p}})()}function f(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}f=function(e,t,n,r){function o(t,n){f(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},f(e,t,n,r)}function m(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var v=["time-management","qrcodes"];function b(){var e=(0,u.L)(),t=e.canCreate,f=e.canEdit,h=e.canDelete,b=p((0,l.useState)(!1),2),y=b[0],g=b[1],x=p((0,l.useState)(null),2),j=x[0],w=x[1],S=(0,o.jE)(),N=(0,l.useRef)(null),k=(0,l.useRef)(null),C=p((0,l.useState)(0),2),O=C[0],A=C[1],E=(0,a.I)({queryKey:v,queryFn:s.k1}),P=E.data,F=void 0===P?[]:P,T=E.isFetching,D=(0,i.n)({mutationFn:s.uQ,onSuccess:function(){S.invalidateQueries({queryKey:v})}}),_=(0,i.n)({mutationFn:s.SP,onSuccess:function(){S.invalidateQueries({queryKey:v})}}),I=function(){var e,t=(e=d().m(function e(t){var r,a,o,i,s,l,c,u;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!t.url||"qrcode"!==t.type){e.n=7;break}return e.p=1,e.n=2,n.e(583).then(n.t.bind(n,87583,19));case 2:return r=e.v,a=t.url.startsWith("/")?"".concat(window.location.origin).concat(t.url):t.url,e.n=3,r.toDataURL(a,{width:512,margin:2,color:{dark:"#000000",light:"#FFFFFF"},errorCorrectionLevel:"H"});case 3:return o=e.v,e.n=4,fetch(o);case 4:return i=e.v,e.n=5,i.blob();case 5:s=e.v,l=window.URL.createObjectURL(s),(c=document.createElement("a")).href=l,c.download="".concat(t.name||"qrcode",".png"),document.body.appendChild(c),c.click(),setTimeout(function(){document.body.removeChild(c),window.URL.revokeObjectURL(l)},100),e.n=7;break;case 6:e.p=6,u=e.v,console.error("Erro ao baixar QR Code:",u),alert("Erro ao gerar QR Code para download");case 7:return e.a(2)}},e,null,[[1,6]])}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){m(o,r,a,i,s,"next",e)}function s(e){m(o,r,a,i,s,"throw",e)}i(void 0)})});return function(e){return t.apply(this,arguments)}}(),M=(0,l.useMemo)(function(){return 0===F.length},[F]);(0,l.useEffect)(function(){var e=function(){if(N.current&&k.current){var e=N.current.getBoundingClientRect(),t=k.current.getBoundingClientRect();A(t.left-e.left+t.width/2)}};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[F]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("style",{children:"\n .qrcode-list-container { overflow: visible !important; overflow-x: visible !important; overflow-y: visible !important; }\n .qrcode-list-container .card { overflow: visible !important; }\n .qrcode-list-container .card-body { overflow: visible !important; }\n .qrcode-list-container .row { overflow: visible !important; }\n @media (max-width: 768px) {\n .qrcode-actions { position: absolute; top: 10px; right: 10px; }\n }\n "}),(0,r.jsx)("div",{className:"position-relative",children:!M&&(0,r.jsx)("div",{style:{position:"absolute",top:-28,left:O,transform:"translateX(-50%)"},className:"text-muted d-none d-md-block",children:"Status"})}),!M&&(0,r.jsx)("div",{className:"mb-3 qrcode-list-container",ref:N,style:{overflow:"visible"},children:F.map(function(e){var t=function(e){if(!e.temporary)return{label:"Ativo",color:"#28a745"};var t=e.endDate?new Date("".concat(e.endDate,"T").concat(e.endTime||"23:59",":00")):null;return t&&new Date>t?{label:"Encerrado",color:"#dc3545"}:{label:"Ativo",color:"#28a745"}}(e);return(0,r.jsx)("div",{className:"card mb-3",style:{border:"1px solid #e0e0e0",borderRadius:"8px",position:"relative",overflow:"visible"},children:(0,r.jsx)("div",{className:"card-body py-3",style:{overflow:"visible"},children:(0,r.jsxs)("div",{className:"row no-gutters align-items-center",style:{overflow:"visible"},children:[(0,r.jsx)("div",{className:"col-auto pr-2 d-flex align-items-center justify-content-center",style:{width:"40px",height:"40px"},children:(0,r.jsx)("div",{className:"d-flex align-items-center justify-content-center bg-primary-soft rounded",style:{width:"40px",height:"40px"},children:"link"===e.type?(0,r.jsx)("i",{className:"fas fa-link text-primary",style:{fontSize:"1.1rem"}}):(0,r.jsx)("i",{className:"fas fa-qrcode text-primary",style:{fontSize:"1.1rem"}})})}),(0,r.jsx)("div",{className:"col-12 col-md-3 px-2 d-flex",style:{minWidth:0},children:(0,r.jsxs)("div",{className:"d-flex flex-column w-100 my-auto",style:{minWidth:0},children:[(0,r.jsx)("span",{className:"font-weight-bold text-truncate",style:{minWidth:0},children:e.name}),"spaces_control"===e.source&&(0,r.jsxs)("small",{className:"text-info",style:{fontSize:"0.75rem"},children:[(0,r.jsx)("i",{className:"fas fa-building mr-1"}),e.buildingName," - ",e.floorName]})]})}),(0,r.jsx)("div",{className:"col-12 col-md-6 px-2 d-flex",style:{minWidth:0},children:(0,r.jsx)("div",{className:"w-100 my-auto text-muted text-truncate text-center",style:{minWidth:0},children:e.description||("spaces_control"===e.source?"QR Code do Controle de Espaços":"")})}),(0,r.jsx)("div",{ref:k,className:"col-auto px-2 d-flex align-items-center",style:{flexShrink:0},children:(0,r.jsx)("span",{className:"badge",style:{backgroundColor:"#f8f9fa",color:t.color,border:"1px solid ".concat(t.color),padding:"6px 10px"},children:t.label})}),(0,r.jsxs)("div",{className:"col-auto pl-2 dropdown qrcode-actions ml-auto",style:{flexShrink:0,position:"static"},children:[(0,r.jsx)("button",{className:"btn btn-link text-muted p-0","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{fontSize:"1.2rem"},children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v"})}),(0,r.jsxs)("div",{className:"dropdown-menu dropdown-menu-right",children:[f&&"spaces_control"!==e.source&&(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(){return function(e){"spaces_control"!==e.source?(w(e),g(!0)):alert("Este QR Code foi criado no Controle de Espaços. Para editá-lo, acesse o módulo de Controle de Espaços.")}(e)},disabled:D.isPending,children:[(0,r.jsx)("i",{className:"far fa-edit mr-2"}),"Editar"]}),"qrcode"===e.type&&(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(){return I(e)},children:[(0,r.jsx)("i",{className:"fas fa-download mr-2"}),"Baixar QR Code"]}),"link"===e.type&&e.url&&(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(){navigator.clipboard.writeText(e.url),alert("Link copiado!")},children:[(0,r.jsx)("i",{className:"fas fa-copy mr-2"}),"Copiar Link"]}),h&&(0,r.jsxs)("button",{className:"dropdown-item text-danger",onClick:function(){return function(e){if(window.confirm('Tem certeza que deseja excluir "'.concat(e.name,'"?')))if("spaces_control"===e.source&&e.id.startsWith("floor-")){var t=e.id.replace("floor-","");_.mutate(t)}else D.mutate(e.id)}(e)},disabled:D.isPending||_.isPending,children:[(0,r.jsx)("i",{className:"far fa-trash-alt mr-2"}),D.isPending||_.isPending?"Excluindo...":"Excluir"]})]})]})]})})},e.id)})}),t&&(0,r.jsxs)("div",{className:"text-muted d-flex align-items-center",role:"button",onClick:function(){return g(!0)},style:{cursor:"pointer",fontSize:"0.95rem"},children:[(0,r.jsx)("i",{className:"fas fa-plus mr-2"})," Gerar",T&&(0,r.jsx)("i",{className:"fas fa-spinner fa-spin ml-2"})]}),y&&(0,r.jsx)(c.default,{show:y,onClose:function(){g(!1),w(null)},editData:j})]})}},47339(e,t,n){"use strict";n.d(t,{A:()=>s,o:()=>i});n(28706),n(76031);var r={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"},a={success:"fas fa-check-circle",error:"fas fa-exclamation-circle",warning:"fas fa-exclamation-triangle",info:"fas fa-info-circle"};function o(e){var t=e.title,n=e.message,o=e.type,i=e.duration,s=void 0===i?3e3:i,l=document.createElement("div");l.style.cssText="\n position: fixed;\n top: 20px;\n right: 20px;\n min-width: 300px;\n max-width: 500px;\n background: white;\n border-left: 4px solid ".concat(r[o],";\n border-radius: 4px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n padding: 16px 20px;\n z-index: 9999;\n font-family: 'Inter', sans-serif;\n animation: slideInRight 0.3s ease-out;\n "),l.innerHTML='\n <div style="display: flex; align-items: flex-start; gap: 12px;">\n <i class="'.concat(a[o],'" style="color: ').concat(r[o],'; font-size: 20px; margin-top: 2px;"></i>\n <div style="flex: 1;">\n ').concat(t?'<div style="font-weight: 600; font-size: 14px; color: #333; margin-bottom: 4px;">'.concat(t,"</div>"):"",'\n <div style="font-size: 13px; color: #666; line-height: 1.4;">').concat(n,'</div>\n </div>\n <button onclick="this.parentElement.parentElement.remove()" style="\n background: none;\n border: none;\n color: #999;\n font-size: 18px;\n cursor: pointer;\n padding: 0;\n margin-left: 8px;\n line-height: 1;\n ">×</button>\n </div>\n ');var c=document.createElement("style");c.textContent="\n @keyframes slideInRight {\n from {\n transform: translateX(100%);\n opacity: 0;\n }\n to {\n transform: translateX(0);\n opacity: 1;\n }\n }\n @keyframes slideOutRight {\n from {\n transform: translateX(0);\n opacity: 1;\n }\n to {\n transform: translateX(100%);\n opacity: 0;\n }\n }\n ",document.querySelector("style[data-notification-styles]")||(c.setAttribute("data-notification-styles","true"),document.head.appendChild(c)),document.body.appendChild(l),setTimeout(function(){l.style.animation="slideOutRight 0.3s ease-in",setTimeout(function(){l.remove()},300)},s)}var i={success:function(e,t){return o({message:e,type:"success",title:t})},error:function(e,t){return o({message:e,type:"error",title:t})},warning:function(e,t){return o({message:e,type:"warning",title:t})},warn:function(e,t){return o({message:e,type:"warning",title:t})},info:function(e,t){return o({message:e,type:"info",title:t})}};const s=i},48592(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>p});n(52675),n(89463),n(2259),n(50113),n(23418),n(64346),n(23792),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(88195),i=n(14463),s=n(47339),l=n(33384);function c(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return u(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(u(t={},r,function(){return this}),t),m=d.prototype=s.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,u(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return l.prototype=d,u(m,"constructor",d),u(d,"constructor",l),l.displayName="GeneratorFunction",u(d,a,"GeneratorFunction"),u(m),u(m,a,"Generator"),u(m,r,function(){return this}),u(m,"toString",function(){return"[object Generator]"}),(c=function(){return{w:o,m:p}})()}function u(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}u=function(e,t,n,r){function o(t,n){u(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},u(e,t,n,r)}function d(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function p(e){var t=e.activities,n=e.projetos,u=e.atividadesDisponiveis,m=e.currentDate,p=e.workloadHours,h=e.onActivityAdded,v=f((0,a.useState)(!1),2),b=v[0],y=v[1],g=f((0,a.useState)(null),2),x=g[0],j=g[1],w=f((0,a.useState)(null),2),S=w[0],N=w[1],k=f((0,a.useState)(null),2),C=k[0],O=k[1],A=f((0,a.useState)(""),2),E=A[0],P=A[1],F=f((0,a.useState)(""),2),T=F[0],D=F[1],_=f((0,a.useState)(""),2),I=_[0],M=_[1],R=f((0,a.useState)(""),2),z=R[0],L=R[1],q=function(){y(!1),j(null),N(null),O(null),P(""),D(""),M(""),L("")},B=function(){var e,t=(e=c().m(function e(t){var r,a,o,i;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,(0,l.submitActivityFromCard)(t,S,C,E,T,I,z,n,u,m,p);case 1:s.o.success("Atividade adicionada com sucesso!"),q(),h&&h(),e.n=3;break;case 2:e.p=2,i=e.v,console.error("Erro ao adicionar atividade a partir do planejamento:",i),o=(null==i||null===(r=i.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.message)||(null==i||null===(a=i.response)||void 0===a||null===(a=a.data)||void 0===a?void 0:a.error)||"Erro ao adicionar atividade",s.o.error(o);case 3:return e.a(2)}},e,null,[[0,2]])}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){d(o,r,a,i,s,"next",e)}function s(e){d(o,r,a,i,s,"throw",e)}i(void 0)})});return function(e){return t.apply(this,arguments)}}();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"card app-card-surface mt-3",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsx)("h5",{className:"tm-section-title mb-2",children:"Atividades Planejadas"}),(0,r.jsx)(o.A,{columns:[{key:"projeto",label:"Projeto",width:"14%"},{key:"atividade",label:"Atividade",width:"14%"},{key:"inicio",label:"Início",width:"14%",align:"center"},{key:"fim",label:"Fim",width:"14%",align:"center"},{key:"percentDia",label:"% do dia",width:"14%",align:"center"},{key:"duracao",label:"Duração",width:"14%",align:"center"},{key:"acoes",label:"Ações",width:"14%",align:"center"}],data:t,renderRow:function(e){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"ms-table-cell",title:e.projeto,children:e.projeto}),(0,r.jsx)("td",{className:"ms-table-cell",title:e.atividade,children:e.atividade}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.inicio}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.fim}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.percentDia}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.duracao}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:(0,r.jsx)("button",{className:"app-icon-button",onClick:function(){return function(e){var t,r,a,o,i=(0,l.findProjectByName)(e.projeto,n),s=(0,l.findActivityByName)(e.atividade,u);M(e.projeto),L(e.atividade),N(null!==(t=null==i?void 0:i.id)&&void 0!==t?t:null),O(null!==(r=null==s?void 0:s.id)&&void 0!==r?r:null),P(null!==(a=null==i?void 0:i.name)&&void 0!==a?a:""),D(null!==(o=null==s?void 0:s.name)&&void 0!==o?o:"");var c={startTime:e.inicio||"00:00",endTime:e.fim||"00:00",percentage:(0,l.extractPercentage)(e.percentDia),duration:(0,l.parseDurationToMinutes)(e.duracao),comment:""};j(c),y(!0)}(e)},title:"Registrar atividade planejada",children:(0,r.jsx)("i",{className:"fas fa-check ms-table-action-icon","aria-hidden":"true"})})})]})},emptyMessage:"Nenhuma atividade planejada para hoje"})]})}),(0,r.jsx)(i.default,{show:b,onClose:q,onSubmit:B,selectedProject:E||I,selectedActivity:T||z,workloadHours:p,prefilledData:x,allowProjectSelection:!0,projectOptions:n,activityOptions:u,selectedProjectId:S,selectedActivityId:C,suggestedProjectName:I,suggestedActivityName:z,onProjectChange:function(e){var t,r;if(null===e)return N(null),void P("");var a=n.find(function(t){return t.id===e});N(null!==(t=null==a?void 0:a.id)&&void 0!==t?t:null),P(null!==(r=null==a?void 0:a.name)&&void 0!==r?r:"")},onActivityChange:function(e){var t,n;if(null===e)return O(null),void D("");var r=u.find(function(t){return t.id===e});O(null!==(t=null==r?void 0:r.id)&&void 0!==t?t:null),D(null!==(n=null==r?void 0:r.name)&&void 0!==n?n:"")}})]})}},49293(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>y});n(52675),n(89463),n(2259),n(28706),n(50113),n(51629),n(23418),n(64346),n(23792),n(62062),n(72712),n(34782),n(23288),n(62010),n(2892),n(26099),n(58940),n(27495),n(38781),n(47764),n(71761),n(68156),n(23500),n(62953),n(76031);var r=n(74848),a=n(96540),o=n(33930),i=n(88195),s=n(14463),l=n(88821),c=n(39618),u=n(92268),d=n(59261),f=n(75842),m=n(81623),p=n(47339),h=n(96339);function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e){var t=e.projetos,n=e.atividadesDisponiveis,b=e.activities,y=e.currentDate,g=e.workloadHours,x=(e.onActivityEdit,e.onActivityDelete,e.onActivityAction,e.onActivityAdded),j=v((0,a.useState)(""),2),w=j[0],S=j[1],N=v((0,a.useState)(""),2),k=N[0],C=N[1],O=v((0,a.useState)(""),2),A=O[0],E=O[1],P=v((0,a.useState)(!1),2),F=P[0],T=P[1],D=v((0,a.useState)("00:00:00"),2),_=D[0],I=D[1],M=v((0,a.useState)("automatico"),2),R=M[0],z=M[1],L=v((0,a.useState)(!1),2),q=L[0],B=L[1],G=v((0,a.useState)(null),2),H=G[0],W=G[1],U=v((0,a.useState)(null),2),V=U[0],Q=U[1],K=v((0,a.useState)({}),2),$=K[0],J=K[1],Y=v((0,a.useState)({}),2),Z=Y[0],X=Y[1],ee=v((0,a.useState)(null),2),te=ee[0],ne=ee[1],re=v((0,a.useState)(null),2),ae=re[0],oe=re[1],ie=v((0,a.useState)(null),2),se=ie[0],le=ie[1],ce=v((0,a.useState)(!1),2),ue=ce[0],de=ce[1],fe=(0,a.useRef)(null),me=(0,o.I)({queryKey:["time-management","policy"],queryFn:h.Z,staleTime:6e4}).data,pe=(0,a.useMemo)(function(){return b.reduce(function(e,t){var n=t.duracao.match(/(\d+)h?\s*(\d+)?/);return n?e+60*parseInt(n[1]||"0")+parseInt(n[2]||"0"):e},0)},[b]);(0,a.useEffect)(function(){var e={},t={};b.forEach(function(n){e[n.id]=(0,a.createRef)(),t[n.id]=(0,a.createRef)()}),J(e),X(t)},[b]),(0,a.useEffect)(function(){return function(){fe.current&&clearInterval(fe.current)}},[]);var he=function(){return w?!!k||(p.o.warn("Selecione uma atividade primeiro!"),!1):(p.o.warn("Selecione um projeto primeiro!"),!1)},ve=function(){if(he()){T(!0);var e=new Date;oe(e),fe.current=setInterval(function(){var t=(new Date).getTime()-e.getTime(),n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),a=Math.floor(t%6e4/1e3);I("".concat(n.toString().padStart(2,"0"),":").concat(r.toString().padStart(2,"0"),":").concat(a.toString().padStart(2,"0")))},1e3)}},be=function(e){m.Z4.createActivity(e).then(function(){p.o.success("Atividade adicionada com sucesso!"),B(!1),ue&&(I("00:00:00"),oe(null),le(null),de(!1)),x&&x()}).catch(function(e){var t;if(console.error("Erro ao adicionar atividade:",e),422===(null===(t=e.response)||void 0===t?void 0:t.status)){var n,r,a,o=(null===(n=e.response)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.message)||(null===(r=e.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.error)||"Limite de horas diárias excedido",i=null===(a=e.response)||void 0===a||null===(a=a.data)||void 0===a?void 0:a.details;p.o.error(o),i&&console.warn("Detalhes do bloqueio:",i)}else{var s,l,c=(null===(s=e.response)||void 0===s||null===(s=s.data)||void 0===s?void 0:s.message)||(null===(l=e.response)||void 0===l||null===(l=l.data)||void 0===l?void 0:l.error)||"Erro ao adicionar atividade";p.o.error(c)}})},ye=function(e){C(e)},ge=function(e){console.log("Nova atividade:",e)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"card app-card-surface mt-3",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("div",{className:"d-flex justify-content-between align-items-center mb-3 flex-wrap",style:{gap:"8px"},children:[(0,r.jsx)("div",{style:{flex:"1 1 auto",minWidth:0,maxWidth:"100%"},children:(0,r.jsx)(d.default,{selectedProject:w,projetos:t,onProjectChange:function(e){S(e),E("")},selectedActivity:k,selectedTask:A,atividadesDisponiveis:n,onSelectActivity:ye,onSelectTask:E,onAddNewActivity:ge})}),(0,r.jsx)("div",{className:"d-flex align-items-center",style:{gap:"8px",flexShrink:0,flexGrow:0},children:(0,r.jsx)(f.default,{selectedProject:w,selectedActivity:k,onSelectActivity:ye,onAddNewActivity:ge,atividadesDisponiveis:n,counterMode:R,onModeChange:z,onStartCounter:ve,onStopCounter:function(){if(fe.current&&(clearInterval(fe.current),fe.current=null),T(!1),"00:00:00"!==_&&ae){var e=new Date,t=v(_.split(":").map(Number),2),n=60*t[0]+t[1],r=n/(60*g)*100,a=ae.toTimeString().substring(0,5),o=e.toTimeString().substring(0,5);le({startTime:a,endTime:o,percentage:r,duration:n,comment:""}),de(!0),B(!0)}I("00:00:00"),oe(null)},onAddManualTime:function(){he()&&(de(!1),le(null),B(!0))},isCounterRunning:F,counterTime:_})})]}),(0,r.jsx)(i.A,{columns:[{key:"projeto",label:"Projeto",width:"18%"},{key:"atividade",label:"Atividade",width:"18%"},{key:"task",label:"Task",width:"14%"},{key:"inicio",label:"Início",width:"10%"},{key:"fim",label:"Fim",width:"10%"},{key:"percentDia",label:"% do dia",width:"10%"},{key:"duracao",label:"Duração",width:"10%"},{key:"acoes",label:"Ações",width:"10%"}],data:b,renderRow:function(e){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"ms-table-cell",children:e.projeto}),(0,r.jsx)("td",{className:"ms-table-cell",children:e.atividade}),(0,r.jsx)("td",{className:"ms-table-cell",children:e.task||"-"}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.inicio}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.fim}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.percentDia}),(0,r.jsx)("td",{className:"ms-table-cell-center",children:e.duracao}),(0,r.jsxs)("td",{className:"ms-table-cell-center position-relative",children:[(0,r.jsx)("button",{ref:Z[e.id],className:"app-icon-button",onClick:function(){return function(e){S(e.projeto),C(e.atividade),e.task?E(e.task):E(""),ne(e.id)}(e)},title:"Repetir Atividade",children:(0,r.jsx)("img",{src:"/images/icons/Group(3).svg",alt:"Play",className:"ms-table-action-icon"})}),te===e.id&&(0,r.jsx)(u.A,{show:!0,onClose:function(){return ne(null)},position:"bottom",triggerRef:Z[e.id],options:[{label:"Automático",value:"automatico",icon:"fas fa-check",selected:!1},{label:"Manual",value:"manual",icon:"fas fa-check",selected:!1}],onSelect:function(e){return t=e,ne(null),void("automatico"===t?ve():(de(!1),le(null),B(!0)));var t}}),(0,r.jsx)("button",{ref:$[e.id],className:"app-icon-button",onClick:function(){return t=e.id,void W(t);var t},title:"Comentário",children:(0,r.jsx)("img",{src:"/images/icons/Group(4).svg",alt:"Comentário",className:"ms-table-action-icon"})}),H===e.id&&(0,r.jsx)(l.default,{show:!0,onClose:function(){return W(null)},onSave:function(t){return function(e,t){var n={comment:t};m.Z4.updateActivity(e,n).then(function(){p.o.success("Comentário atualizado com sucesso!"),W(null),x&&x()}).catch(function(e){var t,n;console.error("Erro ao atualizar comentário:",e);var r=(null===(t=e.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.message)||(null===(n=e.response)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.error)||"Erro ao atualizar comentário";p.o.error(r)})}(e.id,t)},initialComment:e.comment||"",activityName:e.atividade,triggerRef:$[e.id]}),(0,r.jsx)("button",{className:"app-icon-button",onClick:function(){return function(e){Q({id:e.id,name:e.atividade,project:e.projeto})}(e)},title:"Deletar",children:(0,r.jsx)("img",{src:"/images/icons/Group(5).svg",alt:"Deletar",className:"ms-table-action-icon"})})]})]})},emptyMessage:"Nenhuma atividade registrada hoje"})]})}),(0,r.jsx)(s.default,{show:q,onClose:function(){B(!1),ue&&(I("00:00:00"),oe(null),le(null),de(!1))},onSubmit:function(e){var r=t.find(function(e){return e.name===w});if(r){var a=60*g,o={date:y,project_id:r.id,start_time:e.startTime&&"00:00"!==e.startTime?"".concat(y," ").concat(e.startTime,":00"):void 0,end_time:e.endTime&&"00:00"!==e.endTime?"".concat(y," ").concat(e.endTime,":00"):void 0,percentage:e.percentage||void 0,duration:e.duration||0,comment:e.comment||"",workload_minutes:a};if(A)m.Z4.getProjectTasks(r.id).then(function(e){var t=e.find(function(e){return e.name===A});t&&(o.project_task_id=t.id,o.activity_name_legacy=k),be(o)}).catch(function(e){console.error("Erro ao buscar task:",e),p.o.error("Erro ao buscar task selecionada")});else if(k){var i=n.find(function(e){return e.name===k});i&&(o.activity_template_id=i.id,o.activity_name_legacy=k),be(o)}else p.o.error("Selecione uma tarefa ou atividade!")}else p.o.error("Projeto não encontrado!")},selectedProject:w,selectedActivity:k,selectedTask:A,workloadHours:g,prefilledData:se,isReadOnly:ue,alreadyRegisteredMinutes:pe,dailyLimitHours:null!=me&&me.blockOvertimeTimesheet?null==me?void 0:me.dailyHoursLimit:null}),V&&(0,r.jsx)(c.default,{show:!!V,onClose:function(){return Q(null)},onConfirm:function(){V&&m.Z4.deleteActivity(V.id).then(function(){p.o.success("Atividade excluída com sucesso!"),Q(null),x&&x()}).catch(function(e){var t,n;console.error("Erro ao excluir atividade:",e);var r=(null===(t=e.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.message)||(null===(n=e.response)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.error)||"Erro ao excluir atividade";p.o.error(r)})},activityName:V.name,projectName:V.project})]})}},49299(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>b});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(27495),n(38781),n(47764),n(23500),n(62953);var r=n(74848),a=n(28482),o=n(5614),i=n(69107),s=n(46668),l=n(77984),c=n(23495),u=n(88224);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){p(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function p(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=d(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==d(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return v(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(e){var t=e.teams,n=void 0===t?[]:t;if(0===n.length)return(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"200px",color:"#5C5D5D",fontFamily:"Inter",fontSize:"14px"},children:"Sem dados disponíveis"});var d=Math.max.apply(Math,h(n.map(function(e){return e.total})).concat([20])),f=4*Math.ceil(d/4),p=f/5,v=Array.from({length:6},function(e,t){return Math.round(t*p)}),b=n.map(function(e){var t=e.regular+e.extra;return m(m({},e),{},{background:f-t})});return(0,r.jsxs)("div",{children:[(0,r.jsx)(a.u,{width:"100%",height:200,children:(0,r.jsxs)(u.E,{data:b,layout:"vertical",margin:{top:30,right:60,left:80,bottom:10},barSize:32,children:[(0,r.jsx)(i.d,{strokeDasharray:"3 3",horizontal:!1,stroke:"#E0E0E0"}),(0,r.jsx)(l.W,{type:"number",domain:[0,f],ticks:v,axisLine:!1,tickLine:!1,tick:{fill:"#5C5D5D",fontSize:12,fontFamily:"Inter"},orientation:"top"}),(0,r.jsx)(c.h,{type:"category",dataKey:"name",axisLine:!1,tickLine:!1,tick:{fill:"#5C5D5D",fontSize:12,fontWeight:500,fontFamily:"Inter"},width:70}),(0,r.jsx)(s.yP,{dataKey:"regular",stackId:"team",fill:"#186073",radius:[0,0,0,0],children:(0,r.jsx)(o.Ze,{dataKey:"regular",position:"inside",formatter:function(e){return e>0?"".concat(e,"h"):""},style:{fill:"#FFFFFF",fontSize:11,fontWeight:600,fontFamily:"Inter"}})}),(0,r.jsx)(s.yP,{dataKey:"extra",stackId:"team",fill:"#FF6D6D",radius:[0,0,0,0],children:(0,r.jsx)(o.Ze,{dataKey:"extra",position:"inside",formatter:function(e){return e>0?"".concat(e,"h"):""},style:{fill:"#FFFFFF",fontSize:11,fontWeight:600,fontFamily:"Inter"}})}),(0,r.jsx)(s.yP,{dataKey:"background",stackId:"team",fill:"rgba(214, 219, 237, 0.40)",radius:[0,4,4,0]})]})}),(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-center flex-wrap gap-3 mt-3",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{paddingRight:"12px"},children:[(0,r.jsx)("div",{style:{width:"12px",height:"12px",background:"#186073",borderRadius:"2px",marginRight:"8px"}}),(0,r.jsx)("span",{style:{fontSize:"12px",color:"#5C5D5D",fontFamily:"Inter"},children:"Horas Regulares"})]}),(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{paddingRight:"12px"},children:[(0,r.jsx)("div",{style:{width:"12px",height:"12px",background:"#FF6D6D",borderRadius:"2px",marginRight:"8px"}}),(0,r.jsx)("span",{style:{fontSize:"12px",color:"#5C5D5D",fontFamily:"Inter"},children:"Horas Extras"})]})]})]})}},49791(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>y});n(52675),n(89463),n(2259),n(23418),n(74423),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(26099),n(3362),n(27495),n(38781),n(21699),n(47764),n(71761),n(62953),n(3296),n(27208),n(48408);var r=n(74848),a=n(96540),o=n(94034),i=n(97665),s=new(n(15072).E)({defaultOptions:{queries:{staleTime:0,refetchOnWindowFocus:!1,retry:1},mutations:{retry:0}}}),l=n(76336);function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var d=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,18098))}),f=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,65342))}),m=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,52558))}),p=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,57909))}),h=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,23696))}),v=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,43432))});function b(e,t){var n=location.hash.match(/tab=([a-z-]+)$/i),r=null==n?void 0:n[1];return r?t&&!t.includes(r)?e:r:e}function y(){var e=(0,l.L)(),t=e.canView,n=e.canEdit,u=e.canDelete,y=e.canCreate,g=!0===t,x=n||u||y,j=g?"overview":"bater-ponto",w=(0,a.useMemo)(function(){return b(j)},[j]),S=c((0,a.useState)(w),2),N=S[0],k=S[1];(0,a.useEffect)(function(){var e,t;e=N,(t=new URL(location.href)).hash="tab=".concat(e),history.replaceState(null,"",t.toString())},[N]),(0,a.useEffect)(function(){return document.body.classList.add("tm-page-active"),function(){document.body.classList.remove("tm-page-active")}},[]);var C=(0,a.useMemo)(function(){if(g){var e=[{key:"overview",label:"Visão Geral"},{key:"ponto",label:"Controle de Ponto"},{key:"bater-ponto",label:"Bater Ponto"},{key:"timesheet",label:"Timesheet"},{key:"modo-foco",label:"Modo Foco"}];return x&&e.push({key:"settings",label:"Configurações"}),e}return[{key:"bater-ponto",label:"Bater Ponto"},{key:"timesheet",label:"Timesheet"},{key:"modo-foco",label:"Modo Foco"}]},[g,x]);(0,a.useEffect)(function(){var e=C.map(function(e){return e.key}),t=b(j,e);e.includes(N)||k(t)},[N,j,C]),(0,a.useEffect)(function(){var e=function(){return k(b(j,C.map(function(e){return e.key})))};return window.addEventListener("hashchange",e),function(){return window.removeEventListener("hashchange",e)}},[j,C]);return(0,r.jsx)(i.Ht,{client:s,children:(0,r.jsxs)("section",{className:"zero-padding ".concat(g?"":"page"),style:{position:"relative"},children:[(0,r.jsx)(o.A,{items:C,title:"GESTÃO DE TEMPO",activeKey:N,onChange:function(e){return k(e)}}),(0,r.jsx)("div",{className:g?"tm-shell":"",style:{position:"relative",zIndex:1},children:(0,r.jsx)(a.Suspense,{fallback:(0,r.jsx)("div",{className:"p-3",children:"Carregando…"}),children:function(){switch(N){case"overview":return(0,r.jsx)(p,{});case"ponto":return(0,r.jsx)(h,{});case"settings":return(0,r.jsx)(v,{});case"bater-ponto":return(0,r.jsx)(d,{});case"timesheet":return(0,r.jsx)(f,{});case"modo-foco":return(0,r.jsx)(m,{});default:return g?(0,r.jsx)(p,{}):(0,r.jsx)(d,{})}}()})})]})})}},50418(e,t,n){"use strict";n.d(t,{Qb:()=>d,py:()=>c});n(52675),n(89463),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362);var r=n(71083);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}var l="/time-management/justifications";function c(e){return u.apply(this,arguments)}function u(){return(u=s(a().m(function e(t){var n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.A.post("".concat(l,"/reasons"),t);case 1:return n=e.v,e.a(2,n.data)}},e)}))).apply(this,arguments)}function d(e){return f.apply(this,arguments)}function f(){return(f=s(a().m(function e(t){var n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.A.post("".concat(l,"/licenses"),t);case 1:return n=e.v,e.a(2,n.data)}},e)}))).apply(this,arguments)}},50455(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>o});n(42762);var r=n(74848),a=n(1806);function o(e){var t=e.isOpen,n=e.onClose,o=(e.memberName,e.memberInitials),i=void 0===o?"?":o,s=e.justify;if(!t)return null;var l=s&&""!==s.trim(),c=["#F59E0B","#EF4444","#10B981","#3B82F6","#8B5CF6","#EC4899"],u=c[Math.floor(Math.random()*c.length)];return(0,r.jsx)(a.A,{show:t,onClose:n,title:"Justificativa",size:"md",footer:(0,r.jsx)("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:n,style:{fontFamily:"Inter",fontSize:"14px",paddingLeft:"20px",paddingRight:"20px"},children:"Fechar"}),children:(0,r.jsx)("div",{style:{padding:"24px"},children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("div",{className:"rounded-circle text-white d-flex align-items-center justify-content-center flex-shrink-0",style:{width:40,height:40,backgroundColor:u,fontWeight:700,fontSize:"16px"},children:i}),(0,r.jsx)("div",{className:"ml-3 flex-grow-1",children:l?(0,r.jsx)("p",{className:"mb-0",style:{fontFamily:"Inter",fontSize:"14px",color:"#5C5D5D",lineHeight:"1.6",whiteSpace:"pre-wrap"},children:s}):(0,r.jsx)("p",{className:"mb-0 text-muted",style:{fontFamily:"Inter",fontWeight:500,lineHeight:"100%",letterSpacing:"0%"},children:"Ainda não foi fornecida uma justificativa para esta ocorrência."})})]})})})}},50860(e,t,n){"use strict";n.d(t,{A:()=>c});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23792),n(89572),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(47764),n(23500),n(62953);var r=n(74848),a=n(96540);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){var t=e.title,n=e.subtitle,o=e.right,i=e.children,l=e.className,c=e.style;return(0,a.useEffect)(function(){var e=window;e&&e.$&&"function"==typeof e.$.fn.tooltip&&e.$('[data-toggle="tooltip"]').tooltip({container:"body",html:!0,boundary:"viewport",placement:"auto"})},[]),(0,r.jsxs)("section",{className:"content options-section-project ".concat(null!=l?l:""),style:s(s({},c),{},{position:"relative",zIndex:1}),children:[(t||n||o)&&(0,r.jsxs)("div",{className:"d-flex justify-content-between align-items-start mb-3 mt-3",children:[(0,r.jsxs)("div",{children:[t&&(0,r.jsx)("h4",{className:"meta-title mb-2",children:t}),n&&(0,r.jsx)("p",{className:"meta-subtitle mb-0",children:n})]}),o&&(0,r.jsx)("div",{className:"ms-3",children:o})]}),i]})}},52354(e,t,n){"use strict";n.d(t,{F:()=>r});var r=n(71083).A.create({baseURL:"/",timeout:25e3,withCredentials:!0})},52558(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>O});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(2892),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(97665),i=n(33930),s=n(57097),l=n(34559),c=n(69794),u=n(97839),d=n(26723),f=n(50860),m=(n(94170),n(59904),n(84185),n(40875),n(79432),n(10287),n(3362),n(52354));function p(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return h(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(h(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,h(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,h(d,"constructor",c),h(c,"constructor",l),l.displayName="GeneratorFunction",h(c,a,"GeneratorFunction"),h(d),h(d,a,"Generator"),h(d,r,function(){return this}),h(d,"toString",function(){return"[object Generator]"}),(p=function(){return{w:o,m:f}})()}function h(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}h=function(e,t,n,r){function o(t,n){h(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},h(e,t,n,r)}function v(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function b(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){v(o,r,a,i,s,"next",e)}function s(e){v(o,r,a,i,s,"throw",e)}i(void 0)})}}var y="/api/time/focus-mode";function g(){return x.apply(this,arguments)}function x(){return(x=b(p().m(function e(){var t,n;return p().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,m.F.get(y);case 1:if(t=e.v,(n=t.data)&&0!==Object.keys(n).length){e.n=2;break}return e.a(2,null);case 2:return e.a(2,n)}},e)}))).apply(this,arguments)}function j(e){return w.apply(this,arguments)}function w(){return(w=b(p().m(function e(t){var n,r;return p().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,m.F.put(y,t);case 1:return n=e.v,r=n.data,e.a(2,r)}},e)}))).apply(this,arguments)}var S=n(20826);function N(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return k(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var C=["time-management","focus-mode"];function O(){var e=(0,o.jE)(),t=N(a.useState(!1),2),n=t[0],m=t[1],p=(0,i.I)({queryKey:C,queryFn:g,staleTime:0}),h=p.data,v=(p.isLoading,(0,s.n)({mutationFn:j,onSuccess:function(){return e.invalidateQueries({queryKey:C})}})),b=N(a.useState(""),2),y=b[0],x=b[1],w=N(a.useState(""),2),k=w[0],O=w[1],A=N(a.useState(""),2),E=A[0],P=A[1],F=N(a.useState(""),2),T=F[0],D=F[1],_=N(a.useState(""),2),I=_[0],M=_[1];(0,a.useEffect)(function(){var e,t,n,r,a;h&&(x(null!==(e=h.clock)&&void 0!==e?e:""),O(null!==(t=h.method)&&void 0!==t?t:""),P(null!==(n=h.background)&&void 0!==n?n:""),D(null!==(r=h.workMinutes)&&void 0!==r?r:""),M(null!==(a=h.breakMinutes)&&void 0!==a?a:""))},[h]),(0,a.useEffect)(function(){"pomodoro"===k&&(D(25),M(5)),"regra_52_17"===k&&(D(52),M(17))},[k]);var R="personalizado"===k,z=!(!y||!k||!E||R&&(!T||!I));return(0,r.jsx)("div",{style:{maxWidth:"1400px",margin:"0 auto"},children:(0,r.jsxs)(f.A,{children:[(0,r.jsxs)("div",{className:"card app-card-surface",children:[(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"tm-label d-block mb-1",children:"Tipo de Relógio"}),(0,r.jsx)(l.A,{className:"w-100",options:[{label:"Digital",value:"digital"}],placeholder:"Selecione o tipo de relógio",size:"md",value:y||void 0,onChange:function(e){return x(e)}})]}),(0,r.jsxs)("div",{className:"form-group mt-3",children:[(0,r.jsx)("label",{className:"tm-label d-block mb-1",children:"Métodos de Foco"}),(0,r.jsx)(l.A,{className:"w-100",options:[{label:"Pomodoro (25/5)",value:"pomodoro"},{label:"Regra 52/17",value:"regra_52_17"},{label:"Personalizado",value:"personalizado"}],placeholder:"Selecione o modo que melhor funciona para você",size:"md",value:k||void 0,onChange:function(e){return O(e)}})]}),R&&(0,r.jsxs)("div",{className:"row mt-3",children:[(0,r.jsxs)("div",{className:"col-md-6",children:[(0,r.jsx)("label",{className:"tm-label d-block mb-1",children:"Minutos de foco"}),(0,r.jsx)("input",{type:"number",className:"form-control",placeholder:"Ex.: 30"})]}),(0,r.jsxs)("div",{className:"col-md-6 mt-3 mt-md-0",children:[(0,r.jsx)("label",{className:"tm-label d-block mb-1",children:"Minutos de descanso"}),(0,r.jsx)("input",{type:"number",className:"form-control",placeholder:"Ex.: 5"})]})]}),(0,r.jsx)("div",{className:"mt-4",children:(0,r.jsx)(u.default,{method:k||""})}),(0,r.jsxs)("div",{className:"mt-4",children:[(0,r.jsx)("label",{className:"tm-label d-block mb-2",children:"Escolha o Plano de Fundo"}),(0,r.jsx)(c.default,{selected:E||"",onSelect:function(e){return P(e)}})]})]}),(0,r.jsxs)("div",{className:"card-footer d-flex justify-content-end gap-2",children:[(0,r.jsx)("button",{className:"btn tm-btn-cancel mr-2",disabled:!z,onClick:function(){return m(!0)},children:"Iniciar"}),(0,r.jsx)(S.A,{label:"Salvar Alterações",variant:"solid",onClick:function(){z&&v.mutate({clock:y,method:k,background:E,workMinutes:""===T?null:Number(T),breakMinutes:""===I?null:Number(I)})},className:"px-3 py-1",style:{height:"38px",paddingLeft:"12px",paddingRight:"12px",paddingTop:"6px",paddingBottom:"6px"}})]})]}),(0,r.jsx)(d.default,{open:n,onClose:function(){return m(!1)},clock:y||"digital",background:E||"black",workMinutes:Number(T||25),breakMinutes:Number(I||5)})]})})}},52798(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>m});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(58940),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(33930),o=n(97665),i=n(57097),s=n(96339),l=n(96540),c=n(76336);function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var f=["time-management","policy"];function m(){var e=(0,c.L)().canEdit,t=(0,o.jE)(),n=u((0,l.useState)(!1),2),d=n[0],m=n[1],p=u((0,l.useState)(!1),2),h=p[0],v=p[1],b=u((0,l.useState)(!1),2),y=b[0],g=b[1],x=u((0,l.useState)(!1),2),j=x[0],w=x[1],S=u((0,l.useState)(5),2),N=S[0],k=S[1],C=u((0,l.useState)(10),2),O=C[0],A=C[1],E=u((0,l.useState)(2),2),P=E[0],F=E[1],T=(0,a.I)({queryKey:f,queryFn:s.Z}),D=T.data;T.isFetching;(0,l.useEffect)(function(){D&&(m(D.enableAdvanceTolerance),v(D.enableDelayTolerance),g(D.enableDistanceTolerance),w(D.editPoint),k(D.advanceTolerance||5),A(D.delayTolerance||10),F(D.distanceTolerance||2))},[D]);var _=(0,i.n)({mutationFn:function(e){return(0,s.E)(e)},onSuccess:function(){t.invalidateQueries({queryKey:f})}}),I=function(){D&&_.mutate({enableAdvanceTolerance:d,enableDelayTolerance:h,enableDistanceTolerance:y,editPoint:j,advanceTolerance:d?N:0,delayTolerance:h?O:0,distanceTolerance:y?P:0})};return(0,l.useEffect)(function(){D&&I()},[d,h,y,j]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-12 col-md-6 col-xl-3 mb-3",children:(0,r.jsx)("div",{className:"card h-100 tm-card-mobile-auto ".concat(d?"border-primary bg-primary-soft":""),style:{border:"1px solid #e0e0e0",borderRadius:"8px"},children:(0,r.jsxs)("div",{className:"card-body d-flex flex-column",children:[(0,r.jsxs)("div",{className:"custom-control custom-checkbox mb-2",children:[(0,r.jsx)("input",{type:"checkbox",id:"pol-adiant",className:"custom-control-input",checked:d,onChange:function(e){return m(e.target.checked)},disabled:!e}),(0,r.jsxs)("label",{className:"custom-control-label ".concat(d?"text-primary":""),htmlFor:"pol-adiant",children:["Tolerância para adiantamento de",!e&&(0,r.jsx)("i",{className:"fas fa-lock ml-2 text-muted",style:{fontSize:"0.7rem"}})]})]}),(0,r.jsx)("small",{className:"text-muted d-block mb-2",style:{fontSize:"0.85rem"},children:"Define quantos minutos antes do horário previsto o colaborador pode bater o ponto sem ser considerado antecipado."}),(0,r.jsxs)("div",{className:"input-group mt-auto",children:[(0,r.jsx)("input",{type:"number",className:"form-control",value:N,onChange:function(e){return k(parseInt(e.target.value)||0)},onBlur:I,disabled:!d||!e,min:"0"}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("span",{className:"input-group-text",children:"min"})})]})]})})}),(0,r.jsx)("div",{className:"col-12 col-md-6 col-xl-3 mb-3",children:(0,r.jsx)("div",{className:"card h-100 tm-card-mobile-auto ".concat(h?"border-primary bg-primary-soft":""),style:{border:"1px solid #e0e0e0",borderRadius:"8px"},children:(0,r.jsxs)("div",{className:"card-body d-flex flex-column",children:[(0,r.jsxs)("div",{className:"custom-control custom-checkbox mb-2",children:[(0,r.jsx)("input",{type:"checkbox",id:"pol-atraso",className:"custom-control-input",checked:h,onChange:function(e){return v(e.target.checked)},disabled:!e}),(0,r.jsxs)("label",{className:"custom-control-label ".concat(h?"text-primary":""),htmlFor:"pol-atraso",children:["Tolerância para atraso de",!e&&(0,r.jsx)("i",{className:"fas fa-lock ml-2 text-muted",style:{fontSize:"0.7rem"}})]})]}),(0,r.jsx)("small",{className:"text-muted d-block mb-2",style:{fontSize:"0.85rem"},children:"Define quantos minutos após o horário previsto o colaborador pode bater o ponto sem ser considerado em atraso."}),(0,r.jsxs)("div",{className:"input-group mt-auto",children:[(0,r.jsx)("input",{type:"number",className:"form-control",value:O,onChange:function(e){return A(parseInt(e.target.value)||0)},onBlur:I,disabled:!h||!e,min:"0"}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("span",{className:"input-group-text",children:"min"})})]})]})})}),(0,r.jsx)("div",{className:"col-12 col-md-6 col-xl-3 mb-3",children:(0,r.jsx)("div",{className:"card h-100 tm-card-mobile-auto ".concat(y?"border-primary bg-primary-soft":""),style:{border:"1px solid #e0e0e0",borderRadius:"8px"},children:(0,r.jsxs)("div",{className:"card-body d-flex flex-column",children:[(0,r.jsxs)("div",{className:"custom-control custom-checkbox mb-2",children:[(0,r.jsx)("input",{type:"checkbox",id:"pol-dist",className:"custom-control-input",checked:y,onChange:function(e){return g(e.target.checked)},disabled:!e}),(0,r.jsxs)("label",{className:"custom-control-label ".concat(y?"text-primary":""),htmlFor:"pol-dist",children:["Tolerância para distância de",!e&&(0,r.jsx)("i",{className:"fas fa-lock ml-2 text-muted",style:{fontSize:"0.7rem"}})]})]}),(0,r.jsx)("small",{className:"text-muted d-block mb-2",style:{fontSize:"0.85rem"},children:"Define o raio de distância permitido em torno do local cadastrado para validar o ponto por geolocalização."}),(0,r.jsxs)("div",{className:"input-group mt-auto",children:[(0,r.jsx)("input",{type:"number",className:"form-control",value:P,onChange:function(e){return F(parseInt(e.target.value)||0)},onBlur:I,disabled:!y||!e,min:"0"}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("span",{className:"input-group-text",children:"km"})})]})]})})}),(0,r.jsx)("div",{className:"col-12 col-md-6 col-xl-3 mb-3",children:(0,r.jsx)("div",{className:"card h-100 tm-card-mobile-auto ".concat(j?"border-primary bg-primary-soft":""),style:{border:"1px solid #e0e0e0",borderRadius:"8px"},children:(0,r.jsxs)("div",{className:"card-body d-flex flex-column",children:[(0,r.jsxs)("div",{className:"custom-control custom-checkbox mb-2",children:[(0,r.jsx)("input",{type:"checkbox",id:"pol-edicao",className:"custom-control-input",checked:j,onChange:function(e){return w(e.target.checked)},disabled:!e}),(0,r.jsxs)("label",{className:"custom-control-label ".concat(j?"text-primary":""),htmlFor:"pol-edicao",children:["Edição de Ponto",!e&&(0,r.jsx)("i",{className:"fas fa-lock ml-2 text-muted",style:{fontSize:"0.7rem"}})]})]}),(0,r.jsx)("small",{className:"text-muted",style:{fontSize:"0.85rem"},children:"O membro poderá editar seu ponto caso ocorra alguma ocorrência leve."})]})})})]}),_.isPending&&(0,r.jsxs)("div",{className:"text-muted mt-2",children:[(0,r.jsx)("i",{className:"fas fa-spinner fa-spin mr-2"}),"Salvando..."]})]})}},54958(e,t,n){"use strict";var r=n(3066);n(28706),n(51629),n(23792),n(48598),n(62062),n(79432),n(26099),n(27495),n(25440),n(23500),n(62953);var a,o,i;(0,r.E)(n(86628));a=n(97677),i={},(o=a).keys().forEach(function(e){return i[e]=o(e).default}),window.resolveReactComponent=function(e){var t=i["./".concat(e,".jsx")]||i["./".concat(e,".tsx")];if(void 0===t){var n=Object.keys(i).map(function(e){return e.replace("./","").replace(".jsx","").replace(".tsx","")});throw new Error('React controller "'.concat(e,'" does not exist. Possible values: ').concat(n.join(", ")))}return t},console.log("Symfony UX React bootstrap (TS) loaded"),console.log("React UX app.js loaded successfully")},55098(e,t,n){"use strict";n.d(t,{KI:()=>u,Te:()=>v,WS:()=>f,iM:()=>l,rI:()=>p});n(52675),n(89463),n(28706),n(51629),n(23792),n(34782),n(1688),n(23288),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(38781),n(47764),n(23500),n(62953),n(3296),n(27208),n(48408);var r=n(69404);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}function l(e){return c.apply(this,arguments)}function c(){return(c=s(a().m(function e(t){var n,o,i,s;return a().w(function(e){for(;;)switch(e.n){case 0:return n=new URLSearchParams,null!=t&&t.start_date&&n.append("start_date",t.start_date),null!=t&&t.end_date&&n.append("end_date",t.end_date),null!=t&&t.types&&t.types.length>0&&t.types.forEach(function(e){n.append("types[]",e)}),null!=t&&t.time_start&&n.append("time_start",t.time_start),null!=t&&t.time_end&&n.append("time_end",t.time_end),null!=t&&t.status&&n.append("status",t.status),null!=t&&t.role&&n.append("role",t.role),null!=t&&t.keyword&&n.append("keyword",t.keyword),null!=t&&t.page&&t.page>0&&n.append("page",t.page.toString()),null!=t&&t.limit&&t.limit>0&&n.append("limit",t.limit.toString()),o=n.toString(),i="/time-management/members-occurrences".concat(o?"?".concat(o):""),e.n=1,r.u.get(i);case 1:return s=e.v,e.a(2,s.data)}},e)}))).apply(this,arguments)}function u(e,t){return d.apply(this,arguments)}function d(){return(d=s(a().m(function e(t,n){var o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.u.post("/time-management/occurrence/approve?id=".concat(t,"&approved=").concat(n));case 1:return o=e.v,e.a(2,o.data)}},e)}))).apply(this,arguments)}function f(){return m.apply(this,arguments)}function m(){return m=s(a().m(function e(){var t,n,o,i,s,l,c,u=arguments;return a().w(function(e){for(;;)switch(e.n){case 0:return t=u.length>0&&void 0!==u[0]?u[0]:1,n=u.length>1&&void 0!==u[1]?u[1]:10,o=u.length>2?u[2]:void 0,(i=new URLSearchParams).append("page",t.toString()),i.append("limit",n.toString()),null!=o&&o.start_date&&i.append("start_date",o.start_date),null!=o&&o.end_date&&i.append("end_date",o.end_date),null!=o&&o.recordType&&i.append("record_type",o.recordType),null!=o&&o.validatedBy&&i.append("validated_by",o.validatedBy),null!=o&&o.channel&&i.append("channel",o.channel),null!=o&&o.mode&&i.append("mode",o.mode),null!=o&&o.keyword&&i.append("keyword",o.keyword),s=i.toString(),l="/time-management/clock-in-history?".concat(s),e.n=1,r.u.get(l);case 1:return c=e.v,e.a(2,c.data)}},e)})),m.apply(this,arguments)}function p(e){return h.apply(this,arguments)}function h(){return(h=s(a().m(function e(t){var n,o,i,s,l,c,u,d;return a().w(function(e){for(;;)switch(e.n){case 0:return n=new URLSearchParams,null!=t&&t.start_date&&n.append("start_date",t.start_date),null!=t&&t.end_date&&n.append("end_date",t.end_date),null!=t&&t.recordType&&n.append("record_type",t.recordType),null!=t&&t.validatedBy&&n.append("validated_by",t.validatedBy),null!=t&&t.channel&&n.append("channel",t.channel),null!=t&&t.mode&&n.append("mode",t.mode),null!=t&&t.keyword&&n.append("keyword",t.keyword),o=n.toString(),i="/time-management/clock-in-history/export".concat(o?"?".concat(o):""),e.n=1,r.u.get(i,{responseType:"blob"});case 1:s=e.v,l=new Blob([s.data],{type:"text/csv"}),c=window.URL.createObjectURL(l),(u=document.createElement("a")).href=c,d=(new Date).toISOString().slice(0,10),u.download="historico-pontos-".concat(d,".csv"),document.body.appendChild(u),u.click(),document.body.removeChild(u),window.URL.revokeObjectURL(c);case 2:return e.a(2)}},e)}))).apply(this,arguments)}function v(e){return b.apply(this,arguments)}function b(){return(b=s(a().m(function e(t){var n,o,i,s;return a().w(function(e){for(;;)switch(e.n){case 0:return n=new URLSearchParams,t&&n.append("date",t),o=n.toString(),i="/time-management/daily-statistics".concat(o?"?".concat(o):""),e.n=1,r.u.get(i);case 1:return s=e.v,e.a(2,s.data)}},e)}))).apply(this,arguments)}},55278(e,t,n){"use strict";n.d(t,{Eq:()=>f,Nt:()=>v,vD:()=>l,xD:()=>u,yJ:()=>p,zR:()=>y});n(52675),n(89463),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362);var r=n(52354);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}function l(){return c.apply(this,arguments)}function c(){return(c=s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/can-view-maps");case 1:return t=e.v,n=t.data,e.a(2,n.can_view_maps)}},e)}))).apply(this,arguments)}function u(e){return d.apply(this,arguments)}function d(){return(d=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.put("/time-management/can-view-maps",{can_view_maps:t});case 1:return n=e.v,o=n.data,e.a(2,o.can_view_maps)}},e)}))).apply(this,arguments)}function f(){return m.apply(this,arguments)}function m(){return(m=s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/location");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function p(e){return h.apply(this,arguments)}function h(){return(h=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.post("/time-management/location",t);case 1:return n=e.v,o=n.data,e.a(2,o.data)}},e)}))).apply(this,arguments)}function v(e,t){return b.apply(this,arguments)}function b(){return(b=s(a().m(function e(t,n){var o,i;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.put("/time-management/location/".concat(t),n);case 1:return o=e.v,i=o.data,e.a(2,i.data)}},e)}))).apply(this,arguments)}function y(e){return g.apply(this,arguments)}function g(){return(g=s(a().m(function e(t){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.delete("/time-management/location/".concat(t));case 1:return e.a(2)}},e)}))).apply(this,arguments)}},55801(e,t,n){"use strict";n.d(t,{G8:()=>l,Tt:()=>f,iY:()=>u,kc:()=>p});n(52675),n(89463),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362);var r=n(52354);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}function l(){return c.apply(this,arguments)}function c(){return(c=s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/validation");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function u(e){return d.apply(this,arguments)}function d(){return(d=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.post("/time-management/validation",{mode:t});case 1:return n=e.v,o=n.data,e.a(2,o.data)}},e)}))).apply(this,arguments)}function f(e){return m.apply(this,arguments)}function m(){return(m=s(a().m(function e(t){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.post("/time-management/validation/others",{type:t});case 1:return e.a(2)}},e)}))).apply(this,arguments)}function p(e){return h.apply(this,arguments)}function h(){return(h=s(a().m(function e(t){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.delete("/time-management/validation/others/".concat(t));case 1:return e.a(2)}},e)}))).apply(this,arguments)}},57909(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>O});n(52675),n(89463),n(2259),n(28706),n(2008),n(50113),n(78350),n(23418),n(64346),n(23792),n(62062),n(34782),n(30237),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(68156),n(42762),n(62953);var r=n(74848),a=n(96540),o=n(49785),i=n(33930),s=n(10280),l=n(84136),c=n(55098),u=n(69404);function d(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return f(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(f(t={},r,function(){return this}),t),m=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,f(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return l.prototype=c,f(m,"constructor",c),f(c,"constructor",l),l.displayName="GeneratorFunction",f(c,a,"GeneratorFunction"),f(m),f(m,a,"Generator"),f(m,r,function(){return this}),f(m,"toString",function(){return"[object Generator]"}),(d=function(){return{w:o,m:p}})()}function f(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}f=function(e,t,n,r){function o(t,n){f(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},f(e,t,n,r)}function m(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function p(){return h.apply(this,arguments)}function h(){var e;return e=d().m(function e(){var t,n;return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,u.u.get("/time-management/members/roles");case 1:return t=e.v,n=Array.isArray(t.data)?t.data:t.data.data||[],e.a(2,n)}},e)}),h=function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){m(o,r,a,i,s,"next",e)}function s(e){m(o,r,a,i,s,"throw",e)}i(void 0)})},h.apply(this,arguments)}n(76031);function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=v((0,a.useState)(e),2),r=n[0],o=n[1];return(0,a.useEffect)(function(){var n=setTimeout(function(){o(e)},t);return function(){clearTimeout(n)}},[e,t]),r}var g=n(72210),x=n(73215),j=n(50860);function w(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return S(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(S(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,S(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,S(d,"constructor",c),S(c,"constructor",l),l.displayName="GeneratorFunction",S(c,a,"GeneratorFunction"),S(d),S(d,a,"Generator"),S(d,r,function(){return this}),S(d,"toString",function(){return"[object Generator]"}),(w=function(){return{w:o,m:f}})()}function S(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}S=function(e,t,n,r){function o(t,n){S(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},S(e,t,n,r)}function N(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return C(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function O(){var e,t,n,u,d,f,m,h,v,b,S,C,O,A,E,P=(0,o.mN)({defaultValues:{selectedDate:(C=new Date,O=C.getFullYear(),A=String(C.getMonth()+1).padStart(2,"0"),E=String(C.getDate()).padStart(2,"0"),"".concat(O,"-").concat(A,"-").concat(E)),occurrencePage:1,occurrencePageSize:10,historyPage:1,historyPageSize:10,searchKeyword:"",selectedRole:"",roleString:"",occurrenceType:"",timeStart:"",timeEnd:"",status:"",historyRecordType:"",historyValidatedBy:"",historyChannel:"",historyMode:"",historySearchKeyword:""}}),F=P.watch,T=P.setValue,D=k((0,a.useState)(!1),2),_=(D[0],D[1],k((0,a.useState)(!1),2)),I=_[0],M=_[1],R=F("selectedDate"),z=F("occurrencePage"),L=F("occurrencePageSize"),q=F("historyPage"),B=F("historyPageSize"),G=F("searchKeyword"),H=F("selectedRole"),W=F("roleString"),U=F("occurrenceType"),V=F("timeStart"),Q=F("timeEnd"),K=F("status"),$=F("historyRecordType"),J=F("historyValidatedBy"),Y=F("historyChannel"),Z=F("historyMode"),X=F("historySearchKeyword"),ee=y(G,500),te=y(X,500),ne=(0,a.useMemo)(function(){var e={};return R&&(e.start_date=R,e.end_date=R),U&&(e.types=[U]),V&&(e.time_start=V),Q&&(e.time_end=Q),K&&(e.status=K),W&&(e.role=W),ee&&(e.keyword=ee),e.page=z,e.limit=L,e},[R,U,V,Q,K,W,ee,z,L]),re=(0,i.I)({queryKey:["time-management","overview","members-occurrences",ne],queryFn:function(){return(0,c.iM)(ne)},staleTime:6e4,refetchInterval:6e4}),ae=re.data,oe=re.isLoading,ie=(0,i.I)({queryKey:["time-management","member-roles"],queryFn:p,staleTime:3e5}),se=ie.data,le=ie.isLoading,ce=(0,i.I)({queryKey:["time-management","overview","kpis",R],queryFn:function(){return(0,c.Te)(R)},staleTime:3e4,refetchInterval:3e4}),ue=ce.data,de=ce.isLoading,fe=(0,a.useMemo)(function(){var e={page:q,limit:B};return R&&(e.start_date=R,e.end_date=R),$&&(e.recordType=$),J&&(e.validatedBy=J),Y&&(e.channel=Y),Z&&(e.mode=Z),te&&(e.keyword=te),e},[R,q,B,$,J,Y,Z,te]),me=(0,i.I)({queryKey:["time-management","overview","clock-in-history",fe],queryFn:function(){return(0,c.WS)(q,B,fe)},staleTime:6e4,refetchInterval:6e4}),pe=me.data,he=(me.isLoading,(0,a.useMemo)(function(){var e;return null!==(e=null==ae?void 0:ae.data.flatMap(function(e){return e.occurrences.map(function(t){var n="".concat(e.member.firstName," ").concat(e.member.lastName).trim(),r=t.hitSpotTime.time?t.hitSpotTime.time.substring(0,5):"-",a=l.L[t.type]||t.type;return{id:t.id,nome:n,iniciais:void 0,avatarBg:void 0,ocorrencia:a,horario:r,status:(0,l.j)(t.severity),justify:t.justify||null}})}))&&void 0!==e?e:[]},[ae])),ve=(0,a.useMemo)(function(){if(console.log("🔍 rolesData recebida:",se),console.log("🔍 É array?",Array.isArray(se)),!se||!Array.isArray(se))return console.log("⚠️ rolesData não é um array válido"),[];console.log("📊 Roles da API (array):",se);var e=se.filter(function(e){var t=e.role&&""!==e.role.trim();return t||console.log("⚠️ Role inválida filtrada:",e),t}).map(function(e){return{value:e.id,label:e.role}});return console.log("✅ Role options transformadas:",e),e},[se]),be=(0,a.useMemo)(function(){var e;return null!==(e=null==pe?void 0:pe.data.map(function(e){return{id:e.id,nome:e.memberName,data:e.time,tipo:e.recordType,validacao:e.validatedBy,canal:e.channel,modo:e.mode,memberId:e.memberId,type:e.type,status:e.status,latitude:e.latitude,longitude:e.longitude,selfie:e.selfie,print:e.print,createdAt:e.createdAt,updatedAt:e.updatedAt,justificationType:e.justificationType,justificationId:e.justificationId,justification:e.justification}}))&&void 0!==e?e:[]},[pe]),ye=function(){var e,t=(e=w().m(function e(){var t,n;return w().w(function(e){for(;;)switch(e.p=e.n){case 0:return M(!0),e.p=1,t={},$&&(t.recordType=$),J&&(t.validatedBy=J),Y&&(t.channel=Y),Z&&(t.mode=Z),te&&(t.keyword=te),e.n=2,(0,c.rI)(t);case 2:e.n=4;break;case 3:e.p=3,n=e.v,console.error("Erro ao exportar CSV:",n),alert("Erro ao exportar arquivo CSV");case 4:return e.p=4,M(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){N(o,r,a,i,s,"next",e)}function s(e){N(o,r,a,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}(),ge=function(e){var t=new Date(R+"T00:00:00");t.setDate(t.getDate()+e);var n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");T("selectedDate","".concat(n,"-").concat(r,"-").concat(a)),T("occurrencePage",1),T("historyPage",1)};return(0,r.jsxs)(j.A,{children:[(0,r.jsx)("div",{className:"mb-3",style:{display:"flex",justifyContent:"flex-end",alignItems:"center",marginTop:"16px"},children:(0,r.jsxs)("div",{style:{position:"relative",display:"inline-block"},children:[(0,r.jsx)("input",{ref:function(e){if(e){var t=e.nextElementSibling,n=null==t?void 0:t.querySelector(".tm-date-trigger");n&&!n.onclick&&(n.onclick=function(){e.showPicker?e.showPicker():e.click()})}},type:"date",value:R,onChange:function(e){T("selectedDate",e.target.value),T("occurrencePage",1),T("historyPage",1)},style:{position:"absolute",opacity:0,width:"100%",height:"100%",cursor:"pointer",zIndex:-1,pointerEvents:"none"}}),(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{gap:8},children:[(0,r.jsx)("button",{type:"button",className:"btn btn-link text-muted p-1",onClick:function(e){e.stopPropagation(),ge(-1)},"aria-label":"Dia anterior",children:(0,r.jsx)("i",{className:"fas fa-chevron-left"})}),(0,r.jsx)("div",{className:"tm-date-trigger",style:{fontFamily:"Inter, sans-serif",fontSize:"14px",fontWeight:400,color:"#186073",userSelect:"none"},children:function(e){if(!e)return"";var t=new Date(e+"T00:00:00"),n=["Dom.","Seg.","Ter.","Qua.","Qui.","Sex.","Sáb."][t.getDay()],r=t.getDate(),a=["Jan.","Fev.","Mar.","Abr.","Mai.","Jun.","Jul.","Ago.","Set.","Out.","Nov.","Dez."][t.getMonth()],o=t.getFullYear();return"".concat(n," ").concat(r," de ").concat(a," ").concat(o)}(R)}),(0,r.jsx)("button",{type:"button",className:"btn btn-link text-muted p-1",onClick:function(e){e.stopPropagation(),ge(1)},"aria-label":"Próximo dia",children:(0,r.jsx)("i",{className:"fas fa-chevron-right"})})]})]})}),(0,r.jsx)("div",{className:"mt-3",children:(0,r.jsxs)("div",{className:"row justify-content-start align-items-stretch",children:[(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg mb-2",children:(0,r.jsx)(s.A,{value:de?"...":null!==(e=null==ue?void 0:ue.working)&&void 0!==e?e:0,label:"Membros trabalhando",variant:"green",className:"rounded-lg elevation-1 h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg mb-2",children:(0,r.jsx)(s.A,{value:de?"...":null!==(t=null==ue?void 0:ue.onBreak)&&void 0!==t?t:0,label:"Membros em pausa",variant:"blue",className:"rounded-lg elevation-1 h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg mb-2",children:(0,r.jsx)(s.A,{value:de?"...":null!==(n=null==ue?void 0:ue.absences)&&void 0!==n?n:0,label:"Ausência no dia",variant:"red",className:"rounded-lg elevation-1 h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg mb-2",children:(0,r.jsx)(s.A,{value:de?"...":null!==(u=null==ue?void 0:ue.onLicense)&&void 0!==u?u:0,label:"Membros em licença",variant:"white",className:"rounded-lg elevation-1 h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg mb-2",children:(0,r.jsx)(s.A,{value:de?"...":null!==(d=null==ue?void 0:ue.pendingOccurrences)&&void 0!==d?d:0,label:"Ocorrências pendentes",variant:"gray",className:"rounded-lg elevation-1 h-100"})})]})}),(0,r.jsx)(g.default,{data:he,title:"Ocorrências",searchKeyword:G,onSearchChange:function(e){return T("searchKeyword",e)},roleOptions:ve,selectedRole:H,onRoleChange:function(e){console.log("Função selecionada (ID):",e),T("selectedRole",e);var t=null==se?void 0:se.find(function(t){return t.id===e}),n=(null==t?void 0:t.role)||"";console.log("Role string para backend:",n),T("roleString",n)},isLoading:oe,isLoadingRoles:le,onApplyFilters:function(e){T("occurrenceType",e.occurrenceType),T("timeStart",e.timeStart),T("timeEnd",e.timeEnd),T("status",e.status),T("occurrencePage",1)},onClearFilters:function(){T("occurrenceType",""),T("timeStart",""),T("timeEnd",""),T("status",""),T("occurrencePage",1)},hasActiveFilters:""!==U||""!==V||""!==Q||""!==K,total:null!==(f=null==ae||null===(m=ae.pagination)||void 0===m?void 0:m.total)&&void 0!==f?f:0,totalPages:null==ae||null===(h=ae.pagination)||void 0===h?void 0:h.totalPages,page:z,pageSize:L,onPageChange:function(e){return T("occurrencePage",e)},onPageSizeChange:function(e){return T("occurrencePageSize",e)}}),(0,r.jsx)(x.default,{data:be,total:null!==(v=null==pe||null===(b=pe.pagination)||void 0===b?void 0:b.total)&&void 0!==v?v:0,totalPages:null==pe||null===(S=pe.pagination)||void 0===S?void 0:S.total_pages,page:q,pageSize:B,onPageChange:function(e){return T("historyPage",e)},onPageSizeChange:function(e){return T("historyPageSize",e)},hasActiveFilters:""!==$||""!==J||""!==Y||""!==Z,searchKeyword:X,onSearchChange:function(e){return T("historySearchKeyword",e)},onExportCSV:ye,isExporting:I,onApplyFilters:function(e){T("historyRecordType",e.recordType),T("historyValidatedBy",e.validatedBy),T("historyChannel",e.channel),T("historyMode",e.mode),T("historyPage",1)},onClearFilters:function(){T("historyRecordType",""),T("historyValidatedBy",""),T("historyChannel",""),T("historyMode",""),T("historyPage",1)}})]})}},59261(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>d});n(52675),n(89463),n(2259),n(50113),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(33930),i=n(73638);function s(e){var t=e.show,n=e.onClose,a=e.atividades,o=e.selectedActivity,s=e.onSelectActivity,l=e.onAddNew,c=e.triggerRef,u=e.title,d=void 0===u?"Selecionar Atividade":u,f=e.hideAddNew,m=void 0===f||f,p=e.centered,h=void 0!==p&&p;return(0,r.jsxs)(i.A,{show:t,onClose:n,position:"bottom",width:"220px",triggerRef:c,centered:h,children:[(0,r.jsx)("div",{style:{padding:"10px 15px",fontSize:"13px",color:"#5C5D5D",borderBottom:"2px solid #EAEEF3",fontWeight:600},children:d}),(0,r.jsx)("div",{style:{maxHeight:"250px",overflowY:"auto"},children:a.map(function(e){return(0,r.jsx)("div",{style:{padding:"10px 15px",cursor:"pointer",fontSize:"13px",color:"#5C5D5D",borderBottom:"1px solid #EAEEF3",backgroundColor:o===e.name?"#F3F3F3":"transparent"},onClick:function(){s(e.name),n()},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#F8F9FA"},onMouseLeave:function(t){return t.currentTarget.style.backgroundColor=o===e.name?"#F3F3F3":"transparent"},children:e.name},e.id)})}),!m&&(0,r.jsxs)("div",{style:{padding:"10px 15px",cursor:"pointer",fontSize:"13px",color:"#17A2B8",fontWeight:600,borderTop:"2px solid #EAEEF3"},onClick:function(){var e=prompt("Nome da nova atividade:");e&&l(e)},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#F8F9FA"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="transparent"},children:[(0,r.jsx)("i",{className:"fas fa-plus",style:{marginRight:"8px"}}),"Adicionar Nova"]})]})}var l=n(81623);function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){var t=e.projetos,n=(e.atividadesDisponiveis,e.selectedProject),u=e.selectedActivity,d=e.selectedTask,f=void 0===d?"":d,m=e.onProjectChange,p=e.onSelectActivity,h=e.onSelectTask,v=e.onAddNewActivity,b=(0,a.useRef)(null),y=(0,a.useRef)(null),g=c((0,a.useState)(!1),2),x=g[0],j=g[1],w=c((0,a.useState)(!1),2),S=w[0],N=w[1],k=t.find(function(e){return e.name===n}),C=null==k?void 0:k.id,O=(0,o.I)({queryKey:["timesheet-project-tasks",C],queryFn:function(){return l.Z4.getProjectTasks(C)},enabled:!!C,staleTime:6e4,refetchOnWindowFocus:!1}).data,A=void 0===O?[]:O,E=(0,o.I)({queryKey:["timesheet-activity-templates"],queryFn:function(){return l.Z4.getActivityTemplates()},enabled:!0,staleTime:6e4,refetchOnWindowFocus:!1}).data,P=void 0===E?[]:E;return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{gap:"12px",width:"100%"},children:[(0,r.jsx)("div",{className:"project-select-wrapper",children:(0,r.jsxs)("select",{value:n,onChange:function(e){return m(e.target.value)},children:[(0,r.jsx)("option",{value:"",children:"Está trabalhando em qual projeto?"}),t.map(function(e){return(0,r.jsx)("option",{value:e.name,children:e.name},e.id)})]})}),(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{gap:"8px",flexShrink:0},children:[(0,r.jsxs)(i.d,{children:[(0,r.jsx)("button",{ref:b,onClick:function(){return j(!x)},title:"Selecionar Tarefa",className:"app-icon-button",disabled:!C,style:{backgroundColor:f?"rgba(24, 96, 115, 0.10)":"white",border:f?"1px solid rgba(24, 96, 115, 0.25)":"1px solid rgba(0, 0, 0, 0.15)"},children:(0,r.jsx)("img",{src:f?"/images/icons/Group(7).svg":"/images/icons/price-tag-3-line.png",alt:"Selecionar Tarefa"})}),(0,r.jsx)(s,{show:x,onClose:function(){return j(!1)},atividades:A,selectedActivity:f,onSelectActivity:function(e){h&&h(e),j(!1)},onAddNew:v,triggerRef:b,title:"Selecionar Tarefa",hideAddNew:!0,centered:!0})]}),(0,r.jsxs)(i.d,{children:[(0,r.jsx)("button",{ref:y,onClick:function(){return N(!S)},title:"Selecionar Atividades",className:"app-icon-button",style:{backgroundColor:u?"rgba(24, 96, 115, 0.10)":"white",border:u?"1px solid rgba(24, 96, 115, 0.25)":"1px solid rgba(0, 0, 0, 0.15)"},children:(0,r.jsx)("img",{src:u?"/images/icons/Frame(1).svg":"/images/icons/frame(2).svg",alt:"Selecionar Atividades"})}),(0,r.jsx)(s,{show:S,onClose:function(){return N(!1)},atividades:P,selectedActivity:u,onSelectActivity:function(e){p(e),N(!1)},onAddNew:v,triggerRef:y,title:"Selecionar Atividades",centered:!0})]})]})]})})}},61909(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>o});n(52675),n(89463),n(28706),n(78459),n(11392);var r=n(74848),a=n(1806);function o(e){var t=e.isOpen,n=e.onClose,o=e.record;if(!t||!o)return null;var i=function(e){return e.startsWith("data:image")?e:"data:image/jpeg;base64,".concat(e)};return(0,r.jsx)(a.A,{show:t,onClose:n,title:"Visualizando Ponto - ".concat(o.memberName),size:"md",footer:(0,r.jsx)("button",{type:"button",className:"btn btn-secondary",onClick:n,style:{fontFamily:"Inter",fontSize:"14px"},children:"Fechar"}),children:(0,r.jsxs)("div",{style:{padding:"24px"},children:[(0,r.jsx)("div",{className:"mt-4",children:function(){if(o.selfie)return(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("img",{src:i(o.selfie),alt:"Selfie de validação",className:"img-fluid rounded",style:{maxHeight:"500px",maxWidth:"100%",objectFit:"contain"}}),(0,r.jsx)("div",{className:"mt-3",style:{color:"#6c757d",fontSize:"15px"},children:o.time})]});if(o.print)return(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("img",{src:i(o.print),alt:"Print de tela",className:"img-fluid rounded",style:{maxHeight:"500px",maxWidth:"100%",objectFit:"contain"}}),(0,r.jsx)("div",{className:"mt-3",style:{color:"#6c757d",fontSize:"15px"},children:o.time})]});if("geolocation"===o.validatedBy&&o.latitude&&o.longitude){var e=parseFloat(o.latitude),t=parseFloat(o.longitude),n="https://www.openstreetmap.org/export/embed.html?bbox=".concat(t-.01,",").concat(e-.01,",").concat(t+.01,",").concat(e+.01,"&layer=mapnik&marker=").concat(e,",").concat(t);return(0,r.jsxs)("div",{children:[(0,r.jsx)("iframe",{width:"100%",height:"450",frameBorder:"0",scrolling:"no",marginHeight:0,marginWidth:0,src:n,style:{border:"none",borderRadius:"8px"}}),(0,r.jsxs)("div",{className:"text-center mt-3",style:{color:"#6c757d",fontSize:"15px"},children:["Latitude: ",o.latitude,", Longitude: ",o.longitude]})]})}return"manual"===o.validatedBy||"sistema"===o.channel?(0,r.jsxs)("div",{className:"alert alert-info",role:"alert",children:[(0,r.jsx)("i",{className:"fas fa-info-circle mr-2"}),(0,r.jsx)("strong",{children:"Registro Manual"}),(0,r.jsxs)("p",{className:"mb-0 mt-2",children:["Este registro de ponto foi batido manualmente pelo usuário"," ",(0,r.jsx)("strong",{children:o.memberName})]}),"ausente"===o.status&&(0,r.jsx)("p",{className:"mb-0 mt-2",children:(0,r.jsx)("span",{className:"badge badge-warning",children:"Status: Ausente"})})]}):(0,r.jsxs)("div",{className:"alert alert-secondary",role:"alert",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle mr-2"}),"Nenhuma informação de validação disponível para este registro."]})}()}),o.justification&&(0,r.jsxs)("div",{className:"mt-4 pt-4",style:{borderTop:"1px solid #dee2e6"},children:[(0,r.jsx)("h6",{style:{fontFamily:"Inter",fontSize:"16px",fontWeight:600,color:"#5C5D5D",marginBottom:"16px"},children:function(e){switch(e){case"license":return"Licença";case"reason":return"Abono";default:return e}}(o.justification.type)}),"license"===o.justification.type&&void 0!==o.justification.partialLicense&&(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsx)("label",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:600,color:"#5C5D5D",marginBottom:"8px",display:"block"},children:"Licença Parcial"}),(0,r.jsx)("input",{type:"text",className:"form-control",value:o.justification.partialLicense?"Sim":"Não",readOnly:!0,style:{fontFamily:"Inter",fontSize:"14px",backgroundColor:"#f8f9fa",cursor:"not-allowed"}})]}),"license"===o.justification.type&&o.justification.payOffLicense&&(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsx)("label",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:600,color:"#5C5D5D",marginBottom:"8px",display:"block"},children:"Motivo"}),(0,r.jsx)("input",{type:"text",className:"form-control",value:function(e){switch(e){case"licenca_maternidade":return"Licença maternidade";case"licenca_medica":return"Licença médica";case"licenca_casamento":return"Licença casamento";case"other":return"Outro";default:return e}}(o.justification.payOffLicense),readOnly:!0,style:{fontFamily:"Inter",fontSize:"14px",backgroundColor:"#f8f9fa",cursor:"not-allowed"}})]}),(o.justification.startPeriod||o.justification.endPeriod)&&(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsx)("label",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:600,color:"#5C5D5D",marginBottom:"8px",display:"block"},children:"Período"}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{className:"col-6",children:[(0,r.jsxs)("div",{className:"input-group",children:[(0,r.jsx)("input",{type:"text",className:"form-control",value:o.justification.startPeriod||"—",readOnly:!0,style:{fontFamily:"Inter",fontSize:"14px",backgroundColor:"#f8f9fa",cursor:"not-allowed"}}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("span",{className:"input-group-text",style:{backgroundColor:"#f8f9fa"},children:(0,r.jsx)("i",{className:"far fa-calendar-alt"})})})]}),(0,r.jsx)("small",{className:"text-muted",style:{fontFamily:"Inter",fontSize:"12px"},children:"Data de início"})]}),(0,r.jsxs)("div",{className:"col-6",children:[(0,r.jsxs)("div",{className:"input-group",children:[(0,r.jsx)("input",{type:"text",className:"form-control",value:o.justification.endPeriod||"—",readOnly:!0,style:{fontFamily:"Inter",fontSize:"14px",backgroundColor:"#f8f9fa",cursor:"not-allowed"}}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("span",{className:"input-group-text",style:{backgroundColor:"#f8f9fa"},children:(0,r.jsx)("i",{className:"far fa-calendar-alt"})})})]}),(0,r.jsx)("small",{className:"text-muted",style:{fontFamily:"Inter",fontSize:"12px"},children:"Data de finalização"})]})]})]}),o.justification.description&&(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsx)("label",{style:{fontFamily:"Inter",fontSize:"14px",fontWeight:600,color:"#5C5D5D",marginBottom:"8px",display:"block"},children:"Descrição"}),(0,r.jsx)("textarea",{className:"form-control",value:o.justification.description,readOnly:!0,rows:3,style:{fontFamily:"Inter",fontSize:"14px",backgroundColor:"#f8f9fa",cursor:"not-allowed",resize:"none"}})]})]})]})})}},64466(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>C});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(51629),n(23792),n(89572),n(94170),n(2892),n(59904),n(67945),n(84185),n(83851),n(81278),n(40875),n(79432),n(10287),n(26099),n(3362),n(47764),n(42762),n(23500),n(62953);var r,a,o=n(74848),i=n(49785),s=n(97665),l=n(57097),c=n(34559);n(23418),n(64346),n(34782),n(23288),n(62010),n(27495),n(38781),n(62062),n(5506);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e.MEDICAL_CERTIFICATE="medical_certificate",e.CHILD_MONITORING="child_monitoring",e.SPOUSE_MONITORING="spouse_monitoring",e.UNION_ACTIVITY="union_activity",e.WEATHER_DELAY="weather_delay",e.TRANSPORT_DELAY="transport_delay",e.COMPENSATED_TIME_OFF="compensated_time_off",e.EMPLOYEE_MARRIAGE="employee_marriage",e.COURT_APPEARANCE="court_appearance",e.ELECTORAL_SERVICE="electoral_service",e.MILITARY_SERVICE="military_service",e.BLOOD_DONATION="blood_donation",e.OTHER="other"}(a||(a={}));var p=(m(m(m(m(m(m(m(m(m(m(r={},a.MEDICAL_CERTIFICATE,"Atestado médico"),a.CHILD_MONITORING,"Acompanhamento de filho"),a.SPOUSE_MONITORING,"Acompanhamento de cônjuge"),a.UNION_ACTIVITY,"Atividade sindical"),a.WEATHER_DELAY,"Atraso por chuva"),a.TRANSPORT_DELAY,"Atraso por transporte"),a.COMPENSATED_TIME_OFF,"Compensação de horas"),a.EMPLOYEE_MARRIAGE,"Casamento"),a.COURT_APPEARANCE,"Audiência judicial"),a.ELECTORAL_SERVICE,"Serviço eleitoral"),m(m(m(r,a.MILITARY_SERVICE,"Serviço militar"),a.BLOOD_DONATION,"Doação de sangue"),a.OTHER,"Outro"));var h=n(50418),v=n(96540),b=n(1806),y=n(47339);function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function x(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function j(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?x(Object(n),!0).forEach(function(t){w(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function w(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=g(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=g(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==g(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return N(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(N(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,N(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,N(d,"constructor",c),N(c,"constructor",l),l.displayName="GeneratorFunction",N(c,a,"GeneratorFunction"),N(d),N(d,a,"Generator"),N(d,r,function(){return this}),N(d,"toString",function(){return"[object Generator]"}),(S=function(){return{w:o,m:f}})()}function N(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}N=function(e,t,n,r){function o(t,n){N(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},N(e,t,n,r)}function k(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function C(e){var t,n,r=e.isOpen,u=e.onClose,f=e.record,m=(e.onSave,(0,s.jE)()),g=(0,i.mN)({mode:"onChange",defaultValues:{tipoAbono:"dia_inteiro",motivo:"",descricao:"",periodoInicioData:"",periodoInicioHora:"",periodoFimData:"",periodoFimHora:""}}),x=g.register,w=g.handleSubmit,N=g.control,C=g.watch,O=g.reset,A=g.formState.errors,E=C("tipoAbono"),P=C("motivo"),F=(0,v.useMemo)(function(){return Object.entries(p).map(function(e){var t=d(e,2);return{value:t[0],label:t[1]}})},[]),T=(0,l.n)({mutationFn:(t=S().m(function e(t){var n;return S().w(function(e){for(;;)switch(e.n){case 0:if(null!=f&&f.id){e.n=1;break}throw new Error("ID do registro (hitTheSpotId) não encontrado");case 1:return console.log(f),n={hitTheSpotId:f.id,timeReason:"dia_inteiro"===t.tipoAbono?"all_day":"a_part_of_the_hour",payOffAbsence:t.motivo,otherText:t.motivo===a.OTHER?t.descricao:void 0,startPeriod:"horas_falta"===t.tipoAbono?"".concat(t.periodoInicioData,"T").concat(t.periodoInicioHora,":00"):void 0,endPeriod:"horas_falta"===t.tipoAbono?"".concat(t.periodoFimData,"T").concat(t.periodoFimHora,":00"):void 0,description:t.descricao||void 0},e.a(2,(0,h.py)(n))}},e)}),n=function(){var e=this,n=arguments;return new Promise(function(r,a){var o=t.apply(e,n);function i(e){k(o,r,a,i,s,"next",e)}function s(e){k(o,r,a,i,s,"throw",e)}i(void 0)})},function(e){return n.apply(this,arguments)}),onSuccess:function(e){m.invalidateQueries({queryKey:["time-management","hit-spot-time-history"]}),y.A.success(e.message||"Abono aplicado com sucesso!","Sucesso"),I()},onError:function(e){var t,n=(null===(t=e.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.error)||"Erro ao aplicar abono";y.A.error(n,"Erro")}}),D=T.mutate,_=T.isPending,I=function(){O(),u()};return r?(0,o.jsx)(b.A,{show:r,onClose:I,title:"Abonar",size:"md",footer:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:I,disabled:_,children:"Cancelar"}),(0,o.jsx)("button",{type:"submit",form:"abonarForm",className:"btn btn-primary",disabled:_,style:{backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:_?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("i",{className:"fas fa-spinner fa-spin mr-1"}),"Salvando..."]}):"Aplicar Abono"})]}),children:(0,o.jsxs)("form",{id:"abonarForm",onSubmit:w(function(e){e.motivo?e.motivo!==a.OTHER||e.descricao.trim()?"horas_falta"!==e.tipoAbono||e.periodoInicioData&&e.periodoInicioHora&&e.periodoFimData&&e.periodoFimHora?D(e):y.A.warning("Por favor, preencha o período de início e finalização.","Campo obrigatório"):y.A.warning("Por favor, descreva o motivo.","Campo obrigatório"):y.A.warning("Por favor, selecione o motivo.","Campo obrigatório")}),children:[(0,o.jsxs)("div",{className:"mb-4",children:[(0,o.jsxs)("div",{className:"form-check mb-3",children:[(0,o.jsx)("input",j(j({},x("tipoAbono")),{},{className:"form-check-input",type:"radio",id:"abonarDiaInteiro",value:"dia_inteiro",style:{width:"20px",height:"20px",cursor:"pointer"}})),(0,o.jsx)("label",{className:"form-check-label",htmlFor:"abonarDiaInteiro",style:{fontWeight:400,color:"#5C5D5D",marginLeft:"8px",cursor:"pointer"},children:"Abonar o dia inteiro"})]}),(0,o.jsxs)("div",{className:"form-check",children:[(0,o.jsx)("input",j(j({},x("tipoAbono")),{},{className:"form-check-input",type:"radio",id:"abonarHorasFalta",value:"horas_falta",style:{width:"20px",height:"20px",cursor:"pointer"}})),(0,o.jsx)("label",{className:"form-check-label",htmlFor:"abonarHorasFalta",style:{color:"#5C5D5D",marginLeft:"8px",cursor:"pointer"},children:"Abonar somente as horas em falta do dia"})]})]}),(0,o.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,o.jsx)("h6",{style:{color:"#5C5D5D",marginBottom:"8px"},children:"Selecione o Motivo"}),(0,o.jsx)("p",{children:"Informe o motivo pelo qual este ponto precisa ser ajustado."}),(0,o.jsxs)("div",{className:"row",children:[(0,o.jsxs)("div",{className:P===a.OTHER?"col-4":"col-12",children:[(0,o.jsx)(i.xI,{name:"motivo",control:N,rules:{required:"Motivo é obrigatório"},render:function(e){var t=e.field;return(0,o.jsx)(c.A,{options:F,value:t.value,placeholder:"Motivo*",size:"md",onChange:function(e){t.onChange(e),e!==a.OTHER&&O(function(e){return j(j({},e),{},{descricao:""})})}})}}),A.motivo&&(0,o.jsx)("small",{className:"text-danger d-block mt-1",children:A.motivo.message})]}),P===a.OTHER&&(0,o.jsxs)("div",{className:"col-8",children:[(0,o.jsx)("input",j(j({},x("descricao",{required:P===a.OTHER&&"Descrição é obrigatória"})),{},{type:"text",className:"form-control",placeholder:"Descreva o motivo*",style:{height:"100%"}})),A.descricao&&(0,o.jsx)("small",{className:"text-danger d-block mt-1",children:A.descricao.message})]})]})]}),"horas_falta"===E&&(0,o.jsxs)("div",{className:"row",children:[(0,o.jsxs)("div",{className:"col-6 mb-3",children:[(0,o.jsx)("h6",{style:{color:"#5C5D5D",marginBottom:"8px"},children:"Período de Início"}),(0,o.jsxs)("div",{className:"mb-2",children:[(0,o.jsx)("div",{className:"input-group",children:(0,o.jsx)("input",j(j({},x("periodoInicioData",{required:"horas_falta"===E&&"Data de início obrigatória"})),{},{type:"date",className:"form-control"}))}),A.periodoInicioData&&(0,o.jsx)("small",{className:"text-danger d-block mt-1",children:A.periodoInicioData.message})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("input",j(j({},x("periodoInicioHora",{required:"horas_falta"===E&&"Hora de início obrigatória"})),{},{type:"time",className:"form-control",placeholder:"Horas"})),A.periodoInicioHora&&(0,o.jsx)("small",{className:"text-danger d-block mt-1",children:A.periodoInicioHora.message})]})]}),(0,o.jsxs)("div",{className:"col-6 mb-3",children:[(0,o.jsx)("h6",{style:{color:"#5C5D5D",marginBottom:"8px"},children:"Período de Finalização"}),(0,o.jsxs)("div",{className:"mb-2",children:[(0,o.jsx)("div",{className:"input-group",children:(0,o.jsx)("input",j(j({},x("periodoFimData",{required:"horas_falta"===E&&"Data de fim obrigatória"})),{},{type:"date",className:"form-control"}))}),A.periodoFimData&&(0,o.jsx)("small",{className:"text-danger d-block mt-1",children:A.periodoFimData.message})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("input",j(j({},x("periodoFimHora",{required:"horas_falta"===E&&"Hora de fim obrigatória"})),{},{type:"time",className:"form-control",placeholder:"Horas"})),A.periodoFimHora&&(0,o.jsx)("small",{className:"text-danger d-block mt-1",children:A.periodoFimHora.message})]})]})]})]})}):null}},65207(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>o});n(62062),n(62010),n(9868),n(26099);var r=n(74848),a=n(10280);function o(e){var t=e.onCollaboratorClick,n=e.kpis,o=e.members,i=void 0===o?[]:o;if(0===i.length)return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"row mb-4",children:(n?[{label:"Total de Horas Trabalhadas",value:n.totalHoursWorked.formatted,variant:"teal-dark"},{label:"Total de Horas Faltantes",value:n.totalMissingHours.formatted,variant:"salmon"},{label:"Total de Horas Extras",value:n.totalExtraHours.formatted,variant:"turquoise"},{label:"Sobrecarga de Trabalho",value:"".concat(n.workOverload.toFixed(1),"%"),variant:"cyan"}]:[{label:"Total de Horas Trabalhadas",value:"0h00",variant:"teal-dark"},{label:"Total de Horas Faltantes",value:"0h00",variant:"salmon"},{label:"Total de Horas Extras",value:"0h00",variant:"turquoise"},{label:"Sobrecarga de Trabalho",value:"0%",variant:"cyan"}]).map(function(e,t){return(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(a.A,{value:e.value,label:e.label,variant:e.variant,className:"h-100"})},t)})}),(0,r.jsx)("div",{className:"text-center p-5 text-muted",children:"Nenhum membro encontrado para esta equipe/time."})]});var s=n?[{label:"Total de Horas Trabalhadas",value:n.totalHoursWorked.formatted,variant:"teal-dark"},{label:"Total de Horas Faltantes",value:n.totalMissingHours.formatted,variant:"salmon"},{label:"Total de Horas Extras",value:n.totalExtraHours.formatted,variant:"turquoise"},{label:"Sobrecarga de Trabalho",value:"".concat(n.workOverload.toFixed(1),"%"),variant:"cyan"}]:[{label:"Total de Horas Trabalhadas",value:"0h00",variant:"teal-dark"},{label:"Total de Horas Faltantes",value:"0h00",variant:"salmon"},{label:"Total de Horas Extras",value:"0h00",variant:"turquoise"},{label:"Sobrecarga de Trabalho",value:"0%",variant:"cyan"}];return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"row mb-4",children:s.map(function(e,t){return(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(a.A,{value:e.value,label:e.label,variant:e.variant,className:"h-100"})},t)})}),(0,r.jsx)("div",{className:"card app-card-surface mt-3",children:(0,r.jsx)("div",{className:"card-body p-0",children:(0,r.jsx)("div",{className:"ms-table-occurrences-wrapper",children:(0,r.jsxs)("table",{className:"ms-table-occurrences ms-table-occurrences-with-divider",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Colaborador"}),(0,r.jsx)("th",{children:"Carga Horária"}),(0,r.jsx)("th",{children:"Média Diária"}),(0,r.jsx)("th",{children:"Total de Horas"}),(0,r.jsx)("th",{children:"Horas Regulares"}),(0,r.jsx)("th",{children:"Horas Extras"}),(0,r.jsx)("th",{children:"Sobrecarga de Trabalho"}),(0,r.jsx)("th",{className:"ms-text-right",children:"Ações"})]})}),(0,r.jsx)("tbody",{children:0===i.length?(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:8,className:"ms-table-occurrences-empty",children:"Nenhum membro encontrado"})}):i.map(function(e){return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("div",{className:"tm-avatar-32 rounded-circle d-flex align-items-center justify-content-center text-white",style:{background:e.avatarBg},children:e.initials}),(0,r.jsx)("span",{children:e.name})]})}),(0,r.jsx)("td",{children:e.weeklyHours}),(0,r.jsx)("td",{children:e.dailyAverage}),(0,r.jsx)("td",{children:e.totalHours}),(0,r.jsx)("td",{children:e.regularHours}),(0,r.jsx)("td",{children:e.extraHours}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"badge badge-".concat((n=e.badge,{Baixa:"success",Moderada:"warning",Preocupante:"danger"}[n])),children:e.badge})}),(0,r.jsx)("td",{className:"ms-text-right",children:(0,r.jsx)("button",{className:"ms-table-occurrences-action-button",title:"Ver detalhes",onClick:function(){return null==t?void 0:t({id:e.id,name:e.name,initials:e.initials,avatarBg:e.avatarBg})},children:(0,r.jsx)("img",{src:"/images/icons/Group copy.svg",alt:"Ver gráfico",className:"ms-table-occurrences-action-icon",style:{width:"15px",height:"15px"}})})})]},e.id);var n})})]})})})})]})}},65342(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>w});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(62062),n(34782),n(1688),n(23288),n(94170),n(62010),n(2892),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(68156),n(62953);var r=n(74848),a=n(96540),o=n(33930),i=n(20826),s=n(92801),l=n(1125),c=n(50860),u=n(49293),d=n(36279),f=n(48592),m=n(17649),p=n(81623),h=n(10280);function v(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return b(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(b(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,b(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,b(d,"constructor",c),b(c,"constructor",l),l.displayName="GeneratorFunction",b(c,a,"GeneratorFunction"),b(d),b(d,a,"Generator"),b(d,r,function(){return this}),b(d,"toString",function(){return"[object Generator]"}),(v=function(){return{w:o,m:f}})()}function b(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}b=function(e,t,n,r){function o(t,n){b(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},b(e,t,n,r)}function y(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function g(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){y(o,r,a,i,s,"next",e)}function s(e){y(o,r,a,i,s,"throw",e)}i(void 0)})}}function x(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return j(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?j(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function w(){var e,t,n=x((0,a.useState)(!0),2),b=n[0],y=n[1],j=x((0,a.useState)(new Date),2),w=j[0],S=j[1],N=x((0,a.useState)(8),2),k=N[0],C=N[1],O=x((0,a.useState)(!1),2),A=O[0],E=O[1],P=x((0,a.useState)(!1),2),F=P[0],T=P[1],D=x((0,a.useState)(null),2),_=D[0],I=D[1],M=x((0,a.useState)(!1),2),R=M[0],z=M[1],L=x((0,a.useState)(null),2),q=L[0],B=L[1],G=x((0,a.useState)(!1),2),H=G[0],W=G[1],U=(0,a.useRef)(null),V=function(e){return e.toISOString().split("T")[0]},Q=function(e,t){if(!e||!t)return"00:00";var n=x(e.split(":").map(Number),2),r=n[0],a=n[1],o=x(t.split(":").map(Number),2),i=60*o[0]+o[1]-(60*r+a),s=Math.floor(i/60),l=i%60;return"".concat(String(s).padStart(2,"0"),":").concat(String(l).padStart(2,"0"))},K=(0,o.I)({queryKey:["timesheet-activities",V(w)],queryFn:function(){return p.Ay.getActivities(V(w))},enabled:!0,retry:1,refetchOnWindowFocus:!1}),$=K.data,J=void 0===$?[]:$,Y=K.refetch,Z=K.isLoading,X=K.error,ee=(0,o.I)({queryKey:["timesheet-projects"],queryFn:function(){return p.Ay.getProjects()},enabled:!0,retry:1,refetchOnWindowFocus:!1}),te=ee.data,ne=void 0===te?[]:te,re=(ee.isLoading,ee.error,(0,o.I)({queryKey:["timesheet-activity-templates"],queryFn:function(){return p.Ay.getActivityTemplates()},enabled:!0,retry:1,refetchOnWindowFocus:!1})),ae=re.data,oe=void 0===ae?[]:ae,ie=(re.isLoading,re.error,(0,o.I)({queryKey:["timesheet-scheduled-activities",V(w)],queryFn:function(){return p.Ay.getScheduledActivities(V(w))},enabled:!0,retry:1,refetchOnWindowFocus:!1})),se=ie.data,le=void 0===se?[]:se,ce=ie.refetch,ue=ie.isLoading,de=ie.error,fe=(0,o.I)({queryKey:["timesheet-planned-activities",V(w)],queryFn:function(){return p.Ay.getPlannedActivities(V(w))},enabled:!0,retry:1,refetchOnWindowFocus:!1}),me=fe.data,pe=void 0===me?[]:me,he=fe.refetch,ve=fe.isLoading,be=fe.error,ye=(0,o.I)({queryKey:["timesheet-hours-worked-kpi",V(w)],queryFn:function(){return p.Ay.getHoursWorkedKPI(V(w))},enabled:!0,retry:1,refetchOnWindowFocus:!1}),ge=ye.data,xe=ye.isLoading,je=ye.refetch,we=(0,o.I)({queryKey:["timesheet-workload",V(w)],queryFn:function(){return p.Ay.getWorkload(V(w))},enabled:!0,retry:1,refetchOnWindowFocus:!1}),Se=we.data,Ne=we.isLoading,ke=(0,o.I)({queryKey:["timesheet-day-kpis",V(w)],queryFn:function(){return p.Ay.getDayKPIs(V(w))},enabled:!0,retry:1,refetchOnWindowFocus:!1}),Ce=ke.data,Oe=ke.isLoading,Ae=ke.refetch;(0,a.useEffect)(function(){void 0!==Se&&C(Se)},[Se]);var Ee=function(){var e=g(v().m(function e(t){var n;return v().w(function(e){for(;;)switch(e.p=e.n){case 0:return C(t),e.p=1,e.n=2,p.Ay.updateWorkload(V(w),t);case 2:je(),e.n=4;break;case 3:e.p=3,n=e.v,console.error("Erro ao atualizar carga horária:",n);case 4:return e.a(2)}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}(),Pe=J.map(function(e){return{id:e.id,projeto:e.project_name,atividade:e.activity_name||e.activity_template_name||e.activity_name_legacy||"",task:e.project_task_name||"",inicio:e.start_time||"00:00",fim:e.end_time||"00:00",percentDia:"".concat(e.percentage,"%"),duracao:(t=e.duration,n=Math.floor(t/60),r=t%60,"".concat(n.toString().padStart(2,"0"),":").concat(r.toString().padStart(2,"0"))),comment:e.comment||""};var t,n,r}),Fe=ne.map(function(e){return{id:e.id,name:e.name}}),Te=oe.map(function(e){return{id:e.id,name:e.name}});var De=function(){var e=g(v().m(function e(){var t,n;return v().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,(0,p.jZ)(V(w));case 1:return t=e.v,I(t.timesheetDayId),z(t.hasSatisfaction),W(t.isFinalized),B(t.workSatisfaction),y(!t.isFinalized),e.a(2,t);case 2:return e.p=2,n=e.v,console.error("Erro ao verificar status do dia:",n),B(null),e.a(2,null)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}();(0,a.useEffect)(function(){console.log("🔄 Carregando atividades para data:",V(w)),Y(),De()},[w,Y]),(0,a.useEffect)(function(){},[J,ne,oe]);var _e,Ie,Me,Re,ze,Le=function(){var e=g(v().m(function e(t){var n,r,a,o,i;return v().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,n=_,H){e.n=2;break}return e.n=1,p.Ay.finalizeDay(V(w));case 1:r=e.v,console.log("Dia finalizado:",w),y(!1),W(!0),null!=r&&r.id&&(n=r.id,I(r.id)),e.n=3;break;case 2:y(!1);case 3:if(n){e.n=5;break}return e.n=4,De();case 4:o=e.v,n=null!==(a=null==o?void 0:o.timesheetDayId)&&void 0!==a?a:null;case 5:if(null===t||!n){e.n=6;break}return e.n=6,(0,p.VU)(n,t);case 6:return e.n=7,De();case 7:e.n=9;break;case 8:throw e.p=8,i=e.v,console.error("Erro ao finalizar dia:",i),i;case 9:return e.a(2)}},e,null,[[0,8]])}));return function(t){return e.apply(this,arguments)}}();return A?(0,r.jsx)(s.A,{title:"Dashboard - Controle de Atividades",subtitle:"Visão detalhada das horas trabalhadas e performance pessoal",showBackButton:!0,onBack:function(){return E(!1)},showExportButton:!0,onExport:function(){return console.log("Exportar dashboard")}}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(c.A,{title:"",subtitle:"",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center mb-3",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center mr-auto",children:[(0,r.jsx)("i",{className:"fas fa-chevron-left ".concat(Z?"text-muted":""," mr-2 ").concat(Z?"":"text-primary"),onClick:Z?void 0:function(){var e=new Date(w);e.setDate(e.getDate()-1),S(e)}}),(0,r.jsxs)("span",{className:"tm-date-label",onClick:function(){U.current&&U.current.showPicker()},title:"Clique para selecionar uma data",children:[(_e=w,Ie=["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"][_e.getDay()],Me=_e.getDate().toString().padStart(2,"0"),Re=["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"][_e.getMonth()],ze=_e.getFullYear(),"".concat(Ie,", ").concat(Me," ").concat(Re,". ").concat(ze)),Z&&(0,r.jsx)("span",{className:"ml-2",children:(0,r.jsx)("i",{className:"fas fa-spinner fa-spin text-primary"})}),(0,r.jsx)("input",{ref:U,type:"date",value:V(w),onChange:function(e){var t=new Date(e.target.value+"T00:00:00");S(t)},className:"sr-only"})]}),(0,r.jsx)("i",{className:"fas fa-chevron-right ".concat(Z?"text-muted":""," ml-2 ").concat(Z?"":"text-primary"),onClick:Z?void 0:function(){var e=new Date(w);e.setDate(e.getDate()+1),S(e)}})]}),(0,r.jsx)(i.A,{label:"Ver Dashboard",icon:"/images/icons/graph.svg",variant:"solid",onClick:function(){return E(!0)}}),(0,r.jsx)(i.A,{label:b?"Finalizar Dia":"Editar Dia",icon:b?"fas fa-check":"fas fa-pen",variant:"outline",onClick:function(){b?T(!0):(y(!0),W(!1))}})]}),(0,r.jsx)("div",{className:"mt-3",children:(0,r.jsxs)("div",{className:"row justify-content-start align-items-stretch",children:[(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(h.A,{value:null!==(e=null==Ce?void 0:Ce.projetos_desenvolvidos)&&void 0!==e?e:0,label:"Projetos Desenvolvidos",variant:"teal-dark",isLoading:Oe,className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(h.A,{value:null!==(t=null==Ce?void 0:Ce.atividades_desenvolvidas)&&void 0!==t?t:0,label:"Atividades Desenvolvidas",variant:"cyan",isLoading:Oe,className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(h.A,{value:xe?"Carregando...":ge?"".concat(ge.formatted_time," | ").concat(ge.percentage):"00:00h | 0%",label:"Horas Trabalhadas",variant:"turquoise",className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(h.A,{value:k,label:"Carga Horária",variant:"dark-gray",editable:!0,isInteger:!0,isLoading:Ne,onValueChange:function(e){Ee(e)},className:"h-100"})})]})}),Z?(0,r.jsx)(l.A,{message:"Carregando atividades..."}):X?(0,r.jsxs)("div",{className:"alert alert-danger",role:"alert",children:[(0,r.jsx)("strong",{children:"Erro ao carregar atividades:"})," ",X.message,(0,r.jsx)("button",{className:"btn btn-sm btn-outline-danger ml-2",onClick:function(){return Y()},children:"Tentar novamente"})]}):(0,r.jsx)(u.default,{projetos:Fe,atividadesDisponiveis:Te,activities:Pe,currentDate:V(w),workloadHours:k,onActivityEdit:function(e){return console.log("Editar atividade:",e)},onActivityDelete:function(e){return console.log("Deletar atividade:",e)},onActivityAction:function(e){return console.log("Ação adicional:",e)},onActivityAdded:function(){Y(),je(),Ae()}}),ue?(0,r.jsx)(l.A,{message:"Carregando atividades previstas..."}):de?(0,r.jsxs)("div",{className:"alert alert-warning",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-triangle mr-2"}),"Erro ao carregar atividades previstas"]}):(0,r.jsx)(d.default,{activities:le.map(function(e){return{id:e.id,projeto:e.projeto,atividade:e.atividade,inicio:e.inicio,fim:e.fim,percentDia:"".concat(Math.round(e.porcentagem_diaria||0),"%"),status:"A Fazer",prioridade:"Média",duracao:Q(e.inicio,e.fim)}}),projetos:Fe,atividadesDisponiveis:Te,currentDate:V(w),workloadHours:k,onActivityAdded:function(){Y(),ce(),he(),je(),Ae()}}),ve?(0,r.jsx)(l.A,{message:"Carregando atividades planejadas..."}):be?(0,r.jsxs)("div",{className:"alert alert-warning",children:[(0,r.jsx)("i",{className:"fas fa-exclamation-triangle mr-2"}),"Erro ao carregar atividades planejadas"]}):(0,r.jsx)(f.default,{activities:pe.map(function(e){return{id:e.id,projeto:e.projeto,atividade:e.atividade,inicio:e.inicio,fim:e.fim,percentDia:"".concat(Math.round(e.porcentagem_diaria||0),"%"),duracao:Q(e.inicio,e.fim)}}),projetos:Fe,atividadesDisponiveis:Te,currentDate:V(w),workloadHours:k,onActivityAdded:function(){Y(),je(),Ae()}}),(0,r.jsx)(m.default,{show:F,onClose:function(){return T(!1)},hasExistingSatisfaction:R,initialSatisfaction:q,onConfirmFinalize:Le})]})})}},67784(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>l});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(42762),n(62953);var r=n(74848),a=n(96540),o=n(1806);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e){var t=e.isOpen,n=e.onClose,s=e.onSave,l=e.occurrenceTitle,c=void 0===l?"":l,u=e.existingJustification,d=void 0===u?null:u,f=e.isSaving,m=void 0!==f&&f,p=i((0,a.useState)(""),2),h=p[0],v=p[1],b=d&&""!==d.trim(),y=function(){b||v(""),n()};return t?(0,r.jsx)(o.A,{show:t,onClose:y,title:"Justificativa",size:"md",footer:b?(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:y,children:"Fechar"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:y,disabled:m,children:"Fechar"}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary",onClick:function(){b||(h.trim()?s(h):alert("Por favor, escreva uma justificativa."))},disabled:m||!h.trim(),style:{backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:m?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"spinner-border spinner-border-sm me-2"}),"Enviando..."]}):(0,r.jsx)(r.Fragment,{children:"Enviar Justificativa"})})]}),children:(0,r.jsxs)("div",{style:{padding:"24px"},children:[c&&(0,r.jsxs)("p",{className:"text-muted mb-3",style:{fontFamily:"Inter",fontSize:"14px"},children:["Ocorrência: ",(0,r.jsx)("strong",{children:c})]}),(0,r.jsx)("div",{className:"form-group mb-0",children:b?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"form-control bg-light",style:{fontFamily:"Inter",fontSize:"14px",minHeight:"100px",whiteSpace:"pre-wrap",color:"#5C5D5D"},children:d}),(0,r.jsxs)("div",{className:"alert alert-info mt-3 mb-0",style:{fontFamily:"Inter",fontSize:"13px"},children:[(0,r.jsx)("i",{className:"fas fa-info-circle me-2"}),"Esta justificativa foi enviada anteriormente e não pode ser editada."]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("textarea",{className:"form-control",rows:4,placeholder:"Escreva sua justificativa",value:h,onChange:function(e){return v(e.target.value)},disabled:m,style:{fontFamily:"Inter",fontSize:"14px",resize:"vertical"}}),(0,r.jsx)("small",{className:"text-muted",style:{fontFamily:"Inter",fontSize:"13px"},children:"Tem certeza de que deseja enviar esta justificativa? Ela não poderá ser editada futuramente."})]})})]})}):null}},68925(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>c});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(62062),n(34782),n(1688),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(68156),n(62953),n(76031);var r=n(74848),a=n(96540),o=n(82942);n(85231);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e){var t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return"".concat(["Domingo","Segunda-Feira","Terça-Feira","Quarta-Feira","Quinta-Feira","Sexta-Feira","Sábado"][e.getDay()]," - ").concat(t,"/").concat(n,"/").concat(r)}function c(e){var t=e.onRegister,n=e.availableOptions,s=void 0===n?[]:n,c=e.onSelectOption,u=e.isNoneMode,d=void 0!==u&&u,f=e.disabled,m=void 0!==f&&f,p=(e.onPointCleared,i((0,a.useState)(new Date),2)),h=p[0],v=p[1],b=i((0,a.useState)((new Date).toISOString().split("T")[0]),2),y=(b[0],b[1],i((0,a.useState)(!1),2)),g=(y[0],y[1],i((0,a.useState)(null),2));g[0],g[1];(0,a.useEffect)(function(){var e=setInterval(function(){return v(new Date)},1e3);return function(){return clearInterval(e)}},[]);var x=String(h.getHours()).padStart(2,"0"),j=String(h.getMinutes()).padStart(2,"0"),w=String(h.getSeconds()).padStart(2,"0");return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"ms-clock-card-box",children:[(0,r.jsxs)("div",{className:"ms-clock-card-time",children:[x,":",j,":",w]}),(0,r.jsx)("div",{className:"ms-clock-card-date",children:l(h)})]}),d||0===s.length?(0,r.jsx)("button",{className:"ms-clock-card-register-btn",onClick:t,disabled:m,children:"Registrar Ponto"}):1===s.length?(0,r.jsx)("button",{className:"ms-clock-card-register-btn",onClick:function(){return null==c?void 0:c(s[0])},disabled:m,children:(0,o.kC)(s[0])}):(0,r.jsxs)("div",{className:"btn-group btn-block dropdown ms-clock-card-dropdown-wrapper",children:[(0,r.jsx)("button",{className:"ms-clock-card-register-btn dropdown-toggle","data-toggle":"dropdown",type:"button",disabled:m,children:"Registrar Ponto"}),(0,r.jsx)("div",{className:"dropdown-menu dropdown-menu-right",children:s.map(function(e,t){return(0,r.jsxs)("a",{className:"dropdown-item ".concat(m?"disabled":""),href:"#",onClick:function(t){t.preventDefault(),m||null==c||c(e)},children:[(0,r.jsx)("i",{className:"".concat((0,o.JC)(e)," mr-2")}),(0,o.kC)(e)]},t)})})]})]})}},69404(e,t,n){"use strict";n.d(t,{u:()=>r});var r=n(71083).A.create({baseURL:"/",timeout:25e3,withCredentials:!0})},69511(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>s});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(68156),n(62953),n(76031);var r=n(74848),a=n(96540);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s(e){var t=e.activeTab,n=e.onTabChange,i=e.selectedDate,s=e.onDateChange,l=o((0,a.useState)(new Date),2),c=l[0],u=l[1],d=o((0,a.useState)(!1),2),f=d[0],m=d[1],p=(0,a.useRef)(null);(0,a.useEffect)(function(){var e=setInterval(function(){return u(new Date)},1e3);return function(){return clearInterval(e)}},[]);var h,v,b,y,g,x,j=String(c.getHours()).padStart(2,"0"),w=String(c.getMinutes()).padStart(2,"0"),S=String(c.getSeconds()).padStart(2,"0");return(0,r.jsxs)("div",{style:{backgroundColor:"#FFFFFF",borderRadius:"0 0 12px 12px",padding:"24px 20px",marginBottom:"16px"},children:[(0,r.jsx)("div",{style:{textAlign:"center",marginBottom:"12px"},children:(0,r.jsxs)("div",{style:{fontSize:"48px",fontWeight:700,lineHeight:1.1,color:"#2E3A46",letterSpacing:".5px",fontFamily:"Inter"},children:[j,":",w,":",S]})}),"ponto"===t&&(0,r.jsxs)("div",{style:{textAlign:"center",marginBottom:"16px",position:"relative"},children:[(0,r.jsxs)("button",{onClick:function(){m(!0),setTimeout(function(){var e,t,n;null===(e=p.current)||void 0===e||e.focus(),null===(t=p.current)||void 0===t||null===(n=t.showPicker)||void 0===n||n.call(t)},10)},style:{background:"none",border:"none",padding:"8px 16px",cursor:"pointer",fontSize:"13px",color:"#17A2B8",fontFamily:"Inter",fontWeight:500,textDecoration:f?"underline":"none"},children:[(0,r.jsx)("i",{className:"far fa-calendar-alt mr-2"}),(h=i,v=new Date(h+"T00:00:00"),b=["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"][v.getDay()],y=v.getDate(),g=v.getMonth()+1,x=v.getFullYear(),"".concat(b,", ").concat(String(y).padStart(2,"0"),"/").concat(String(g).padStart(2,"0"),"/").concat(x))]}),f&&(0,r.jsx)("input",{ref:p,type:"date",value:i,onChange:function(e){var t=e.target.value;t&&(s(t),m(!1))},onBlur:function(){return m(!1)},style:{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"4px",padding:"8px",fontSize:"14px",border:"1px solid #ced4da",borderRadius:"6px",zIndex:1e3,backgroundColor:"#FFFFFF",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"}})]}),(0,r.jsxs)("div",{style:{display:"flex",borderBottom:"1px solid #E5E7EB"},children:[(0,r.jsx)("button",{onClick:function(){return n("ponto")},style:{flex:1,padding:"12px",border:"none",background:"none",fontSize:"15px",fontWeight:"ponto"===t?600:400,color:"ponto"===t?"#17A2B8":"#6B7280",borderBottom:"ponto"===t?"2px solid #17A2B8":"none",cursor:"pointer",fontFamily:"Inter",transition:"all 0.2s"},children:"Ponto"}),(0,r.jsx)("button",{onClick:function(){return n("ocorrencias")},style:{flex:1,padding:"12px",border:"none",background:"none",fontSize:"15px",fontWeight:"ocorrencias"===t?600:400,color:"ocorrencias"===t?"#17A2B8":"#6B7280",borderBottom:"ocorrencias"===t?"2px solid #17A2B8":"none",cursor:"pointer",fontFamily:"Inter",transition:"all 0.2s"},children:"Ocorrências"})]})]})}},69794(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>l});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var s=[{id:"black",src:"/images/tenant/black_full_card.png",alt:"Fundo preto"},{id:"blue",src:"/images/tenant/blue_full_card.png",alt:"Fundo azul"},{id:"white",src:"/images/tenant/white_full_card.png",alt:"Fundo branco"}];function l(e){var t=e.selected,n=e.onSelect,i=(0,a.useRef)(null),l=o((0,a.useState)(!1),2),c=l[0],u=l[1],d=o((0,a.useState)(0),2),f=d[0],m=d[1],p=o((0,a.useState)(0),2),h=p[0],v=p[1];(0,a.useEffect)(function(){var e=i.current;if(e){var t=function(t){var n,r;u(!0);var a="touches"in t?t.touches[0].pageX:t.pageX;m(a-e.getBoundingClientRect().left),v(e.scrollLeft),null===(n=document.activeElement)||void 0===n||null===(r=n.blur)||void 0===r||r.call(n),e.style.cursor="grabbing"},n=function(){u(!1),i.current&&(i.current.style.cursor="grab")},r=function(e){if(c){e.preventDefault();var t=i.current,n=("touches"in e?e.touches[0].pageX:e.pageX)-t.getBoundingClientRect().left;t.scrollLeft=h-(n-f)}};return e.addEventListener("mousedown",t),e.addEventListener("mouseleave",n),e.addEventListener("mouseup",n),e.addEventListener("mousemove",r),e.addEventListener("touchstart",t,{passive:!1}),e.addEventListener("touchend",n),e.addEventListener("touchmove",r,{passive:!1}),function(){e.removeEventListener("mousedown",t),e.removeEventListener("mouseleave",n),e.removeEventListener("mouseup",n),e.removeEventListener("mousemove",r),e.removeEventListener("touchstart",t),e.removeEventListener("touchend",n),e.removeEventListener("touchmove",r)}}},[c,f,h]),(0,a.useEffect)(function(){var e=i.current;if(e){var t=function(t){Math.abs(t.deltaX)<Math.abs(t.deltaY)&&(e.scrollLeft+=t.deltaY,t.preventDefault())};return e.addEventListener("wheel",t,{passive:!1}),function(){return e.removeEventListener("wheel",t)}}},[]);return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"position-relative",children:(0,r.jsx)("div",{ref:i,className:"d-flex align-items-center justify-content-center",style:{overflowX:"auto",display:"flex",alignItems:"center",scrollSnapType:"x mandatory",WebkitOverflowScrolling:"touch",paddingBottom:8,cursor:"grab",scrollbarWidth:"none"},tabIndex:0,onKeyDown:function(e){var t=i.current;if(t){"ArrowRight"===e.key&&t.scrollBy({left:436,behavior:"smooth"}),"ArrowLeft"===e.key&&t.scrollBy({left:-436,behavior:"smooth"})}},children:s.map(function(e){var a=t===e.id;return(0,r.jsx)("button",{type:"button",onClick:function(){return n(e.id)},className:"btn p-0 border-0",style:{scrollSnapAlign:"center",outline:"none",background:"transparent",userSelect:"none"},"aria-label":"Selecionar plano de fundo ".concat(e.alt),title:e.alt,children:(0,r.jsxs)("div",{className:"position-relative",style:{width:420,maxWidth:"70vw",height:220,borderRadius:16,overflow:"hidden",transform:a?"scale(1.02)":"scale(0.96)",transition:"transform 200ms ease, box-shadow 200ms ease, filter 200ms ease, opacity 200ms ease",filter:a?"none":"blur(2px)",opacity:a?1:.85,border:a?"2px solid rgba(0,123,255,0.6)":"2px solid transparent",cursor:"pointer",margin:"4px"},children:[(0,r.jsx)("img",{src:e.src,alt:e.alt,draggable:!1,style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"black"===e.id?"0% 100%":"center",pointerEvents:"none"}}),a&&(0,r.jsx)("span",{className:"position-absolute badge badge-primary",style:{top:8,right:8,borderRadius:12,padding:"2px 8px",fontWeight:600},children:"Selecionado"})]})},e.id)})})}),(0,r.jsx)("div",{className:"d-flex justify-content-center mt-2",children:s.map(function(e){var a=t===e.id;return(0,r.jsx)("span",{onClick:function(){return n(e.id)},className:"mx-1",style:{width:8,height:8,borderRadius:"50%",display:"inline-block",background:a?"#007bff":"rgba(0,0,0,0.2)",cursor:"pointer"},"aria-label":"Ir para ".concat(e.alt),title:e.alt},e.id)})})]})}},70038(e,t,n){"use strict";n.d(t,{b1:()=>p,hY:()=>l,nx:()=>v,z1:()=>u,zS:()=>f});n(52675),n(89463),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362);var r=n(52354);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}function l(){return c.apply(this,arguments)}function c(){return(c=s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/work-shifts");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function u(e){return d.apply(this,arguments)}function d(){return(d=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.post("/time-management/work-shifts",t);case 1:return n=e.v,o=n.data,e.a(2,o.data)}},e)}))).apply(this,arguments)}function f(e,t){return m.apply(this,arguments)}function m(){return(m=s(a().m(function e(t,n){var o,i;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.put("/time-management/work-shifts/".concat(t),n);case 1:return o=e.v,i=o.data,e.a(2,i.data)}},e)}))).apply(this,arguments)}function p(e){return h.apply(this,arguments)}function h(){return(h=s(a().m(function e(t){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.delete("/time-management/work-shifts/".concat(t));case 1:return e.a(2)}},e)}))).apply(this,arguments)}function v(e,t){return b.apply(this,arguments)}function b(){return(b=s(a().m(function e(t,n){var o,i;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.post("/time-management/work-shifts/".concat(t,"/members"),{memberIds:n});case 1:return o=e.v,i=o.data,e.a(2,i.data)}},e)}))).apply(this,arguments)}},71458(e,t,n){"use strict";n.d(t,{A:()=>m});n(52675),n(89463),n(2259),n(28706),n(50113),n(23418),n(74423),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(9868),n(26099),n(27495),n(38781),n(21699),n(47764),n(71761),n(62953);var r=n(74848),a=n(46539),o=n(28482),i=n(69107),s=n(46668),l=n(77984),c=n(23495),u=n(88224);function d(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e){var t=e.selectedFilters,n=e.weeklyData,f=e.attendanceData,m=void 0===f?[]:f,p=t.includes("attendance"),h=t.includes("task"),v=(n.length>0&&n[0].label,[].concat(d(n.map(function(e){return e.total_hours})),d(m.map(function(e){return e.total_hours})))),b=Math.max.apply(Math,d(v).concat([8])),y=10*Math.ceil(b/10)||100,g=n.map(function(e,t){var n=m.find(function(t){return t.period===e.period}),r=h?e.total_hours:0,a=p&&n?n.total_hours:0,o=e.label||"Período ".concat(e.period),i=o;if("week"===e.type){var s=o.match(/^Sem \d+/);i=s?s[0]:o}return{label:i,fullLabel:o,type:e.type||"unknown",byTask:r,byAttendance:a,backgroundTask:Math.max(0,y-r),backgroundAttendance:Math.max(0,y-a)}}),x=g.length<=7?48:g.length<=12?36:24;return(0,r.jsxs)("div",{style:{userSelect:"none",transform:"none",transition:"none"},children:[(0,r.jsx)(o.u,{width:"100%",height:300,style:{transform:"none"},children:(0,r.jsxs)(u.E,{data:g,margin:{top:20,right:30,left:20,bottom:40},barSize:x,barGap:4,style:{cursor:"default"},onMouseMove:function(e){var t;return null==e||null===(t=e.stopPropagation)||void 0===t?void 0:t.call(e)},onMouseDown:function(e){var t;return null==e||null===(t=e.stopPropagation)||void 0===t?void 0:t.call(e)},onMouseUp:function(e){var t;return null==e||null===(t=e.stopPropagation)||void 0===t?void 0:t.call(e)},onClick:function(e){var t;return null==e||null===(t=e.stopPropagation)||void 0===t?void 0:t.call(e)},children:[(0,r.jsx)(i.d,{strokeDasharray:"3 3",vertical:!1,stroke:"#E0E0E0"}),(0,r.jsx)(c.h,{domain:[0,y],axisLine:!1,tickLine:!1,tick:{fill:"#5C5D5D",fontSize:12},width:40,tickFormatter:function(e){return"".concat(e,"h")}}),(0,r.jsx)(l.W,{dataKey:"label",axisLine:!1,tickLine:!1,tick:{fill:"#5C5D5D",fontSize:10},interval:0,angle:g.length>8?-45:0,textAnchor:g.length>8?"end":"middle",height:g.length>8?60:30}),(0,r.jsx)(a.m,{content:(0,r.jsx)(function(e){var t=e.active,n=e.payload;e.label;if(t&&n&&n.length){var a=n[0].payload;return(0,r.jsxs)("div",{style:{background:"rgba(255, 255, 255, 0.95)",border:"1px solid #ccc",borderRadius:"6px",padding:"6px 10px",boxShadow:"0 1px 4px rgba(0,0,0,0.1)",fontSize:"11px",lineHeight:"1.4",minWidth:"auto",maxWidth:"180px"},children:[(0,r.jsx)("div",{style:{fontWeight:600,marginBottom:"3px",fontSize:"11px",color:"#333"},children:a.fullLabel}),h&&a.byTask>0&&(0,r.jsxs)("div",{style:{color:"#17A2B8",fontSize:"10px",margin:"2px 0"},children:["Tarefa: ",(0,r.jsxs)("strong",{children:[a.byTask.toFixed(1),"h"]})]}),p&&a.byAttendance>0&&(0,r.jsxs)("div",{style:{color:"#186073",fontSize:"10px",margin:"2px 0"},children:["Registro: ",(0,r.jsxs)("strong",{children:[a.byAttendance.toFixed(1),"h"]})]})]})}return null},{})}),p&&(0,r.jsx)(s.yP,{dataKey:"byAttendance",fill:"#186073",radius:[4,4,0,0],isAnimationActive:!1}),h&&(0,r.jsx)(s.yP,{dataKey:"byTask",fill:"#17A2B8",radius:[4,4,0,0],isAnimationActive:!1})]})}),(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-center gap-4 mt-3",children:[p&&(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{paddingRight:"12px"},children:[(0,r.jsx)("div",{style:{width:"12px",height:"12px",background:"#186073",borderRadius:"2px",marginRight:"8px"}}),(0,r.jsx)("span",{style:{fontSize:"12px",color:"#5C5D5D"},children:"Por Registro de Ponto"})]}),h&&(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{paddingRight:"12px"},children:[(0,r.jsx)("div",{style:{width:"12px",height:"12px",background:"#17A2B8",borderRadius:"2px",marginRight:"8px"}}),(0,r.jsx)("span",{style:{fontSize:"12px",color:"#5C5D5D"},children:"Por Tarefa"})]})]})]})}},72210(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>g});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(58940),n(27495),n(38781),n(31415),n(47764),n(90744),n(42762),n(23500),n(62953);var r=n(74848),a=n(96540),o=n(97665),i=n(57097),s=n(34559),l=n(50455),c=n(55098),u=n(47339),d=n(76336);function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function h(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=f(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==f(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e){var t,n,r=e.trim().split(/\s+/);return((null!==(t=null===(n=r[0])||void 0===n?void 0:n[0])&&void 0!==t?t:"")+(r.length>1?r[r.length-1][0]:"")).toUpperCase()}function g(e){var t,n,f,m,h=e.data,b=e.title,g=e.searchKeyword,x=void 0===g?"":g,j=e.onSearchChange,w=e.roleOptions,S=void 0===w?[]:w,N=e.selectedRole,k=e.onRoleChange,C=e.isLoading,O=void 0!==C&&C,A=e.isLoadingRoles,E=void 0!==A&&A,P=(e.onOpenFilters,e.onApplyFilters),F=e.onClearFilters,T=e.hasActiveFilters,D=void 0!==T&&T,_=e.total,I=e.totalPages,M=e.page,R=void 0===M?1:M,z=e.pageSize,L=void 0===z?10:z,q=e.onPageChange,B=e.onPageSizeChange,G=(0,d.L)().canEdit,H=null!=_?_:h.length,W=Math.ceil(H/L),U=R<(null!=I?I:W),V=(0,o.jE)(),Q=v((0,a.useState)({isOpen:!1}),2),K=Q[0],$=Q[1],J=v((0,a.useState)(new Set),2),Y=(J[0],J[1]),Z=(0,i.n)({mutationFn:function(e){var t=e.occurrenceId,n=e.approved;return(0,c.KI)(t,n)},onSuccess:function(e,t){var n=t.approved?"Justificativa aprovada com sucesso!":"Justificativa rejeitada com sucesso!";u.A.success(n,"Sucesso"),Y(new Set),V.invalidateQueries({queryKey:["time-management","overview","members-occurrences"]})},onError:function(e){var t,n=(null==e||null===(t=e.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.error)||"Erro ao processar justificativa";u.A.error(n,"Erro")}}),X=function(e,t){Z.mutate({occurrenceId:e.id,approved:t})},ee=v((0,a.useState)(!1),2),te=ee[0],ne=ee[1],re=(0,a.useRef)(null),ae=(0,a.useRef)(null),oe=v((0,a.useState)({occurrenceType:"",timeStart:"",timeEnd:"",status:""}),2),ie=oe[0],se=oe[1],le=function(){P&&P(ie),ne(!1)},ce=function(){se({occurrenceType:"",timeStart:"",timeEnd:"",status:""}),F&&F(),ne(!1)};return(0,a.useEffect)(function(){Y(new Set)},[R,h]),(0,a.useEffect)(function(){function e(e){if(te){var t=e.target,n=re.current&&re.current.contains(t),r=ae.current&&ae.current.contains(t);n||r||ne(!1)}}return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[te]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.default,{isOpen:K.isOpen,onClose:function(){$({isOpen:!1})},memberName:(null===(t=K.occurrence)||void 0===t?void 0:t.nome)||"",memberInitials:(null===(n=K.occurrence)||void 0===n?void 0:n.iniciais)||y((null===(f=K.occurrence)||void 0===f?void 0:f.nome)||""),justify:null===(m=K.occurrence)||void 0===m?void 0:m.justify}),(0,r.jsxs)("div",{className:"card app-card-surface mt-2",children:[(0,r.jsxs)("div",{className:"card-header app-controls-bar tm-controls-bar",children:[(0,r.jsxs)("div",{className:"d-none d-lg-flex align-items-center w-100",children:[(0,r.jsx)("h3",{className:"card-title mb-0 mr-2",children:b}),(0,r.jsx)("span",{className:"text-muted","data-toggle":"tooltip","data-placement":"top",title:"Lista de ocorrências recentes",children:(0,r.jsx)("i",{className:"far fa-question-circle"})}),(0,r.jsxs)("div",{className:"ml-auto d-flex align-items-center",style:{gap:8},children:[(0,r.jsxs)("div",{className:"app-controls-search",style:{width:220},children:[(0,r.jsx)("i",{className:"fas fa-search mr-2 text-muted"}),(0,r.jsx)("input",{type:"text",className:"form-control",placeholder:"Buscar por membro",value:x,onChange:function(e){return null==j?void 0:j(e.target.value)}})]}),(0,r.jsx)("div",{style:{width:220},children:(0,r.jsx)(s.A,{options:S,value:N,placeholder:"Selecionar função",onChange:k,loading:E})}),(0,r.jsxs)("div",{className:"dropdown",ref:re,children:[(0,r.jsx)("button",{type:"button",className:"app-list-filter-btn ".concat(D?"has-filters":""),onClick:function(){return ne(!te)},title:D?"Filtros ativos":"Filtros",children:(0,r.jsx)("i",{className:"fas fa-filter"})}),te&&(0,r.jsxs)("div",{className:"dropdown-menu app-filter-dropdown show",style:{right:0},children:[(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Tipo de ocorrência"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:ie.occurrenceType,onChange:function(e){return se(p(p({},ie),{},{occurrenceType:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"atraso",children:"Atraso"}),(0,r.jsx)("option",{value:"duplicado",children:"Ponto duplicado"}),(0,r.jsx)("option",{value:"falta",children:"Falta"})]})]}),(0,r.jsxs)("div",{className:"form-row",children:[(0,r.jsxs)("div",{className:"form-group col",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Hora início"}),(0,r.jsx)("input",{type:"time",className:"form-control form-control-sm",value:ie.timeStart,onChange:function(e){return se(p(p({},ie),{},{timeStart:e.target.value}))}})]}),(0,r.jsxs)("div",{className:"form-group col",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Hora fim"}),(0,r.jsx)("input",{type:"time",className:"form-control form-control-sm",value:ie.timeEnd,onChange:function(e){return se(p(p({},ie),{},{timeEnd:e.target.value}))}})]})]}),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Status"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:ie.status,onChange:function(e){return se(p(p({},ie),{},{status:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"leve",children:"Leve"}),(0,r.jsx)("option",{value:"atencao",children:"Atenção"}),(0,r.jsx)("option",{value:"resolvido",children:"Resolvido"})]})]}),(0,r.jsxs)("div",{className:"d-flex justify-content-between pt-1",children:[(0,r.jsx)("button",{type:"button",className:"btn btn-sm text-muted",onClick:ce,children:"Limpar"}),(0,r.jsx)("button",{type:"button",className:"btn btn-sm btn-primary",onClick:le,children:"Aplicar"})]})]})]})]})]}),(0,r.jsxs)("div",{className:"d-lg-none",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between mb-2",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("h3",{className:"card-title mb-0",children:b}),(0,r.jsx)("span",{className:"ml-2 text-muted",title:"Lista de ocorrências recentes",children:(0,r.jsx)("i",{className:"far fa-question-circle"})})]}),(0,r.jsxs)("div",{className:"dropdown",ref:ae,children:[(0,r.jsx)("button",{type:"button",className:"app-list-filter-btn ".concat(D?"has-filters":""),onClick:function(){return ne(!te)},children:(0,r.jsx)("i",{className:"fas fa-filter"})}),te&&(0,r.jsxs)("div",{className:"dropdown-menu app-filter-dropdown show",style:{right:0},children:[(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Tipo de ocorrência"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:ie.occurrenceType,onChange:function(e){return se(p(p({},ie),{},{occurrenceType:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"atraso",children:"Atraso"}),(0,r.jsx)("option",{value:"duplicado",children:"Ponto duplicado"}),(0,r.jsx)("option",{value:"falta",children:"Falta"})]})]}),(0,r.jsxs)("div",{className:"form-row",children:[(0,r.jsxs)("div",{className:"form-group col",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Hora início"}),(0,r.jsx)("input",{type:"time",className:"form-control form-control-sm",value:ie.timeStart,onChange:function(e){return se(p(p({},ie),{},{timeStart:e.target.value}))}})]}),(0,r.jsxs)("div",{className:"form-group col",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Hora fim"}),(0,r.jsx)("input",{type:"time",className:"form-control form-control-sm",value:ie.timeEnd,onChange:function(e){return se(p(p({},ie),{},{timeEnd:e.target.value}))}})]})]}),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Status"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:ie.status,onChange:function(e){return se(p(p({},ie),{},{status:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"leve",children:"Leve"}),(0,r.jsx)("option",{value:"atencao",children:"Atenção"}),(0,r.jsx)("option",{value:"resolvido",children:"Resolvido"})]})]}),(0,r.jsxs)("div",{className:"d-flex justify-content-between pt-1",children:[(0,r.jsx)("button",{type:"button",className:"btn btn-sm text-muted",onClick:ce,children:"Limpar"}),(0,r.jsx)("button",{type:"button",className:"btn btn-sm btn-primary",onClick:le,children:"Aplicar"})]})]})]})]}),(0,r.jsxs)("div",{className:"d-flex flex-column",children:[(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsxs)("div",{className:"app-controls-search",children:[(0,r.jsx)("i",{className:"fas fa-search mr-2 text-muted"}),(0,r.jsx)("input",{type:"text",className:"form-control",placeholder:"Buscar por membro",value:x,onChange:function(e){return null==j?void 0:j(e.target.value)}})]})}),(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsx)(s.A,{options:S,value:N,placeholder:"Selecionar função",size:"sm",onChange:k,loading:E,className:""})})]})]})]}),(0,r.jsxs)("div",{className:"card-body p-0",children:[(0,r.jsx)("div",{className:"ms-table-occurrences-wrapper",children:(0,r.jsxs)("table",{className:"ms-table-occurrences ms-table-occurrences-with-divider",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Colaborador"}),(0,r.jsx)("th",{children:"Ocorrências"}),(0,r.jsx)("th",{children:"Horário do ponto"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"ms-text-right",children:"Ações"})]})}),(0,r.jsxs)("tbody",{children:[O?(0,r.jsx)("tr",{children:(0,r.jsxs)("td",{colSpan:5,className:"ms-table-occurrences-empty",children:[(0,r.jsx)("div",{className:"spinner-border text-primary",role:"status",children:(0,r.jsx)("span",{className:"sr-only",children:"Carregando..."})}),(0,r.jsx)("p",{className:"text-muted mt-2 mb-0",children:"Carregando ocorrências..."})]})}):h.map(function(e){var t,n,a,o,i,s=null!==(t=e.iniciais)&&void 0!==t?t:y(e.nome),l=null!==(n=e.avatarBg)&&void 0!==n?n:"bg-secondary";return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("div",{className:"rounded text-white d-inline-flex align-items-center justify-content-center ".concat(l),style:{width:36,height:36,fontWeight:700},children:s}),(0,r.jsx)("span",{className:"ml-2",children:e.nome})]})}),(0,r.jsx)("td",{children:(i=e.ocorrencia,{ponto_duplicado:"Ponto Duplicado",atraso:"Atraso",atraso_severo:"Atraso Severo",saida_antecipada:"Saída Antecipada",ponto_dia_folga:"Ponto em Dia de Folga",ausencia_sem_justificativa:"Ausência sem Justificativa",ausencia_com_justificativa:"Ausência com Justificativa",registro_nao_fechado:"Ponto Não Fechado",sequencia_invalida:"Sequência Inválida"}[i]||i)}),(0,r.jsx)("td",{children:e.horario}),(0,r.jsx)("td",{children:(a=e.status,o={leve:{color:"#01D6C5",label:"Leve"},atencao:{color:"#DC3545",label:"Atenção"},resolvido:{color:"#17A2B8BF",label:"Resolvido"},pendente:{color:"#DC3545",label:"Pendente"}}[a],(0,r.jsxs)("div",{className:"ms-table-occurrences-status",children:[(0,r.jsx)("span",{className:"ms-table-occurrences-status-dot",style:{backgroundColor:o.color}}),(0,r.jsx)("span",{children:o.label})]}))}),(0,r.jsx)("td",{className:"ms-text-right",children:(0,r.jsxs)("div",{className:"btn-group",children:[(0,r.jsx)("button",{type:"button",className:"ms-table-occurrences-action-button","data-toggle":"dropdown","aria-expanded":"false",title:"Mais ações",children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v ms-table-occurrences-action-icon"})}),(0,r.jsxs)("div",{className:"dropdown-menu dropdown-menu-right",role:"menu",children:[(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(t){var n;t.preventDefault(),$({isOpen:!0,occurrence:n=e}),Y(function(e){return new Set(e).add(n.id)})},children:[(0,r.jsx)("i",{className:"far fa-file-alt mr-2"})," Ler Justificativa"]}),G&&(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(t){t.preventDefault(),X(e,!0)},disabled:Z.isPending||"resolvido"===e.status||"pendente"===e.status,children:[(0,r.jsx)("i",{className:"fas fa-check mr-2"}),Z.isPending?"Processando...":"Aprovar"]}),G&&(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(t){t.preventDefault(),X(e,!1)},disabled:Z.isPending||"resolvido"===e.status||"pendente"===e.status,children:[(0,r.jsx)("i",{className:"fas fa-times mr-2"}),"Rejeitar"]})]})]})})]},e.id)}),!O&&0===h.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:5,className:"ms-table-occurrences-empty",children:"Nenhuma ocorrência"})})]})]})}),(0,r.jsxs)("div",{className:"app-table-footer",style:{padding:"15px"},children:[(0,r.jsx)("div",{className:"app-table-footer__left",children:(0,r.jsxs)("small",{className:"text-muted",children:["Mostrando ",h.length," de ",H," Resultados"]})}),(0,r.jsx)("nav",{"aria-label":"Navegação da tabela",className:"app-table-footer__center",children:(0,r.jsxs)("ul",{className:"pagination pagination-sm mb-0 app-table-pagination",children:[(0,r.jsx)("li",{className:"page-item ".concat(R<=1?"disabled":""),children:(0,r.jsx)("button",{className:"page-link",onClick:function(){return null==q?void 0:q(Math.max(1,R-1))},"aria-label":"Anterior",disabled:R<=1,children:(0,r.jsx)("span",{"aria-hidden":"true",children:"‹"})})}),(0,r.jsx)("li",{className:"page-item active",children:(0,r.jsx)("span",{className:"page-link",children:R})}),(0,r.jsx)("li",{className:"page-item ".concat(U?"":"disabled"),children:(0,r.jsx)("button",{className:"page-link",onClick:function(){U&&(null==q||q(R+1))},"aria-label":"Próxima",disabled:!U,children:(0,r.jsx)("span",{"aria-hidden":"true",children:"›"})})})]})}),(0,r.jsxs)("div",{className:"d-flex align-items-center app-table-footer__right",children:[(0,r.jsx)("span",{className:"text-muted mr-2",children:"Resultados por página"}),(0,r.jsx)("select",{className:"custom-select custom-select-sm",style:{width:72},value:L,onChange:function(e){return null==B?void 0:B(parseInt(e.target.value,10))},children:[10,20,50,100].map(function(e){return(0,r.jsx)("option",{value:e,children:e},e)})})]})]})]})]})]})}},72722(e,t,n){"use strict";n.d(t,{A:()=>m});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(50113),n(51629),n(23418),n(74423),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(27495),n(38781),n(21699),n(47764),n(23500),n(62953);var r=n(74848),a=n(96540);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||d(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e){var t=e.options,n=e.selectedValues,o=e.onChange,i=e.placeholder,l=void 0===i?"Selecione":i,d=e.className,f=void 0===d?"":d,m=e.style,p=void 0===m?{}:m,h=e.dropdownStyle,v=void 0===h?{}:h,b=u((0,a.useState)(!1),2),y=b[0],g=b[1],x=(0,a.useRef)(null);(0,a.useEffect)(function(){var e=function(e){x.current&&!x.current.contains(e.target)&&g(!1)};return y&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[y]);var j=function(e){n.includes(e)?o(n.filter(function(t){return t!==e})):o([].concat(c(n),[e]))};return(0,r.jsxs)("div",{ref:x,className:"dropdown ".concat(f),style:s({position:"relative",display:"inline-block",minWidth:"220px"},p),children:[(0,r.jsxs)("button",{type:"button",className:"d-flex justify-content-between align-items-center",onClick:function(){return g(!y)},style:{width:"100%",minWidth:"fit-content",padding:"10px 12px",backgroundColor:"#F8F9FA",border:"1px solid #E0E0E0",height:"20px",borderRadius:"8px",cursor:"pointer",color:"#5C5D5D",outline:"none",transition:"all 0.2s ease",whiteSpace:"nowrap"},onMouseEnter:function(e){e.currentTarget.style.backgroundColor="#F0F0F0"},onMouseLeave:function(e){e.currentTarget.style.backgroundColor="#F8F9FA"},children:[(0,r.jsx)("span",{style:{textAlign:"left",paddingRight:"8px",whiteSpace:"nowrap"},children:function(){if(0===n.length)return l;if(n.length===t.length)return"".concat(t.length," Opções Selecionadas");if(1===n.length){var e=t.find(function(e){return e.value===n[0]});return(null==e?void 0:e.label)||l}return"".concat(n.length," Opções Selecionadas")}()}),(0,r.jsx)("i",{className:"fas fa-chevron-down",style:{fontSize:"10px",color:"#999",flexShrink:0,transform:y?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}})]}),y&&(0,r.jsx)("div",{style:s({position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:"100%",width:"max-content",backgroundColor:"#FFFFFF",border:"1px solid #E0E0E0",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.1)",zIndex:1e3,maxHeight:"250px",overflowY:"auto"},v),children:t.map(function(e){return(0,r.jsxs)("label",{style:{display:"flex",alignItems:"center",padding:"8px 16px",cursor:"pointer",fontSize:"14px",color:"#333",fontFamily:"Inter",fontWeight:400,lineHeight:"100%",letterSpacing:"0%",transition:"background-color 0.15s ease",whiteSpace:"nowrap"},onMouseEnter:function(e){e.currentTarget.style.backgroundColor="#F8F9FA"},onMouseLeave:function(e){e.currentTarget.style.backgroundColor="transparent"},children:[(0,r.jsx)("input",{type:"checkbox",className:"tm-select-checkbox",checked:n.includes(e.value),onChange:function(){return j(e.value)}}),(0,r.jsx)("span",{style:{whiteSpace:"nowrap",fontFamily:"Inter",fontWeight:400,lineHeight:"100%",letterSpacing:"0%"},children:e.label})]},e.value)})})]})}},72810(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>o});n(62062),n(26099);var r=n(74848),a=n(82942);function o(e){var t=e.isOpen,n=e.onClose,o=e.options,i=e.onSelectOption;return t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{onClick:n,style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1040,animation:"fadeIn 0.2s ease-in-out"}}),(0,r.jsxs)("div",{style:{position:"fixed",bottom:0,left:0,right:0,backgroundColor:"#FFFFFF",borderRadius:"16px 16px 0 0",padding:"24px 20px",paddingBottom:"32px",zIndex:1050,animation:"slideUp 0.3s ease-out",boxShadow:"0 -4px 16px rgba(0, 0, 0, 0.1)"},children:[(0,r.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,r.jsx)("h5",{style:{fontFamily:"Inter",fontSize:"18px",fontWeight:600,color:"#1F2937",marginBottom:"4px"},children:"Registrar Ponto"}),(0,r.jsx)("p",{style:{fontFamily:"Inter",fontSize:"13px",color:"#9CA3AF",margin:0},children:"Selecione uma opção para registrar seu ponto"})]}),(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:o.map(function(e,t){return(0,r.jsxs)("button",{onClick:function(){i(e),n()},style:{display:"flex",alignItems:"center",gap:"16px",padding:"16px",backgroundColor:"#F9FAFB",border:"none",borderRadius:"8px",cursor:"pointer",transition:"background-color 0.2s",width:"100%"},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#F3F4F6"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="#F9FAFB"},children:[(0,r.jsx)("div",{style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#FFFFFF",borderRadius:"8px",color:"#17A2B8"},children:(0,r.jsx)("i",{className:(0,a.JC)(e),style:{fontSize:"20px"}})}),(0,r.jsx)("div",{style:{flex:1,textAlign:"left"},children:(0,r.jsx)("div",{style:{fontFamily:"Inter",fontSize:"15px",fontWeight:500,color:"#1F2937"},children:(0,a.kC)(e)})})]},t)})}),(0,r.jsx)("button",{onClick:n,style:{width:"100%",marginTop:"16px",padding:"14px",backgroundColor:"transparent",border:"1px solid #E5E7EB",borderRadius:"8px",color:"#6B7280",fontSize:"15px",fontWeight:500,fontFamily:"Inter",cursor:"pointer"},children:"Cancelar"})]}),(0,r.jsx)("style",{children:"\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n \n @keyframes slideUp {\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n }\n "})]}):null}},73215(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>m});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(58940),n(27495),n(38781),n(47764),n(23500),n(62953);var r=n(74848),a=n(96540),o=n(61909),i=n(88195);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==s(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e){var t=e.data,n=e.total,s=e.totalPages,l=e.page,u=void 0===l?1:l,f=e.pageSize,m=void 0===f?10:f,p=e.onPageChange,h=e.onPageSizeChange,v=e.title,b=void 0===v?"Histórico":v,y=(e.onOpenFilters,e.hasActiveFilters),g=void 0!==y&&y,x=e.searchKeyword,j=void 0===x?"":x,w=e.onSearchChange,S=e.onExportCSV,N=e.isExporting,k=void 0!==N&&N,C=e.isLoading,O=void 0!==C&&C,A=e.onApplyFilters,E=e.onClearFilters,P=d((0,a.useState)(!1),2),F=P[0],T=P[1],D=d((0,a.useState)(null),2),_=D[0],I=D[1],M=null!=n?n:t.length,R=Math.ceil(M/m),z=u<(null!=s?s:R),L=d((0,a.useState)(!1),2),q=L[0],B=L[1],G=(0,a.useRef)(null),H=(0,a.useRef)(null),W=d((0,a.useState)({recordType:"",validatedBy:"",channel:"",mode:""}),2),U=W[0],V=W[1],Q=function(){A&&A(U),B(!1)},K=function(){V({recordType:"",validatedBy:"",channel:"",mode:""}),E&&E(),B(!1)};return(0,a.useEffect)(function(){function e(e){if(q){var t=e.target,n=G.current&&G.current.contains(t),r=H.current&&H.current.contains(t);n||r||B(!1)}}return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[q]),(0,r.jsxs)("div",{className:"card app-card-surface mt-3",children:[(0,r.jsxs)("div",{className:"card-header app-controls-bar tm-controls-bar",children:[(0,r.jsxs)("div",{className:"d-none d-lg-flex align-items-center",children:[(0,r.jsx)("h3",{className:"card-title mb-0 mr-3",children:b}),(0,r.jsxs)("div",{className:"card-tools ml-auto d-flex align-items-center",children:[(0,r.jsxs)("button",{type:"button",className:"app-table-action-btn ml-2",onClick:S,disabled:k,children:[(0,r.jsx)("i",{className:"fas ".concat(k?"fa-spinner fa-spin":"fa-file"," mr-2")}),k?"Exportando...":"Exportar CSV"]}),(0,r.jsxs)("div",{className:"app-controls-search ml-2",style:{width:220},children:[(0,r.jsx)("i",{className:"fas fa-search mr-2 text-muted"}),(0,r.jsx)("input",{type:"text",className:"form-control",placeholder:"Buscar por Membro",value:j,onChange:function(e){return null==w?void 0:w(e.target.value)}})]}),(0,r.jsxs)("div",{className:"dropdown ml-2",ref:G,children:[(0,r.jsx)("button",{type:"button",className:"app-list-filter-btn ".concat(g?"has-filters":""),onClick:function(){return B(!q)},title:"Filtros",children:(0,r.jsx)("i",{className:"fas fa-filter"})}),q&&(0,r.jsxs)("div",{className:"dropdown-menu app-filter-dropdown show",style:{right:0},children:[(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Tipo de registro"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:U.recordType,onChange:function(e){return V(c(c({},U),{},{recordType:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"first_check_in",children:"Primeira Entrada"}),(0,r.jsx)("option",{value:"first_check_out",children:"Primeira Saída"}),(0,r.jsx)("option",{value:"second_check_in",children:"Segunda Entrada"}),(0,r.jsx)("option",{value:"second_check_out",children:"Segunda Saída"})]})]}),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Validação por"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:U.validatedBy,onChange:function(e){return V(c(c({},U),{},{validatedBy:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"selfie",children:"Selfie"}),(0,r.jsx)("option",{value:"screenshot",children:"Screenshot"}),(0,r.jsx)("option",{value:"geolocation",children:"Geolocalização"}),(0,r.jsx)("option",{value:"manual",children:"Manual"})]})]}),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Canal"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:U.channel,onChange:function(e){return V(c(c({},U),{},{channel:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"mobile",children:"App"}),(0,r.jsx)("option",{value:"web",children:"Navegador"}),(0,r.jsx)("option",{value:"sistema",children:"Sistema"})]})]}),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Modo"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:U.mode,onChange:function(e){return V(c(c({},U),{},{mode:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"individual",children:"Individual"}),(0,r.jsx)("option",{value:"coletivo",children:"Coletivo"})]})]}),(0,r.jsxs)("div",{className:"d-flex justify-content-between pt-1",children:[(0,r.jsx)("button",{className:"btn btn-sm text-muted",type:"button",onClick:K,children:"Limpar"}),(0,r.jsx)("button",{className:"btn btn-sm btn-primary",type:"button",onClick:Q,children:"Aplicar"})]})]})]})]})]}),(0,r.jsxs)("div",{className:"d-lg-none",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between mb-2",children:[(0,r.jsx)("h3",{className:"card-title mb-0",children:b}),(0,r.jsxs)("div",{className:"dropdown",ref:H,children:[(0,r.jsx)("button",{type:"button",className:"app-list-filter-btn ".concat(g?"has-filters":""),onClick:function(){return B(!q)},children:(0,r.jsx)("i",{className:"fas fa-filter"})}),q&&(0,r.jsxs)("div",{className:"dropdown-menu app-filter-dropdown show",style:{right:0},children:[(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Tipo de registro"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:U.recordType,onChange:function(e){return V(c(c({},U),{},{recordType:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"first_check_in",children:"Primeira Entrada"}),(0,r.jsx)("option",{value:"first_check_out",children:"Primeira Saída"}),(0,r.jsx)("option",{value:"second_check_in",children:"Segunda Entrada"}),(0,r.jsx)("option",{value:"second_check_out",children:"Segunda Saída"})]})]}),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Validação por"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:U.validatedBy,onChange:function(e){return V(c(c({},U),{},{validatedBy:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"selfie",children:"Selfie"}),(0,r.jsx)("option",{value:"screenshot",children:"Screenshot"}),(0,r.jsx)("option",{value:"geolocation",children:"Geolocalização"}),(0,r.jsx)("option",{value:"manual",children:"Manual"})]})]}),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Canal"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:U.channel,onChange:function(e){return V(c(c({},U),{},{channel:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"mobile",children:"App"}),(0,r.jsx)("option",{value:"web",children:"Navegador"}),(0,r.jsx)("option",{value:"sistema",children:"Sistema"})]})]}),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Modo"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:U.mode,onChange:function(e){return V(c(c({},U),{},{mode:e.target.value}))},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"individual",children:"Individual"}),(0,r.jsx)("option",{value:"coletivo",children:"Coletivo"})]})]}),(0,r.jsxs)("div",{className:"d-flex justify-content-between pt-1",children:[(0,r.jsx)("button",{className:"btn btn-sm text-muted",type:"button",onClick:K,children:"Limpar"}),(0,r.jsx)("button",{className:"btn btn-sm btn-primary",type:"button",onClick:Q,children:"Aplicar"})]})]})]})]}),(0,r.jsxs)("div",{className:"d-flex flex-column",children:[(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsxs)("div",{className:"input-group input-group-sm",children:[(0,r.jsx)("input",{type:"text",className:"form-control",placeholder:"Buscar por Membro",value:j,onChange:function(e){return null==w?void 0:w(e.target.value)}}),(0,r.jsx)("div",{className:"input-group-append",children:(0,r.jsx)("button",{type:"button",className:"btn btn-default",children:(0,r.jsx)("i",{className:"fas fa-search"})})})]})}),(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsxs)("button",{type:"button",className:"btn btn-sm btn-default w-100",title:"Exportar CSV",onClick:S,disabled:k,children:[(0,r.jsx)("i",{className:"fas ".concat(k?"fa-spinner fa-spin":"fa-file"," mr-2")}),k?"Exportando...":"Exportar CSV"]})})]})]})]}),(0,r.jsx)("div",{className:"card-body",children:O?(0,r.jsx)("div",{className:"text-center py-4",children:(0,r.jsx)("div",{className:"spinner-border text-primary",role:"status",children:(0,r.jsx)("span",{className:"sr-only",children:"Carregando..."})})}):(0,r.jsx)(i.A,{columns:[{key:"nome",label:"Nome"},{key:"data",label:"Data",width:"18%"},{key:"tipo",label:"Tipo de Registro",width:"16%"},{key:"validacao",label:"Validação por",width:"18%"},{key:"canal",label:"Canal",width:"16%"},{key:"modo",label:"Modo",width:"12%"},{key:"acoes",label:"Ações",width:"8%",align:"right"}],data:t,renderRow:function(e){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"ms-table-cell",style:{textTransform:"capitalize"},children:e.nome}),(0,r.jsx)("td",{className:"ms-table-cell",style:{textTransform:"capitalize"},children:e.data}),(0,r.jsx)("td",{className:"ms-table-cell",style:{textTransform:"capitalize"},children:e.tipo}),(0,r.jsx)("td",{className:"ms-table-cell",style:{textTransform:"capitalize"},children:e.validacao}),(0,r.jsx)("td",{className:"ms-table-cell",style:{textTransform:"capitalize"},children:e.canal}),(0,r.jsx)("td",{className:"ms-table-cell",style:{textTransform:"capitalize"},children:e.modo}),(0,r.jsx)("td",{className:"app-table-cell-right",children:(0,r.jsx)("button",{type:"button",className:"app-table-action-button",onClick:function(){return function(e){var t={id:e.id,memberName:e.nome,memberId:e.memberId||0,time:e.data,recordType:e.tipo,type:e.type||"",validatedBy:e.validacao,channel:e.canal,mode:e.modo,status:e.status||"registrado",latitude:e.latitude||null,longitude:e.longitude||null,selfie:e.selfie||null,print:e.print||null,createdAt:e.createdAt||"",updatedAt:e.updatedAt||"",justificationType:e.justificationType||null,justificationId:e.justificationId||null,justification:e.justification||null};I(t),T(!0)}(e)},title:"Visualizar detalhes",children:(0,r.jsx)("i",{className:"fas fa-eye app-table-action-icon"})})})]})},emptyMessage:"Sem registros"})}),(0,r.jsxs)("div",{className:"card-footer app-table-footer",children:[(0,r.jsx)("div",{className:"app-table-footer__left",children:(0,r.jsxs)("small",{className:"text-muted",children:["Mostrando ",t.length," de ",M," Resultados"]})}),(0,r.jsx)("nav",{"aria-label":"Navegação da tabela",className:"app-table-footer__center",children:(0,r.jsxs)("ul",{className:"pagination pagination-sm mb-0 app-table-pagination",children:[(0,r.jsx)("li",{className:"page-item ".concat(u<=1?"disabled":""),children:(0,r.jsx)("button",{className:"page-link",onClick:function(){return null==p?void 0:p(Math.max(1,u-1))},"aria-label":"Anterior",disabled:u<=1,children:(0,r.jsx)("span",{"aria-hidden":"true",children:"‹"})})}),(0,r.jsx)("li",{className:"page-item active",children:(0,r.jsx)("span",{className:"page-link",children:u})}),(0,r.jsx)("li",{className:"page-item ".concat(z?"":"disabled"),children:(0,r.jsx)("button",{className:"page-link",onClick:function(){z&&(null==p||p(u+1))},"aria-label":"Próxima",disabled:!z,children:(0,r.jsx)("span",{"aria-hidden":"true",children:"›"})})})]})}),(0,r.jsxs)("div",{className:"d-flex align-items-center app-table-footer__right",children:[(0,r.jsx)("span",{className:"text-muted mr-2",children:"Resultados por página"}),(0,r.jsx)("select",{className:"custom-select custom-select-sm",style:{width:72},value:m,onChange:function(e){return null==h?void 0:h(parseInt(e.target.value,10))},children:[10,20,50,100].map(function(e){return(0,r.jsx)("option",{value:e,children:e},e)})})]})]}),(0,r.jsx)(o.default,{isOpen:F,onClose:function(){T(!1),I(null)},record:_})]})}},73236(e,t,n){"use strict";n.d(t,{A:()=>a});var r=n(74848);function a(e){var t=e.title,n=e.children,a=e.headerActions,o=e.className,i=void 0===o?"":o,s=e.bodyClassName,l=void 0===s?"":s;return(0,r.jsxs)("div",{className:"card app-card-surface ".concat(i),children:[(0,r.jsxs)("div",{className:"card-header app-controls-bar tm-controls-bar d-flex align-items-center",children:[(0,r.jsx)("h3",{className:"mb-0 mr-auto card-title",children:t}),a&&(0,r.jsx)("div",{children:a})]}),(0,r.jsx)("div",{className:"card-body ".concat(l),children:n})]})}},73638(e,t,n){"use strict";n.d(t,{A:()=>d,d:()=>f});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23418),n(64346),n(23792),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(58940),n(27495),n(38781),n(47764),n(23500),n(62953),n(76031);var r=n(74848),a=n(96540);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){var t=e.show,n=e.onClose,o=e.children,i=e.position,l=void 0===i?"bottom":i,u=e.width,d=void 0===u?"auto":u,f=e.triggerRef,m=e.centered,p=void 0!==m&&m,h=(0,a.useRef)(null),v=c((0,a.useState)({}),2),b=v[0],y=v[1];(0,a.useEffect)(function(){if(t){var e=function(e){var t=e.target;!h.current||h.current.contains(t)||null!=f&&f.current&&f.current.contains(t)||n()};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}},[t,n,f]);var g=(0,a.useCallback)(function(){if(t&&null!=f&&f.current&&h.current){var e=f.current.getBoundingClientRect(),n=h.current.offsetWidth||parseInt(d)||220,r=p?0:-150,a={position:"fixed",zIndex:900};switch(l){case"left":a.top="".concat(e.top,"px"),a.right="".concat(window.innerWidth-e.left+8,"px");break;case"right":a.top="".concat(e.top,"px"),a.left="".concat(e.right+8,"px");break;case"bottom":if(a.top="".concat(e.bottom+8,"px"),p){var o=e.left+e.width/2;a.left="".concat(o-n/2,"px")}else a.left="".concat(e.left+r,"px");a.transform="none",a.right="auto";break;case"top":if(a.bottom="".concat(window.innerHeight-e.top+8,"px"),p){var i=e.left+e.width/2;a.left="".concat(i-n/2,"px")}else a.left="".concat(e.left+r,"px");a.transform="none",a.right="auto"}y(a)}},[t,f,p,l,d]);return(0,a.useEffect)(function(){if(t)return window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),function(){window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g)}},[t,g]),(0,a.useEffect)(function(){if(t&&null!=f&&f.current&&h.current)g(),setTimeout(g,0);else if(t&&(null==f||!f.current)){y({left:{position:"absolute",top:"0",right:"100%",marginRight:"8px",transform:"none"},right:{position:"absolute",top:"0",left:"100%",marginLeft:"8px",transform:"none"},bottom:{position:"absolute",top:"100%",left:"0",transform:"none",marginTop:"8px"},top:{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px"}}[l])}},[t,l,f,g]),t?(0,r.jsx)("div",{ref:h,className:"dropdown-menu show",style:s(s({},b),{},{width:d}),children:o}):null}function f(e){var t=e.children;return(0,r.jsx)("div",{style:{position:"relative",display:"inline-block"},children:t})}},75842(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>d});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(20826),i=n(73638),s=n(92268),l={card:{backgroundColor:"#FFF",borderRadius:"8px",padding:"20px",marginTop:"20px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},title:{color:"#17A2B8",fontSize:"16px",fontWeight:600,marginBottom:"15px"},counter:{fontSize:"12px",fontWeight:400,color:"rgba(0, 0, 0, 0.25)",padding:"12px 15px",backgroundColor:"#EAEBEE",borderRadius:"5px",textAlign:"center",minWidth:"170px"},iconButton:{background:"transparent",border:"none",cursor:"pointer",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.2rem"},iconImage:{width:"20px",height:"20px"},select:{fontSize:"14px",padding:"8px 12px",border:"1px solid #EAEEF3",borderRadius:"5px",width:"100%",color:"#5C5D5D"},popover:{position:"absolute !important",top:"0 !important",right:"100% !important",marginRight:"8px !important",backgroundColor:"#FFF",border:"1px solid #EAEEF3",borderRadius:"5px",boxShadow:"0 4px 12px rgba(0,0,0,0.25)",zIndex:"9999 !important",minWidth:"200px",maxHeight:"300px",overflowY:"auto"},popoverItem:{padding:"10px 15px",cursor:"pointer",fontSize:"13px",color:"#5C5D5D",borderBottom:"1px solid #EAEEF3"}};function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){e.selectedProject,e.selectedActivity,e.onSelectActivity,e.onAddNewActivity,e.atividadesDisponiveis;var t=e.counterMode,n=e.onModeChange,u=e.onStartCounter,d=e.onStopCounter,f=e.onAddManualTime,m=e.isCounterRunning,p=e.counterTime,h=c((0,a.useState)(!1),2),v=h[0],b=h[1],y=(0,a.useRef)(null);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("style",{children:"\n\t\t\t\n\t\t\t"}),(0,r.jsx)("div",{style:l.counter,className:"counter-display-responsive",children:"automatico"===t?m?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{style:{fontSize:"14px",fontWeight:600,color:"#17A2B8"},children:p}),(0,r.jsx)("div",{style:{fontSize:"10px",color:"#6C757D"},children:"Contando..."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{style:{fontSize:"14px",fontWeight:600,color:"#6C757D"},children:p}),(0,r.jsx)("div",{style:{fontSize:"10px",color:"#6C757D"},children:"Pronto para iniciar"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{style:{fontSize:"14px",fontWeight:600,color:"#6C757D"},children:"Modo Manual"}),(0,r.jsx)("div",{style:{fontSize:"10px",color:"#6C757D"}})]})}),"automatico"===t?m?(0,r.jsx)(o.A,{label:"Parar Contador",icon:"/images/icons/stop.svg",variant:"solid",onClick:d,className:"btn-larger"}):(0,r.jsx)(o.A,{label:"Iniciar contador",icon:"/images/icons/Group(6).png",variant:"solid",onClick:u}):(0,r.jsx)(o.A,{label:"Adicionar Tempo",icon:"fas fa-plus",variant:"solid",onClick:f,className:"btn-larger"}),(0,r.jsxs)(i.d,{children:[(0,r.jsx)("button",{ref:y,style:l.iconButton,onClick:function(){return b(!v)},title:"Modo do Contador",className:"btn btn-link text-muted p-0",children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v"})}),(0,r.jsx)(s.A,{show:v,onClose:function(){return b(!1)},position:"bottom",triggerRef:y,options:[{label:"Automático",value:"automatico",icon:"/images/icons/automatico.svg",selected:"automatico"===t},{label:"Manual",value:"manual",icon:"/images/icons/play.svg",selected:"manual"===t}],onSelect:function(e){return n(e)}})]})]})}},75930(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>V});n(52675),n(89463),n(2259),n(45700),n(28706),n(88431),n(2008),n(50113),n(51629),n(23418),n(74423),n(64346),n(23792),n(48598),n(62062),n(72712),n(34782),n(15086),n(26910),n(59089),n(1688),n(60739),n(89572),n(23288),n(94170),n(62010),n(36033),n(2892),n(40150),n(59904),n(67945),n(84185),n(83851),n(81278),n(40875),n(79432),n(10287),n(26099),n(3362),n(27495),n(38781),n(31415),n(21699),n(47764),n(71761),n(68156),n(25440),n(42762),n(23500),n(62953),n(3296),n(27208),n(48408);var r=n(74848),a=n(96540),o=n(53482),i=n(97665),s=n(33930),l=n(57097),c=n(50860),u=n(1806),d=n(12921),f=n(52354);function m(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return p(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(p(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,p(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,p(d,"constructor",c),p(c,"constructor",l),l.displayName="GeneratorFunction",p(c,a,"GeneratorFunction"),p(d),p(d,a,"Generator"),p(d,r,function(){return this}),p(d,"toString",function(){return"[object Generator]"}),(m=function(){return{w:o,m:f}})()}function p(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}p=function(e,t,n,r){function o(t,n){p(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},p(e,t,n,r)}function h(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function v(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){h(o,r,a,i,s,"next",e)}function s(e){h(o,r,a,i,s,"throw",e)}i(void 0)})}}function b(){return(b=v(m().m(function e(t){var n,r;return m().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,f.F.post("/time-management/presence-lists",t);case 1:return n=e.v,r=n.data,e.a(2,r)}},e)}))).apply(this,arguments)}function y(){return(y=v(m().m(function e(t,n){var r,a;return m().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,f.F.post("/time-management/presence-lists/".concat(t,"/recreate"),n);case 1:return r=e.v,a=r.data,e.a(2,a)}},e)}))).apply(this,arguments)}function g(e){return x.apply(this,arguments)}function x(){return(x=v(m().m(function e(t){return m().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,f.F.delete("/time-management/presence-lists/".concat(t));case 1:return e.a(2)}},e)}))).apply(this,arguments)}function j(e,t){return w.apply(this,arguments)}function w(){return(w=v(m().m(function e(t,n){return m().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,f.F.delete("/time-management/presence-lists/".concat(t,"/participants/").concat(n));case 1:return e.a(2)}},e)}))).apply(this,arguments)}function S(e){return N.apply(this,arguments)}function N(){return(N=v(m().m(function e(t){var n,r;return m().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,f.F.get("/v2/file-management/files/".concat(t));case 1:return n=e.v,r=n.data,e.a(2,r.data)}},e)}))).apply(this,arguments)}function k(){return C.apply(this,arguments)}function C(){return(C=v(m().m(function e(){var t,n;return m().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,f.F.get("/time-management/presence-lists");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function O(e){return A.apply(this,arguments)}function A(){return(A=v(m().m(function e(t){var n,r;return m().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,f.F.get("/time-management/presence-lists/".concat(t));case 1:return n=e.v,r=n.data,e.a(2,r.data)}},e)}))).apply(this,arguments)}function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function P(e){return function(e){if(Array.isArray(e))return q(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||L(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F(Object(n),!0).forEach(function(t){D(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function D(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=E(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==E(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return I(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(I(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,I(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,I(d,"constructor",c),I(c,"constructor",l),l.displayName="GeneratorFunction",I(c,a,"GeneratorFunction"),I(d),I(d,a,"Generator"),I(d,r,function(){return this}),I(d,"toString",function(){return"[object Generator]"}),(_=function(){return{w:o,m:f}})()}function I(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}I=function(e,t,n,r){function o(t,n){I(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},I(e,t,n,r)}function M(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function R(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){M(o,r,a,i,s,"next",e)}function s(e){M(o,r,a,i,s,"throw",e)}i(void 0)})}}function z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||L(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(e,t){if(e){if("string"==typeof e)return q(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(e,t):void 0}}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var B=[{value:"",label:"Status"},{value:"draft",label:"Rascunho"},{value:"in_progress",label:"Em andamento"},{value:"finished",label:"Finalizado"}],G=[{value:"",label:"Status"},{value:"Presente",label:"Presente"},{value:"Pendente",label:"Pendente"},{value:"Ausente",label:"Ausente"}],H=[{value:"treinamento",label:"Treinamento"},{value:"palestra",label:"Palestra"},{value:"workshop",label:"Workshop"},{value:"reuniao",label:"Reunião"},{value:"outros",label:"Outros"}],W=[{value:"",label:"Origem"}].concat(H),U=[{value:"qr_code",label:"QR Code",icon:"fas fa-qrcode mr-2 text-primary"},{value:"photo",label:"Foto",icon:"fas fa-mobile-alt mr-2 text-primary"},{value:"signature",label:"Assinatura",icon:"fas fa-signature mr-2 text-primary"}];function V(){var e,t,n,o=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).onHeaderContextChange,l=z((0,a.useState)({startDate:"",endDate:""}),2),u=l[0],d=l[1],f=z((0,a.useState)(""),2),m=f[0],p=f[1],h=z((0,a.useState)(""),2),v=h[0],b=h[1],y=z((0,a.useState)(""),2),x=y[0],w=y[1],N=z((0,a.useState)(10),2),C=N[0],A=N[1],E=z((0,a.useState)("list"),2),P=E[0],F=E[1],D=z((0,a.useState)(!1),2),I=D[0],M=D[1],L=z((0,a.useState)(null),2),q=L[0],G=L[1],H=z((0,a.useState)(null),2),U=H[0],V=H[1],$=z((0,a.useState)(null),2),J=$[0],Y=$[1],Z=z((0,a.useState)(null),2),X=Z[0],ee=Z[1],te=z((0,a.useState)(null),2),ne=te[0],re=te[1],ae=z((0,a.useState)(new Set),2),le=ae[0],ue=ae[1],de=(0,i.jE)(),pe=(0,s.I)({queryKey:["time-management","presence-lists"],queryFn:k}),he=pe.data,ge=pe.isFetching,xe=pe.isError,je=pe.refetch,we=(0,s.I)({queryKey:["time-management","presence-list-details",null==X?void 0:X.id],queryFn:function(){return O(X.id)},enabled:null!==X}),Ne=ge&&!he,ke=null!==(e=null==he?void 0:he.rows)&&void 0!==e?e:[],Oe=null!==(t=null==he?void 0:he.summary)&&void 0!==t?t:{active_lists:0,closed_lists:0,pending_validations:0,validated:0,attendance_average:0,presences:0,absences:0},Ae=[{title:"Listas Ativas",value:String(Oe.active_lists),progress:Ce(Oe.active_lists,Oe.active_lists+Oe.closed_lists),footer:"Fechadas: ".concat(Oe.closed_lists)},{title:"Pendências de validação",value:String(Oe.pending_validations),progress:Ce(Oe.validated,Oe.validated+Oe.pending_validations),footer:"Validadas: ".concat(Oe.validated)},{title:"Média de presença",value:"".concat(Oe.attendance_average,"%"),progress:Oe.attendance_average,footer:"Presenças: ".concat(Oe.presences," Faltas: ").concat(Oe.absences)}];(0,a.useEffect)(function(){var e=window,t=e.TM_PUSHER_KEY||"",n=e.TM_PUSHER_CLUSTER||"mt1",r=Number(e.TM_USER_ID)||0;if(t&&r&&void 0!==e.Pusher){var a=new e.Pusher(t,{cluster:n,forceTLS:!0}),o="time-management-user-".concat(r),i=a.subscribe(o);return i.bind("presence-list-generating",function(e){var t=Number(null==e?void 0:e.presenceId);t>0&&(ue(function(e){return new Set(e).add(t)}),je())}),i.bind("presence-list-ready",function(t){var n=Number(null==t?void 0:t.presenceId);if(n>0){var r,a;ue(function(e){var t=new Set(e);return t.delete(n),t}),je();var o=null!=t&&t.title?' "'.concat(t.title,'"'):"";null===(r=e.toastr)||void 0===r||null===(a=r.success)||void 0===a||a.call(r,"Lista de presença".concat(o," processada com sucesso."))}}),i.bind("presence-list-failed",function(t){var n,r,a=Number(null==t?void 0:t.presenceId);a>0&&ue(function(e){var t=new Set(e);return t.delete(a),t});var o=null!=t&&t.error?" ".concat(t.error):"";null===(n=e.toastr)||void 0===n||null===(r=n.error)||void 0===r||r.call(n,"Falha ao processar lista de presença.".concat(o))}),function(){i.unbind_all(),a.unsubscribe(o)}}},[]),(0,a.useEffect)(function(){return function(){return null==o?void 0:o({title:"GESTÃO DE TEMPO",hideTabs:!1})}},[o]),(0,a.useEffect)(function(){var e;o&&o(X?{title:(null===(e=we.data)||void 0===e?void 0:e.list.title)||X.title||"Lista de presença",onBack:function(){return ee(null)},hideTabs:!0}:{title:"GESTÃO DE TEMPO",hideTabs:!1})},[null===(n=we.data)||void 0===n?void 0:n.list.title,o,X]);var Ee=(0,a.useMemo)(function(){var e=Se(x);return ke.filter(function(t){var n=!e||Se("".concat(t.title," ").concat(t.method," ").concat(t.status," ").concat(t.origin)).includes(e),r=function(e,t){return!t||("draft"===t?"Rascunho"===e:"finished"===t?"Finalizada"===e:"in_progress"!==t||("Em andamento"===e||"Aguardando"===e||"Erro"===e))}(t.status,m),a=function(e,t,n){if(!n.startDate&&!n.endDate)return!0;var r=e?new Date(e).getTime():Number.NaN,a=t?new Date(t).getTime():r;if(Number.isNaN(r)&&Number.isNaN(a))return!1;var o=n.startDate?new Date("".concat(n.startDate,"T00:00:00")).getTime():Number.NEGATIVE_INFINITY,i=n.endDate?new Date("".concat(n.endDate,"T23:59:59")).getTime():Number.POSITIVE_INFINITY,s=Number.isNaN(r)?a:r,l=Number.isNaN(a)?s:a;return s<=i&&l>=o}(t.validationStartsAt,t.validationEndsAt,u),o=!v||t.originKey===v;return n&&r&&a&&o})},[ke,u,v,x,m]),Pe=function(){var e=R(_().m(function e(t){return _().w(function(e){for(;;)switch(e.n){case 0:if(window.confirm('Tem certeza que deseja excluir a lista "'.concat(t.title,'"?'))){e.n=1;break}return e.a(2);case 1:return e.n=2,g(t.id);case 2:(null==X?void 0:X.id)===t.id&&ee(null),de.invalidateQueries({queryKey:["time-management","presence-lists"]}),de.invalidateQueries({queryKey:["time-management","presence-list-details",t.id]});case 3:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),Fe=function(){var e=R(_().m(function e(t){var n,r,a,o,i,s;return _().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,O(t.id);case 1:n=e.v,re(n),M(!0),e.n=3;break;case 2:e.p=2,s=e.v,i=(null==s||null===(r=s.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.message)||"Não foi possível carregar a lista para edição.",null===(a=window.toastr)||void 0===a||null===(o=a.error)||void 0===o||o.call(a,i);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),Te=function(){var e=R(_().m(function e(t){return _().w(function(e){for(;;)switch(e.n){case 0:if(X){e.n=1;break}return e.a(2);case 1:if(window.confirm("Remover ".concat(t.name," desta lista de presença?"))){e.n=2;break}return e.a(2);case 2:return e.n=3,j(X.id,t.id);case 3:de.invalidateQueries({queryKey:["time-management","presence-lists"]}),de.invalidateQueries({queryKey:["time-management","presence-list-details",X.id]});case 4:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),De=function(){var e=R(_().m(function e(t){var n,r,a;return _().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.photoFileId){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,S(t.photoFileId);case 2:if(r=e.v,a=(null===(n=r.local_urls)||void 0===n?void 0:n.view)||r.preview_url||r.content_url){e.n=3;break}return window.alert("Não foi possível carregar a foto enviada."),e.a(2);case 3:Y(a),V(t),e.n=5;break;case 4:e.p=4,e.v,window.alert("Não foi possível carregar a foto enviada.");case 5:return e.a(2)}},e,null,[[1,4]])}));return function(t){return e.apply(this,arguments)}}();return(0,r.jsxs)(c.A,{className:"tm-attendance-page",children:[!X&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"row no-gutters mb-md-4 app-controls-bar-row tm-attendance-controls-row",children:(0,r.jsxs)("div",{className:"col-12 d-flex flex-column flex-md-row justify-content-between align-items-md-center app-controls-bar filters-section pl-3 pr-2 py-2 tm-attendance-toolbar",children:[(0,r.jsx)("div",{className:"tm-attendance-header-actions mb-2 mb-md-0",children:(0,r.jsx)(Q,{icon:"fas fa-plus",onClick:function(){return M(!0)},children:"Criar Lista"})}),(0,r.jsxs)("div",{className:"tm-attendance-filters d-flex flex-column flex-md-row align-items-md-center justify-content-md-end order-2 w-100 w-md-auto","aria-label":"Filtros de presença",children:[(0,r.jsx)(ve,{value:u,onChange:d}),(0,r.jsx)(be,{options:B,value:m,onChange:p}),(0,r.jsx)(be,{options:W,value:v,onChange:b}),(0,r.jsx)(ye,{value:x,onChange:w}),(0,r.jsx)("button",{className:"tm-attendance-icon-button ".concat("cards"===P?"is-active":""),type:"button","aria-label":"cards"===P?"Ver em lista":"Ver em cards","aria-pressed":"cards"===P,onClick:function(){return F(function(e){return"cards"===e?"list":"cards"})},children:(0,r.jsx)("i",{className:"far fa-calendar-alt"})})]})]})}),(0,r.jsx)("div",{className:"tm-attendance-summary-grid",children:Ae.map(function(e){return(0,r.jsx)(oe,T({},e),e.title)})})]}),X?(0,r.jsx)(ce,{row:X,details:we.data,isLoading:we.isFetching&&!we.data,isError:we.isError,onRetry:function(){return we.refetch()},onShowPhoto:De,onRemoveParticipant:Te,itemsPerPage:C,onItemsPerPageChange:A}):xe?(0,r.jsxs)("div",{className:"tm-attendance-empty-card",children:["Não foi possível carregar as listas de presença.",(0,r.jsx)("button",{type:"button",className:"btn btn-link p-0 ml-2",onClick:function(){return je()},children:"Tentar novamente"})]}):Ne?(0,r.jsx)("div",{className:"tm-attendance-empty-card",children:"Carregando listas de presença..."}):"cards"===P?(0,r.jsx)(se,{rows:Ee,onView:ee,onEdit:Fe,onDelete:Pe,onShowQr:function(e){return G(e)},generatingIds:le}):(0,r.jsx)(ie,{rows:Ee,totalRows:ke.length,itemsPerPage:C,onItemsPerPageChange:A,onView:ee,onEdit:Fe,onDelete:Pe,onShowQr:function(e){return G(e)},generatingIds:le}),(0,r.jsx)(K,{show:I,onClose:function(){M(!1),re(null)},onCreated:function(e){G(e),e.id>0&&(ue(function(t){return new Set(t).add(e.id)}),je())},editDetails:ne}),(0,r.jsx)(fe,{row:q,onClose:function(){return G(null)}}),(0,r.jsx)(me,{participant:U,photoUrl:J,onClose:function(){V(null),Y(null)}})]})}function Q(e){var t=e.children,n=e.icon,a=e.onClick;return(0,r.jsxs)("button",{type:"button",className:"tm-attendance-create-button",onClick:a,children:[n&&(0,r.jsx)("i",{className:n,"aria-hidden":"true"}),t]})}function K(e){var t=e.show,n=e.onClose,s=e.onCreated,c=e.editDetails,d=(0,i.jE)(),m=!!c,p=z((0,a.useState)(""),2),h=p[0],v=p[1],g=z((0,a.useState)("treinamento"),2),x=g[0],j=g[1],w=z((0,a.useState)(""),2),S=w[0],N=w[1],k=z((0,a.useState)(""),2),C=k[0],A=k[1],E=z((0,a.useState)(""),2),F=E[0],T=E[1],D=z((0,a.useState)(""),2),I=D[0],M=D[1],L=z((0,a.useState)(""),2),q=L[0],B=L[1],G=z((0,a.useState)("qr_code"),2),W=G[0],V=G[1],Q=z((0,a.useState)([]),2),K=Q[0],J=Q[1],oe=z((0,a.useState)([]),2),ie=oe[0],se=oe[1],le=z((0,a.useState)([]),2),ce=le[0],ue=le[1],de=z((0,a.useState)([]),2),fe=de[0],me=de[1],pe=z((0,a.useState)(!1),2),he=pe[0],ve=pe[1],be=z((0,a.useState)(!1),2),ye=be[0],ge=be[1],xe=z((0,a.useState)(!1),2),je=xe[0],we=xe[1],Se=z((0,a.useState)(null),2),Ne=Se[0],ke=Se[1],Ce=z((0,a.useState)([]),2),Ae=Ce[0],Ee=Ce[1],Pe=z((0,a.useState)([]),2),Fe=Pe[0],Te=Pe[1],De=z((0,a.useState)([]),2),_e=De[0],Ie=De[1],Me=z((0,a.useState)(!1),2),Re=Me[0],ze=Me[1];(0,a.useEffect)(function(){var e,n,r,a,o,i,s,l;if(t){var u=null!==(e=null==c?void 0:c.participants.map(Z))&&void 0!==e?e:[],d=null!==(n=null==c?void 0:c.list.responsibles.map(X))&&void 0!==n?n:[];v(null!==(r=null==c?void 0:c.list.title)&&void 0!==r?r:""),j(null!==(a=null==c?void 0:c.list.eventOrigin)&&void 0!==a?a:"treinamento"),N(null!==(o=null==c?void 0:c.list.workload)&&void 0!==o?o:""),A(null!==(i=null==c?void 0:c.list.location)&&void 0!==i?i:""),T(null!==(s=null==c?void 0:c.list.programContent)&&void 0!==s?s:""),M(c?Oe(c.list.validationStartsAt):""),B(c?Oe(c.list.validationEndsAt):""),V(null!==(l=null==c?void 0:c.list.validationModel)&&void 0!==l?l:"qr_code"),J(u),se(d),ue(u),me(d),we(!1)}},[t,c]),(0,a.useEffect)(function(){t&&c&&(Ge("",ue,ve),Ge("",me,ge))},[t,c]);var Le,qe=(0,l.n)({mutationFn:function(e){return c?function(e,t){return y.apply(this,arguments)}(c.list.id,e):function(e){return b.apply(this,arguments)}(e)},onSuccess:(Le=R(_().m(function e(t){var r,a,o,i,l;return _().w(function(e){for(;;)switch(e.n){case 0:if(a=null,!((o=Number((null==t||null===(r=t.data)||void 0===r?void 0:r.id)||0))>0)||"qr_code"!==W&&"photo"!==W&&"signature"!==W){e.n=2;break}return e.n=1,O(o);case 1:l=e.v,a={id:l.list.id,title:l.list.title,method:l.list.method,globalToken:l.list.globalToken,signatureEditUrl:null!==(i=l.list.signatureEditUrl)&&void 0!==i?i:null};case 2:v(""),j("treinamento"),N(""),A(""),T(""),M(""),B(""),V("qr_code"),J([]),se([]),ue([]),me([]),we(!1),d.invalidateQueries({queryKey:["time-management","presence-lists"]}),n(),a&&s(a);case 3:return e.a(2)}},e)})),function(e){return Le.apply(this,arguments)})}),Be=!h.trim()||!I||!q||0===K.length||qe.isPending,Ge=function(){var e=R(_().m(function e(){var t,n,r,a,o,i=arguments;return _().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:"",n=i.length>1?i[1]:void 0,(r=i.length>2?i[2]:void 0)(!0),e.p=1,e.n=2,f.F.get("/v2/company/members",{params:{term:t,limit:100},headers:{Accept:"application/json"}});case 2:a=e.v,o=a.data,n(ne(o).map(Y));case 3:return e.p=3,r(!1),e.f(3);case 4:return e.a(2)}},e,null,[[1,,3,4]])}));return function(){return e.apply(this,arguments)}}(),He=function(){var e=R(_().m(function e(){var t,n,r,a,o,i,s,l,c,u,d;return _().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!(Fe.length>0)){e.n=1;break}return e.a(2);case 1:return ze(!0),e.p=2,e.n=3,Promise.all([f.F.get("/v2/company/members",{params:{term:"",limit:1e3},headers:{Accept:"application/json"}}),f.F.get("/v2/company/teams",{params:{term:""},headers:{Accept:"application/json"}}).catch(function(){return{data:{data:[]}}})]);case 3:t=e.v,n=z(t,2),r=n[0],a=n[1],o=ne(r.data).map(Y),i=ne(a.data).map(function(e){return{value:String(e.id),label:e.name||e.text||"#".concat(e.id)}}),Te(o),ue(function(e){return te(e,o)}),me(function(e){return te(e,o)}),Ie(i),e.n=5;break;case 4:e.p=4,d=e.v,u=(null==d||null===(s=d.response)||void 0===s||null===(s=s.data)||void 0===s?void 0:s.message)||"Não foi possível carregar os membros.",null===(l=window.toastr)||void 0===l||null===(c=l.error)||void 0===c||c.call(l,u);case 5:return e.p=5,ze(!1),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),We=function(e){Ee("participants"===e?K:ie),ke(e),He()},Ue=function(){ke(null),Ee([])},Ve=function(e,t){(function(e){return e instanceof Element&&!!e.closest(".tm-presence-select__multi-value__remove, .tm-presence-select__clear-indicator")})(e.target)||(e.preventDefault(),We(t))},Qe=function(e,t){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),We(t))};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.A,{show:t,onClose:n,title:m?"Editar Lista de Presença":"Nova Lista de Presença",size:"xl",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{type:"button",className:"btn btn-link text-muted text-decoration-none mr-auto",onClick:function(){var e,t,n=function(e){var t,n=window,r=String(n.TM_ATTENDANCE_LIST_PREVIEW_URL||"").trim();if(!r)return"";var a=e.selectedResponsibles.map(function(e,t){return{id:e.value||t+1,name:e.label||e.email||"Responsável ".concat(t+1),email:e.email||""}}),o=(null===(t=a[0])||void 0===t?void 0:t.name)||String(n.TM_ATTENDANCE_LIST_PREVIEW_RESPONSIBLE||"Responsavel MetaHuman"),i=String(n.TM_ATTENDANCE_LIST_PREVIEW_COMPANY||"MetaHuman"),s=e.selectedParticipants.map(function(e,t){return{user_id:e.value||t+1,name:e.label||"Participante ".concat(t+1),email:e.email||"",company:"",role:"",area:"",status:"pending"}}),l=new URL(r,window.location.origin);l.searchParams.set("title",e.title.trim()||"Lista de Presenca"),l.searchParams.set("description",e.title.trim()||"Lista de Presenca"),l.searchParams.set("event_type",function(e){var t=H.find(function(t){return t.value===e});return(null==t?void 0:t.label)||"Treinamento"}(e.eventOrigin)),e.validationStartsAt&&l.searchParams.set("date",ee(e.validationStartsAt));e.validationEndsAt&&l.searchParams.set("end_date",ee(e.validationEndsAt));l.searchParams.set("workload",e.workload.trim()||"15 minutos"),l.searchParams.set("location",e.location.trim()||"-"),e.programContent.trim()&&l.searchParams.set("program_content",e.programContent.trim());l.searchParams.set("participants",String(s.length||10)),s.length&&l.searchParams.set("participants_data",JSON.stringify(s));l.searchParams.set("company",i),l.searchParams.set("responsible",o),a.length&&l.searchParams.set("responsibles_data",JSON.stringify(a));return l.searchParams.set("exported_by",String(n.TM_ATTENDANCE_LIST_PREVIEW_RESPONSIBLE||o)),l.searchParams.set("unit",e.title.trim()||"Lista de Presenca"),l.toString()}({title:h,eventOrigin:x,workload:S,location:C,programContent:F,validationStartsAt:I,validationEndsAt:q,selectedParticipants:K,selectedResponsibles:ie});n?window.open(n,"_blank","noopener,noreferrer"):null===(e=window.toastr)||void 0===e||null===(t=e.error)||void 0===t||t.call(e,"Não foi possível abrir o preview da lista de presença.")},children:[(0,r.jsx)("i",{className:"far fa-eye mr-1"}),"Ver template"]}),(0,r.jsx)(u.M,{onCancel:n,onConfirm:function(){var e;Be||qe.mutate({title:h.trim(),event_origin:x,validation_model:W,workload:S.trim(),location:C.trim(),program_content:F.trim(),validation_starts_at:I,validation_ends_at:q,participant_user_ids:K.map(function(e){return e.value}),responsible_user_ids:ie.map(function(e){return e.value}),product:(null==c?void 0:c.list.productKey)||"manual",product_reference_id:null!==(e=null==c?void 0:c.list.productReferenceId)&&void 0!==e?e:null,send_chat_message:je})},cancelText:"Cancelar",confirmText:qe.isPending?m?"Salvando...":"Criando...":m?"Salvar alterações":"Criar lista",confirmDisabled:Be})]}),children:(0,r.jsxs)("form",{className:"tm-attendance-create-form",children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-md-7",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"presenceTitle",children:"Título da lista *"}),(0,r.jsx)("input",{id:"presenceTitle",type:"text",className:"form-control",value:h,onChange:function(e){return v(e.target.value)},placeholder:"Ex.: Lista de presença para treinamento"})]})}),(0,r.jsx)("div",{className:"col-md-5",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"presenceEventOrigin",children:"Origem do evento *"}),(0,r.jsx)("select",{id:"presenceEventOrigin",className:"form-control",value:x,onChange:function(e){return j(e.target.value)},children:H.map(function(e){return(0,r.jsx)("option",{value:e.value,children:e.label},e.value)})})]})})]}),(0,r.jsxs)("details",{className:"tm-attendance-optional-accordion mb-3",children:[(0,r.jsx)("summary",{className:"tm-attendance-optional-summary",children:"Campos opcionais da lista de assinatura"}),(0,r.jsxs)("div",{className:"tm-attendance-optional-body mt-3",children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"presenceWorkload",children:"Carga horária"}),(0,r.jsx)("input",{id:"presenceWorkload",type:"text",className:"form-control",value:S,maxLength:100,onChange:function(e){return N(e.target.value)},placeholder:"Ex.: 15 minutos"})]})}),(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"presenceLocation",children:"Local"}),(0,r.jsx)("input",{id:"presenceLocation",type:"text",className:"form-control",value:C,maxLength:80,onChange:function(e){return A(e.target.value)},placeholder:"Ex.: Sala 01"})]})})]}),(0,r.jsxs)("div",{className:"form-group mb-0",children:[(0,r.jsx)("label",{htmlFor:"presenceProgramContent",children:"Conteúdo programático"}),(0,r.jsx)("textarea",{id:"presenceProgramContent",className:"form-control",value:F,maxLength:1e3,rows:4,onChange:function(e){return T(e.target.value)},placeholder:"Descreva brevemente os tópicos abordados."}),(0,r.jsxs)("small",{className:"form-text text-muted",children:[F.length,"/1000 caracteres"]})]})]})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"presenceParticipants",children:"Participantes *"}),(0,r.jsx)("div",{role:"button",tabIndex:0,onMouseDown:function(e){return Ve(e,"participants")},onKeyDown:function(e){return Qe(e,"participants")},children:(0,r.jsx)(o.Ay,{inputId:"presenceParticipants",isMulti:!0,isSearchable:!1,openMenuOnClick:!1,openMenuOnFocus:!1,menuIsOpen:!1,isLoading:he,options:ce,value:K,onChange:function(e){return J(P(e))},placeholder:"Selecione os participantes",noOptionsMessage:function(){return"Nenhum participante encontrado"},classNamePrefix:"tm-presence-select",styles:ae,menuPortalTarget:"undefined"!=typeof document?document.body:void 0,menuPosition:"fixed"})})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"presenceResponsibles",children:"Responsáveis"}),(0,r.jsx)("div",{role:"button",tabIndex:0,onMouseDown:function(e){return Ve(e,"responsibles")},onKeyDown:function(e){return Qe(e,"responsibles")},children:(0,r.jsx)(o.Ay,{inputId:"presenceResponsibles",isMulti:!0,isSearchable:!1,openMenuOnClick:!1,openMenuOnFocus:!1,menuIsOpen:!1,isLoading:ye,options:fe,value:ie,onChange:function(e){return se(P(e))},placeholder:"Selecione os responsáveis",noOptionsMessage:function(){return"Nenhum responsável encontrado"},classNamePrefix:"tm-presence-select",styles:ae,menuPortalTarget:"undefined"!=typeof document?document.body:void 0,menuPosition:"fixed"})})]}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"presenceValidationStartsAt",children:"Validação a partir de *"}),(0,r.jsx)("input",{id:"presenceValidationStartsAt",type:"datetime-local",className:"form-control",value:I,onChange:function(e){return M(e.target.value)}})]})}),(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"presenceValidationEndsAt",children:"Validação até *"}),(0,r.jsx)("input",{id:"presenceValidationEndsAt",type:"datetime-local",className:"form-control",value:q,onChange:function(e){return B(e.target.value)}})]})})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{children:"Modelo de validação *"}),(0,r.jsx)("div",{className:"row",children:U.map(function(e){var t=W===e.value;return(0,r.jsx)("div",{className:"col-12 col-md-4 mb-2",children:(0,r.jsxs)("button",{type:"button",onClick:function(){return V(e.value)},className:"btn btn-block text-left d-flex align-items-center ".concat(t?"border-primary text-primary bg-primary-soft":"border"),children:[(0,r.jsx)("i",{className:e.icon}),e.label]})},e.value)})}),(0,r.jsx)("small",{className:"form-text text-muted",children:"QR Code e Foto geram um QR Code global por lista que o manager imprime e cola no evento. O participante precisa fazer login para confirmar presença."})]}),(0,r.jsxs)("div",{className:"custom-control custom-checkbox",children:[(0,r.jsx)("input",{type:"checkbox",className:"custom-control-input",id:"presenceSendChatMessage",checked:je,onChange:function(e){return we(e.target.checked)}}),(0,r.jsx)("label",{className:"custom-control-label",htmlFor:"presenceSendChatMessage",children:"Enviar mensagem automaticamente no chat para os participantes"})]}),qe.isError&&(0,r.jsx)("div",{className:"alert alert-danger mt-3 mb-0",children:re(qe.error,m)})]})}),(0,r.jsx)($,{show:null!==Ne,title:"responsibles"===Ne?"Selecionar Responsáveis":"Selecionar Participantes",members:Fe,teams:_e,selected:Ae,isLoading:Re,onChange:Ee,onClose:Ue,onConfirm:function(){"participants"===Ne&&(J(Ae),ue(function(e){return te(e,Ae)})),"responsibles"===Ne&&(se(Ae),me(function(e){return te(e,Ae)})),Ue()}})]})}function $(e){var t=e.show,n=e.title,o=e.members,i=e.teams,s=e.selected,l=e.isLoading,c=e.onChange,d=e.onClose,f=e.onConfirm,m=z((0,a.useState)(""),2),p=m[0],h=m[1],v=z((0,a.useState)(""),2),b=v[0],y=v[1],g=(0,a.useMemo)(function(){return new Map(s.map(function(e){return[String(e.value),e]}))},[s]),x=(0,a.useMemo)(function(){var e=Se("".concat(p));return o.filter(function(t){var n,r=!e||Se("".concat(t.label," ").concat(t.email)).includes(e),a=!b||(null!==(n=t.teams)&&void 0!==n?n:[]).some(function(e){return e.id===b});return r&&a})},[o,p,b]),j=x.length>0&&x.every(function(e){return g.has(String(e.value))});(0,a.useEffect)(function(){t||(h(""),y(""))},[t]);var w=function(e){var t=String(e.value);g.has(t)?c(s.filter(function(e){return String(e.value)!==t})):c([].concat(P(s),[e]))};return(0,r.jsxs)(u.A,{show:t,onClose:d,title:n,size:"lg",className:"tm-member-picker-modal",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("span",{className:"mr-auto small text-muted",children:[s.length," selecionado(s)"]}),(0,r.jsx)("button",{type:"button",className:"btn mhs-btn-cancel",onClick:d,children:"Cancelar"}),(0,r.jsx)("button",{type:"button",className:"btn mhs-btn-primary",onClick:f,children:"Selecionar"})]}),children:[(0,r.jsxs)("div",{className:"tm-member-picker-filters",children:[(0,r.jsx)("input",{type:"search",className:"form-control",value:p,onChange:function(e){return h(e.target.value)},placeholder:"Buscar por Nome"}),(0,r.jsxs)("select",{className:"form-control",value:b,onChange:function(e){return y(e.target.value)},children:[(0,r.jsx)("option",{value:"",children:"Filtrar por Equipe"}),i.map(function(e){return(0,r.jsx)("option",{value:e.value,children:e.label},e.value)})]})]}),(0,r.jsx)("div",{className:"tm-member-picker-table-wrap",children:(0,r.jsxs)("table",{className:"table mb-0 tm-member-picker-table",children:[(0,r.jsx)("thead",{className:"thead-light",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{style:{width:48},children:(0,r.jsxs)("label",{className:"tm-member-picker-check",children:[(0,r.jsx)("input",{type:"checkbox",checked:j,disabled:0===x.length,onChange:function(){if(j){var e=new Set(x.map(function(e){return String(e.value)}));c(s.filter(function(t){return!e.has(String(t.value))}))}else c(te(s,x))}}),(0,r.jsx)("span",{})]})}),(0,r.jsx)("th",{children:"Membro"}),(0,r.jsx)("th",{className:"text-black-50 font-weight-bold",children:"Equipe"})]})}),(0,r.jsxs)("tbody",{children:[l&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:3,className:"text-muted p-4",children:"Carregando membros..."})}),!l&&0===x.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:3,className:"text-muted p-4",children:"Nenhum resultado."})}),!l&&x.map(function(e){var t,n=g.has(String(e.value));return(0,r.jsxs)("tr",{className:n?"selected":"",onClick:function(){return w(e)},children:[(0,r.jsx)("td",{children:(0,r.jsxs)("label",{className:"tm-member-picker-check",onClick:function(e){return e.stopPropagation()},children:[(0,r.jsx)("input",{type:"checkbox",checked:n,onChange:function(){return w(e)}}),(0,r.jsx)("span",{})]})}),(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)(J,{member:e}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{children:e.label}),(0,r.jsx)("div",{className:"tm-member-picker-email",children:e.email})]})]})}),(0,r.jsx)("td",{className:"tm-member-picker-teams",children:(null!==(t=e.teams)&&void 0!==t?t:[]).map(function(e){return(0,r.jsx)("span",{className:"tm-member-picker-team",children:e.name},e.id)})})]},e.value)})]})]})})]})}function J(e){var t=e.member,n=(t.label||t.email||"?").charAt(0).toUpperCase();return t.avatar?(0,r.jsx)("img",{className:"tm-member-picker-avatar",src:t.avatar,alt:""}):(0,r.jsx)("span",{className:"tm-member-picker-avatar",children:n})}function Y(e){var t=e.id||e.user_id,n=e.text||e.name||"".concat(e.firstName||""," ").concat(e.lastName||"").trim()||e.email||"#".concat(t);return{value:Number(t),label:n,email:e.email||"",avatar:e.avatar||null,teams:ne(e.teams).map(function(e){return{id:String(e.id),name:e.name||e.text||"#".concat(e.id)}})}}function Z(e){return{value:e.userId,label:e.name||e.email||"#".concat(e.userId),email:e.email||""}}function X(e){return{value:e.userId,label:e.name||e.email||"#".concat(e.userId),email:e.email||""}}function ee(e){return e||""}function te(e,t){var n=new Map(e.map(function(e){return[String(e.value),e]}));return t.forEach(function(e){return n.set(String(e.value),e)}),Array.from(n.values())}function ne(e){return Array.isArray(null==e?void 0:e.results)?e.results:Array.isArray(null==e?void 0:e.data)?e.data:Array.isArray(e)?e:[]}function re(e,t){var n,r=null==e||null===(n=e.response)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.message;return r||(t?"Não foi possível editar a lista de presença.":"Não foi possível criar a lista de presença.")}var ae={control:function(e,t){return T(T({},e),{},{borderColor:t.isFocused?"#17A2B8":"#ECEDED",boxShadow:t.isFocused?"0 0 0 0.2rem rgba(23, 162, 184, 0.15)":"none","&:hover":{borderColor:"#17A2B8"}})},multiValue:function(e){return T(T({},e),{},{backgroundColor:"rgba(23, 162, 184, 0.12)"})},multiValueLabel:function(e){return T(T({},e),{},{color:"#0F6674"})},option:function(e,t){return T(T({},e),{},{backgroundColor:t.isSelected?"#17A2B8":t.isFocused?"rgba(23, 162, 184, 0.08)":"#FFFFFF",color:t.isSelected?"#FFFFFF":"#1E1E1E"})},menuPortal:function(e){return T(T({},e),{},{zIndex:10080})},menu:function(e){return T(T({},e),{},{zIndex:10080})}};function oe(e){var t=e.title,n=e.value,a=e.progress,o=e.footer;return(0,r.jsxs)("div",{className:"tm-attendance-card",children:[(0,r.jsx)("span",{className:"tm-attendance-card-title",children:t}),(0,r.jsx)("strong",{className:"tm-attendance-card-value",children:n}),(0,r.jsx)("div",{className:"tm-attendance-progress","aria-hidden":"true",children:(0,r.jsx)("span",{style:{width:"".concat(a,"%")}})}),(0,r.jsx)("span",{className:"tm-attendance-card-footer",children:o})]})}function ie(e){var t=e.rows,n=e.totalRows,o=e.itemsPerPage,i=e.onItemsPerPageChange,s=e.onView,l=e.onEdit,c=e.onDelete,u=e.onShowQr,d=e.generatingIds,f=void 0===d?new Set:d,m=z((0,a.useState)(null),2),p=m[0],h=m[1];return(0,r.jsxs)("div",{className:"tm-attendance-table-card",children:[(0,r.jsx)("div",{className:"table-responsive app-table-responsive",children:(0,r.jsxs)("table",{className:"table mb-0 tm-attendance-table",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Título da lista"}),(0,r.jsx)("th",{children:"Método"}),(0,r.jsx)("th",{children:"Produto"}),(0,r.jsx)("th",{children:"Colaboradores"}),(0,r.jsx)("th",{children:"Criada em"}),(0,r.jsx)("th",{children:"Início"}),(0,r.jsx)("th",{children:"Fim"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-center",children:"Ações"})]})}),(0,r.jsxs)("tbody",{children:[t.map(function(e){return(0,r.jsxs)("tr",{children:[(0,r.jsxs)("td",{children:[e.title,f.has(e.id)&&(0,r.jsxs)("span",{style:{marginLeft:6,fontSize:11,color:"#5a6a85",fontWeight:500},children:[(0,r.jsx)("i",{className:"fas fa-circle-notch fa-spin",style:{marginRight:3,color:"#3498db"}}),"Processando..."]})]}),(0,r.jsx)("td",{children:e.method}),(0,r.jsx)("td",{children:e.product}),(0,r.jsx)("td",{children:e.collaborators}),(0,r.jsx)("td",{children:e.createdAt}),(0,r.jsx)("td",{children:e.validationStartsAtLabel}),(0,r.jsx)("td",{children:e.validationEndsAtLabel}),(0,r.jsx)("td",{children:(0,r.jsx)(ge,{status:e.status})}),(0,r.jsx)("td",{children:(0,r.jsx)("div",{className:"tm-attendance-row-actions",children:e.hasMoreActions&&(0,r.jsxs)("div",{className:"tm-attendance-actions-menu",children:[(0,r.jsx)("button",{type:"button",className:"tm-attendance-action-button","aria-label":"Mais ações",onClick:function(){return h(function(t){return t===e.id?null:e.id})},children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v"})}),p===e.id&&(0,r.jsxs)("div",{className:"tm-attendance-actions-dropdown",children:[(0,r.jsxs)("button",{type:"button",onClick:function(){h(null),s(e)},children:[(0,r.jsx)("i",{className:"far fa-eye"}),"Visualizar"]}),(0,r.jsxs)("button",{type:"button",onClick:function(){h(null),l(e)},children:[(0,r.jsx)("i",{className:"far fa-edit"}),"Editar"]}),("QR Code"===e.method||"Foto"===e.method||"Lista de Assinatura"===e.method)&&(0,r.jsxs)("button",{type:"button",onClick:function(){h(null),u(e)},children:[(0,r.jsx)("i",{className:"fas fa-qrcode"}),"Ver QR Code"]}),(0,r.jsxs)("button",{type:"button",className:"is-danger",onClick:function(){h(null),c(e)},children:[(0,r.jsx)("i",{className:"far fa-trash-alt"}),"Excluir"]})]})]})})})]},e.id)}),0===t.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:9,className:"text-center text-muted py-4",children:"Nenhuma lista encontrada para os filtros selecionados."})})]})]})}),(0,r.jsxs)("div",{className:"tm-attendance-table-footer",children:[(0,r.jsxs)("span",{children:["Mostrando ",t.length," de ",n," listas"]}),(0,r.jsxs)("div",{className:"tm-attendance-pagination","aria-label":"Paginação",children:[(0,r.jsx)("button",{type:"button","aria-label":"Página anterior",children:(0,r.jsx)("i",{className:"fas fa-chevron-left"})}),(0,r.jsx)("span",{children:"1"}),(0,r.jsx)("button",{type:"button","aria-label":"Próxima página",children:(0,r.jsx)("i",{className:"fas fa-chevron-right"})})]}),(0,r.jsxs)("label",{children:["Resultados por página",(0,r.jsx)("select",{value:o,onChange:function(e){return i(Number(e.target.value))},children:[10,20,30,50].map(function(e){return(0,r.jsx)("option",{value:e,children:e},e)})})]})]})]})}function se(e){var t=e.rows,n=e.onView,a=e.onEdit,o=e.onDelete,i=e.onShowQr,s=e.generatingIds,l=void 0===s?new Set:s;return 0===t.length?(0,r.jsx)("div",{className:"tm-attendance-empty-card",children:"Nenhuma lista encontrada para os filtros selecionados."}):(0,r.jsx)("div",{className:"tm-attendance-list-card-grid",children:t.slice(0,3).map(function(e){return(0,r.jsx)(le,{row:e,onView:n,onEdit:a,onDelete:o,onShowQr:i,isGenerating:l.has(e.id)},e.id)})})}function le(e){var t=e.row,n=e.onView,o=e.onEdit,i=e.onDelete,s=e.onShowQr,l=e.isGenerating,c=void 0!==l&&l,u=z((0,a.useState)(!1),2),d=u[0],f=u[1];return(0,r.jsxs)("article",{className:"tm-attendance-list-card",children:[(0,r.jsxs)("div",{className:"tm-attendance-list-card-menu tm-attendance-actions-menu",children:[(0,r.jsx)("button",{type:"button",className:"tm-attendance-action-button","aria-label":"Mais ações",onClick:function(){return f(function(e){return!e})},children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v"})}),d&&(0,r.jsxs)("div",{className:"tm-attendance-actions-dropdown",children:[(0,r.jsxs)("button",{type:"button",onClick:function(){f(!1),n(t)},children:[(0,r.jsx)("i",{className:"far fa-eye"}),"Visualizar"]}),(0,r.jsxs)("button",{type:"button",onClick:function(){f(!1),o(t)},children:[(0,r.jsx)("i",{className:"far fa-edit"}),"Editar"]}),("QR Code"===t.method||"Foto"===t.method||"Lista de Assinatura"===t.method)&&(0,r.jsxs)("button",{type:"button",onClick:function(){f(!1),s(t)},children:[(0,r.jsx)("i",{className:"fas fa-qrcode"}),"Ver QR Code"]}),(0,r.jsxs)("button",{type:"button",className:"is-danger",onClick:function(){f(!1),i(t)},children:[(0,r.jsx)("i",{className:"far fa-trash-alt"}),"Excluir"]})]})]}),(0,r.jsxs)("header",{children:[(0,r.jsxs)("h3",{children:[t.title,c&&(0,r.jsxs)("span",{style:{marginLeft:6,fontSize:11,color:"#5a6a85",fontWeight:500},children:[(0,r.jsx)("i",{className:"fas fa-circle-notch fa-spin",style:{marginRight:3,color:"#3498db"}}),"Processando..."]})]}),(0,r.jsx)("span",{children:t.origin})]}),(0,r.jsx)("p",{className:"tm-attendance-list-card-description",children:t.description}),(0,r.jsxs)("div",{className:"tm-attendance-list-card-meta",children:[(0,r.jsx)("span",{children:"Produto"}),(0,r.jsx)("strong",{children:t.product})]}),(0,r.jsxs)("div",{className:"tm-attendance-list-card-meta",children:[(0,r.jsx)("span",{children:"Responsável"}),(0,r.jsx)("strong",{children:t.responsible})]}),(0,r.jsxs)("div",{className:"tm-attendance-list-card-meta",children:[(0,r.jsx)("span",{children:"Participantes"}),(0,r.jsx)("strong",{children:t.collaborators})]}),(0,r.jsx)("footer",{children:(0,r.jsxs)("div",{className:"tm-attendance-list-card-status",children:[(0,r.jsx)("span",{children:t.status}),(0,r.jsx)("strong",{className:"tm-attendance-list-card-dot tm-attendance-list-card-dot-".concat(Ne(t.status))}),(0,r.jsx)("time",{children:Ae(t.createdAt)})]})})]})}function ce(e){e.row;var t,n,o=e.details,i=e.isLoading,s=e.isError,l=e.onRetry,c=e.onShowPhoto,u=e.onRemoveParticipant,d=e.itemsPerPage,f=e.onItemsPerPageChange,m=z((0,a.useState)(""),2),p=m[0],h=m[1],v=z((0,a.useState)(""),2),b=v[0],y=v[1],g=null!==(t=null==o?void 0:o.participants)&&void 0!==t?t:[],x=null!==(n=null==o?void 0:o.list.validationEndsAt)&&void 0!==n?n:"",j=(0,a.useMemo)(function(){return function(e,t){return e.reduce(function(e,n){var r=je(n,t);return"Presente"===r&&(e.present+=1),"Pendente"===r&&(e.pending+=1),"Ausente"===r&&(e.absent+=1),e.total+=1,e},{present:0,pending:0,absent:0,total:0})}(g,x)},[g,x]),w=(0,a.useMemo)(function(){var e=Se(b);return g.filter(function(t){var n=je(t,x),r=!p||n===p,a=!e||Se("".concat(t.name," ").concat(t.email," ").concat(t.role)).includes(e);return r&&a})},[b,p,g,x]);return i?(0,r.jsx)("div",{className:"tm-attendance-empty-card",children:"Carregando participantes..."}):s||!o?(0,r.jsxs)("div",{className:"tm-attendance-empty-card",children:["Não foi possível carregar os participantes.",(0,r.jsx)("button",{type:"button",className:"btn btn-link p-0 ml-2",onClick:l,children:"Tentar novamente"})]}):(0,r.jsx)("div",{className:"tm-attendance-detail",children:(0,r.jsxs)("div",{className:"tm-attendance-detail-layout row",children:[(0,r.jsxs)("div",{className:"tm-attendance-detail-main col-12",children:[(0,r.jsx)("div",{className:"tm-attendance-toolbar tm-attendance-detail-toolbar",children:(0,r.jsxs)("div",{className:"tm-attendance-filters","aria-label":"Filtros de participantes",children:[(0,r.jsx)(be,{options:G,value:p,onChange:h}),(0,r.jsx)(ye,{value:b,onChange:y,placeholder:"Buscar participante..."})]})}),(0,r.jsx)(ue,{participants:w,totalRows:g.length,validationEndsAt:x,isPhoto:"photo"===o.list.validationModel,onShowPhoto:c,onRemoveParticipant:u,itemsPerPage:d,onItemsPerPageChange:f})]}),(0,r.jsx)("div",{className:"tm-attendance-summary-col col-12",children:(0,r.jsx)(pe,{summary:j,updatedAt:we(g)})})]})})}function ue(e){var t=e.participants,n=e.totalRows,o=e.validationEndsAt,i=e.isPhoto,s=e.onShowPhoto,l=e.onRemoveParticipant,c=e.itemsPerPage,u=e.onItemsPerPageChange,d=z((0,a.useState)(null),2),f=d[0],m=d[1];return(0,r.jsxs)("div",{className:"tm-attendance-table-card",children:[(0,r.jsx)("div",{className:"table-responsive app-table-responsive",children:(0,r.jsxs)("table",{className:"table mb-0 tm-attendance-table",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Participante"}),(0,r.jsx)("th",{children:"Cargo"}),(0,r.jsx)("th",{children:"Evidência"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{children:"Horário"}),(0,r.jsx)("th",{className:"text-center",children:"Ações"})]})}),(0,r.jsxs)("tbody",{children:[t.map(function(e){var t,n,a=je(e,o);return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"tm-attendance-participant-cell",children:[(0,r.jsx)(de,{participant:e}),(0,r.jsxs)("div",{children:[(0,r.jsx)("strong",{children:e.name}),(0,r.jsx)("span",{children:e.email})]})]})}),(0,r.jsx)("td",{children:e.role}),(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"tm-attendance-evidence-cell",children:[(0,r.jsx)("span",{children:e.evidence}),e.evidenceAt&&(0,r.jsx)("small",{children:e.evidenceAt})]})}),(0,r.jsx)("td",{children:(0,r.jsx)(xe,{status:a})}),(0,r.jsx)("td",{children:(null===(t=e.evidenceAt)||void 0===t?void 0:t.slice(11))||(null===(n=e.updatedAt)||void 0===n?void 0:n.slice(11))||"--"}),(0,r.jsx)("td",{children:(0,r.jsx)("div",{className:"tm-attendance-row-actions",children:(0,r.jsxs)("div",{className:"tm-attendance-actions-menu",children:[(0,r.jsx)("button",{type:"button",className:"tm-attendance-action-button","aria-label":"Mais ações",onClick:function(){return m(function(t){return t===e.id?null:e.id})},children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v"})}),f===e.id&&(0,r.jsxs)("div",{className:"tm-attendance-actions-dropdown",children:[i&&e.photoFileId&&(0,r.jsxs)("button",{type:"button",onClick:function(){m(null),s(e)},children:[(0,r.jsx)("i",{className:"far fa-image"}),"Ver foto"]}),e.signatureEvidenceUrl&&(0,r.jsxs)("a",{href:e.signatureEvidenceUrl,target:"_blank",rel:"noreferrer",onClick:function(){return m(null)},children:[(0,r.jsx)("i",{className:"fas fa-signature"}),"Ver evidência"]}),(0,r.jsxs)("button",{type:"button",className:"is-danger",onClick:function(){m(null),l(e)},children:[(0,r.jsx)("i",{className:"far fa-trash-alt"}),"Remover"]})]})]})})})]},e.id)}),0===t.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:6,className:"text-center text-muted py-4",children:"Nenhum participante encontrado para os filtros selecionados."})})]})]})}),(0,r.jsxs)("div",{className:"tm-attendance-table-footer",children:[(0,r.jsxs)("span",{children:["Mostrando ",t.length," de ",n," participantes"]}),(0,r.jsxs)("div",{className:"tm-attendance-pagination","aria-label":"Paginação",children:[(0,r.jsx)("button",{type:"button","aria-label":"Página anterior",children:(0,r.jsx)("i",{className:"fas fa-chevron-left"})}),(0,r.jsx)("span",{children:"1"}),(0,r.jsx)("button",{type:"button","aria-label":"Próxima página",children:(0,r.jsx)("i",{className:"fas fa-chevron-right"})})]}),(0,r.jsxs)("label",{children:["Resultados por página",(0,r.jsx)("select",{value:c,onChange:function(e){return u(Number(e.target.value))},children:[10,20,30,50].map(function(e){return(0,r.jsx)("option",{value:e,children:e},e)})})]})]})]})}function de(e){var t=e.participant,n=t.name.split(" ").filter(Boolean).slice(0,2).map(function(e){return e[0]}).join("").toUpperCase();return t.avatar?(0,r.jsx)("img",{className:"tm-attendance-participant-avatar",src:t.avatar,alt:""}):(0,r.jsx)("span",{className:"tm-attendance-participant-avatar",children:n||"?"})}function fe(e){var t=e.row,n=e.onClose,o=(0,a.useRef)(null),i=z((0,a.useState)(!0),2),s=i[0],l=i[1];if((0,a.useEffect)(function(){t&&l(!0)},[null==t?void 0:t.id]),!t)return null;var c="Foto"===t.method,d="Lista de Assinatura"===t.method,f="/time-management/presence/".concat(t.globalToken,c?"/photo":d?"/signature":"/confirm"),m="/time-management/presence-lists/".concat(t.id,"/qr");return(0,r.jsx)(u.A,{show:!0,onClose:n,title:"QR Code Global — ".concat(t.title),size:"lg",className:"tm-attendance-qr-modal",footer:(0,r.jsx)(u.M,{onCancel:n,onConfirm:n,cancelText:"Fechar",confirmText:"Concluir"}),children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("p",{className:"text-muted mb-2",children:c?"Imprima este QR Code e cole no local do evento. O participante escaneia, faz login e envia a foto para confirmar presença.":d?"Imprima este QR Code e cole no local do evento. O participante escaneia, faz login e assina a própria linha no MetaHuman.":"Imprima este QR Code e cole no local do evento. O participante escaneia, faz login e confirma presença automaticamente."}),(0,r.jsxs)("div",{className:"tm-attendance-qr-frame-wrapper",children:[s&&(0,r.jsxs)("div",{className:"tm-attendance-qr-loading",role:"status","aria-live":"polite",children:[(0,r.jsx)("i",{className:"fas fa-circle-notch fa-spin","aria-hidden":"true"}),(0,r.jsx)("span",{children:"Renderizando QR Code..."})]}),(0,r.jsx)("iframe",{ref:o,title:"QR Code global de ".concat(t.title),src:m,className:"tm-attendance-qr-frame ".concat(s?"is-loading":""),onLoad:function(){return l(!1)}})]}),(0,r.jsxs)("div",{className:"mt-2 tm-attendance-qr-actions",children:[(0,r.jsxs)("a",{href:f,target:"_blank",rel:"noreferrer",className:"btn btn-outline-primary btn-sm mr-2",children:[(0,r.jsx)("i",{className:"fas fa-external-link-alt mr-1"}),d?"Abrir link de assinatura":"Abrir link de presença"]}),d&&t.signatureEditUrl&&(0,r.jsxs)("a",{href:t.signatureEditUrl,target:"_blank",rel:"noreferrer",className:"btn btn-outline-primary btn-sm mr-2",children:[(0,r.jsx)("i",{className:"fas fa-edit mr-1"}),"Visualizar Assinaturas"]}),(0,r.jsxs)("button",{type:"button",className:"btn btn-outline-secondary btn-sm",onClick:function(){var e,t=null===(e=o.current)||void 0===e?void 0:e.contentWindow;if(t)return t.focus(),void t.print();window.open(m,"_blank","noopener,noreferrer")},children:[(0,r.jsx)("i",{className:"fas fa-print mr-1"}),"Imprimir QR Code"]})]})]})})}function me(e){var t=e.participant,n=e.photoUrl,a=e.onClose;return(0,r.jsx)(u.A,{show:null!==t,onClose:a,title:t?"Foto — ".concat(t.name):"Foto",size:"lg",footer:(0,r.jsx)(u.M,{onCancel:a,onConfirm:a,cancelText:"Fechar",confirmText:"Concluir"}),children:t&&n?(0,r.jsxs)("div",{className:"tm-attendance-photo-preview",children:[(0,r.jsx)("iframe",{title:"Foto de ".concat(t.name),src:n,className:"tm-attendance-qr-frame"}),(0,r.jsx)("a",{href:n,target:"_blank",rel:"noreferrer",className:"btn btn-link mt-2 p-0",children:"Abrir foto em nova aba"})]}):(0,r.jsx)("div",{className:"tm-attendance-empty-card",children:"Foto indisponível para este participante."})})}function pe(e){var t=e.summary,n=e.updatedAt,a=Ce(t.present,t.total),o=Ce(t.pending,t.total),i=Ce(t.absent,t.total);return(0,r.jsxs)("aside",{className:"tm-attendance-summary-panel",children:[(0,r.jsx)("h3",{children:"Resumo da lista"}),(0,r.jsx)("span",{children:"Participação geral"}),(0,r.jsxs)("div",{className:"tm-attendance-donut",style:{"--present":"".concat(a,"%"),"--pending":"".concat(a+o,"%")},children:[(0,r.jsxs)("strong",{children:[a,"%"]}),(0,r.jsx)("small",{children:"Presentes"})]}),(0,r.jsxs)("div",{className:"tm-attendance-summary-legend",children:[(0,r.jsx)(he,{label:"Presentes",value:t.present,percent:a,tone:"present"}),(0,r.jsx)(he,{label:"Pendentes",value:t.pending,percent:o,tone:"pending"}),t.absent>0&&(0,r.jsx)(he,{label:"Ausentes",value:t.absent,percent:i,tone:"absent"})]}),(0,r.jsxs)("div",{className:"tm-attendance-summary-updated",children:[(0,r.jsx)("i",{className:"far fa-clock"}),"Última atualização: ",n||"--"]})]})}function he(e){var t=e.label,n=e.value,a=e.percent,o=e.tone;return(0,r.jsxs)("div",{className:"tm-attendance-summary-legend-row",children:[(0,r.jsx)("span",{className:"tm-attendance-summary-dot tm-attendance-summary-dot-".concat(o)}),(0,r.jsx)("span",{children:t}),(0,r.jsxs)("strong",{children:[n," (",a,"%)"]})]})}function ve(e){var t=e.value,n=e.onChange,o=z((0,a.useState)(!1),2),i=o[0],s=o[1],l=(0,a.useRef)(null),c=t.startDate&&t.endDate,u=c?"".concat(ke(t.startDate)," - ").concat(ke(t.endDate)):"Período";return(0,a.useEffect)(function(){if(i){var e=function(e){l.current&&!l.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}},[i]),(0,r.jsxs)("div",{className:"tm-attendance-compact-date",ref:l,children:[(0,r.jsxs)("button",{type:"button",className:"tm-attendance-compact-select tm-attendance-compact-date-button ".concat(c?"is-active":""),"aria-expanded":i,onClick:function(){return s(function(e){return!e})},children:[(0,r.jsx)("span",{children:u}),(0,r.jsx)("i",{className:"fas fa-chevron-down","aria-hidden":"true"})]}),i&&(0,r.jsxs)("div",{className:"tm-attendance-compact-date-dropdown",children:[(0,r.jsxs)("div",{className:"tm-attendance-compact-date-header",children:[(0,r.jsx)("strong",{children:"Selecionar período"}),(0,r.jsx)("button",{type:"button",onClick:function(){return s(!1)},"aria-label":"Fechar período",children:(0,r.jsx)("i",{className:"fas fa-times","aria-hidden":"true"})})]}),(0,r.jsx)(d.A,{initialStartDate:t.startDate,initialEndDate:t.endDate,onChange:n,defaultToLastMonth:!1}),(0,r.jsxs)("div",{className:"tm-attendance-compact-date-footer",children:[(0,r.jsx)("button",{type:"button",onClick:function(){return n({startDate:"",endDate:""})},children:"Limpar período"}),(0,r.jsx)("button",{type:"button",onClick:function(){return s(!1)},children:"Aplicar"})]})]})]})}function be(e){var t,n=e.options,a=e.value,o=e.onChange,i=null!==(t=n.find(function(e){return e.value===a}))&&void 0!==t?t:n[0];return(0,r.jsxs)("label",{className:"tm-attendance-compact-select",children:[(0,r.jsx)("span",{children:i.label}),(0,r.jsx)("select",{value:a,onChange:function(e){return o(e.target.value)},"aria-label":n[0].label,children:n.map(function(e){return(0,r.jsx)("option",{value:e.value,children:e.label},e.value||"all")})}),(0,r.jsx)("i",{className:"fas fa-chevron-down","aria-hidden":"true"})]})}function ye(e){var t=e.value,n=e.onChange,o=e.placeholder,i=void 0===o?"Buscar":o,s=z((0,a.useState)(!1),2),l=s[0],c=s[1];return(0,r.jsxs)("div",{className:"tm-attendance-search ".concat(l||t?"is-expanded":""),children:[(0,r.jsx)("input",{type:"search",value:t,onChange:function(e){return n(e.target.value)},onFocus:function(){return c(!0)},onBlur:function(){return!t&&c(!1)},placeholder:i,"aria-label":"Buscar listas de presença"}),(0,r.jsx)("button",{type:"button",onClick:function(){return c(function(e){return!e})},"aria-label":"Buscar",children:(0,r.jsx)("i",{className:"fas fa-search"})})]})}function ge(e){var t=e.status;return(0,r.jsx)("span",{className:"tm-attendance-status tm-attendance-status-".concat(Ne(t)),children:t})}function xe(e){var t=e.status;return(0,r.jsx)("span",{className:"tm-attendance-status tm-attendance-status-".concat(Ne(t)),children:t})}function je(e,t){return"signed"===e.rawStatus?"Presente":t&&new Date(t).getTime()<Date.now()?"Ausente":"Pendente"}function we(e){var t,n=e.map(function(e){return e.updatedAt}).filter(Boolean).sort();return null!==(t=n[n.length-1])&&void 0!==t?t:""}function Se(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function Ne(e){return Se(e).replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function ke(e){var t=new Date("".concat(e,"T00:00:00"));return Number.isNaN(t.getTime())?e:t.toLocaleDateString("pt-BR",{day:"2-digit",month:"short"}).replace(".","")}function Ce(e,t){return t<=0?0:Math.min(100,Math.max(0,Math.round(e/t*100)))}function Oe(e){if(!e)return"";var t=new Date(e);if(Number.isNaN(t.getTime()))return"";var n=t.getTimezoneOffset();return new Date(t.getTime()-60*n*1e3).toISOString().slice(0,16)}function Ae(e){var t,n=e.match(/(\d{1,2})\s+([a-zç]+)\s+(\d{4})/i);if(!n)return e;var r=z(n,4),a=r[1],o=r[2],i=r[3];return"".concat(a.padStart(2,"0"),"/").concat(null!==(t={jan:"01",fev:"02",mar:"03",abr:"04",mai:"05",jun:"06",jul:"07",ago:"08",set:"09",out:"10",nov:"11",dez:"12"}[o.slice(0,3).toLowerCase()])&&void 0!==t?t:"01","/").concat(i)}},76336(e,t,n){"use strict";function r(){var e=window.PRODUCT_PERMISSIONS||{canView:!1,canEdit:!1,canCreate:!1,canDelete:!1};return{canView:!0===e.canView,canEdit:!0===e.canEdit,canCreate:!0===e.canCreate,canDelete:!0===e.canDelete}}function a(){return!0===window.ACCESS_DENIED}n.d(t,{L:()=>r,v:()=>a})},77332(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>o});n(52675),n(89463),n(28706),n(51629),n(48598),n(62062),n(94490),n(26099),n(23500);var r=n(74848),a=n(1806);function o(e){var t,n,o,i,s=e.isOpen,l=e.onClose,c=e.record;if(!s||!c)return null;var u={totalJornada:c.horas||"00:00",atraso:c.delay||null,hoursDifference:c.hoursDifference||"00:00",isOvertime:c.isOvertime||!1,isMissingHours:c.isMissingHours||!1,missingClockIns:c.missingClockIns||[],expectedHours:c.expectedHours||"00:00"},d=function(){var e=[],t=c.justification;if(e.push("Total de jornada registrada: ".concat(u.totalJornada)),u.isOvertime?e.push("Este membro possui ".concat(u.hoursDifference," de horas extras registradas")):u.isMissingHours?e.push("Devendo ".concat(u.hoursDifference," neste dia")):e.push("Este membro não possui horas extras registradas"),u.missingClockIns.length>0)if(4===u.missingClockIns.length)if(!t||"reason"!==t.type&&"license"!==t.type)e.push("Nenhum ponto registrado e sem justificativa");else{var n=function(e){switch(e){case"license":return"Licença";case"reason":return"Abono";default:return e}}(t.type);e.push("Nenhum ponto registrado com justificativa de: ".concat(n))}else u.missingClockIns.forEach(function(t){e.push("Faltando a marcação obrigatória da ".concat(t))});if(u.atraso&&e.push("Atraso na primeira entrada de ".concat(u.atraso)),t&&"edit"===t.type){var r=t.editReasonLabel||t.editReason,a=t.updatedAt||"data desconhecida";e.push("Registro ajustado manualmente em ".concat(a," por motivos de: ").concat(r))}if(t&&"reason"===t.type){var o;o="other"===t.payOffAbsence&&t.otherText?t.otherText:t.payOffAbsenceLabel||function(e){switch(e){case"medical_certificate":return"Atestado médico";case"child_monitoring":return"Acompanhamento de filho";case"spouse_monitoring":return"Acompanhamento de cônjuge";case"union_activity":return"Atividade sindical";case"weather_delay":return"Atraso por chuva";case"transport_delay":return"Atraso por transporte";case"compensated_time_off":return"Compensação de horas";case"employee_marriage":return"Casamento";case"court_appearance":return"Audiência judicial";case"electoral_service":return"Serviço eleitoral";case"military_service":return"Serviço militar";case"blood_donation":return"Doação de sangue";case"other":return"Outro";default:return e}}(t.payOffAbsence||"");var i=t.timeReason||"todo o dia";e.push("Foram abonadas ".concat(i," neste dia por motivos de: ").concat(o))}if(t&&"license"===t.type){var s;s="other"===t.payOffLicense&&t.description?t.description:t.payOffLicenseLabel||function(e){switch(e){case"maternity_leave":return"Licença maternidade";case"sick_leave":return"Licença médica";case"marriage_leave":return"Casamento";case"other":return"Outro";default:return e}}(t.payOffLicense||"");var l=t.durationFormatted||"0h";t.partialLicense?e.push("Foi aplicada a licença parcial ".concat(s," com duração de ").concat(l)):e.push("Foi aplicada a licença ".concat(s," com duração de ").concat(l))}return e}();return(0,r.jsx)(a.A,{show:s,onClose:l,title:"Visualizando Registro",size:"md",className:"w-75",footer:(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:l,children:"Fechar"}),children:(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"row mb-3",children:[(0,r.jsxs)("div",{className:"col-md-6",children:[(0,r.jsx)("h6",{children:"Primeira Entrada"}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-8",children:(0,r.jsx)("input",{type:"date",className:"form-control",value:c.data?c.data.split("/").reverse().join("-"):""})}),(0,r.jsx)("div",{className:"col-4",children:(0,r.jsx)("input",{type:"text",className:"form-control",value:(null===(t=c.registros)||void 0===t?void 0:t[0])||"Não registrado ainda",readOnly:!0})})]})]}),(0,r.jsxs)("div",{className:"col-md-6",children:[(0,r.jsx)("h6",{children:"Primeira Saída"}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-8",children:(0,r.jsx)("input",{type:"date",className:"form-control",value:c.data?c.data.split("/").reverse().join("-"):"",style:{fontFamily:"Inter",fontSize:"14px"}})}),(0,r.jsx)("div",{className:"col-4",children:(0,r.jsx)("input",{type:"text",className:"form-control",value:(null===(n=c.registros)||void 0===n?void 0:n[1])||"Não registrado ainda",readOnly:!0})})]})]})]}),(0,r.jsxs)("div",{className:"row mb-3",children:[(0,r.jsxs)("div",{className:"col-md-6",children:[(0,r.jsx)("h6",{children:"Segunda Entrada"}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-8",children:(0,r.jsx)("input",{type:"date",className:"form-control",value:c.data?c.data.split("/").reverse().join("-"):"",style:{fontFamily:"Inter",fontSize:"14px"}})}),(0,r.jsx)("div",{className:"col-4",children:(0,r.jsx)("input",{type:"text",className:"form-control",value:(null===(o=c.registros)||void 0===o?void 0:o[2])||"Não registrado ainda",readOnly:!0})})]})]}),(0,r.jsxs)("div",{className:"col-md-6",children:[(0,r.jsx)("h6",{children:"Segunda Saída"}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-8",children:(0,r.jsx)("input",{type:"date",className:"form-control",value:c.data?c.data.split("/").reverse().join("-"):""})}),(0,r.jsx)("div",{className:"col-4",children:(0,r.jsx)("input",{type:"text",className:"form-control",value:(null===(i=c.registros)||void 0===i?void 0:i[3])||"Não registrado ainda",readOnly:!0})})]})]})]}),(0,r.jsxs)("div",{className:"mt-3 pt-3",style:{borderTop:"1px solid #dee2e6"},children:[(0,r.jsx)("h6",{children:"Informações Adicionais"}),(0,r.jsx)("ul",{children:d.map(function(e,t){return(0,r.jsxs)("li",{children:["• ",e]},t)})})]}),c.justification&&"reason"===c.justification.type&&c.justification.description&&(0,r.jsxs)("div",{className:"mt-3 pt-3",style:{borderTop:"1px solid #dee2e6"},children:[(0,r.jsx)("h6",{children:"Observações"}),(0,r.jsx)("textarea",{className:"form-control",value:c.justification.description,readOnly:!0,rows:3})]})]})})}},77770(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>d});n(52675),n(89463),n(2259),n(51629),n(23418),n(64346),n(23792),n(34782),n(23288),n(94170),n(62010),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(27495),n(38781),n(47764),n(23500),n(62953),n(76031);var r=n(74848),a=n(96540),o=n(1806);function i(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var i=r&&r.prototype instanceof c?r:c,u=Object.create(i.prototype);return s(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(s(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,s(m,"constructor",d),s(d,"constructor",u),u.displayName="GeneratorFunction",s(d,a,"GeneratorFunction"),s(m),s(m,a,"Generator"),s(m,r,function(){return this}),s(m,"toString",function(){return"[object Generator]"}),(i=function(){return{w:o,m:p}})()}function s(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}s=function(e,t,n,r){function o(t,n){s(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},s(e,t,n,r)}function l(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){var t=e.isOpen,n=e.onCapture,s=e.onClose,u=c((0,a.useState)(null),2),d=u[0],f=u[1],m=c((0,a.useState)(null),2),p=m[0],h=m[1],v=c((0,a.useState)(null),2),b=v[0],y=v[1],g=c((0,a.useState)(!1),2),x=g[0],j=g[1],w=(0,a.useRef)(null),S=(0,a.useRef)(null);(0,a.useEffect)(function(){return!t||p||d||(console.log("SelfieModal: Iniciando câmera..."),N()),function(){t||k()}},[t,p,d]);var N=function(){var e,t=(e=i().m(function e(){var t,n,r;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,console.log("SelfieModal: Solicitando acesso à câmera..."),j(!0),y(null),navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){e.n=1;break}throw new Error("Seu navegador não suporta acesso à câmera");case 1:return e.n=2,navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}},audio:!1});case 2:return t=e.v,console.log("SelfieModal: Câmera acessada com sucesso!",t),f(t),e.n=3,new Promise(function(e){return setTimeout(e,100)});case 3:w.current?(console.log("SelfieModal: Conectando stream ao vídeo..."),w.current.srcObject=t,w.current.onloadedmetadata=function(){var e;console.log("SelfieModal: Metadata carregada, iniciando play..."),null===(e=w.current)||void 0===e||e.play().then(function(){console.log("SelfieModal: Vídeo tocando!"),j(!1)}).catch(function(e){console.error("SelfieModal: Erro ao iniciar play:",e),j(!1)})}):(console.warn("SelfieModal: videoRef.current é null!"),j(!1)),e.n=5;break;case 4:e.p=4,r=e.v,console.error("SelfieModal: Erro ao acessar câmera:",r),n="Não foi possível acessar a câmera. Verifique se concedeu as permissões necessárias.","NotAllowedError"===r.name||"PermissionDeniedError"===r.name?n="Permissão de acesso à câmera negada. Por favor, permita o acesso à câmera nas configurações do navegador e tente novamente.":"NotFoundError"===r.name?n="Nenhuma câmera foi encontrada no seu dispositivo.":"NotReadableError"===r.name?n="A câmera está em uso por outro aplicativo. Feche outros aplicativos e tente novamente.":"OverconstrainedError"===r.name?n="A câmera do seu dispositivo não atende aos requisitos necessários.":r.message&&(n=r.message),y(n),j(!1);case 5:return e.a(2)}},e,null,[[0,4]])}),function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){l(o,r,a,i,s,"next",e)}function s(e){l(o,r,a,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}(),k=function(){d&&(d.getTracks().forEach(function(e){return e.stop()}),f(null))},C=function(){k(),h(null),y(null),s()};return t?(0,r.jsx)(o.A,{show:t,onClose:C,title:"Capturar Selfie",size:"md",footer:p?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:function(){h(null),N()},children:"Tirar Novamente"}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary",onClick:function(){p&&fetch(p).then(function(e){return e.blob()}).then(function(e){n(e),h(null)}).catch(function(e){console.error("Erro ao processar imagem:",e),y("Erro ao processar imagem. Tente novamente.")})},children:"Confirmar"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:C,children:"Cancelar"}),b&&(0,r.jsx)("button",{type:"button",className:"btn btn-warning",onClick:N,children:"Tentar Novamente"}),(0,r.jsx)("button",{type:"button",className:"btn btn-primary",onClick:function(){if(w.current&&S.current){var e=w.current,t=S.current,n=t.getContext("2d");if(n){t.width=e.videoWidth,t.height=e.videoHeight,n.drawImage(e,0,0,t.width,t.height);var r=t.toDataURL("image/jpeg",.8);h(r),k()}}},disabled:x||!!b||!d,children:"Capturar"})]}),children:(0,r.jsxs)("div",{style:{padding:"24px"},children:[b&&(0,r.jsxs)("div",{className:"alert d-flex align-items-center",style:{backgroundColor:"#E6F7F9",borderColor:"#17A2B8",color:"#0C5460",gap:"12px"},children:[(0,r.jsx)("i",{className:"fas fa-exclamation-circle",style:{color:"#17A2B8",fontSize:"24px"}}),(0,r.jsx)("div",{style:{flex:1},children:b})]}),x&&(0,r.jsxs)("div",{className:"text-center py-5",children:[(0,r.jsx)("div",{className:"spinner-border text-primary mb-3"}),(0,r.jsx)("p",{className:"text-muted",children:"Iniciando câmera..."}),(0,r.jsx)("button",{type:"button",className:"btn btn-sm btn-link",onClick:N,children:"Clique aqui se a câmera não iniciar"})]}),(0,r.jsx)("div",{className:"text-center",style:{display:b||x?"none":"block"},children:p?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("img",{src:p,alt:"Selfie capturada",className:"w-100 rounded",style:{maxHeight:"400px",objectFit:"cover"}}),(0,r.jsx)("p",{className:"text-success mt-2",children:"Foto capturada com sucesso!"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("video",{ref:w,autoPlay:!0,playsInline:!0,muted:!0,className:"w-100 rounded",style:{maxHeight:"400px",objectFit:"cover",backgroundColor:"#000"}}),(0,r.jsx)("p",{className:"text-muted mt-2",children:"Posicione seu rosto no centro da tela"})]})}),(0,r.jsx)("canvas",{ref:S,style:{display:"none"}})]})}):null}},79724(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>y});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(51629),n(23418),n(74423),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(27495),n(38781),n(21699),n(47764),n(23500),n(62953),n(76031);var r=n(74848),a=n(97665),o=n(57097),i=n(49785),s=n(70038),l=n(96540),c=n(1806);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){m(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function m(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var v=[{n:0,l:"D"},{n:1,l:"S"},{n:2,l:"T"},{n:3,l:"Q"},{n:4,l:"Q"},{n:5,l:"S"},{n:6,l:"S"}],b=["time-management","work-shifts"];function y(e){var t=e.show,n=e.onClose,u=e.editData,d=(0,a.jE)(),m=!!u,h=(0,i.mN)({mode:"onChange",defaultValues:{name:"",description:"",daysOfWeek:[],firstCheckIn:"",firstCheckOut:"",secondCheckIn:"",secondCheckOut:""}}),y=h.register,g=h.handleSubmit,x=h.watch,j=h.setValue,w=h.reset,S=h.trigger,N=h.formState.errors;(0,l.useEffect)(function(){u&&(j("name",u.name,{shouldValidate:!0}),j("description",u.description||"",{shouldValidate:!1}),j("daysOfWeek",u.daysOfWeek||[],{shouldValidate:!1}),j("firstCheckIn",u.firstCheckIn||"",{shouldValidate:!0}),j("firstCheckOut",u.firstCheckOut||"",{shouldValidate:!0}),j("secondCheckIn",u.secondCheckIn||"",{shouldValidate:!0}),j("secondCheckOut",u.secondCheckOut||"",{shouldValidate:!0}),setTimeout(function(){S(["firstCheckIn","firstCheckOut","secondCheckIn","secondCheckOut"])},0))},[u,j,S]),(0,l.useEffect)(function(){t||w()},[t,w]);var k=x("daysOfWeek"),C=x("name"),O=x("firstCheckIn"),A=x("firstCheckOut"),E=x("secondCheckIn"),P=x("secondCheckOut"),F=(0,o.n)({mutationFn:function(e){var t={name:e.name,description:e.description||void 0,daysOfWeek:e.daysOfWeek,firstCheckIn:e.firstCheckIn||null,firstCheckOut:e.firstCheckOut||null,secondCheckIn:e.secondCheckIn||null,secondCheckOut:e.secondCheckOut||null};return m&&null!=u&&u.id?(0,s.zS)(u.id,t):(0,s.z1)(t)},onSuccess:function(){d.invalidateQueries({queryKey:b}),w(),n()}});return(0,r.jsx)(c.A,{show:t,onClose:n,title:m?"Editando Turno":"Criando Turno",size:"md",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:n,children:"Cancelar"}),(0,r.jsx)("button",{type:"submit",form:"workShiftForm",className:"btn text-white px-4",style:{backgroundColor:"#17a2b8"},disabled:F.isPending||!C||0===((null==k?void 0:k.length)||0),children:F.isPending?(0,r.jsx)("i",{className:"fas fa-spinner fa-spin"}):m?"Salvar":"Criar Turno"})]}),children:(0,r.jsxs)("form",{id:"workShiftForm",onSubmit:g(function(e){F.mutate(e)}),children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Nome do Turno"}),(0,r.jsx)("input",f({type:"text",className:"form-control",placeholder:"Digite o nome do turno"},y("name",{required:!0})))]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Descrição"}),(0,r.jsx)("textarea",f({className:"form-control",rows:3,placeholder:"Detalhe mais informações sobre essa atividade"},y("description")))]}),(0,r.jsx)("hr",{className:"my-4"}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Dias da Semana"}),(0,r.jsx)("div",{className:"d-flex justify-content-between",children:v.map(function(e){return(0,r.jsx)("button",{type:"button",className:"btn ".concat(k.includes(e.n)?"text-white":"btn-outline-secondary"),style:f({flex:1,height:"60px",fontSize:"1.1rem",fontWeight:"normal",margin:"0 0.25rem"},k.includes(e.n)?{backgroundColor:"rgb(23, 162, 184)"}:{}),onClick:function(){return t=e.n,void j("daysOfWeek",(n=k||[]).includes(t)?n.filter(function(e){return e!==t}):[].concat(p(n),[t]));var t,n},children:e.l},e.n)})}),(0,r.jsx)("small",{className:"text-muted d-block mt-2",children:"Necessário escolher pelo menos um dia da semana.*"})]}),(0,r.jsx)("hr",{className:"my-4"}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Primeira Entrada"}),(0,r.jsx)("input",f({type:"time",className:"form-control ".concat(N.firstCheckIn?"is-invalid":"")},y("firstCheckIn",{validate:{notEqualToFirstOut:function(e){return!e||!A||(e!==A||"Não pode ser igual à Primeira Saída")}}}))),N.firstCheckIn&&(0,r.jsx)("small",{className:"text-danger d-block mt-1",children:N.firstCheckIn.message})]})}),(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Primeira Saída"}),(0,r.jsx)("input",f({type:"time",className:"form-control ".concat(N.firstCheckOut?"is-invalid":"")},y("firstCheckOut",{validate:{notEqualToFirstIn:function(e){return!e||!O||(e!==O||"Não pode ser igual à Primeira Entrada")},notEqualToSecondIn:function(e){return!e||!E||(e!==E||"Não pode ser igual à Segunda Entrada")}}}))),N.firstCheckOut&&(0,r.jsx)("small",{className:"text-danger d-block mt-1",children:N.firstCheckOut.message})]})})]}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Segunda Entrada"}),(0,r.jsx)("input",f({type:"time",className:"form-control ".concat(N.secondCheckIn?"is-invalid":"")},y("secondCheckIn",{validate:{notEqualToFirstOut:function(e){return!e||!A||(e!==A||"Não pode ser igual à Primeira Saída")},notEqualToSecondOut:function(e){return!e||!P||(e!==P||"Não pode ser igual à Segunda Saída")}}}))),N.secondCheckIn&&(0,r.jsx)("small",{className:"text-danger d-block mt-1",children:N.secondCheckIn.message})]})}),(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group mb-0",children:[(0,r.jsx)("label",{className:"font-weight-normal text-dark",children:"Saída"}),(0,r.jsx)("input",f({type:"time",className:"form-control ".concat(N.secondCheckOut?"is-invalid":"")},y("secondCheckOut",{validate:{notEqualToSecondIn:function(e){return!e||!E||(e!==E||"Não pode ser igual à Segunda Entrada")}}}))),N.secondCheckOut&&(0,r.jsx)("small",{className:"text-danger d-block mt-1",children:N.secondCheckOut.message})]})})]})]})})}},80217(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>f});n(52675),n(89463),n(2259),n(28706),n(33771),n(23418),n(64346),n(23792),n(62062),n(72712),n(34782),n(23288),n(62010),n(2892),n(9868),n(26099),n(27495),n(38781),n(47764),n(62953),n(76031);var r=n(74848),a=n(28482),o=n(72050),i=n(9655),s=n(75548),l=n(96540);function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var d=Math.PI/180;function f(e){e.viewMode,e.onViewModeChange;var t=e.projects,n=void 0===t?[]:t,u=n.length>0?n.map(function(e){return{name:e.name,value:e.hours,color:e.color}}):[{name:"Sem dados",value:0,color:"#E0E0E0"}],f=u.reduce(function(e,t){return e+t.value},0),m=c((0,l.useState)(!0),2),p=m[0],h=m[1];(0,l.useEffect)(function(){var e,t=function(){h(!1),clearTimeout(e),e=setTimeout(function(){h(!0)},100)};return window.addEventListener("resize",t),function(){window.removeEventListener("resize",t),clearTimeout(e)}},[]);return p?(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between",children:[(0,r.jsxs)("div",{style:{width:"60%",height:"280px",position:"relative"},children:[(0,r.jsx)(a.u,{width:"100%",height:"100%",children:(0,r.jsx)(s.r,{children:(0,r.jsx)(i.Fq,{data:u,dataKey:"value",cx:"40%",cy:"50%",innerRadius:60,outerRadius:80,label:function(e){var t=e.cx,n=e.cy,a=e.midAngle,o=e.outerRadius,i=e.fill,s=e.payload,l=(e.percent,Math.sin(-d*a)),c=Math.cos(-d*a),u=Math.abs(1/c)+10,f=t+o*c,m=n+o*l,p=t+(o+u)*c,h=n+(o+u)*l,v=p+20*Number(c.toFixed(1)),b=h,y=c>=0?"start":"end";return(0,r.jsxs)("g",{children:[(0,r.jsx)("path",{d:"M".concat(f,",").concat(m,"L").concat(p,",").concat(h,"L").concat(v,",").concat(b),stroke:i,strokeWidth:"1",fill:"none"}),(0,r.jsx)("text",{x:v+5*(c>=0?1:-1),y:b-6,textAnchor:y,style:{fontSize:"12px",fontWeight:400,fill:"rgba(0, 0, 0, 0.70)",fontFamily:"Inter"},children:s.name}),(0,r.jsx)("text",{x:v+5*(c>=0?1:-1),y:b+6,textAnchor:y,style:{fontSize:"12px",fontWeight:600,fill:i,fontFamily:"Inter"},children:"".concat(s.value,"h")})]})},labelLine:!1,children:u.map(function(e,t){return(0,r.jsx)(o.f,{fill:e.color},"cell-".concat(t))})})})}),(0,r.jsx)("div",{style:{position:"absolute",top:"50%",left:"40%",transform:"translate(-50%, -50%)",textAlign:"center",pointerEvents:"none"},children:(0,r.jsxs)("div",{style:{fontSize:"24px",fontWeight:600,color:"#5C5D5D",fontFamily:"Inter"},children:[f,"h"]})})]}),(0,r.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"12px",paddingRight:"15px",alignItems:"flex-end",justifyContent:"center"},children:u.map(function(e,t){return(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("div",{style:{width:"12px",height:"12px",background:e.color,borderRadius:"2px",marginRight:"8px",flexShrink:0}}),(0,r.jsx)("span",{style:{fontSize:"12px",color:"#5C5D5D",fontWeight:500,fontFamily:"Inter"},children:e.name})]},t)})})]}):(0,r.jsx)("div",{style:{height:"280px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,r.jsx)("span",{style:{color:"#999",fontSize:"12px"},children:"Atualizando..."})})}},80596(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>l});n(52675),n(89463),n(2259),n(28706),n(2008),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(2892),n(26099),n(27495),n(38781),n(47764),n(90744),n(62953);var r=n(74848),a=n(96540),o=n(76336);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e){var t=e.data,n=e.title,i=void 0===n?"Registro de pontos":n,s=e.isLoading,l=void 0!==s&&s,u=e.pagination,d=e.onPageChange,f=e.onItemsPerPageChange,m=(e.onFilterClick,e.onExportClick),p=e.isExporting,h=void 0!==p&&p,v=e.onEditRecord,b=e.onAbonarRecord,y=e.onLicencaRecord,g=e.onViewRecord,x=e.selectedStatus,j=e.onStatusChange,w=(0,o.L)(),S=w.canEdit,N=w.canCreate;return(0,r.jsxs)("div",{className:"card app-card-surface mt-2",children:[(0,r.jsxs)("div",{className:"card-header app-controls-bar tm-controls-bar",children:[(0,r.jsxs)("div",{className:"d-none d-lg-flex align-items-center",children:[(0,r.jsx)("h3",{className:"card-title mb-0",children:i}),(0,r.jsxs)("div",{className:"ml-auto d-flex align-items-center",children:[(0,r.jsx)("button",{className:"app-table-action-btn mr-2",onClick:m,disabled:h||l,type:"button",children:h?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("i",{className:"fas fa-spinner fa-spin mr-1"}),"Exportando..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("i",{className:"fas fa-file-export mr-1"}),"Exportar Tabela"]})}),(0,r.jsx)(c,{selectedStatus:x,onStatusChange:j})]})]}),(0,r.jsxs)("div",{className:"d-lg-none",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between mb-2",children:[(0,r.jsx)("h3",{className:"card-title mb-0",children:i}),(0,r.jsx)(c,{selectedStatus:x,onStatusChange:j})]}),(0,r.jsx)("div",{className:"d-flex flex-column",children:(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsxs)("button",{className:"btn btn-sm btn-default w-100",onClick:m,disabled:h||l,type:"button",title:"Exportar Tabela",children:[(0,r.jsx)("i",{className:"fas ".concat(h?"fa-spinner fa-spin":"fa-file-export"," mr-2")}),h?"Exportando...":"Exportar Tabela"]})})})]})]}),(0,r.jsxs)("div",{className:"card-body",children:[l&&(0,r.jsxs)("div",{className:"text-center py-4",children:[(0,r.jsx)("div",{className:"spinner-border text-primary",role:"status",children:(0,r.jsx)("span",{className:"sr-only",children:"Carregando..."})}),(0,r.jsx)("p",{className:"text-muted mt-2",children:"Carregando registros..."})]}),!l&&(0,r.jsx)("div",{className:"table-responsive app-table-responsive",children:(0,r.jsxs)("table",{className:"table mb-0 app-table",children:[(0,r.jsx)("thead",{className:"thead-light",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{style:{width:"10%"},children:"Data"}),(0,r.jsx)("th",{style:{width:"20%"},className:"text-center",children:"Nome do Membro"}),(0,r.jsx)("th",{style:{width:"22%"},className:"text-center",children:"Registros (Entrada e Saída)"}),(0,r.jsx)("th",{style:{width:"20%"},className:"text-center",children:"Registros Previstos"}),(0,r.jsx)("th",{style:{width:"10%"},className:"text-center",children:"Horas Trabalhadas"}),(0,r.jsx)("th",{style:{width:"10%"},className:"text-center",children:"Status"}),(0,r.jsx)("th",{style:{width:"8%",textAlign:"right"},children:"Ações"})]})}),(0,r.jsxs)("tbody",{children:[t.map(function(e,t){var n,o,i=e.memberName||"—",s=i.split(/\s+/).filter(Boolean),l="—"!==i?((null===(n=s[0])||void 0===n?void 0:n[0])||"?").toUpperCase():"?",c=["#FF6B6B","#4ECDC4","#45B7D1","#FFA07A","#98D8C8","#F7DC6F","#BB8FCE","#85C1E2"],u=c[i.charCodeAt(0)%c.length];return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"text-muted",children:e.data}),(0,r.jsx)("td",{className:"text-center",children:(0,r.jsx)("div",{className:"rounded-circle d-inline-flex align-items-center justify-content-center text-white",style:{width:36,height:36,backgroundColor:u,fontWeight:700,cursor:"help"},title:i,children:l})}),(0,r.jsx)("td",{className:"text-center",children:(0,r.jsx)("div",{className:"d-flex flex-wrap align-items-center justify-content-center",children:e.registros.map(function(e,t){return(0,r.jsxs)(a.Fragment,{children:[t>0&&(0,r.jsx)("span",{className:"text-muted mx-2",children:"|"}),(0,r.jsx)("span",{className:0===t?"text-primary font-weight-bold":"",children:e})]},t)})})}),(0,r.jsx)("td",{className:"text-muted text-center",children:e.previstos}),(0,r.jsx)("td",{className:"text-center ".concat("success"===e.horasColor?"tm-hours-success":"danger"===e.horasColor?"tm-hours-danger":"tm-hours-secondary"),children:e.horas}),(0,r.jsx)("td",{className:"text-center ".concat("success"===e.statusColor?"tm-status-success":"danger"===e.statusColor?"tm-status-danger":"info"===e.statusColor?"tm-status-info":"tm-status-secondary"),children:e.status}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsx)("div",{className:"d-inline-flex align-items-center",children:(o=[],S&&o.push({key:"edit",label:"Editar Registro",onClick:function(){return null==v?void 0:v(e)}}),N&&(o.push({key:"abonar",label:"Abonar",onClick:function(){return null==b?void 0:b(e)}}),o.push({key:"licenca",label:"Incluir Licença",onClick:function(){return null==y?void 0:y(e)}})),o.push({key:"view",label:"Visualizar Registro",onClick:function(){return null==g?void 0:g(e)}}),1===o.length&&"view"===o[0].key?(0,r.jsx)("button",{className:"btn btn-default btn-sm",title:o[0].label,type:"button",onClick:o[0].onClick,children:(0,r.jsx)("i",{className:"far fa-eye"})}):(0,r.jsxs)("div",{className:"btn-group",children:[(0,r.jsx)("button",{className:"ms-table-occurrences-action-button","data-toggle":"dropdown","aria-expanded":"false",title:"Mais ações",type:"button",children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v ms-table-occurrences-action-icon"})}),(0,r.jsx)("div",{className:"dropdown-menu dropdown-menu-right",role:"menu",children:o.map(function(e,t){return(0,r.jsx)("button",{className:"dropdown-item",onClick:function(t){t.preventDefault(),e.onClick()},children:e.label},"".concat(e.key,"-").concat(t))})})]}))})})]},e.id)}),0===t.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:7,className:"text-center text-muted py-4",children:"Nenhum registro encontrado para o período selecionado"})})]})]})})]}),!l&&u&&(0,r.jsxs)("div",{className:"card-footer app-table-footer",children:[(0,r.jsx)("div",{className:"app-table-footer__left",children:(0,r.jsxs)("small",{className:"text-muted",children:["Mostrando ",t.length," de ",u.total," registros ",u.total_pages>0&&" (Página ".concat(u.current_page," de ").concat(u.total_pages,")")]})}),(0,r.jsx)("nav",{"aria-label":"Navegação da tabela",className:"app-table-footer__center",children:(0,r.jsxs)("ul",{className:"pagination pagination-sm mb-0 app-table-pagination",children:[(0,r.jsx)("li",{className:"page-item ".concat(1===u.current_page?"disabled":""),children:(0,r.jsx)("button",{className:"page-link",onClick:function(){u&&u.current_page>1&&d&&d(u.current_page-1)},disabled:u.current_page<=1,"aria-label":"Anterior",children:(0,r.jsx)("span",{"aria-hidden":"true",children:"‹"})})}),(0,r.jsx)("li",{className:"page-item active",children:(0,r.jsx)("span",{className:"page-link",children:u.current_page})}),(0,r.jsx)("li",{className:"page-item ".concat(u.current_page>=u.total_pages?"disabled":""),children:(0,r.jsx)("button",{className:"page-link",onClick:function(){u&&u.current_page<u.total_pages&&d&&d(u.current_page+1)},disabled:u.current_page>=u.total_pages,"aria-label":"Próxima",children:(0,r.jsx)("span",{"aria-hidden":"true",children:"›"})})})]})}),(0,r.jsxs)("div",{className:"d-flex align-items-center app-table-footer__right",children:[(0,r.jsx)("span",{className:"text-muted mr-2",children:"Resultados por página"}),(0,r.jsx)("select",{className:"custom-select custom-select-sm",style:{width:72},value:u.per_page,onChange:function(e){f&&f(Number(e.target.value))},children:[10,20,30,50,100].map(function(e){return(0,r.jsx)("option",{value:e,children:e},e)})})]})]})]})}function c(e){var t=e.selectedStatus,n=e.onStatusChange,o=i((0,a.useState)(!1),2),s=o[0],l=o[1],c=(0,a.useRef)(null);(0,a.useEffect)(function(){function e(e){if(s){var t=e.target;c.current&&!c.current.contains(t)&&l(!1)}}return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[s]);var u=t&&""!==t;return(0,r.jsxs)("div",{className:"dropdown",ref:c,children:[(0,r.jsx)("button",{className:"app-list-filter-btn ".concat(u?"has-filters":""),type:"button",onClick:function(){return l(!s)},title:u?"Filtros ativos":"Filtros",children:(0,r.jsx)("i",{className:"fas fa-filter"})}),s&&(0,r.jsxs)("div",{className:"dropdown-menu app-filter-dropdown show",style:{right:0},children:[(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("label",{className:"small text-muted mb-1",children:"Status"}),(0,r.jsxs)("select",{className:"custom-select custom-select-sm",value:t||"",onChange:function(e){return null==n?void 0:n(e.target.value)},children:[(0,r.jsx)("option",{value:"",children:"Todos"}),(0,r.jsx)("option",{value:"incomplete",children:"Incompleto"}),(0,r.jsx)("option",{value:"missing_hours",children:"Devendo Horas"}),(0,r.jsx)("option",{value:"on_time",children:"Em Dia"}),(0,r.jsx)("option",{value:"overtime",children:"Horas Extras"})]})]}),(0,r.jsxs)("div",{className:"d-flex justify-content-between pt-1",children:[(0,r.jsx)("button",{className:"btn btn-sm text-muted",type:"button",onClick:function(){n&&n(""),l(!1)},children:"Limpar"}),(0,r.jsx)("button",{className:"btn btn-sm btn-primary",type:"button",onClick:function(){l(!1)},children:"Aplicar"})]})]})]})}},81149(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>g});n(52675),n(89463),n(2259),n(23418),n(74423),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(3362),n(27495),n(38781),n(47764),n(25440),n(62953),n(3296),n(27208),n(48408);var r=n(74848),a=n(96540),o=n(97665),i=n(15072),s=n(94034);function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var u=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,57909))}),d=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,23696))}),f=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,14785))}),m=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,75930))}),p=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,43432))}),h=(0,a.lazy)(function(){return Promise.resolve().then(n.bind(n,41081))}),v=new i.E({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),b=["overview","ponto","timesheet","attendance","settings","permissoes"];function y(e){var t=new URLSearchParams(location.hash.replace(/^#/,"")).get("tab");return t&&b.includes(t)?t:e}function g(e){var t=e.active,n=void 0===t?"overview":t,i=(0,a.useMemo)(function(){return y(n)},[n]),c=l((0,a.useState)(i),2),g=c[0],x=c[1],j=l((0,a.useState)({title:"GESTÃO DE TEMPO"}),2),w=j[0],S=j[1];(0,a.useEffect)(function(){x(y(n))},[n]),(0,a.useEffect)(function(){b.includes(g)||x(y(n))},[n,g]),(0,a.useEffect)(function(){var e,t;e=g,(t=new URL(location.href)).hash="tab=".concat(e),history.replaceState(null,"",t.toString())},[g]),(0,a.useEffect)(function(){"attendance"!==g&&S({title:"GESTÃO DE TEMPO",hideTabs:!1})},[g]),(0,a.useEffect)(function(){var e=function(){return x(y(n))};return window.addEventListener("hashchange",e),function(){return window.removeEventListener("hashchange",e)}},[n]),(0,a.useEffect)(function(){return document.body.classList.add("tm-page-active"),function(){document.body.classList.remove("tm-page-active")}},[]);var N=function(){switch(g){case"overview":default:return(0,r.jsx)(u,{});case"ponto":return(0,r.jsx)(d,{});case"timesheet":return(0,r.jsx)(f,{});case"attendance":return(0,r.jsx)(m,{onHeaderContextChange:S});case"settings":return(0,r.jsx)(p,{});case"permissoes":return(0,r.jsx)(h,{})}}();return(0,r.jsx)(o.Ht,{client:v,children:(0,r.jsxs)("section",{className:"zero-padding",style:{position:"relative"},children:[(0,r.jsx)(s.A,{items:[{key:"overview",label:"Visão Geral"},{key:"ponto",label:"Controle de Ponto"},{key:"timesheet",label:"Timesheet"},{key:"attendance",label:"Presenças"},{key:"settings",label:"Configurações"},{key:"permissoes",label:"Permissões"}],title:w.title,onBack:"attendance"===g?w.onBack:void 0,activeKey:g,onChange:x,hideTabs:w.hideTabs}),(0,r.jsx)("div",{style:{position:"relative",zIndex:1},children:(0,r.jsx)(a.Suspense,{fallback:(0,r.jsx)("div",{className:"p-3",children:"Carregando…"}),children:N})})]})})}},81623(e,t,n){"use strict";n.d(t,{Ay:()=>d,VU:()=>c,Z4:()=>l,jZ:()=>u});n(52675),n(89463),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362);var r=n(69404);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}var l={getActivities:function(e){return s(a().m(function t(){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.get("/api/timesheet-v2/activities/".concat(e));case 1:return n=t.v,o=n.data,t.a(2,o.data)}},t)}))()},getProjects:function(){return s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.u.get("/api/timesheet-v2/projects");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))()},getProjectTasks:function(e){return s(a().m(function t(){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.get("/api/timesheet-v2/projects/".concat(e,"/tasks"));case 1:return n=t.v,o=n.data,t.a(2,o.data)}},t)}))()},getActivityTemplates:function(){return s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.u.get("/api/timesheet-v2/activity-templates");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))()},createActivity:function(e){return s(a().m(function t(){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.post("/api/timesheet-v2/activities",e);case 1:return n=t.v,o=n.data,t.a(2,o.data)}},t)}))()},updateActivity:function(e,t){return s(a().m(function n(){var o,i;return a().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,r.u.put("/api/timesheet-v2/activities/".concat(e),t);case 1:return o=n.v,i=o.data,n.a(2,i.data)}},n)}))()},deleteActivity:function(e){return s(a().m(function t(){return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.delete("/api/timesheet-v2/activities/".concat(e));case 1:return t.a(2)}},t)}))()},finalizeDay:function(e){return s(a().m(function t(){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.post("/api/timesheet-v2/days/".concat(e,"/finalize"));case 1:return n=t.v,o=n.data,t.a(2,o.data)}},t)}))()},getScheduledActivities:function(e){return s(a().m(function t(){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.get("/api/timesheet-v2/scheduled-activities/".concat(e));case 1:return n=t.v,o=n.data,t.a(2,o.data)}},t)}))()},getPlannedActivities:function(e){return s(a().m(function t(){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.get("/api/timesheet-v2/planned-activities/".concat(e));case 1:return n=t.v,o=n.data,t.a(2,o.data)}},t)}))()},getHoursWorkedKPI:function(e){return s(a().m(function t(){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.get("/api/timesheet-v2/kpi/hours-worked/".concat(e));case 1:return n=t.v,o=n.data,t.a(2,o.data)}},t)}))()},getHoursByProject:function(e,t,n){return s(a().m(function o(){var i,s;return a().w(function(a){for(;;)switch(a.n){case 0:return a.n=1,r.u.get("/api/timesheet-v2/kpi/hours-by-project",{params:{start_date:e,end_date:t,member_id:n}});case 1:return i=a.v,s=i.data,a.a(2,s.data)}},o)}))()},getEnergyPeaks:function(e,t,n){return s(a().m(function o(){var i,s;return a().w(function(a){for(;;)switch(a.n){case 0:return a.n=1,r.u.get("/api/timesheet-v2/kpi/energy-peaks",{params:{start_date:e,end_date:t,member_id:n}});case 1:return i=a.v,s=i.data,a.a(2,s.data)}},o)}))()},getWeeklyHours:function(e,t,n){return s(a().m(function o(){var i,s;return a().w(function(a){for(;;)switch(a.n){case 0:return a.n=1,r.u.get("/api/timesheet-v2/kpi/weekly-hours",{params:{start_date:e,end_date:t,member_id:n}});case 1:return i=a.v,s=i.data,a.a(2,s.data)}},o)}))()},getWorkload:function(e){return s(a().m(function t(){var n;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.get("/api/timesheet-v2/workload/".concat(e));case 1:return n=t.v,t.a(2,n.data.workload_hours)}},t)}))()},updateWorkload:function(e,t){return s(a().m(function n(){return a().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,r.u.put("/api/timesheet-v2/workload",{date:e,workload_hours:t});case 1:return n.a(2)}},n)}))()},getHoursControl:function(e,t,n){return s(a().m(function o(){var i,s;return a().w(function(a){for(;;)switch(a.n){case 0:return a.n=1,r.u.get("/api/timesheet-v2/hours-control/",{params:{start_date:e,end_date:t,member_id:n}});case 1:return i=a.v,s=i.data,a.a(2,s.data)}},o)}))()},getMonthInfo:function(e,t,n){return s(a().m(function o(){var i,s;return a().w(function(a){for(;;)switch(a.n){case 0:return a.n=1,r.u.get("/api/timesheet-v2/month-info",{params:{start_date:e,end_date:t,member_id:n}});case 1:return i=a.v,s=i.data,a.a(2,s.data)}},o)}))()},getMonthKPIs:function(e,t,n){return s(a().m(function o(){var i,s;return a().w(function(a){for(;;)switch(a.n){case 0:return a.n=1,r.u.get("/api/timesheet-v2/kpi/month",{params:{start_date:e,end_date:t,member_id:n}});case 1:return i=a.v,s=i.data,a.a(2,s.data)}},o)}))()},getDayKPIs:function(e){return s(a().m(function t(){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,r.u.get("/api/timesheet-v2/kpi/day/".concat(e));case 1:return n=t.v,o=n.data,t.a(2,o.data)}},t)}))()}},c=function(){var e=s(a().m(function e(t,n){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.u.put("/api/timesheet-v2/days/".concat(t,"/satisfaction"),{work_satisfaction:n});case 1:return e.a(2)}},e)}));return function(t,n){return e.apply(this,arguments)}}(),u=function(){var e=s(a().m(function e(t){var n,o,i,s,l,c,u;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.u.get("/api/timesheet-v2/days/".concat(t,"/satisfaction"));case 1:return c=e.v,u=c.data,e.a(2,{timesheetDayId:(null===(n=u.data)||void 0===n?void 0:n.id)||null,hasSatisfaction:null!==(null===(o=u.data)||void 0===o?void 0:o.work_satisfaction),isFinalized:2===(null===(i=u.data)||void 0===i?void 0:i.work_period),workSatisfaction:null!==(s=null===(l=u.data)||void 0===l?void 0:l.work_satisfaction)&&void 0!==s?s:null})}},e)}));return function(t){return e.apply(this,arguments)}}();const d=l},82942(e,t,n){"use strict";n.d(t,{AD:()=>a,JC:()=>o,Q8:()=>r,kC:()=>i});n(2008),n(62062),n(26099);function r(e,t){if(!e)return[];var n=e.mode,r=e.validate_points_others,a=t||window.innerWidth<=768;if("none"===n)return[];if("qrcode"===n)return a?["qrcode"]:[];if("flexible"===n){var o=["selfie","geolocation","screenshot"];return a&&o.push("qrcode"),o}return"manual"===n?r.map(function(e){return e.type}).filter(function(e){return!("qrcode"===e&&!a)}):[]}function a(e,t){if(!e)return!1;var n=t||window.innerWidth<=768;return"qrcode"===e.mode&&!n}function o(e){return{selfie:"fas fa-camera",geolocation:"fas fa-map-marker-alt",screenshot:"fas fa-image",qrcode:"fas fa-qrcode",teste:"fas fa-flask"}[e]||"fas fa-check"}function i(e){return{selfie:"Selfie",geolocation:"Localização",screenshot:"Screenshot",qrcode:"QR Code",teste:"Bater Ponto Teste"}[e]||e}},84136(e,t,n){"use strict";n.d(t,{L:()=>r,j:()=>a});var r={ponto_duplicado:"Ponto Duplicado",atraso:"Atraso",ponto_dia_folga:"Ponto em Dia de Folga",ausencia_sem_justificativa:"Ausência sem Justificativa",ausencia_com_justificativa:"Ausência com Justificativa",saida_antecipada:"Saída Antecipada",ponto_adiantado:"Ponto Adiantado"};function a(e){return{leve:"leve",moderado:"atencao",atencao:"atencao",resolvido:"resolvido",pendente:"pendente"}[e]||"leve"}},85231(e,t,n){"use strict";n.d(t,{GB:()=>p,Nb:()=>y,Tp:()=>l,X3:()=>f,bP:()=>v,xP:()=>u});n(52675),n(89463),n(23288),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362),n(38781);var r=n(52354);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}function l(e){return c.apply(this,arguments)}function c(){return(c=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/professional/clock-in/shift",{params:{date:t}});case 1:return n=e.v,o=n.data,e.a(2,o.data)}},e)}))).apply(this,arguments)}function u(e){return d.apply(this,arguments)}function d(){return(d=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/professional/clock-in/occurrences",{params:{date:t}});case 1:return n=e.v,o=n.data,e.a(2,o.data)}},e)}))).apply(this,arguments)}function f(e){return m.apply(this,arguments)}function m(){return(m=s(a().m(function e(t){var n,o,i;return a().w(function(e){for(;;)switch(e.n){case 0:return(n=new FormData).append("device",t.device),n.append("mode",t.mode),t.selfie&&n.append("selfie",t.selfie,"selfie.jpg"),t.location&&(n.append("latitude",t.location.lat.toString()),n.append("longitude",t.location.lng.toString())),t.screenshot&&n.append("screenshot",t.screenshot),t.qrcode&&n.append("qrcode",t.qrcode),t.testTime&&n.append("testTime",t.testTime),e.n=1,r.F.post("/time-management/professional/clock-in",n,{headers:{"Content-Type":"multipart/form-data"}});case 1:return o=e.v,i=o.data,e.a(2,i.data)}},e)}))).apply(this,arguments)}function p(e,t){return h.apply(this,arguments)}function h(){return(h=s(a().m(function e(t,n){var o,i;return a().w(function(e){for(;;)switch(e.n){case 0:return console.log("[addJustification] Enviando requisição..."),console.log("[addJustification] URL:","/time-management/professional/clock-in/occurrences/".concat(t,"/justification")),console.log("[addJustification] Payload:",{justification:n}),e.n=1,r.F.post("/time-management/professional/clock-in/occurrences/".concat(t,"/justification"),{justification:n},{headers:{"Content-Type":"application/json",Accept:"application/json"}});case 1:return o=e.v,i=o.data,console.log("[addJustification] Status da resposta OK"),console.log("[addJustification] response.data:",i),e.a(2,i)}},e)}))).apply(this,arguments)}function v(e,t){return b.apply(this,arguments)}function b(){return(b=s(a().m(function e(t,n){var o,i;return a().w(function(e){for(;;)switch(e.n){case 0:return console.log("[editOccurrenceTime] Enviando requisição..."),console.log("[editOccurrenceTime] URL:","/time-management/professional/clock-in/occurrences/".concat(t,"/edit-time")),console.log("[editOccurrenceTime] Payload:",{time:n}),e.n=1,r.F.patch("/time-management/professional/clock-in/occurrences/".concat(t,"/edit-time"),{time:n},{headers:{"Content-Type":"application/json",Accept:"application/json"}});case 1:return o=e.v,i=o.data,console.log("[editOccurrenceTime] Status da resposta OK"),console.log("[editOccurrenceTime] response.data:",i),e.a(2,i)}},e)}))).apply(this,arguments)}function y(e){return g.apply(this,arguments)}function g(){return(g=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.delete("/time-management/test/clear-point",{params:{date:t},headers:{"Content-Type":"application/json",Accept:"application/json"}});case 1:return n=e.v,o=n.data,e.a(2,o)}},e)}))).apply(this,arguments)}},86628(e,t,n){var r={"./TesteController.tsx":90412};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=86628},88195(e,t,n){"use strict";n.d(t,{A:()=>a});n(62062),n(26099);var r=n(74848);function a(e){var t=e.columns,n=e.data,a=e.renderRow,o=e.emptyMessage,i=void 0===o?"Nenhuma atividade registrada":o,s=e.className,l=void 0===s?"":s;return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"table-responsive app-table-responsive ".concat(l),children:(0,r.jsxs)("table",{className:"table mb-0 table-hover app-table",children:[(0,r.jsx)("thead",{className:"thead-light",children:(0,r.jsx)("tr",{children:t.map(function(e){return(0,r.jsx)("th",{className:"center"===e.align?"text-center":"right"===e.align?"text-right":"",style:{width:e.width},children:e.label},e.key)})})}),(0,r.jsx)("tbody",{children:0===n.length?(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:t.length,className:"text-center text-muted py-4",children:i})}):n.map(function(e,t){return(0,r.jsx)("tr",{className:t%2==1?"bg-light":"",children:a(e,t)},t)})})]})})})}},88821(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>c});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540),o=n(73638);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var l={container:{padding:"16px",minWidth:"320px",maxWidth:"400px"},header:{fontSize:"14px",fontWeight:600,color:"#5C5D5D",marginBottom:"12px",paddingBottom:"8px",borderBottom:"1px solid #E0E0E0"},textarea:{width:"100%",padding:"10px",border:"1px solid #D1D5DB",borderRadius:"5px",fontSize:"13px",color:"#5C5D5D",minHeight:"100px",resize:"vertical",marginBottom:"12px",boxSizing:"border-box"},buttonGroup:{display:"flex",justifyContent:"flex-end",gap:"8px"},cancelButton:{padding:"8px 16px",border:"1px solid #D1D5DB",borderRadius:"5px",backgroundColor:"#FFF",fontSize:"13px",fontWeight:600,color:"#5C5D5D",cursor:"pointer"},saveButton:{padding:"8px 16px",border:"none",borderRadius:"5px",backgroundColor:"#186073",fontSize:"13px",fontWeight:600,color:"#FFF",cursor:"pointer"}};function c(e){var t=e.show,n=e.onClose,s=e.onSave,c=e.initialComment,u=e.activityName,d=e.triggerRef,f=i((0,a.useState)(c),2),m=f[0],p=f[1];(0,a.useEffect)(function(){p(c)},[c,t]);return(0,r.jsx)(o.A,{show:t,onClose:n,position:"bottom",triggerRef:d,children:(0,r.jsxs)("div",{style:l.container,children:[(0,r.jsxs)("div",{style:l.header,children:["Comentário: ",u]}),(0,r.jsx)("textarea",{style:l.textarea,value:m,onChange:function(e){return p(e.target.value)},placeholder:"Adicione observações sobre a atividade...",autoFocus:!0}),(0,r.jsxs)("div",{style:l.buttonGroup,children:[(0,r.jsx)("button",{type:"button",style:l.cancelButton,onClick:n,children:"Cancelar"}),(0,r.jsx)("button",{type:"button",style:l.saveButton,onClick:function(){s(m)},children:"Salvar"})]})]})})}},90162(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>j});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(51629),n(23418),n(64346),n(23792),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(27495),n(38781),n(47764),n(23500),n(62953);var r,a=n(74848),o=n(49785),i=n(96540),s=n(34559);n(62062),n(5506);function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=l(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==l(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e.FORGETFULNESS="esquecimento",e.DUPLICATE_RECORD="registro_duplicado",e.REQUESTED_ADJUSTMENT="ajuste_solicitado"}(r||(r={}));var f=d(d(d({},r.FORGETFULNESS,"Esquecimento"),r.DUPLICATE_RECORD,"Registro duplicado"),r.REQUESTED_ADJUSTMENT,"Ajuste solicitado");var m=n(1806),p=n(47339);function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach(function(t){y(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=h(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==h(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return x(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?x(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function j(e){var t=e.isOpen,n=e.onClose,r=e.record,l=e.onSave,u=e.isSaving,d=(0,o.mN)({mode:"onChange",defaultValues:{motivo:"",primeiraEntradaData:"",primeiraEntradaHora:"",primeiraSaidaData:"",primeiraSaidaHora:"",segundaEntradaData:"",segundaEntradaHora:"",saidaData:"",saidaHora:""}}),h=d.register,v=d.handleSubmit,y=d.control,x=d.reset,j=d.formState,w=j.errors,S=j.isValid;(0,i.useEffect)(function(){if(r){var e,t,n,a,o=g((r.data||"").split("/"),3),i=o[0],s=o[1],l=o[2],c=l&&s&&i?"".concat(l,"-").concat(s,"-").concat(i):"";x({motivo:"",primeiraEntradaData:c,primeiraEntradaHora:(null===(e=r.registros)||void 0===e?void 0:e[0])||"",primeiraSaidaData:c,primeiraSaidaHora:(null===(t=r.registros)||void 0===t?void 0:t[1])||"",segundaEntradaData:c,segundaEntradaHora:(null===(n=r.registros)||void 0===n?void 0:n[2])||"",saidaData:c,saidaHora:(null===(a=r.registros)||void 0===a?void 0:a[3])||""})}},[r,x]);var N=function(e,t){if(!e||!t)return null;var n=new Date("".concat(e,"T").concat(t));return isNaN(n.getTime())?null:n.getTime()},k=function(){x(),n()};if(!t)return null;var C=Object.entries(f).map(function(e){var t=c(e,2);return{value:t[0],label:t[1]}});return(0,a.jsx)(m.A,{show:t,onClose:k,title:"Editando Registro",size:"md",className:"w-75",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:k,disabled:u,children:"Cancelar"}),(0,a.jsx)("button",{type:"submit",form:"editRecordForm",className:"btn btn-primary",disabled:u||!S,style:{backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:u?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("i",{className:"fas fa-spinner fa-spin mr-1"}),"Salvando..."]}):"Salvar Edição"})]}),children:(0,a.jsx)("form",{id:"editRecordForm",onSubmit:v(function(e){if(e.motivo){for(var t=[{name:"Primeira Entrada",value:N(e.primeiraEntradaData,e.primeiraEntradaHora)},{name:"Primeira Saída",value:N(e.primeiraSaidaData,e.primeiraSaidaHora)},{name:"Segunda Entrada",value:N(e.segundaEntradaData,e.segundaEntradaHora)},{name:"Segunda Saída",value:N(e.saidaData,e.saidaHora)}].filter(function(e){return null!==e.value}),n=1;n<t.length;n++){var r=t[n-1],a=t[n];if(a.value<=r.value)return void p.A.warning('O horário de "'.concat(a.name,'" deve ser posterior a "').concat(r.name,'".'),"Horário inválido")}l(e)}else p.A.warning("Por favor, selecione o motivo.","Campo obrigatório")}),children:(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,a.jsx)("h6",{style:{color:"#5C5D5D",marginBottom:"8px"},children:"Selecione o Motivo"}),(0,a.jsx)("p",{children:"Informe o motivo pelo qual este ponto precisa ser ajustado."}),(0,a.jsx)(o.xI,{name:"motivo",control:y,rules:{required:"Motivo é obrigatório"},render:function(e){var t=e.field;return(0,a.jsx)(s.A,{options:C,value:t.value,placeholder:"Motivo*",size:"md",onChange:t.onChange})}}),w.motivo&&(0,a.jsx)("small",{className:"text-danger d-block mt-1",children:w.motivo.message})]}),(0,a.jsxs)("div",{className:"row mb-3",children:[(0,a.jsxs)("div",{className:"col-md-6",children:[(0,a.jsx)("h6",{style:{color:"#5C5D5D",marginBottom:"8px"},children:"Primeira Entrada"}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("div",{className:"col-8",children:(0,a.jsx)("div",{className:"input-group",children:(0,a.jsx)("input",b(b({},h("primeiraEntradaData")),{},{type:"date",className:"form-control"}))})}),(0,a.jsx)("div",{className:"col-4",children:(0,a.jsx)("input",b(b({},h("primeiraEntradaHora")),{},{type:"time",className:"form-control",placeholder:"--:--"}))})]})]}),(0,a.jsxs)("div",{className:"col-md-6",children:[(0,a.jsx)("h6",{style:{color:"#5C5D5D",marginBottom:"8px"},children:"Primeira Saída"}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("div",{className:"col-8",children:(0,a.jsx)("div",{className:"input-group",children:(0,a.jsx)("input",b(b({},h("primeiraSaidaData")),{},{type:"date",className:"form-control"}))})}),(0,a.jsx)("div",{className:"col-4",children:(0,a.jsx)("input",b(b({},h("primeiraSaidaHora")),{},{type:"time",className:"form-control",placeholder:"12:00"}))})]})]})]}),(0,a.jsxs)("div",{className:"row mb-3",children:[(0,a.jsxs)("div",{className:"col-md-6",children:[(0,a.jsx)("h6",{style:{color:"#5C5D5D",marginBottom:"8px"},children:"Segunda Entrada"}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("div",{className:"col-8",children:(0,a.jsx)("div",{className:"input-group",children:(0,a.jsx)("input",b(b({},h("segundaEntradaData")),{},{type:"date",className:"form-control"}))})}),(0,a.jsx)("div",{className:"col-4",children:(0,a.jsx)("input",b(b({},h("segundaEntradaHora")),{},{type:"time",className:"form-control",placeholder:"13:01"}))})]})]}),(0,a.jsxs)("div",{className:"col-md-6",children:[(0,a.jsx)("h6",{style:{color:"#5C5D5D",marginBottom:"8px"},children:"Segunda Saída"}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("div",{className:"col-8",children:(0,a.jsx)("div",{className:"input-group",children:(0,a.jsx)("input",b(b({},h("saidaData")),{},{type:"date",className:"form-control"}))})}),(0,a.jsx)("div",{className:"col-4",children:(0,a.jsx)("input",b(b({},h("saidaHora")),{},{type:"time",className:"form-control",placeholder:"18:00"}))})]})]})]})]})})})}},90412(){},92268(e,t,n){"use strict";n.d(t,{A:()=>o});n(62062),n(26099),n(11392);var r=n(74848),a=n(73638);function o(e){var t=e.show,n=e.onClose,o=e.options,i=e.onSelect,s=e.position,l=void 0===s?"left":s,c=e.triggerRef;return(0,r.jsx)(a.A,{show:t,onClose:n,position:l,width:"200px",triggerRef:c,children:o.map(function(e){return(0,r.jsxs)("button",{type:"button",className:"dropdown-item d-flex align-items-center",onClick:function(){return t=e.value,i(t),void n();var t},style:{backgroundColor:e.selected?"#F3F3F3":"transparent",color:e.selected?"#5C5D5D":"inherit"},children:[e.icon&&(e.icon.startsWith("/")||e.icon.startsWith("http")?(0,r.jsx)("img",{src:e.icon,alt:"",className:"mr-2",style:{width:"16px",height:"16px"}}):(0,r.jsx)("i",{className:"".concat(e.icon," mr-2")})),e.label]},e.value)})})}},92454(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>s});n(52675),n(89463),n(2259),n(23418),n(64346),n(23792),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(96540);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s(e){var t=e.isOpen,n=e.onConfirm,i=e.onClose,s=o((0,a.useState)(""),2),l=s[0],c=s[1],u=o((0,a.useState)(null),2),d=u[0],f=u[1];(0,a.useEffect)(function(){t&&(c(""),f(null))},[t]);return t?(0,r.jsx)("div",{className:"modal show d-block",style:{backgroundColor:"rgba(0,0,0,0.5)"},onClick:i,children:(0,r.jsx)("div",{className:"modal-dialog modal-dialog-centered",onClick:function(e){return e.stopPropagation()},children:(0,r.jsxs)("div",{className:"modal-content",children:[(0,r.jsxs)("div",{className:"modal-header",children:[(0,r.jsxs)("h5",{className:"modal-title",children:[(0,r.jsx)("i",{className:"fas fa-flask mr-2"}),"Bater Ponto Teste"]}),(0,r.jsx)("button",{type:"button",className:"close",onClick:i,"aria-label":"Fechar",children:(0,r.jsx)("span",{"aria-hidden":"true",children:"×"})})]}),(0,r.jsxs)("form",{onSubmit:function(e){(e.preventDefault(),l)?/^([0-1][0-9]|2[0-3]):[0-5][0-9]$/.test(l)?n(l):f("Horário inválido. Use o formato HH:mm (ex: 18:00)"):f("Por favor, informe o horário")},children:[(0,r.jsxs)("div",{className:"modal-body",children:[(0,r.jsx)("p",{className:"text-muted mb-3",children:"Informe o horário que deseja registrar para o ponto de teste:"}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{htmlFor:"test-time",children:"Horário (HH:mm)"}),(0,r.jsx)("input",{type:"time",id:"test-time",className:"form-control ".concat(d?"is-invalid":""),value:l,onChange:function(e){var t=e.target.value;c(t),f(null)},onFocus:function(){f(null)},required:!0}),d&&(0,r.jsx)("div",{className:"invalid-feedback",children:d})]})]}),(0,r.jsxs)("div",{className:"modal-footer",children:[(0,r.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:i,children:"Cancelar"}),(0,r.jsxs)("button",{type:"submit",className:"btn btn-primary",style:{backgroundColor:"#17A2B8",borderColor:"#17A2B8"},children:[(0,r.jsx)("i",{className:"fas fa-check mr-2"}),"Registrar Ponto"]})]})]})]})})}):null}},92801(e,t,n){"use strict";n.d(t,{A:()=>x});n(52675),n(89463),n(2259),n(28706),n(23418),n(74423),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(21699),n(47764),n(68156),n(62953);var r=n(74848),a=n(96540),o=n(33930),i=n(10280),s=n(30588),l=n(73236),c=n(71458),u=n(93628),d=n(42328),f=n(72722),m=n(1125),p=n(81623),h=n(9504),v=n(50860);function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return y(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var g=function(e){var t=e.value,n=e.label,a={container:{background:"#FFF",borderRadius:"3px",border:"1px solid rgba(217, 217, 217, 0.40)",padding:"20px",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",textAlign:"left"},title:{fontSize:"20px",fontWeight:700,color:"#5C5D5D",margin:"0 0 8px 0",lineHeight:"normal"},subtitle:{fontSize:"12px",color:"rgba(92, 93, 93, 0.50)",margin:0,fontWeight:500,lineHeight:"normal"}};return(0,r.jsxs)("div",{style:a.container,children:[(0,r.jsx)("h3",{style:a.title,children:t}),(0,r.jsx)("p",{style:a.subtitle,children:n})]})};function x(e){var t=e.title,n=e.subtitle,y=e.showBackButton,x=void 0!==y&&y,j=e.onBack,w=e.showExportButton,S=void 0!==w&&w,N=(e.onExport,e.userInfo),k=e.memberId,C=b((0,a.useState)(function(){var e=new Date,t=new Date;t.setDate(t.getDate()-30);var n=function(e){var t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(r)};return{startDate:n(t),endDate:n(e)}}()),2),O=C[0],A=C[1],E=b((0,a.useState)(["task"]),2),P=E[0],F=E[1],T=b((0,a.useState)(["timesheet"]),2),D=T[0],_=T[1],I=(0,a.useRef)(null),M=b((0,a.useState)(!1),2),R=M[0],z=M[1],L=function(e){A(e)},q=(0,o.I)({queryKey:["month-kpis",O.startDate,O.endDate,k],queryFn:function(){return p.Z4.getMonthKPIs(O.startDate,O.endDate,k)},staleTime:6e4}),B=q.data,G=q.isLoading,H=B?{totalRegistered:B.total_registered_formatted,dailyAverage:B.daily_average_formatted,extraHours:B.extra_hours_formatted,missingHours:B.missing_hours_formatted}:{totalRegistered:"00:00h",dailyAverage:"00:00h",extraHours:"0h",missingHours:"00:00h"},W=(0,o.I)({queryKey:["month-info",O.startDate,O.endDate,k],queryFn:function(){return p.Z4.getMonthInfo(O.startDate,O.endDate,k)},staleTime:6e4}),U=W.data,V=W.isLoading,Q=U?{diasRegistrados:{value:"".concat(U.dias_registrados," de ").concat(U.total_dias_mes),label:"Dias Registrados no Mês"},diasTrabalhados:{value:"".concat(U.dias_trabalhados),label:"Trabalhados"},atividadesRegistradas:{value:"".concat(U.atividades_registradas),label:"Quantidade de Atividades Registradas"}}:{diasRegistrados:{value:"0 de 0",label:"Dias Registrados no Mês"},diasTrabalhados:{value:"0",label:"Trabalhados"},atividadesRegistradas:{value:"0",label:"Quantidade de Atividades Registradas"}},K=(0,o.I)({queryKey:["hours-control",O.startDate,O.endDate,k],queryFn:function(){return p.Z4.getHoursControl(O.startDate,O.endDate,k)},staleTime:6e4}),$=K.data,J=K.isLoading,Y=$?[{type:"Horas Regulares",value:$.regular_hours},{type:"Horas Extras",value:$.extra_hours},{type:"Horas Noturnas",value:$.night_hours}]:[],Z=$?Math.max(20,4*Math.ceil(($.workload_hours+$.extra_hours)/4)):20,X=function(e){return{"Horas Regulares":"#186073","Horas Extras":"#17A1B7","Horas Noturnas":"#02D6C7"}[e]||"#186073"},ee=(0,o.I)({queryKey:["hours-by-project",O.startDate,O.endDate,k],queryFn:function(){return p.Z4.getHoursByProject(O.startDate,O.endDate,k)},staleTime:6e4}),te=ee.data,ne=ee.isLoading,re=(0,o.I)({queryKey:["energy-peaks",O.startDate,O.endDate,k],queryFn:function(){return p.Z4.getEnergyPeaks(O.startDate,O.endDate,k)},enabled:D.includes("timesheet"),staleTime:6e4}),ae=re.data,oe=re.isLoading,ie=(0,o.I)({queryKey:["weekly-hours",O.startDate,O.endDate,k],queryFn:function(){return p.Z4.getWeeklyHours(O.startDate,O.endDate,k)},enabled:P.includes("task"),staleTime:6e4}),se=ie.data,le=ie.isLoading;return(0,r.jsx)("div",{ref:I,children:(0,r.jsxs)(v.A,{children:[(0,r.jsxs)("div",{className:"d-flex align-items-center justify-content-between mb-4",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[x&&(0,r.jsx)("button",{onClick:j,className:"btn btn-link p-0 mr-3",style:{color:"#5C5D5D",fontSize:"20px",textDecoration:"none"},title:"Voltar",children:(0,r.jsx)("i",{className:"fas fa-arrow-left"})}),(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[N&&(0,r.jsx)("div",{className:"rounded-circle d-flex align-items-center justify-content-center text-white mr-3",style:{width:48,height:48,fontSize:"20px",fontWeight:700,background:N.avatarBg},children:N.initials}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"title_main mb-1",style:{color:"#5C5D5D",fontSize:"20px",fontWeight:600,margin:0},children:t}),n&&(0,r.jsx)("p",{className:"subtitle_main",style:{color:"#5C5D5D",fontSize:"12px",fontWeight:400,margin:0},children:n})]})]})]}),(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{gap:"12px"},children:[S&&(0,r.jsxs)("button",{onClick:function(){(0,h.vl)({dashboardRef:I,dateRange:O,setIsExporting:z})},disabled:R,className:"btn",style:{backgroundColor:"#186073",color:"#fff",border:"none",borderRadius:"8px",padding:"10px 20px",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",cursor:R?"not-allowed":"pointer",opacity:R?.7:1,transition:"all 0.2s ease"},onMouseEnter:function(e){R||(e.currentTarget.style.backgroundColor="#134A5A")},onMouseLeave:function(e){e.currentTarget.style.backgroundColor="#186073"},children:[(0,r.jsx)("i",{className:"fas fa-download"}),R?"Exportando...":"Exportar em PDF"]}),(0,r.jsx)(s.A,{initialStartDate:O.startDate,initialEndDate:O.endDate,onChange:L,maxDays:365})]})]}),(0,r.jsxs)("div",{className:"row mb-4",children:[(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(i.A,{value:H.totalRegistered,label:"Total de Horas Registradas",variant:"teal-dark",isLoading:G,className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(i.A,{value:H.dailyAverage,label:"Média Diária",variant:"cyan",isLoading:G,className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(i.A,{value:H.extraHours,label:"Total de Horas Extras",variant:"turquoise",isLoading:G,className:"h-100"})}),(0,r.jsx)("div",{className:"col-12 col-sm-6 col-lg-3 mb-2",children:(0,r.jsx)(i.A,{value:H.missingHours,label:"Total de Horas Faltantes",variant:"salmon",isLoading:G,className:"h-100"})})]}),(0,r.jsx)("div",{className:"d-flex align-items-center justify-content-between mb-3",children:(0,r.jsx)(s.A,{initialStartDate:O.startDate,initialEndDate:O.endDate,onChange:L,maxDays:365})}),(0,r.jsx)(l.A,{title:"Horas Trabalhadas na Semana",className:"mb-3",headerActions:(0,r.jsx)(f.A,{options:[{value:"task",label:"Referência Por Task"},{value:"attendance",label:"Referência Por Registro de Ponto"}],selectedValues:P,onChange:F,placeholder:"Selecione os filtros"}),children:le?(0,r.jsx)(m.A,{message:"Carregando dados..."}):(0,r.jsx)(c.A,{selectedFilters:P,weeklyData:se||[]})}),(0,r.jsx)(l.A,{title:"Horas Trabalhadas Por Projetos",className:"mb-3",children:ne?(0,r.jsx)(m.A,{message:"Carregando projetos..."}):te&&te.length>0?(0,r.jsx)(u.A,{projects:te}):(0,r.jsxs)("div",{className:"text-center py-5",children:[(0,r.jsx)("i",{className:"fas fa-inbox mr-2",style:{fontSize:"48px",color:"#D6DBED"}}),(0,r.jsx)("p",{className:"text-muted mt-3",children:"Nenhum projeto com horas registradas neste período"})]})}),V?(0,r.jsx)("div",{className:"row mb-3",children:(0,r.jsx)("div",{className:"col-12",children:(0,r.jsx)(m.A,{message:"Carregando informações do mês..."})})}):(0,r.jsxs)("div",{className:"row mb-3",children:[(0,r.jsx)("div",{className:"col-12 col-md-4 mb-3",children:(0,r.jsx)(g,{value:Q.diasRegistrados.value,label:Q.diasRegistrados.label})}),(0,r.jsx)("div",{className:"col-12 col-md-4 mb-3",children:(0,r.jsx)(g,{value:Q.diasTrabalhados.value,label:Q.diasTrabalhados.label})}),(0,r.jsx)("div",{className:"col-12 col-md-4 mb-3",children:(0,r.jsx)(g,{value:Q.atividadesRegistradas.value,label:Q.atividadesRegistradas.label})})]}),(0,r.jsx)(l.A,{title:"Picos de Energia - Horas Registradas",className:"mb-3",headerActions:(0,r.jsx)(f.A,{options:[{value:"timesheet",label:"Por Timesheet"},{value:"attendance",label:"Por Registro de Ponto"}],selectedValues:D,onChange:_,placeholder:"Selecione os filtros"}),children:oe?(0,r.jsx)(m.A,{message:"Carregando dados de energia..."}):(0,r.jsx)(d.A,{selectedFilters:D,timesheetData:D.includes("timesheet")&&ae||[],attendanceData:[]})}),(0,r.jsx)(l.A,{title:"Controle de Horas Trabalhadas",className:"mb-3",children:J?(0,r.jsx)(m.A,{message:"Carregando controle de horas..."}):Y.length>0?(0,r.jsxs)("div",{style:{width:"100%"},children:[(0,r.jsx)("div",{style:{display:"flex",justifyContent:"space-between",paddingLeft:"20px",paddingRight:"30px",marginBottom:"10px"},children:Array.from({length:6},function(e,t){return Math.round(Z/5*t)}).map(function(e){return(0,r.jsx)("span",{style:{color:"#5C5D5D",fontSize:"12px",fontWeight:400},children:e},e)})}),(0,r.jsx)("div",{style:{paddingLeft:"20px",paddingRight:"30px"},children:Y.map(function(e,t){return(0,r.jsx)("div",{style:{marginBottom:"12px"},children:(0,r.jsx)("div",{style:{width:"100%",height:"40px",background:"#F5F5F5",borderRadius:"4px",position:"relative",overflow:"hidden"},children:(0,r.jsx)("div",{style:{width:"".concat(e.value/Z*100,"%"),height:"100%",background:X(e.type),borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"flex-end",paddingRight:"10px",transition:"width 0.3s ease"},children:(0,r.jsxs)("span",{style:{color:"#FFF",fontSize:"12px",fontWeight:600},children:[e.value,"h"]})})})},t)})}),(0,r.jsx)("div",{style:{display:"flex",justifyContent:"center",gap:"20px",marginTop:"20px"},children:Y.map(function(e){return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,r.jsx)("div",{style:{width:"12px",height:"12px",background:X(e.type),borderRadius:"2px"}}),(0,r.jsx)("span",{style:{color:"#5C5D5D",fontSize:"12px",fontWeight:400},children:e.type})]},e.type)})})]}):(0,r.jsxs)("div",{className:"text-center py-5",children:[(0,r.jsx)("i",{className:"fas fa-clock mr-2",style:{fontSize:"48px",color:"#D6DBED"}}),(0,r.jsx)("p",{className:"text-muted mt-3",children:"Nenhuma hora registrada neste período"})]})})]})})}},93628(e,t,n){"use strict";n.d(t,{A:()=>y});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(62010),n(2892),n(67945),n(84185),n(83851),n(81278),n(79432),n(26099),n(27495),n(38781),n(47764),n(23500),n(62953);var r=n(74848),a=n(28482),o=n(72050),i=n(5614),s=n(69107),l=n(46668),c=n(77984),u=n(23495),d=n(88224);function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function h(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=f(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==f(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e){var t=e.projects,n=t.length>0?Math.max.apply(Math,v(t.map(function(e){return e.hours}))):0,f=n>0?Math.ceil(1.2*n):10,m=function(e){if(e<=0)return[0];if(e<=5)return[0,Math.ceil(e)];if(e<=10)return[0,Math.ceil(e/2),Math.ceil(e)];if(e<=20){var t=Math.ceil(e/4);return[0,t,2*t,3*t,Math.ceil(e)]}for(var n=5*Math.ceil(e/4/5),r=[0],a=n;a<=e;a+=n)r.push(a);return r}(f),h=t.map(function(e){return p(p({},e),{},{background:f-e.hours})});return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{children:(0,r.jsx)(a.u,{width:"100%",height:220,children:(0,r.jsxs)(d.E,{data:h,layout:"vertical",margin:{top:10,right:60,left:10,bottom:10},barSize:28,children:[(0,r.jsx)(s.d,{strokeDasharray:"3 3",horizontal:!1,stroke:"#E0E0E0"}),(0,r.jsx)(c.W,{type:"number",domain:[0,f],ticks:m,axisLine:!1,tickLine:!1,tick:{fill:"#5C5D5D",fontSize:12}}),(0,r.jsx)(u.h,{type:"category",dataKey:"name",axisLine:!1,tickLine:!1,tick:!1,width:0}),(0,r.jsxs)(l.yP,{dataKey:"hours",stackId:"project",radius:[0,0,0,0],children:[h.map(function(e,t){return(0,r.jsx)(o.f,{fill:e.color},"cell-".concat(t))}),(0,r.jsx)(i.Ze,{dataKey:"hours",position:"right",formatter:function(e){return"".concat(e,"h")},style:{fill:"#5C5D5D",fontSize:12,fontWeight:600}})]}),(0,r.jsx)(l.yP,{dataKey:"background",stackId:"project",fill:"rgba(214, 219, 237, 0.40)",radius:[0,4,4,0]})]})})}),(0,r.jsx)("div",{className:"d-flex align-items-center justify-content-center flex-wrap gap-3 mt-3",children:t.map(function(e,t){return(0,r.jsxs)("div",{className:"d-flex align-items-center",style:{paddingRight:"12px"},children:[(0,r.jsx)("div",{style:{width:"12px",height:"12px",background:e.color,borderRadius:"2px",marginRight:"8px"}}),(0,r.jsx)("span",{style:{fontSize:"12px",color:"#5C5D5D"},children:e.name})]},t)})})]})}},93794(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>N});n(52675),n(89463),n(2259),n(45700),n(28706),n(2008),n(51629),n(23418),n(64346),n(23792),n(62062),n(34782),n(89572),n(23288),n(94170),n(62010),n(2892),n(59904),n(67945),n(84185),n(83851),n(81278),n(40875),n(79432),n(10287),n(26099),n(3362),n(27495),n(38781),n(31415),n(47764),n(23500),n(62953);var r=n(74848),a=n(33930),o=n(97665),i=n(57097),s=n(19619),l=n(55801),c=n(96540),u=n(76336);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function f(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach(function(t){v(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function v(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=d(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==d(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return y(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(y(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,y(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,y(d,"constructor",c),y(c,"constructor",l),l.displayName="GeneratorFunction",y(c,a,"GeneratorFunction"),y(d),y(d,a,"Generator"),y(d,r,function(){return this}),y(d,"toString",function(){return"[object Generator]"}),(b=function(){return{w:o,m:f}})()}function y(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}y=function(e,t,n,r){function o(t,n){y(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},y(e,t,n,r)}function g(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function x(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){g(o,r,a,i,s,"next",e)}function s(e){g(o,r,a,i,s,"throw",e)}i(void 0)})}}var j=[{label:"Selfie",type:"selfie",description:{enabled:"Exige selfie.",disabled:"Não é exigida"}},{label:"Geolocalização",type:"geolocation",description:{enabled:"Cerca exigida.",disabled:"Cerca não exigida."}},{label:"Print da Tela",type:"screenshot",description:{enabled:"Exige Print",disabled:"Print não é exigida"}},{label:"Escanear QR Code",type:"qrcode",description:{enabled:"Escâner exigido",disabled:"Não é exigida"}}],w=[{id:"sem",title:"Sem validação",note:"Para equipes autônomas e confiáveis, com controle de ponto simplificado.",defaults:{}},{id:"flex",title:"Flexível",note:"Ideal para monitorar equipes externas. Permite várias soluções de validação",defaults:{selfie:!0,geolocation:!0,screenshot:!0,qrcode:!0}},{id:"qr",title:"Por QR Code",note:"Permite validação presencial ou digital por escaneamento de QR Code.",defaults:{qrcode:!0}},{id:"manual",title:"Faça você mesmo",note:"Personalize as verificações conforme a necessidade da sua equipe.",defaults:{}}],S=["time-management","validation"];function N(){var e,t,n,d=(0,u.L)().canEdit,m=(0,o.jE)(),p=(0,a.I)({queryKey:S,queryFn:l.G8,staleTime:6e4,refetchOnWindowFocus:!1}),v=p.data,y=p.isFetching,g=p.isLoading,N=v?s.c[v.mode]:null,k=(0,c.useMemo)(function(){var e;return new Set(null!==(e=null==v?void 0:v.others)&&void 0!==e?e:[])},[v]),C=y||g,O=(0,i.n)({mutationFn:function(e){return(0,l.iY)(s.w[e])},onMutate:(e=x(b().m(function e(t){var n,r;return b().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,m.cancelQueries({queryKey:S});case 1:return(n=m.getQueryData(S))&&(r={mode:s.w[t],others:"manual"===t?n.others:[]},m.setQueryData(S,r)),e.a(2,{prev:n})}},e)})),function(t){return e.apply(this,arguments)}),onError:function(e,t,n){null!=n&&n.prev&&m.setQueryData(S,n.prev)},onSuccess:function(e){m.setQueryData(S,e)}}),A=(0,i.n)({mutationFn:function(e){return(0,l.Tt)(e)},onMutate:(t=x(b().m(function e(t){var n,r;return b().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,m.cancelQueries({queryKey:S});case 1:return(n=m.getQueryData(S))&&(r=h(h({},n),{},{others:Array.from(new Set([].concat(f(n.others),[t])))}),m.setQueryData(S,r)),e.a(2,{prev:n})}},e)})),function(e){return t.apply(this,arguments)}),onError:function(e,t,n){null!=n&&n.prev&&m.setQueryData(S,n.prev)}}),E=(0,i.n)({mutationFn:function(e){return(0,l.kc)(e)},onMutate:(n=x(b().m(function e(t){var n,r;return b().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,m.cancelQueries({queryKey:S});case 1:return(n=m.getQueryData(S))&&(r=h(h({},n),{},{others:n.others.filter(function(e){return e!==t})}),m.setQueryData(S,r)),e.a(2,{prev:n})}},e)})),function(e){return n.apply(this,arguments)}),onError:function(e,t,n){null!=n&&n.prev&&m.setQueryData(S,n.prev)}}),P=O.isPending||A.isPending||E.isPending;return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"row",children:w.map(function(e){var t=N===e.id;return(0,r.jsx)("div",{className:"col-12 col-lg-3 mb-3",children:(0,r.jsx)("div",{className:"card h-100 tm-card-mobile-auto ".concat(t?"border-primary bg-primary-soft":"border"),children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center mb-2",children:[(0,r.jsxs)("div",{className:"custom-control custom-checkbox",children:[(0,r.jsx)("input",{id:"chk-".concat(e.id),type:"checkbox",className:"custom-control-input",checked:!!t,disabled:P||C,onChange:function(){return t=e.id,void(d&&N!==t&&O.mutate(t));var t}}),(0,r.jsx)("label",{className:"custom-control-label",htmlFor:"chk-".concat(e.id)})]}),(0,r.jsx)("label",{htmlFor:"chk-".concat(e.id),className:"mb-0 ml-2 ".concat(t?"text-primary":""),style:{cursor:"pointer"},children:e.title}),(P||C)&&(0,r.jsx)("i",{className:"fas fa-spinner fa-spin ml-auto text-muted"})]}),(0,r.jsx)("small",{className:"text-muted d-block mb-2",children:e.note}),(0,r.jsx)("ul",{className:"list-unstyled mb-0",children:j.map(function(n){var a=!!e.defaults[n.type],o="manual"===e.id?k.has(n.type):a,i="manual"===e.id,s=P||C;return(0,r.jsxs)("li",{className:"d-flex align-items-start mb-3",children:[i?(0,r.jsxs)("div",{className:"custom-control custom-checkbox mr-2",children:[(0,r.jsx)("input",{id:"op-".concat(e.id,"-").concat(n.type),type:"checkbox",className:"custom-control-input",checked:o,disabled:s,onChange:function(){return e=n.type,void(d&&"manual"===N&&(k.has(e)?E.mutate(e):A.mutate(e)));var e}}),(0,r.jsx)("label",{className:"custom-control-label",htmlFor:"op-".concat(e.id,"-").concat(n.type)})]}):(0,r.jsx)("i",{className:"fas ".concat(o?"fa-check ".concat(t?"text-primary":"text-success"):"fa-times text-muted"," mr-2 mt-1"),style:{fontSize:"1.2rem",minWidth:"20px"}}),(0,r.jsxs)("div",{style:{minHeight:"2.5rem"},children:[(0,r.jsx)("div",{className:"".concat(i||o?"":"text-muted"),children:n.label}),i?(0,r.jsx)("small",{className:"text-muted",style:{visibility:"hidden"},children:" "}):(0,r.jsx)("small",{className:"text-muted",children:o?n.description.enabled:n.description.disabled})]})]},n.type)})})]})})},e.id)})})})}},94034(e,t,n){"use strict";n.d(t,{A:()=>o});n(51629),n(62062),n(26099);var r=n(74848),a=n(96540);function o(e){var t=e.items,n=e.activeKey,o=e.title,i=e.onChange,s=e.onBack,l=e.backLabel,c=void 0===l?"Voltar":l,u=e.hideTabs,d=void 0!==u&&u,f=(0,a.useRef)(null);return(0,a.useEffect)(function(){var e=f.current;if(e){for(var t=e.parentElement,n=[];t;){var r=window.getComputedStyle(t),a=r.overflow,o=r.overflowY;"hidden"!==a&&"auto"!==a&&"scroll"!==a&&"hidden"!==o&&"auto"!==o&&"scroll"!==o||(t.style.setProperty("overflow","visible","important"),t.style.setProperty("overflow-y","visible","important"),n.push(t)),t=t.parentElement}var i=e.nextElementSibling;return i&&(i.style.setProperty("position","relative","important"),i.style.setProperty("z-index","1","important")),function(){n.forEach(function(e){e.style.removeProperty("overflow"),e.style.removeProperty("overflow-y")}),i&&(i.style.removeProperty("position"),i.style.removeProperty("z-index"))}}},[]),(0,r.jsxs)("header",{ref:f,className:"modern-header tm-modern-header ".concat(d?"no-tabs":""),children:[(0,r.jsxs)("div",{className:"header-top",children:[s&&(0,r.jsx)("button",{type:"button",className:"btn d-flex align-items-center justify-content-center",style:{borderRadius:5,padding:"5px 10px",height:40,width:40},onClick:s,"aria-label":c,title:c,children:(0,r.jsx)("i",{className:"fas fa-chevron-left","aria-hidden":"true"})}),(0,r.jsx)("h1",{className:"header-title",children:o})]}),!d&&(0,r.jsx)("div",{className:"app-tabs-bar",children:(0,r.jsx)("div",{className:"app-tabs",role:"tablist",children:(0,r.jsx)("div",{className:"d-flex flex-nowrap nav mhs-tabs-nav app-tabs-inner-row",children:t.map(function(e){var t=e.key===n;return e.href?(0,r.jsx)("a",{className:"app-tab-link ".concat(t?"active":""),href:e.href,role:"tab","aria-selected":t,children:e.label},e.key):(0,r.jsx)("button",{type:"button",className:"app-tab-link ".concat(t?"active":""),role:"tab","aria-selected":t,onClick:function(){return null==i?void 0:i(e.key)},children:e.label},e.key)})})})})]})}},95226(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>v});n(52675),n(89463),n(2259),n(28706),n(23418),n(64346),n(23792),n(62062),n(34782),n(23288),n(62010),n(26099),n(27495),n(38781),n(47764),n(62953);var r=n(74848),a=n(33930),o=n(97665),i=n(57097),s=n(70038),l=n(96540),c=n(79724),u=n(14011),d=n(76336),f=n(47339);function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var h=["time-management","work-shifts"];function v(){var e=(0,d.L)(),t=e.canCreate,n=e.canEdit,p=e.canDelete,v=m((0,l.useState)(!1),2),b=v[0],y=v[1],g=m((0,l.useState)(null),2),x=g[0],j=g[1],w=m((0,l.useState)(!1),2),S=w[0],N=w[1],k=m((0,l.useState)(null),2),C=k[0],O=k[1],A=(0,o.jE)(),E=(0,l.useRef)(null),P=(0,l.useRef)(null),F=(0,l.useRef)(null),T=m((0,l.useState)(0),2),D=T[0],_=T[1],I=(0,a.I)({queryKey:h,queryFn:s.hY}),M=I.data,R=void 0===M?[]:M,z=I.isFetching,L=(0,i.n)({mutationFn:s.b1,onSuccess:function(){A.invalidateQueries({queryKey:h})}}),q=(0,i.n)({mutationFn:function(e){var t=e.workShiftId,n=e.memberIds;return(0,s.nx)(t,n)},onSuccess:function(){A.invalidateQueries({queryKey:h}),A.invalidateQueries({queryKey:["time-management","members"]}),A.invalidateQueries({queryKey:["time-management","members-with-shifts"]}),f.A.success("Membros atribuídos com sucesso!","Sucesso"),B()},onError:function(){f.A.error("Erro ao atribuir membros. Por favor, tente novamente.","Erro")}}),B=function(){N(!1),O(null)},G=(0,l.useMemo)(function(){return 0===R.length},[R]);return(0,l.useEffect)(function(){var e=function(){if(P.current&&F.current){var e=P.current.getBoundingClientRect(),t=F.current.getBoundingClientRect(),n=t.left-e.left+t.width/2;_(n)}};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[R]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("style",{children:"\n .workshift-list-container { overflow: visible !important; overflow-x: visible !important; overflow-y: visible !important; }\n .workshift-list-container .card { overflow: visible !important; }\n .workshift-list-container .card-body { overflow: visible !important; }\n .workshift-list-container .row { overflow: visible !important; }\n .workshift-list { max-height: 360px; overflow-y: auto; padding-right: 6px; }\n .workshift-header-time { min-width: 200px; text-align: right; }\n @media (max-width: 768px) {\n .workshift-card-content {\n flex-direction: column !important;\n align-items: flex-start !important;\n }\n .workshift-icon {\n margin-bottom: 10px;\n }\n .workshift-time {\n margin: 10px 0 !important;\n width: 100%;\n }\n .workshift-actions {\n position: absolute;\n top: 10px;\n right: 10px;\n }\n .workshift-header-time {\n display: none !important;\n }\n }\n "}),(0,r.jsx)("div",{ref:E,className:"position-relative",children:!G&&(0,r.jsx)("div",{style:{position:"absolute",top:-28,left:D,transform:"translateX(-50%)"},className:"text-muted d-none d-md-block",children:"Horário"})}),!G&&(0,r.jsx)("div",{className:"mb-3 workshift-list-container workshift-list",ref:P,style:{overflow:"visible"},children:R.map(function(e,t){return(0,r.jsx)("div",{className:"card mb-3",style:{border:"1px solid #e0e0e0",borderRadius:"8px",position:"relative",overflow:"visible"},children:(0,r.jsx)("div",{className:"card-body py-3",style:{overflow:"visible"},children:(0,r.jsxs)("div",{className:"row no-gutters align-items-center workshift-card-content",style:{overflow:"visible"},children:[(0,r.jsx)("div",{className:"col-auto pr-2 d-flex align-items-center justify-content-center workshift-icon",children:(0,r.jsx)("div",{style:{width:40,height:40},className:"d-flex align-items-center justify-content-center bg-primary-soft rounded",children:(0,r.jsx)("i",{className:"far fa-clock text-primary",style:{fontSize:"1.2rem"}})})}),(0,r.jsx)("div",{className:"col-12 col-md-3 px-2 d-flex",style:{minWidth:0},children:(0,r.jsx)("div",{className:"d-flex align-items-center w-100 my-auto",style:{minWidth:0},children:(0,r.jsx)("span",{className:"font-weight-bold text-truncate",style:{minWidth:0},children:e.name})})}),(0,r.jsx)("div",{className:"col px-2 d-flex",style:{minWidth:0},children:(0,r.jsx)("div",{className:"w-100 my-auto text-muted text-truncate text-center",style:{minWidth:0},children:e.description})}),(0,r.jsx)("div",{ref:0===t?F:void 0,className:"col-auto text-center text-muted workshift-time px-2 my-auto",style:{whiteSpace:"nowrap",fontSize:"0.9rem",width:"240px"},children:(a=e.firstCheckIn,o=e.firstCheckOut,i=e.secondCheckIn,s=e.secondCheckOut,l=function(e){return e?e.slice(0,5):"--:--"},"".concat(l(a)," às ").concat(l(o))+(i||s?" • ".concat(l(i)," às ").concat(l(s)):""))}),(0,r.jsxs)("div",{className:"col-auto pl-2 dropdown workshift-actions ml-auto",style:{flexShrink:0,position:"static"},children:[(0,r.jsx)("button",{className:"btn btn-link text-muted p-0","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{fontSize:"1.2rem"},children:(0,r.jsx)("i",{className:"fas fa-ellipsis-v"})}),(0,r.jsxs)("div",{className:"dropdown-menu dropdown-menu-right",style:{zIndex:2e3},children:[n&&(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(){return function(e){j(e),y(!0)}(e)},disabled:L.isPending,children:[(0,r.jsx)("i",{className:"far fa-edit mr-2"}),"Editar"]}),n&&(0,r.jsxs)("button",{className:"dropdown-item",onClick:function(){return function(e){O(e),N(!0)}(e)},disabled:L.isPending,children:[(0,r.jsx)("i",{className:"fas fa-users mr-2"}),"Membros"]}),p&&(0,r.jsxs)("button",{className:"dropdown-item text-danger",onClick:function(){return function(e){window.confirm('Tem certeza que deseja excluir o turno "'.concat(e.name,'"?'))&&L.mutate(e.id)}(e)},disabled:L.isPending,children:[(0,r.jsx)("i",{className:"far fa-trash-alt mr-2"}),L.isPending?"Excluindo...":"Excluir"]})]})]})]})})},e.id);var a,o,i,s,l})}),t&&(0,r.jsxs)("div",{className:"text-muted d-flex align-items-center",role:"button",onClick:function(){return y(!0)},style:{cursor:"pointer",fontSize:"0.95rem"},children:[(0,r.jsx)("i",{className:"fas fa-plus mr-2"})," Adicionar Turno",z&&(0,r.jsx)("i",{className:"fas fa-spinner fa-spin ml-2"})]}),b&&(0,r.jsx)(c.default,{show:b,onClose:function(){y(!1),j(null)},editData:x}),(0,r.jsx)(u.default,{isOpen:S,onClose:B,workShift:C,onSave:function(e){null!=C&&C.id&&q.mutate({workShiftId:C.id,memberIds:e})},isSaving:q.isPending})]})}},96339(e,t,n){"use strict";n.d(t,{E:()=>u,Z:()=>l});n(52675),n(89463),n(94170),n(59904),n(84185),n(40875),n(10287),n(26099),n(3362);var r=n(52354);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(n,r,a,i){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(n,r,a){var o,i,s,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,i=0,s=e,f.n=n,l}};function m(n,r){for(i=n,s=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(s=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(i=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,i=0))}if(a||n>1)return l;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),i=u,s=p;(t=i<2?e:s)||!d;){o||(i?i<3?(i>1&&(f.n=-1),m(i,s)):f.n=s:f.v=s);try{if(c=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(d=f.n<0)?s:n.call(r,f))!==l)break}catch(t){o=e,i=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,a,i),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),m=d.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:p}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)})}}function l(){return c.apply(this,arguments)}function c(){return(c=s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.get("/time-management/policy");case 1:return t=e.v,n=t.data,e.a(2,n.data)}},e)}))).apply(this,arguments)}function u(e){return d.apply(this,arguments)}function d(){return(d=s(a().m(function e(t){var n,o;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.F.put("/time-management/policy",t);case 1:return n=e.v,o=n.data,e.a(2,o.data)}},e)}))).apply(this,arguments)}},96930(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>N});n(52675),n(89463),n(2259),n(45700),n(2008),n(51629),n(23792),n(89572),n(94170),n(2892),n(59904),n(67945),n(84185),n(83851),n(81278),n(40875),n(79432),n(10287),n(26099),n(3362),n(47764),n(42762),n(23500),n(62953);var r,a=n(74848),o=n(49785),i=n(97665),s=n(57097),l=n(34559);n(23418),n(64346),n(62062),n(34782),n(23288),n(62010),n(5506),n(27495),n(38781);function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=c(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==c(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e.MARRIAGE_LEAVE="marriage_leave",e.MATERNITY_LEAVE="maternity_leave",e.SICK_LEAVE="sick_leave",e.OTHER="other"}(r||(r={}));var m=f(f(f(f({},r.MARRIAGE_LEAVE,"Casamento"),r.MATERNITY_LEAVE,"Licença maternidade"),r.SICK_LEAVE,"Licença médica"),r.OTHER,"Outro");var p=n(50418),h=n(96540),v=n(1806);function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function x(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=b(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==b(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return w(c,"_invoke",function(n,r,a){var o,s,l,c=0,u=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,i}};function m(n,r){for(s=n,l=r,t=0;!d&&c&&!a&&t<u.length;t++){var a,o=u[t],m=f.p,p=o[2];n>3?(a=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=m&&((a=n<2&&m<o[1])?(s=0,f.v=r,f.n=o[1]):m<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(a||n>1)return i;throw d=!0,r}return function(a,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),s=u,l=p;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),m(s,l)):f.n=l:f.v=l);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==i)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,a,o),!0),c}var i={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(w(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,w(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,w(d,"constructor",c),w(c,"constructor",l),l.displayName="GeneratorFunction",w(c,a,"GeneratorFunction"),w(d),w(d,a,"Generator"),w(d,r,function(){return this}),w(d,"toString",function(){return"[object Generator]"}),(j=function(){return{w:o,m:f}})()}function w(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}w=function(e,t,n,r){function o(t,n){w(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},w(e,t,n,r)}function S(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function N(e){var t,n,c=e.isOpen,d=e.onClose,f=e.record,b=(e.onSave,e.isSaving,(0,i.jE)()),y=(0,o.mN)({mode:"onChange",defaultValues:{isParcial:!1,motivo:"",descricao:"",periodoInicio:"",periodoFim:""}}),x=y.register,w=y.handleSubmit,N=y.control,k=y.watch,C=y.reset,O=y.formState.errors,A=k("isParcial"),E=k("motivo"),P=(0,h.useMemo)(function(){return Object.entries(m).map(function(e){var t=u(e,2);return{value:t[0],label:t[1]}})},[]),F=(0,s.n)({mutationFn:(t=j().m(function e(t){var n;return j().w(function(e){for(;;)switch(e.n){case 0:if(null!=f&&f.id){e.n=1;break}throw new Error("ID do registro (hitTheSpotId) não encontrado");case 1:return n={hitTheSpotId:f.id,payOffLicense:t.motivo,partialLicense:t.isParcial,startPeriod:t.isParcial?t.periodoInicio:void 0,endPeriod:t.isParcial?t.periodoFim:void 0,description:t.motivo===r.OTHER?t.descricao:void 0},e.a(2,(0,p.Qb)(n))}},e)}),n=function(){var e=this,n=arguments;return new Promise(function(r,a){var o=t.apply(e,n);function i(e){S(o,r,a,i,s,"next",e)}function s(e){S(o,r,a,i,s,"throw",e)}i(void 0)})},function(e){return n.apply(this,arguments)}),onSuccess:function(e){b.invalidateQueries({queryKey:["time-management","hit-spot-time-history"]}),alert(e.message||"Licença aplicada com sucesso!"),_()},onError:function(e){var t,n=(null===(t=e.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.error)||"Erro ao aplicar licença";alert(n)}}),T=F.mutate,D=F.isPending,_=function(){C(),d()};return c?(0,a.jsx)(v.A,{show:c,onClose:_,title:"Licença",size:"md",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"btn mh-btn-cancel",onClick:_,disabled:D,children:"Cancelar"}),(0,a.jsx)("button",{type:"submit",form:"licencaForm",className:"btn btn-primary",disabled:D,children:D?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("i",{className:"fas fa-spinner fa-spin mr-1"}),"Salvando..."]}):"Aplicar Licença"})]}),children:(0,a.jsxs)("form",{id:"licencaForm",onSubmit:w(function(e){e.motivo?e.motivo!==r.OTHER||e.descricao.trim()?!e.isParcial||e.periodoInicio&&e.periodoFim?T(e):alert("Por favor, preencha o período de início e finalização."):alert("Por favor, descreva o motivo."):alert("Por favor, selecione o motivo.")}),children:[(0,a.jsxs)("div",{className:"d-flex align-items-center justify-content-between mb-4",children:[(0,a.jsx)("label",{htmlFor:"toggleParcial",style:{fontWeight:"normal"},children:"A licença é parcial?"}),(0,a.jsxs)("div",{className:"custom-control custom-switch",style:{marginRight:0},children:[(0,a.jsx)("input",g(g({},x("isParcial")),{},{type:"checkbox",className:"custom-control-input",id:"toggleParcial"})),(0,a.jsx)("label",{className:"custom-control-label",htmlFor:"toggleParcial",style:{cursor:"pointer"}})]})]}),A&&(0,a.jsxs)("div",{className:"row mb-4",children:[(0,a.jsxs)("div",{className:"col-6",children:[(0,a.jsx)("h6",{children:"Período de Início"}),(0,a.jsxs)("div",{className:"input-group",children:[(0,a.jsx)("input",g(g({},x("periodoInicio",{required:!!A&&"Data de início obrigatória"})),{},{type:"date",className:"form-control",placeholder:"Data"})),(0,a.jsx)("div",{className:"input-group-append",children:(0,a.jsx)("span",{className:"input-group-text",children:(0,a.jsx)("i",{className:"far fa-calendar-alt"})})})]}),O.periodoInicio&&(0,a.jsx)("small",{className:"text-danger d-block mt-1",children:O.periodoInicio.message})]}),(0,a.jsxs)("div",{className:"col-6",children:[(0,a.jsx)("h6",{children:"Período de Finalização"}),(0,a.jsxs)("div",{className:"input-group",children:[(0,a.jsx)("input",g(g({},x("periodoFim",{required:!!A&&"Data de fim obrigatória"})),{},{type:"date",className:"form-control",placeholder:"Data"})),(0,a.jsx)("div",{className:"input-group-append",children:(0,a.jsx)("span",{className:"input-group-text",children:(0,a.jsx)("i",{className:"far fa-calendar-alt"})})})]}),O.periodoFim&&(0,a.jsx)("small",{className:"text-danger d-block mt-1",children:O.periodoFim.message})]})]}),(0,a.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,a.jsx)("h6",{children:"Motivo"}),(0,a.jsx)("p",{children:"Informe o motivo da licença"}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsxs)("div",{className:E===r.OTHER?"col-4":"col-12",children:[(0,a.jsx)(o.xI,{name:"motivo",control:N,rules:{required:"Motivo é obrigatório"},render:function(e){var t=e.field;return(0,a.jsx)(l.A,{options:P,value:t.value,placeholder:"Motivo*",size:"md",onChange:function(e){t.onChange(e),e!==r.OTHER&&C(function(e){return g(g({},e),{},{descricao:""})})}})}}),O.motivo&&(0,a.jsx)("small",{className:"text-danger d-block mt-1",children:O.motivo.message})]}),E===r.OTHER&&(0,a.jsxs)("div",{className:"col-8",children:[(0,a.jsx)("input",g(g({},x("descricao",{required:E===r.OTHER&&"Descrição é obrigatória"})),{},{type:"text",className:"form-control",placeholder:"Descreva o motivo*"})),O.descricao&&(0,a.jsx)("small",{className:"text-danger d-block mt-1",children:O.descricao.message})]})]})]})]})}):null}},97677(e,t,n){var r={"./PermissionGuard.tsx":19066,"./Professional/index.tsx":49791,"./Professional/tabs/focusmode/index.tsx":52558,"./Professional/tabs/focusmode/partials/FocusBackgroundPicker.tsx":69794,"./Professional/tabs/focusmode/partials/FocusFullscreen.tsx":26723,"./Professional/tabs/focusmode/partials/FocusMethodInfo.tsx":97839,"./Professional/tabs/focusmode/partials/FocusTimerCard.tsx":18851,"./Professional/tabs/point/index.tsx":18098,"./Professional/tabs/point/modals/ConfirmationPopover.tsx":2799,"./Professional/tabs/point/modals/EditPointModal.tsx":18752,"./Professional/tabs/point/modals/GeolocationModal.tsx":5380,"./Professional/tabs/point/modals/JustificationModal.tsx":67784,"./Professional/tabs/point/modals/QRCodeModal.tsx":39576,"./Professional/tabs/point/modals/ScreenshotModal.tsx":2698,"./Professional/tabs/point/modals/SelfieModal.tsx":77770,"./Professional/tabs/point/modals/TestModal.tsx":92454,"./Professional/tabs/point/partials/ClockCard.tsx":68925,"./Professional/tabs/point/partials/MobileClockCard.tsx":69511,"./Professional/tabs/point/partials/MobileOccurrencesTable.tsx":25149,"./Professional/tabs/point/partials/MobileOptionsModal.tsx":72810,"./Professional/tabs/point/partials/MobileTimeline.tsx":46550,"./Professional/tabs/point/partials/NoShiftAssigned.tsx":15186,"./Professional/tabs/point/partials/OccurrencesTable.tsx":31475,"./Professional/tabs/point/partials/PointCardContainer.tsx":8596,"./Professional/tabs/point/partials/ShiftTable.tsx":13359,"./Professional/tabs/timesheet/index.tsx":65342,"./Professional/tabs/timesheet/partials/CommentPopover.tsx":88821,"./Professional/tabs/timesheet/partials/CounterSection.tsx":75842,"./Professional/tabs/timesheet/partials/DeleteActivityModal.tsx":39618,"./Professional/tabs/timesheet/partials/ManualTimeModal.tsx":14463,"./Professional/tabs/timesheet/partials/PlannedActivitiesCard.tsx":48592,"./Professional/tabs/timesheet/partials/ProjectActivityCard.tsx":49293,"./Professional/tabs/timesheet/partials/ProjectSelector.tsx":59261,"./Professional/tabs/timesheet/partials/ScheduledActivitiesCard.tsx":36279,"./Professional/tabs/timesheet/partials/WorkSatisfactionModal.tsx":17649,"./Professional/tabs/timesheet/partials/shared-activity-utils.ts":33384,"./Tenant/index.tsx":81149,"./Tenant/tabs/attendance/index.tsx":75930,"./Tenant/tabs/overview/index.tsx":57909,"./Tenant/tabs/overview/partials/HistoryTable.tsx":73215,"./Tenant/tabs/overview/partials/OccurrenceTable.tsx":72210,"./Tenant/tabs/overview/partials/modals/HistoryDetailsModal.tsx":61909,"./Tenant/tabs/overview/partials/modals/HistoryFilterModal.tsx":195,"./Tenant/tabs/overview/partials/modals/JustificationModal.tsx":50455,"./Tenant/tabs/overview/partials/modals/OccurrenceFilterModal.tsx":22956,"./Tenant/tabs/permissions/index.tsx":41081,"./Tenant/tabs/pointControl/index.tsx":23696,"./Tenant/tabs/pointControl/partials/PointControlTable.tsx":80596,"./Tenant/tabs/pointControl/partials/modals/AbonarModal.tsx":64466,"./Tenant/tabs/pointControl/partials/modals/EditRecordModal.tsx":90162,"./Tenant/tabs/pointControl/partials/modals/FilterModal.tsx":34773,"./Tenant/tabs/pointControl/partials/modals/LicencaModal.tsx":96930,"./Tenant/tabs/pointControl/partials/modals/ViewRecordModal.tsx":77332,"./Tenant/tabs/settings/index.tsx":43432,"./Tenant/tabs/settings/partials/ChannelsCardRow.tsx":19782,"./Tenant/tabs/settings/partials/LocationSection.tsx":17147,"./Tenant/tabs/settings/partials/NotificationCards.tsx":7440,"./Tenant/tabs/settings/partials/PolicyCards.tsx":52798,"./Tenant/tabs/settings/partials/QRCodeLinkSection.tsx":47034,"./Tenant/tabs/settings/partials/SettingsSection.tsx":46265,"./Tenant/tabs/settings/partials/TimesheetLimitCards.tsx":26071,"./Tenant/tabs/settings/partials/ValidationModes.tsx":93794,"./Tenant/tabs/settings/partials/WorkShiftsSection .tsx":95226,"./Tenant/tabs/settings/partials/modals/AssignMembersModal.tsx":14011,"./Tenant/tabs/settings/partials/modals/LocationModal.tsx":30786,"./Tenant/tabs/settings/partials/modals/QRCodeLinkModal.tsx":42415,"./Tenant/tabs/settings/partials/modals/WorkShiftModal.tsx":79724,"./Tenant/tabs/timesheet/index.tsx":14785,"./Tenant/tabs/timesheet/partials/ProjectBudgetScatter.tsx":4818,"./Tenant/tabs/timesheet/partials/ProjectDistributionPie.tsx":80217,"./Tenant/tabs/timesheet/partials/TeamHoursBar.tsx":49299,"./Tenant/tabs/timesheet/partials/TeamSummaryTable.tsx":65207};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=97677},97839(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>a});var r=n(74848);function a(e){var t=e.method,n=function(){switch(t){case"pomodoro":return{title:"Pomodoro",text:"Ciclos de 25 minutos de foco seguidos por 5 minutos de pausa."};case"regra_52_17":return{title:"Regra 52/17",text:"Trabalhe por 52 minutos e faça 17 de pausa, com imersão mais longa."};case"personalizado":return{title:"Personalizado",text:"Defina livremente seus tempos de foco e descanso para seu ritmo."};default:return null}}();return n?(0,r.jsx)("div",{className:"mb-3",children:(0,r.jsxs)("div",{className:"p-3",style:{background:"#FFED99",borderRadius:8,color:"#222"},children:[(0,r.jsxs)("strong",{className:"d-block mb-1",children:[n.title,":"]}),(0,r.jsx)("span",{children:n.text})]})}):null}}},e=>{e.O(0,[169,768],()=>{return t=54958,e(e.s=t);var t});e.O()}]);
File: public/js/chat/features/chat-conversations-list.js
Match lines: 7
894| } else if (typeof window.openOffCanvasCall === 'function') {
895| window.openOffCanvasCall(userId, currentUserName, currentUserAvatar);
925| if (typeof window.openOffCanvasSearch === 'function') {
926| window.openOffCanvasSearch();
928| console.error('❌ window.openOffCanvasSearch is not a function');
1203| if (typeof window.openOffCanvasSearch === 'function') {
1204| window.openOffCanvasSearch();
File: public/js/chat/features/chat-message-actions.js
Match lines: 2
1307| if (typeof window.openOffCanvasFixadas === 'function') {
1308| window.openOffCanvasFixadas();
File: public/js/chat/features/chat-offcanvas-call.js
Match lines: 1
373| * Inicializa a UI da chamada (chamada por openOffCanvasCall para evitar recursão)
File: public/js/chat/features/chat-offcanvas-openers.js
Match lines: 14
27| function openOffCanvasFiles() {
68| function openOffCanvasFixadas() {
124| function openOffCanvasSearch() {
219| function openOffCanvasFavoritadas() {
253| function openOffCanvasMembers(entityId, entityType) {
278| function openOffCanvasInfo(entityId, entityType) {
304| function openOffCanvasCall(userId, userName, userAvatar) {
388| window.openOffCanvasFiles = openOffCanvasFiles;
389| window.openOffCanvasFixadas = openOffCanvasFixadas;
390| window.openOffCanvasSearch = openOffCanvasSearch;
391| window.openOffCanvasFavoritadas = openOffCanvasFavoritadas;
392| window.openOffCanvasMembers = openOffCanvasMembers;
393| window.openOffCanvasInfo = openOffCanvasInfo;
394| window.openOffCanvasCall = openOffCanvasCall;
File: public/js/chat/features/chat-offcanvas-pinned.js
Match lines: 1
14| * Carrega mensagens fixadas - será chamada pela função openOffCanvasFixadas
File: public/js/chat/features/chat-offcanvas-user.js
Match lines: 5
404| if (typeof window.openOffCanvasFiles === 'function') {
405| window.openOffCanvasFiles();
407| console.error('❌ openOffCanvasFiles não disponível');
424| if (typeof window.openOffCanvasSearch === 'function') {
425| window.openOffCanvasSearch();
File: public/js/chat/features/chat-webrtc-integration.js
Match lines: 3
282| if (typeof openOffCanvasCall === 'function') {
283| openOffCanvasCall(callUserId, callUserName, callUserAvatar);
285| console.error('❌ openOffCanvasCall function not found - opening offcanvas manually');
File: public/js/chat/ui/chat-offcanvas-manager.js
Match lines: 8
106| if (typeof window.openOffCanvasFixadas === 'function') {
107| window.openOffCanvasFixadas();
109| console.error('❌ openOffCanvasFixadas não está disponível');
112| if (typeof window.openOffCanvasFiles === 'function') {
113| window.openOffCanvasFiles();
115| console.error('❌ openOffCanvasFiles não está disponível');
118| if (typeof window.openOffCanvasFavoritadas === 'function') {
119| window.openOffCanvasFavoritadas();
File: public/js/chat/utils/chat-offcanvas-helpers.js
Match lines: 2
15| function openOffCanvas(targetId) {
212| window.openOffCanvas = openOffCanvas;
File: public/js/create-instance-offcanvas.js
Match lines: 2
6359| if (typeof window.openOffcanvasinstanceoffcanvas === 'function') {
6360| window.openOffcanvasinstanceoffcanvas();
File: public/js/decision_system/risk_intelligence_signals.js
Match lines: 2
1036| openOffcanvas(FILTER_DRAWER_ID);
2902| function openOffcanvas(id) {
File: public/js/goal-adriana-create-modal.js
Match lines: 4
273| if (typeof window.openOffcanvasmetaCollectiveModal === 'function') {
274| window.openOffcanvasmetaCollectiveModal();
289| if (typeof window.openOffcanvasmetaModal === 'function') {
290| window.openOffcanvasmetaModal();
File: public/js/goals-company-offcanvas.js
Match lines: 2
44| if (typeof window.openOffcanvasmetaModal === 'function') {
45| window.openOffcanvasmetaModal();
File: public/js/governance/governance-authorization-view-monitoring.js
Match lines: 2
684| if (typeof window.openOffcanvasautViewMonitoring === 'function') {
685| window.openOffcanvasautViewMonitoring();
File: public/js/governance/governance-cases-control-wizard.js
Match lines: 5
289| function openOffcanvasPanel() {
290| if (typeof window.openOffcanvasgovCasesControlWizard === 'function') {
291| window.openOffcanvasgovCasesControlWizard();
644| openOffcanvasPanel();
660| openOffcanvasPanel();
File: public/js/metahuman-standard/components/_modal_offcanvas.js
Match lines: 1
224| window["openOffcanvas" + fnSuffix] = function () {
File: public/js/metahuman-standard/pages/organizational_structure_index.js
Match lines: 2
894| if (typeof window.openOffcanvasorgAreaDetails === 'function') {
895| window.openOffcanvasorgAreaDetails();
File: public/js/notifications-center.js
Match lines: 1
868| var openName = 'openOffcanvasnotificationsCenter';
File: public/js/offboarding/visualizar_atividades.js
Match lines: 7
2464| openOffcanvasMembroOffboardingTenant(nav, false, membroLogadoId);
2475| openOffcanvasMembroOffboarding(nav);
2480|function openOffcanvasMembroOffboarding(nav) {
2481| console.log('🚀 openOffcanvasMembroOffboarding chamada!');
2726| openOffcanvasMembroOffboardingTenant(nav, isResponsible, loggedCompanyMemberId);
2729|function openOffcanvasMembroOffboardingTenant(nav, isResponsible = false, loggedCompanyMemberId = null) {
2730| console.log('🚀 openOffcanvasMembroOffboardingTenant chamada!');
File: public/js/onboarding/utils.js
Match lines: 1
40| const openFn = window[`openOffcanvas${fnSuffix}`];
File: public/js/people-analytics/chart-detail-filters.js
Match lines: 1
528| var functionName = 'openOffcanvas' + this.modalId.replace(/-/g, '');
File: public/js/spaces_control/buildings/building_form.js
Match lines: 1
146| const openFn = window['openOffcanvas' + formId];
File: public/js/ssma/action_plan_panel.js
Match lines: 14
2234| setText('ssma-ap-action-view-title', title);
2235| setText('ssma-ap-action-view-id', id ? ('#' + id) : '');
2236| setText('ssma-ap-action-view-origin', origin);
2237| setText('ssma-ap-action-view-executors', executors || '—');
2238| setText('ssma-ap-action-view-validators', validators || '—');
2239| setText('ssma-ap-action-view-deadline', deadline);
2240| setText('ssma-ap-action-view-pending', pending);
2241| setText('ssma-ap-action-view-description', description);
2243| var originLink = document.getElementById('ssma-ap-action-view-origin-link');
2253| if (typeof window.openOffcanvasssmaApActionView === 'function') {
2254| window.openOffcanvasssmaApActionView();
2257| var canvas = document.getElementById('ssmaApActionView-offcanvas-wrapper')
2258| || document.getElementById('ssmaApActionViewOffcanvas');
2263| window.jQuery('#ssmaApActionView').modal('show');
File: public/js/ssma/effectiveness.js
Match lines: 2
792| if (typeof window.openOffcanvasEffectivenessActionDetail === 'function') {
793| window.openOffcanvasEffectivenessActionDetail();
File: public/js/ssma/leadership_evaluation.js
Match lines: 4
295| if (typeof window.openOffcanvasleadershipLeaderDetail === 'function') {
296| window.openOffcanvasleadershipLeaderDetail();
300| if (typeof window.openOffcanvasLeadershipLeaderDetail === 'function') {
301| window.openOffcanvasLeadershipLeaderDetail();
File: public/js/webrtc-calls.js
Match lines: 3
659| console.warn('initializeCallUI function not available, trying openOffCanvasCall');
660| if (typeof window.openOffCanvasCall === 'function') {
661| window.openOffCanvasCall(
File: templates/calendar_member/tabs/_permissions_tab.html.twig
Match lines: 2
982| function openOffcanvas(id) {
1082| openOffcanvas($(this).data('id'));
File: templates/candidate_question/list.html.twig
Match lines: 2
256| if (typeof window.openOffcanvascandidateQuestionOffcanvas === 'function') {
257| window.openOffcanvascandidateQuestionOffcanvas();
File: templates/chat/components/adriana_chat.html.twig
Match lines: 4
429| if (typeof openOffCanvasSearch === 'function') {
430| openOffCanvasSearch();
607| if (typeof openOffCanvasSearch === 'function') openOffCanvasSearch();
724| if (typeof openOffCanvasSearch === 'function') openOffCanvasSearch();
File: templates/chat/components/chat_section.html.twig
Match lines: 2
2661| if (typeof openOffCanvasFixadas === 'function') {
2663| openOffCanvasFixadas();
File: templates/chat/components/company_server.html.twig
Match lines: 3
461| openOffCanvasSearch();
614| openOffCanvasSearch();
772| openOffCanvasSearch();
File: templates/chat/components/conversas_privadas.html.twig
Match lines: 6
635| console.error('❌ [conversas_privadas] window.startCall not found - falling back to openOffCanvasCall');
637| if (typeof openOffCanvasCall === 'function') {
638| openOffCanvasCall(userId, currentUserName, currentUserAvatar);
640| console.error('❌ [conversas_privadas] openOffCanvasCall not found either!');
760| openOffCanvasSearch();
883| openOffCanvasSearch();
File: templates/chat/components/grupos.html.twig
Match lines: 1
218| openOffCanvasSearch();
File: templates/chat/components/offCanva/offcanvas_call.html.twig
Match lines: 1
554|// Initialize call UI (called by openOffCanvasCall to avoid recursion)
File: templates/chat/components/suporte_meta.html.twig
Match lines: 4
289| openOffCanvasSearch();
389| openOffCanvasSearch();
697| openOffCanvasSearch();
821| openOffCanvasSearch();
File: templates/chat/components/suporte_meta_admin.html.twig
Match lines: 1
306| openOffCanvasSearch();
File: templates/chat/layout.html.twig
Match lines: 3
3608| if (typeof openOffCanvasCall === 'function') {
3610| openOffCanvasCall(userId, userName, userAvatar);
3612| console.error('❌ openOffCanvasCall function not found - opening offcanvas manually');
File: templates/communication_center/partials/_modal_create_demand.html.twig
Match lines: 1
722| openOffcanvascreateDemandModal();
File: templates/company/_autorizacoes_javascript.html.twig
Match lines: 2
234| if (typeof window.openOffcanvasmodalAplicarAutorizacao === 'function') {
235| window.openOffcanvasmodalAplicarAutorizacao();
File: templates/company/components/memberOffCanvas.html.twig
Match lines: 4
333| const openOffcanvasBtns = document.querySelectorAll('.open-offcanvas-btn');
339| function openOffcanvas(memberId) {
396| openOffcanvasBtns.forEach((button) => {
399| openOffcanvas(memberId); // Abre o offcanvas com os dados do membro
File: templates/company/components/memberOffCanvas2.html.twig
Match lines: 2
272| function openOffcanvas() {
335| openOffcanvas(); // Exibe o offcanvas
File: templates/company/crm/getLeads/index_leads_view.html.twig
Match lines: 4
489| <a href="#" class="dropdown-item" id="openOffcanvas"></i> Cadastrar Lead</a>
3618| const openOffcanvasEl = document.getElementById('openOffcanvas');
3619| if (openOffcanvasEl) {
3620| openOffcanvasEl.addEventListener('click', function(e) {
File: templates/company/crm/leads/defaultCrmView.html.twig
Match lines: 4
6756| openOffcanvas();
6797| function openOffcanvas() {
6815| openOffcanvas();
7982| openOffcanvas();
File: templates/company/members.html.twig
Match lines: 2
1607| function openOffcanvas() {
1674| openOffcanvas(); // Exibe o offcanvas
File: templates/company/members_v2.html.twig
Match lines: 2
3006| function openOffcanvas() {
3073| openOffcanvas(); // Exibe o offcanvas
File: templates/company/teams_permissions.html.twig
Match lines: 3
919| const openOffcanvasBtns = document.querySelectorAll('.open-offcanvas-btn');
925| function openOffcanvas(memberId) {
984| openOffcanvas(memberId); // Abre o offcanvas com os dados do membro
File: templates/company/teams_permissions_v2.html.twig
Match lines: 3
934| const openOffcanvasBtns = document.querySelectorAll('.open-offcanvas-btn');
940| function openOffcanvas(memberId) {
999| openOffcanvas(memberId); // Abre o offcanvas com os dados do membro
File: templates/components/permissions_tab.html.twig
Match lines: 4
1058| if (config.openOffcanvasCallback) {
1059| config.openOffcanvasCallback(memberId, tabId);
1382|function loadPermissionDataAndOpenOffcanvas(productSlug, memberId, tabId) {
1445| loadPermissionDataAndOpenOffcanvas(productSlug, memberId, tabId);
File: templates/contractor/tabs/_tab_empresas.html.twig
Match lines: 8
1441| if (typeof openOffcanvascontractorCoDetail === 'function') {
1442| openOffcanvascontractorCoDetail();
1842| if (typeof openOffcanvascontractorCoForm === 'function') {
1843| openOffcanvascontractorCoForm();
2164| if (typeof openOffcanvascontractorCoProviders === 'function') {
2165| openOffcanvascontractorCoProviders();
2896| if (typeof openOffcanvascontractorCoDocuments === 'function') {
2897| openOffcanvascontractorCoDocuments();
File: templates/contractor/tabs/_tab_requisitos_documentais.html.twig
Match lines: 2
1616| if (typeof openOffcanvascontractorReqDetail === 'function') {
1617| openOffcanvascontractorReqDetail();
File: templates/decision_system/modals/_candidate_offcanvas.html.twig
Match lines: 2
1115| if (typeof window.openOffcanvascandidateoffcanvas === 'function') {
1116| window.openOffcanvascandidateoffcanvas();
File: templates/decision_system/modals/_edit_stage.html.twig
Match lines: 2
1688| if (typeof window.openOffcanvaseditstagemodal === 'function') {
1689| window.openOffcanvaseditstagemodal();
File: templates/decision_system/modals/_view_record_offcanvas.html.twig
Match lines: 2
1482| if (typeof window.openOffcanvasviewrecordoffcanvas === 'function') {
1483| window.openOffcanvasviewrecordoffcanvas();
File: templates/decision_system/tabs/_gerenciamento.html.twig
Match lines: 3
1195| } else if (typeof window.openOffcanvasinstanceoffcanvas === 'function') {
1197| console.log('🟠 [_gerenciamento] Using component function openOffcanvasinstanceoffcanvas()');
1198| window.openOffcanvasinstanceoffcanvas();
File: templates/decision_system/tabs/_lista.html.twig
Match lines: 2
1189| if (typeof window.openOffcanvascandidateoffcanvas === 'function') {
1190| window.openOffcanvascandidateoffcanvas();
File: templates/evaluation_parent_category/index.html.twig
Match lines: 4
250| if (window.openOffcanvasclusterAddOffcanvas) {
251| window.openOffcanvasclusterAddOffcanvas();
272| if (window.openOffcanvasclusterEditOffcanvas) {
273| window.openOffcanvasclusterEditOffcanvas();
File: templates/free-trial/company_activation_companies.html.twig
Match lines: 1
988| window.openOffcanvascompanyPlanCustomization();
File: templates/governance/authorization/tabs/_tab_authorizations_config.html.twig
Match lines: 2
1096| if (typeof openOffcanvasgovAuthCondDetail === 'function') {
1097| openOffcanvasgovAuthCondDetail();
File: templates/governance/authorization/tabs/_tab_authorizations_create.html.twig
Match lines: 2
979| if (typeof openOffcanvasgovAuthDetail === 'function') {
980| openOffcanvasgovAuthDetail();
File: templates/governance/authorization/tabs/_tab_authorizations_monitoring.html.twig
Match lines: 4
1063| function autApplyOpenOffcanvas() {
1065| if (typeof window.openOffcanvasautApplyMonitoring === 'function') {
1066| window.openOffcanvasautApplyMonitoring();
1684| autApplyOpenOffcanvas();
File: templates/governance/cases/index.html.twig
Match lines: 2
752| if (typeof openOffcanvasgovCasesDetail === 'function') {
753| openOffcanvasgovCasesDetail();
File: templates/job_interview/index.html.twig
Match lines: 4
1236| if (typeof openOffcanvasoffcanvascreateinterviewonline === 'function') {
1237| openOffcanvasoffcanvascreateinterviewonline();
1753| if (typeof openOffcanvasoffcanvascreateinterview === 'function') {
1754| openOffcanvasoffcanvascreateinterview();
File: templates/job_interview/modals/offcanvas_create_interview.html.twig
Match lines: 4
1046| if (typeof openOffcanvasoffcanvascreateinterview === 'function') {
1047| openOffcanvasoffcanvascreateinterview();
1326| if (typeof openOffcanvasoffcanvascreateinterview === 'function') {
1327| openOffcanvasoffcanvascreateinterview();
File: templates/job_interview/modals/offcanvas_create_interview_online.html.twig
Match lines: 4
1046| if (typeof openOffcanvasoffcanvascreateinterviewonline === 'function') {
1047| openOffcanvasoffcanvascreateinterviewonline();
1326| if (typeof openOffcanvasoffcanvascreateinterviewonline === 'function') {
1327| openOffcanvasoffcanvascreateinterviewonline();
File: templates/job_interview/modals/offcanvas_template_details.html.twig
Match lines: 2
747| if (typeof openOffcanvasoffcanvastemplatedetails === 'function') {
748| openOffcanvasoffcanvastemplatedetails();
File: templates/logs/index.html.twig
Match lines: 2
567| if (typeof window.openOffcanvaslogsdetail === 'function') {
568| window.openOffcanvaslogsdetail();
File: templates/manager/lead_qualified_users.html.twig
Match lines: 2
671| if (typeof openOffcanvasuserProfileOffcanvas === 'function') {
672| openOffcanvasuserProfileOffcanvas();
File: templates/marketJob/index.html.twig
Match lines: 2
1271| if (window.openOffcanvasoffcanvasaddmarketjob) {
1272| window.openOffcanvasoffcanvasaddmarketjob();
File: templates/new-goals/components/_goal_detail_offcanvas.html.twig
Match lines: 2
57| if (typeof window.openOffcanvasgoalDetailDrawer === 'function') {
58| window.openOffcanvasgoalDetailDrawer();
File: templates/new-goals/goal_team/goal_team.html.twig
Match lines: 4
1808| if (typeof window.openOffcanvasmetaCollectiveModal === "function") {
1809| window.openOffcanvasmetaCollectiveModal();
3444| if (typeof window.openOffcanvasmetaCollectiveModal === 'function') {
3445| window.openOffcanvasmetaCollectiveModal();
File: templates/new-goals/goal_team/modals_goal_collective/modal_create_meta_colective.html.twig
Match lines: 2
475| if (typeof window.openOffcanvasmetaCollectiveModal === 'function') {
476| window.openOffcanvasmetaCollectiveModal();
File: templates/new-goals/pdi/pdi_permissions.html.twig
Match lines: 6
1150| const openOffcanvasBtns = document.querySelectorAll('.open-offcanvas-btn');
1155| function openOffcanvas(memberId) {
1316| openOffcanvasBtns.forEach(button => {
1319| openOffcanvas(memberId);
1764| const openOffcanvasBtns = document.querySelectorAll('.open-offcanvas-btn');
1765| openOffcanvasBtns.forEach(btn => {
File: templates/notifications_center/_layout_trigger.html.twig
Match lines: 2
45| } else if (typeof window.openOffcanvasnotificationsCenter === 'function') {
46| window.openOffcanvasnotificationsCenter();
File: templates/onboarding/index_user.html.twig
Match lines: 3
313| openOffcanvasMembroUser(nav);
420| function openOffcanvasMembroUser(nav) {
422| openOffcanvasoffcanvasMembro();
File: templates/organograma/company_layout.html.twig
Match lines: 3
9338| // Correção para o método openOffcanvas
9339| openOffcanvas(nodeId) {
11246| OffcanvasController.openOffcanvas(nodeId);
File: templates/organograma/company_layout_js.html.twig
Match lines: 3
4360| // Correção para o método openOffcanvas
4361| openOffcanvas(nodeId) {
6255| OffcanvasController.openOffcanvas(nodeId);
File: templates/permissions_tags/member_tab_permissions.html.twig
Match lines: 3
1253| if (typeof window.openOffcanvasmodalpermissionstagedit !== 'function' && typeof window.setupModalOffcanvas === 'function') {
1256| if (typeof window.openOffcanvasmodalpermissionstagedit === 'function') {
1257| window.openOffcanvasmodalpermissionstagedit();
File: templates/process/_fragment/_modal_interview_roteiro.html.twig
Match lines: 2
335| if (typeof window.openOffcanvasmodalinterviewroteiro === 'function') {
336| window.openOffcanvasmodalinterviewroteiro();
File: templates/process/modal/_modal_selective_process_add_stage.html.twig
Match lines: 4
1692| if (typeof window.openOffcanvasmodalinterviewroteiro === 'function') {
1693| window.openOffcanvasmodalinterviewroteiro();
1702| if (typeof window.openOffcanvasmodalinterviewroteiro === 'function') {
1703| window.openOffcanvasmodalinterviewroteiro();
File: templates/process/new_selective_process.html.twig
Match lines: 2
3014| if (typeof window.openOffcanvasmodalselectiveprocessaddstage === 'function') {
3015| window.openOffcanvasmodalselectiveprocessaddstage();
File: templates/projects2.0/components/off_canvas_task.html.twig
Match lines: 2
1556| if (typeof window.openOffcanvastaskOffcanvas === 'function') {
1557| window.openOffcanvastaskOffcanvas();
File: templates/servicePackages/modals/_modal_new_package.html.twig
Match lines: 2
682| window.openOffcanvasservicePackageForm();
702| window.openOffcanvasservicePackageForm();
File: templates/spaces_control/buildings/tabs/_tab_spaces.html.twig
Match lines: 2
422| if (typeof window.openOffcanvasaddLocation === 'function') {
423| window.openOffcanvasaddLocation();
File: templates/ssma/action_plan/tabs/_tab_action_plan.html.twig
Match lines: 2
1638| if (typeof openOffcanvasSsmaActionPlanViewOffcanvas === 'function') {
1639| openOffcanvasSsmaActionPlanViewOffcanvas();
File: templates/ssma/occurrence/partials/_modal_event.html.twig
Match lines: 4
6562| if (typeof window.openOffcanvasmodalEventNew === 'function') {
6563| window.openOffcanvasmodalEventNew();
7632| * has not registered window.openOffcanvasmodalEventNew yet.
7643| var registryOpener = window.openOffcanvasmodalEventNew;
File: templates/ssma/occurrence/partials/_modal_occurrence.html.twig
Match lines: 8
708| if (typeof window.openOffcanvasmodalEventNew === 'function' &&
709| window.openOffcanvasmodalEventNew !== window.ssmaRevealEventOffcanvas) {
710| window.openOffcanvasmodalEventNew();
716| if (typeof openOffcanvasmodalOccurrenceNew === 'function') {
717| openOffcanvasmodalOccurrenceNew();
722| window.openOffcanvasmodalEventNew();
733| typeof window.openOffcanvasmodalEventNew === 'function') {
761| openOffcanvasmodalOccurrenceNew();
File: templates/ssma/occurrence/tabs/_tab_occurrences.html.twig
Match lines: 1
1919| openOffcanvasmodalOccurrenceNew();
File: templates/ssma/prevention/modals/_modal_approach.html.twig
Match lines: 1
1759| function showOffcanvas() { if (window.openOffcanvasmodalAbordagem) { window.openOffcanvasmodalAbordagem(); } }
File: templates/ssma/prevention/modals/_modal_approach_form.html.twig
Match lines: 2
214| if (typeof window.openOffcanvasmodalSsmaApproachForm === 'function') {
215| window.openOffcanvasmodalSsmaApproachForm();
File: templates/ssma/prevention/modals/_modal_approach_view.html.twig
Match lines: 2
953| if (typeof window.openOffcanvasmodalAbordagemView === 'function') {
954| window.openOffcanvasmodalAbordagemView();
File: templates/ssma/prevention/modals/_modal_inspection.html.twig
Match lines: 4
1877| openOffcanvasmodalInspectionNew();
1988| openOffcanvasmodalInspectionNew();
1997| openOffcanvasmodalInspectionNew();
2010| openOffcanvasmodalInspectionNew();
File: templates/ssma/prevention/modals/_modal_inspection_details.html.twig
Match lines: 1
649| openOffcanvasmodalInspectionDetails();
File: templates/ssma/prevention/partials/_meta_abono_section.html.twig
Match lines: 1
644| var openFn = window['openOffcanvas' + String(modalId).replace(/[-_]/g, '')];
File: templates/ssma/refusal/partials/_modal_register.html.twig
Match lines: 2
369| if (typeof window.openOffcanvasmodalRefusalRegister === 'function') {
370| window.openOffcanvasmodalRefusalRegister();
File: templates/structural_research/structural_research_permission.html.twig
Match lines: 6
1379| const openOffcanvasBtns = document.querySelectorAll('.open-offcanvas-btn');
1384| function openOffcanvas(memberId) {
1426| openOffcanvasBtns.forEach(button => {
1429| openOffcanvas(memberId);
1835| const openOffcanvasBtns = document.querySelectorAll('.open-offcanvas-btn');
1836| openOffcanvasBtns.forEach(btn => {
File: templates/templates/roles.html.twig
Match lines: 2
643| if (typeof window.openOffcanvasoffcanvasaddrole === 'function') {
644| window.openOffcanvasoffcanvasaddrole();
File: templates/time-management/components/Tenant/tabs/permissions/index.tsx
Match lines: 1
186| (window as any).openOffcanvas?.(memberId);
File: templates/tokens/models.html.twig
Match lines: 2
372| if (window.openOffcanvastokensModelOffcanvas) {
373| window.openOffcanvastokensModelOffcanvas();
File: templates/trm/talents_and_communities/partials/_modal_add_community.html.twig
Match lines: 2
270| window.openOffcanvasmodalAddCommunity();
297| window.openOffcanvasmodalAddCommunity();
File: templates/trm/talents_and_communities/partials/_modal_add_talent.html.twig
Match lines: 2
217| window.openOffcanvasmodalAddTalent();
260| window.openOffcanvasmodalAddTalent();
File: templates/trm/talents_and_communities/tabs/_tab_communities.html.twig
Match lines: 1
329| window.openOffcanvasmodalAddCommunity();
File: templates/trm/talents_and_communities/tabs/_tab_talents.html.twig
Match lines: 1
367| window.openOffcanvasmodalAddTalent();
Request #25
deepseek-v4-flash
P:25.77K C:449 CR:23.17K CW:0
3462ms
Reasoning
Let me analyze the code changes and previous review summaries to consolidate findings. I have two previous review summaries that already identified issues. I need to verify these and issue formal code comments.
Let me start by examining the key files to confirm the findings before issuing comments.
Key findings from previous summaries:
1. [ALTA] Permission rule divergence between backend `canMutateSsmaActionPlan()` and UI flags for Gestor de Equipe/Área.
2. [MÉDIA] "Minhas ações" filter fail-open when member not resolved (mineId=0).
3. [MÉDIA] Origin filter loses "refusal"/Direito de Recusa option.
4. [BAIXA/MÉDIA] buildFilterPayload executed twice when mine=true.
5. [MÉDIA] Off-canvas naming divergence between JS and template.
Let me verify the code by reading the relevant regions and searching.
Let me read the controller regions, the service regions, and the JS regions. Also the template for the off-canvas registration.
Let me start with parallel tool calls.
Tool Calls (3)
file_read
Show Details
Arguments
{"file_path": "src/Controller/SsmaController.php", "start_line": 480, "end_line": 575}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 480-575
480| if (!$company instanceof Company) {
481| $emptyPanel = $this->actionPlanPanelPresenter->presentFilterResponse([
482| 'view' => 'pendencias',
483| 'panel_data' => $this->buildEmptyActionPlanPanelData(),
484| ], []);
485|
486| return new JsonResponse(array_merge(['success' => true], $emptyPanel));
487| }
488|
489| $view = (string) $request->query->get('view', 'pendencias');
490| $period = (string) $request->query->get('period', $view === 'pendencias' ? 'next_month' : 'last_3_months');
491| $axis = (string) $request->query->get('axis', '');
492| $team = trim((string) $request->query->get('team', ''));
493| $vinculo = strtoupper(trim((string) $request->query->get('vinculo', '')));
494| $page = max(1, (int) $request->query->get('page', 1));
495| $perPage = max(1, min(100, (int) $request->query->get('per_page', 10)));
496|
497| $unidadeScope = $this->resolveSsmaUnidadeFilterScope($company, $request);
498| $scopeCompanies = $view === 'comparativo'
499| ? $this->resolveSsmaNetworkSubsidiaries($company)
500| : $unidadeScope['companies'];
501| $dataCompany = $unidadeScope['data_company'];
502|
503| $payload = $this->ssmaActionPlanPanelService->buildFilterPayload(
504| $scopeCompanies,
505| $dataCompany,
506| $view,
507| $period,
508| $axis,
509| $team,
510| $vinculo,
511| $this->getActionTypeMetadata(),
512| $this->resolveActionPlanPanelMemberScope($company),
513| $page,
514| $perPage,
515| trim((string) $request->query->get('management', '')),
516| trim((string) $request->query->get('area', '')),
517| trim((string) $request->query->get('exec_responsible', '')),
518| trim((string) $request->query->get('val_responsible', '')),
519| trim((string) $request->query->get('origin', '')),
520| );
521|
522| if ($request->query->getBoolean('mine')) {
523| $user = $this->getUser();
524| $member = ($user instanceof User) ? $this->getCurrentCompanyMember($company, $user) : null;
525| $mineId = (int) ($member?->getId() ?? 0);
526| if ($mineId > 0) {
527| $payload = $this->ssmaActionPlanPanelService->buildFilterPayload(
528| $scopeCompanies,
529| $dataCompany,
530| $view,
531| $period,
532| $axis,
533| $team,
534| $vinculo,
535| $this->getActionTypeMetadata(),
536| [$mineId => true],
537| $page,
538| $perPage,
539| trim((string) $request->query->get('management', '')),
540| trim((string) $request->query->get('area', '')),
541| trim((string) $request->query->get('exec_responsible', '')),
542| trim((string) $request->query->get('val_responsible', '')),
543| trim((string) $request->query->get('origin', '')),
544| );
545| }
546| }
547|
548| $filterOptions = $this->ssmaActionPlanPanelService->buildFilterOptions($dataCompany);
549| $presented = $this->actionPlanPanelPresenter->presentFilterResponse($payload, $filterOptions);
550|
551| return $this->ssmaJsonResponse(array_merge(['success' => true], $presented));
552| }
553|
554| /** @return array<string, mixed> */
555| private function buildActionPlanPanelViewData(Request $request): array
556| {
557| $company = $this->getSsmaCompany();
558| if (!$company instanceof Company) {
559| return $this->actionPlanPanelPresenter->presentDashboard(
560| ['panel_data' => $this->buildEmptyActionPlanPanelData()],
561| ['panel_data' => ['overview' => []]],
562| []
563| );
564| }
565|
566| $memberScope = $this->resolveActionPlanPanelMemberScope($company);
567| $filterOptions = $this->ssmaActionPlanPanelService->buildFilterOptions($company);
568| $unidadeScope = $this->resolveSsmaUnidadeFilterScope($company, $request);
569| $scopeCompanies = $unidadeScope['companies'];
570| $dataCompany = $unidadeScope['data_company'];
571| $actionTypeMeta = $this->getActionTypeMetadata();
572|
573| $pendenciasPayload = $this->ssmaActionPlanPanelService->buildFilterPayload(
574| $scopeCompanies,
575| $dataCompany,
file_read
Show Details
Arguments
{"file_path": "src/Controller/SsmaController.php", "start_line": 11440, "end_line": 11500}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 11440-11500
11440|
11441| $member = $this->getCurrentCompanyMember($company, $user);
11442|
11443| return $this->ssmaOccurrenceCreatePermissionService->canCreateOccurrenceType(
11444| $member,
11445| $user,
11446| $company,
11447| $typeKey,
11448| $this->canManageSsmaOccurrences(),
11449| );
11450| }
11451|
11452| private function canManageSsmaPermissions(): bool
11453| {
11454| return $this->isGranted('ROLE_SUPER_ADMIN') || $this->isGranted('ROLE_MANAGER');
11455| }
11456|
11457| private function canAccessSsmaSupervisorSurface(): bool
11458| {
11459| return $this->canManageSsmaOccurrences() || $this->isSsmaViewer();
11460| }
11461|
11462| /**
11463| * Criar/editar Plano de Ação: gestor/admin.
11464| * Supervisor (viewer ou tag Supervisor*) só visualiza dash/painel — Brenda áudio 6.
11465| * Gestor de Equipe/Área continua podendo mutar.
11466| */
11467| private function canMutateSsmaActionPlan(): bool
11468| {
11469| if ($this->isSsmaViewer()) {
11470| return false;
11471| }
11472|
11473| $tagName = $this->ssmaCurrentMemberPermissionTag()?->getName();
11474| if (in_array($tagName, [
11475| 'Supervisor de Equipe',
11476| 'Supervisor',
11477| SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA,
11478| ], true)) {
11479| return false;
11480| }
11481|
11482| return $this->canManageSsmaOccurrences();
11483| }
11484|
11485| /**
11486| * Abas "Painel" e "Metas" em Prevenção Ativa: apenas perfis de supervisão/gestão na empresa.
11487| * Não usar {@see canAccessSsmaSupervisorSurface()} aqui: ele inclui Membro com can_create na tag
11488| * ssma-prevention (para registrar inspeção/abordagem), e na planilha Membro não acessa Painel/Metas.
11489| */
11490| private function canAccessPreventionDashboardAndMetasTabs(): bool
11491| {
11492| return $this->isGranted('ROLE_SUPER_ADMIN')
11493| || $this->isGranted('ROLE_MANAGER')
11494| || $this->isGranted('ROLE_MANAGER_GESTOR')
11495| || $this->isSsmaViewer();
11496| }
11497|
11498| /**
11499| * Palloma: ROLE_USER + tag Membro/Inspetor → strip de gestão (mesmo com ROLE_MANAGER de plataforma).
11500| * Aura: ROLE_MANAGER sem ROLE_USER + tag Membro → mantém gestão (retorna false aqui).
code_search
Show Details
Arguments
{"search_text": "function canManageSsmaOccurrences", "file_patterns": ["src/Controller/SsmaController.php"]}
Result
File: src/Controller/SsmaController.php Match lines: 1 11339| private function canManageSsmaOccurrences(): bool
Request #26
deepseek-v4-flash
P:28.35K C:254 CR:26.11K CW:0
2201ms
Reasoning
Let me read canManageSsmaOccurrences and the flags area, and the JS file areas, and the template registering openOffcanvas.
Tool Calls (3)
file_read
Show Details
Arguments
{"end_line": 11390, "file_path": "src/Controller/SsmaController.php", "start_line": 11330}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 11330-11390
11330| private function notifyOccurrenceRegistrantOnReject(
11331| SsmaEvent $event,
11332| Company $company,
11333| User $sender,
11334| string $note
11335| ): void {
11336| $this->ssmaNotificationService->notifyOccurrenceRegistrantOnReject($event, $sender, $note);
11337| }
11338|
11339| private function canManageSsmaOccurrences(): bool
11340| {
11341| $user = $this->getUser();
11342| $company = $this->getSsmaCompany() ?? ($user instanceof User ? $user->getCompany() : null);
11343| if ($user instanceof User && $company instanceof Company
11344| && $this->shouldStripSsmaManagementUiForUser($company, $user)) {
11345| return false;
11346| }
11347|
11348| if (
11349| $this->isGranted('ROLE_SUPER_ADMIN')
11350| || $this->isGranted('ROLE_MANAGER')
11351| || $this->isGranted('ROLE_MANAGER_GESTOR')
11352| || $this->isGranted('ROLE_TENANT')
11353| ) {
11354| return true;
11355| }
11356|
11357| $member = null;
11358| if ($user instanceof User) {
11359| $company = $this->getSsmaCompany() ?? $user->getCompany();
11360| if ($company instanceof Company) {
11361| $member = $this->getCurrentCompanyMember($company, $user);
11362| }
11363| }
11364| if ($this->memberIsSsmaGestorAdministrador($member)) {
11365| return true;
11366| }
11367|
11368| $tag = $this->ssmaCurrentMemberPermissionTag();
11369|
11370| $request = $this->requestStack->getCurrentRequest();
11371| if ($request && (
11372| (bool) $request->attributes->get('can_create', false)
11373| || (bool) $request->attributes->get('can_edit', false)
11374| || (bool) $request->attributes->get('can_delete', false)
11375| )) {
11376| return true;
11377| }
11378|
11379| if (!$tag) {
11380| return false;
11381| }
11382|
11383| return (bool) ($tag->getCanCreate() ?? false)
11384| || (bool) ($tag->getCanEdit() ?? false)
11385| || (bool) ($tag->getCanDelete() ?? false);
11386| }
11387|
11388| /**
11389| * Edição no detalhe (UI + API legada createOccurrence edit + updateEvent).
11390| * Tenant/super admin e admin de aprofundamento (Gestor Administrador) editam tudo.
file_read
Show Details
Arguments
{"end_line": 12790, "file_path": "src/Controller/SsmaController.php", "start_line": 12560}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 12560-12790
12560| if ($entityId <= 0) {
12561| continue;
12562| }
12563| $itemsForTrees[] = [
12564| 'id' => $entityId,
12565| 'is_ssma_event' => !empty($occRow['is_ssma_event']),
12566| ];
12567| }
12568| if ($itemsForTrees !== []) {
12569| $treeMeta = $this->ssmaCauseTreeService->resolveEntityTreeMetaBatch(
12570| (int) $company->getId(),
12571| $itemsForTrees
12572| );
12573| foreach ($occurrences as $idx => $occRow) {
12574| $entityId = (int) ($occRow['id'] ?? 0);
12575| $key = (!empty($occRow['is_ssma_event']) ? 'e:' : 'o:') . $entityId;
12576| $occurrences[$idx]['cause_tree_id'] = $treeMeta[$key]['cause_tree_id'] ?? null;
12577| }
12578| }
12579| }
12580| $occurrences = $this->enrichOccurrencesCommitteeTriggerFlags($occurrences, $company);
12581| $occurrences = $this->enrichOccurrencesGravityLabels($occurrences);
12582| }
12583| if ($deferOccurrenceHubHeavyData) {
12584| $actionsTaken = [];
12585| $inspections = [];
12586| $horasData = [];
12587| } else {
12588| $actionsTaken = $company ? $this->loadActions($company) : [];
12589| $inspections = $company ? $this->loadInspections($company, $allMembers, $teams) : [];
12590| $horasData = $company ? $this->loadHorasData($company) : [];
12591| }
12592| }
12593| if ($needsPreventionCollections) {
12594| $abordagens = $company ? $this->loadAbordagens($company) : [];
12595| }
12596| $occurrenceUiMeta = $this->getMockOccurrenceMetadata();
12597|
12598| $userTechnicalTypes = $company
12599| ? $this->resolveUserTechnicalTypes($company, $user, $companyMembers ?? [])
12600| : [];
12601| $ssmaCanManageOccurrences = $this->canManageSsmaOccurrences();
12602| $ssmaCanAccessSupervisorSurface = $this->canAccessSsmaSupervisorSurface();
12603| $ssmaCanAccessPreventionPanelAndMetas = $this->canAccessPreventionDashboardAndMetasTabs();
12604| $ssmaCanAccessOccurrencePanel = $ssmaCanManageOccurrences || $this->isSsmaViewer();
12605| // Supervisores veem a aba Automações mas não criam; o botão de criação usa ssmaCanManageOccurrences
12606| $ssmaCanAccessOccurrenceAutomations = $ssmaCanManageOccurrences || $this->isSsmaViewer();
12607| $ssmaCanManageConfig = $this->canManageSsmaConfig();
12608| $ssmaCanManagePermissions = $this->canManageSsmaPermissions();
12609| // ssmaCanCreateLinkedActions: botão "Criar ação" na aba Ocorrências e occurrence_view.
12610| // Brenda: Supervisor só visualiza (dash/painel). Criar/editar fica com gestor/admin
12611| // e Gestor de Equipe (override abaixo). Membro comum não cria.
12612| $ssmaCanCreateLinkedActions = $this->canMutateSsmaActionPlan();
12613| $ssmaCanMutateActionPlan = $ssmaCanCreateLinkedActions;
12614| // ssmaCanCreateCauseTree: Supervisor ?? SOMENTE LEITURA na Árvore de Causas (planilha).
12615| // NÃO incluir isSsmaViewer() aqui. Usa produto ssma-cause-tree (não can_create de ssma-occurrences).
12616| $ssmaCanCreateCauseTree = $this->canCreateSsmaCauseTree();
12617| $ssmaCanCreateAuthorization = $ssmaCanManageOccurrences;
12618| $ssmaCanEditHorasTrabalhadas = $this->canEditSsmaHorasTrabalhadas();
12619|
12620| // Tag SSMA do colaborador — sempre resolve (ROLE_MANAGER de plataforma ≠ perfil SSMA).
12621| $ssmaProductTagName = null;
12622| $memberForTagCheck = null;
12623| $ssmaPreventionProductTagName = null;
12624| if ($company && $user instanceof User) {
12625| $memberForTagCheck = $this->getCurrentCompanyMember($company, $user);
12626| if ($memberForTagCheck) {
12627| $resolvedTag = $this->resolveSsmaProductPermissionTagForMember($memberForTagCheck);
12628| if ($resolvedTag) {
12629| $ssmaProductTagName = $resolvedTag->getName();
12630| }
12631| if ($this->memberIsSsmaGestorAdministrador($memberForTagCheck)) {
12632| $ssmaProductTagName = 'Gestor Administrador';
12633| }
12634| $ssmaPreventionProductTagName = $this->ssmaPreventionHubAccessService
12635| ->resolvePreventionProductTagName($memberForTagCheck);
12636| }
12637| }
12638|
12639| // Membro/Inspetor: visão de pessoa física (matriz de tipos + registrar).
12640| // Só strip se tiver ROLE_USER (Palloma). Conta admin empresa sem ROLE_USER (Aura) mantém abas.
12641| // Tenant / SUPER_ADMIN mantêm abas mesmo com tag Membro (regressão Felipe).
12642| $ssmaIsPlainProductMemberUi = SsmaOccurrenceCreatePermissionService::shouldStripOccurrenceManagementTabsUi(
12643| $ssmaProductTagName,
12644| $this->isGranted('ROLE_SUPER_ADMIN'),
12645| $this->isGranted('ROLE_TENANT'),
12646| $user instanceof User && in_array('ROLE_USER', $user->getRoles(), true)
12647| );
12648| if ($ssmaIsPlainProductMemberUi && !$this->memberIsSsmaGestorAdministrador($memberForTagCheck)) {
12649| $ssmaCanManageOccurrences = false;
12650| $ssmaCanAccessSupervisorSurface = false;
12651| $ssmaCanAccessPreventionPanelAndMetas = false;
12652| $ssmaCanAccessOccurrencePanel = false;
12653| $ssmaCanAccessOccurrenceAutomations = false;
12654| $ssmaCanManageConfig = false;
12655| $ssmaCanManagePermissions = false;
12656| $ssmaCanCreateLinkedActions = false;
12657| $ssmaCanCreateAuthorization = false;
12658| }
12659|
12660| $loggedMemberForCauseTree = ($company && $user instanceof User)
12661| ? $this->getCurrentCompanyMember($company, $user)
12662| : null;
12663|
12664| // Especialistas técnicos (SsmaPermissionTagMember) e gestores/supervisores podem visualizar.
12665| // Membro/Inspetor com acesso só via mapa legado tipo/equipe NÃO recebem o botão na listagem.
12666| $ssmaCanViewCauseTree = $ssmaCanCreateCauseTree
12667| || $this->isSsmaViewer()
12668| || in_array($ssmaProductTagName, ['Gestor Administrador', 'Gestor de Equipe', 'Supervisor de Equipe', 'Supervisor'], true)
12669| || ($loggedMemberForCauseTree && $company && $this->hasSsmaTechnicalCauseTreeAccess($loggedMemberForCauseTree, $company));
12670|
12671| // Hub Ocorrências — botão "Registrar ocorrência" (empty state / FAB): Membro não cria (planilha),
12672| // mesmo com can_create na tag. Só roles de gestão na empresa ou tag Gestor de Equipe / G. Administrador com manage.
12673| // Reutiliza $ssmaProductTagName (já corrigido por memberIsSsmaGestorAdministrador).
12674| $ssmaProductTagNameForRegister = $ssmaProductTagName;
12675| $ssmaCanRegisterNewOccurrence = $this->isGranted('ROLE_SUPER_ADMIN')
12676| || $this->isGranted('ROLE_MANAGER')
12677| || $this->isGranted('ROLE_MANAGER_GESTOR')
12678| || \in_array($ssmaProductTagNameForRegister, ['Gestor de Equipe', 'Gestor Administrador'], true)
12679| // Permissão padrão do Membro: registrar a própria ocorrência.
12680| || $this->canMemberRegisterOwnOccurrence($company, $user);
12681|
12682| $loggedMemberForOccurrence = ($company && $user instanceof User)
12683| ? $this->getCurrentCompanyMember($company, $user)
12684| : null;
12685| $ssmaAllowedCreateTypes = ($company && $user instanceof User)
12686| ? $this->ssmaOccurrenceCreatePermissionService->resolveAllowedCreateTypes(
12687| $loggedMemberForOccurrence,
12688| $user,
12689| $company,
12690| $this->ssmaOccurrenceTypeConfig->getAllowedTypeKeys($company),
12691| $ssmaCanManageOccurrences,
12692| )
12693| : [];
12694| if (!$ssmaCanRegisterNewOccurrence && $ssmaAllowedCreateTypes !== []) {
12695| $ssmaCanRegisterNewOccurrence = true;
12696| }
12697|
12698| $occurrenceTeamFilterIds = $this->getSsmaOccurrenceDashboardTeamFilterIds($company, $user);
12699| $areaScope = $this->getSsmaPreventionAreaScope($company, $user);
12700| $occurrenceAreaFilterIds = $areaScope->isRestricted() ? $areaScope->areaIds() : null;
12701| $viewerTeamIds = $this->getSsmaViewerTeamIds();
12702|
12703| // ── Detecção de Supervisor/Gestor de Equipe via tag SSMA ──────────────────────────────
12704| // Usuários com ROLE_USER + tag SSMA (sem ROLE_MANAGER_VIEWER global) não são detectados pelas
12705| // funções baseadas em role. Identificamos o perfil pelo nome da tag para ajustar flags de UI.
12706| $ssmaIsTagTeamSupervisor = in_array($ssmaProductTagName, ['Supervisor de Equipe', 'Supervisor'], true);
12707| $ssmaIsTagTeamGestor = $ssmaProductTagName === 'Gestor de Equipe';
12708| $ssmaIsTagAreaSupervisor = $ssmaProductTagName === SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA;
12709| $ssmaIsTagAreaGestor = $ssmaProductTagName === SsmaAreaLimitationScope::TAG_GESTOR_AREA;
12710| $ssmaIsPreventionTagTeamSupervisor = in_array($ssmaPreventionProductTagName, ['Supervisor de Equipe', 'Supervisor'], true);
12711| $ssmaIsPreventionTagTeamGestor = $ssmaPreventionProductTagName === 'Gestor de Equipe';
12712|
12713| // Painel + Metas: libera para Sup/G. de Equipe/Área e Gestor Administrador (ocorrências + ssma-prevention)
12714| if (!$ssmaCanAccessPreventionPanelAndMetas
12715| && (
12716| $ssmaIsTagTeamSupervisor
12717| || $ssmaIsTagTeamGestor
12718| || $ssmaIsTagAreaSupervisor
12719| || $ssmaIsTagAreaGestor
12720| || $ssmaProductTagName === 'Gestor Administrador'
12721| || $ssmaIsPreventionTagTeamSupervisor
12722| || $ssmaIsPreventionTagTeamGestor
12723| || $ssmaPreventionProductTagName === 'Gestor Administrador'
12724| )
12725| ) {
12726| $ssmaCanAccessPreventionPanelAndMetas = true;
12727| }
12728|
12729| // Membro/Inspetor (pessoa física / Palloma): não acessa Painel nem Metas.
12730| // Conta admin empresa sem ROLE_USER (Aura), Tenant e SUPER_ADMIN mantêm — mesmo contrato das abas de Ocorrências.
12731| if (SsmaOccurrenceCreatePermissionService::shouldStripOccurrenceManagementTabsUi(
12732| $ssmaProductTagName,
12733| $this->isGranted('ROLE_SUPER_ADMIN'),
12734| $this->isGranted('ROLE_TENANT'),
12735| $user instanceof User && in_array('ROLE_USER', $user->getRoles(), true)
12736| )) {
12737| $ssmaCanAccessPreventionPanelAndMetas = false;
12738| }
12739|
12740| // Modal + Evento: título/status ocultos na criação para todos os perfis (Figma Etapa 0).
12741| // Na edição o JS (evApplyAuraTitleStatusVisibility) reexibe conforme o modo.
12742| $ssmaHideEventTitleStatusOnCreate = true;
12743|
12744| // ssmaIsTeamViewer: true quando o usuário opera com escopo de equipe (via role SSMA OU via tag SSMA)
12745| // Usado para sinalizar ao template que os dados estáo limitados ?? equipe.
12746| $ssmaIsTeamViewerFlag = $viewerTeamIds !== null || $ssmaIsTagTeamSupervisor || $ssmaIsTagTeamGestor
12747| || $ssmaIsTagAreaSupervisor || $ssmaIsTagAreaGestor;
12748|
12749| // ssmaCanCreatePreventionItems: Gestor de Equipe/Área e Gestor Administrador via tag SSMA
12750| // também podem registrar inspeções/abordagens (ssmaCanManageOccurrences = true via tag).
12751| $ssmaCanCreatePreventionItems = (
12752| $this->isGranted('ROLE_SUPER_ADMIN')
12753| || $this->isGranted('ROLE_MANAGER')
12754| || $this->isGranted('ROLE_MANAGER_GESTOR')
12755| || (
12756| $ssmaCanManageOccurrences
12757| && ($ssmaIsTagTeamGestor || $ssmaIsTagAreaGestor || $ssmaProductTagName === 'Gestor Administrador')
12758| )
12759| );
12760|
12761| // ssmaCanEditPreventionContent: controla botões Editar/Finalizar/Deletar em inspeções e abordagens
12762| // e o botão "Configuração" na aba Metas.
12763| // Supervisor registra/edita o próprio conteúdo (can_mutate por item); gestão edita todos.
12764| $ssmaCanEditPreventionContent = $ssmaCanManageOccurrences
12765| && !$this->isSsmaViewer()
12766| && !$ssmaIsTagTeamSupervisor
12767| && !$ssmaIsTagAreaSupervisor;
12768| $ssmaPreventionMutateOwnOnly = false;
12769|
12770| // Configurações da aba Prevenção Ativa: Sup/Gestor de Equipe ou Área não acessam (planilha: "Não acessa")
12771| if ($ssmaIsTagTeamSupervisor || $ssmaIsTagTeamGestor || $ssmaIsTagAreaSupervisor || $ssmaIsTagAreaGestor) {
12772| $ssmaCanManageConfig = false;
12773| }
12774|
12775| // G. Equipe via tag SSMA pode criar ação (Plano de Ação).
12776| // Árvore de causas: {@see canCreateSsmaCauseTree()} já cobre Gestor de Equipe.
12777| if ($ssmaIsTagTeamGestor || $ssmaIsTagAreaGestor) {
12778| $ssmaCanCreateLinkedActions = true;
12779| $ssmaCanMutateActionPlan = true;
12780| }
12781|
12782| // Tabela de metas por pessoa (aba Metas): edição global só para gestão; membro com can_create não gere metas alheias.
12783| $ssmaCanEditPreventionMetasTable = $company && $user instanceof User
12784| && $this->canEditPreventionMetasTableForCurrentUser($company, $user);
12785|
12786| // ssmaPreventionCanCreateLinkedActions: botão "Criar ação" em Inspeções e Abordagem.
12787| // Alinhado com ssmaCanCreateLinkedActions (Plano de Ações): quem não pode criar
12788| // ação no Plano de Ações também não pode criar em inspeção/abordagem/árvore.
12789| $ssmaPreventionCanCreateLinkedActions = $ssmaCanCreateLinkedActions;
12790|
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "ssmaCurrentMemberPermissionTag"}
Result
File: src/Controller/SsmaController.php
Match lines: 6
627| $ssmaProductTagName = $this->ssmaCurrentMemberPermissionTag()?->getName();
1350| $tag = $this->ssmaCurrentMemberPermissionTag();
1386| if ($this->ssmaCurrentMemberPermissionTag() !== null) {
1401| private function ssmaCurrentMemberPermissionTag(): ?\App\Entity\PermissionTag
11368| $tag = $this->ssmaCurrentMemberPermissionTag();
11473| $tagName = $this->ssmaCurrentMemberPermissionTag()?->getName();
Request #27
deepseek-v4-flash
P:33.74K C:1.98K CR:28.54K CW:0
14816ms
Reasoning
Let me understand the `canManageSsmaOccurrences()` more. It returns true if member is SSMA Gestor Administrador, or the permission tag has canCreate/canEdit/canDelete. But Gestor de Equipe tag — does it have canCreate on tag? Well, comments say `$ssmaCanManageOccurrences` may be true via tag. Hmm, at line 12750 comment: "ssmaCanCreatePreventionItems: Gestor de Equipe/Área e Gestor Administrador via tag SSMA também podem registrar inspeções/abordagens (ssmaCanManageOccurrences = true via tag)." This says canManageSsmaOccurrences IS true via tag for Gestor de Equipe/Área. So it depends on the actual tag having can_create etc.
Hmm, so the divergence concern depends on whether Gestor de Equipe tag has canCreate. But `canMutateSsmaActionPlan()` returns `canManageSsmaOccurrences()` when not viewer/supervisor. And `canManageSsmaOccurrences()` returns true for Gestor de Equipe if their tag has canCreate/canEdit/canDelete OR via memberIsSsmaGestorAdministrador OR request attributes can_create/can_edit/can_delete OR roles ROLE_MANAGER etc.
The UI override at lines 12777-12780 forces `$ssmaCanCreateLinkedActions = true; $ssmaCanMutateActionPlan = true;` for tag Gestor de Equipe/Área even if `canManageSsmaOccurrences()` returned false. Wait but if the tag had canCreate, `canManageSsmaOccurrences()` would return true anyway. The override is only meaningful if canManageSsmaOccurrences() returned false for a Gestor de Equipe. In that case UI shows buttons but backend denies.
But wait — the routes for action create/edit/resolve now use `canMutateSsmaActionPlan()`. So if a Gestor de Equipe has a tag without can_create on ssma-occurrences, `canMutateSsmaActionPlan()` returns false, backend would return 403 on createAction. But the UI would show the "Criar ação" button because `$ssmaCanCreateLinkedActions = true` override.
Is there request attribute can_create set? At line 11371-11377, canManageSsmaOccurrences() checks request attributes can_create/can_edit/can_delete. So maybe on the route for the panel data the attribute might be set? Actually these request attributes are likely per-route attributes set via some annotation or listener mapping capabilities. That's uncertain.
Let me check what `ssmaCurrentMemberPermissionTag()` returns and how Gestor de Equipe tags are typically configured. Also let me check how canMutateSsmaActionPlan is used on the createAction endpoint and where these request attributes come from.
Actually, the important observation for the review comment: The controller logic `canMutateSsmaActionPlan()` is the authoritative backend check (used in createAction at ~7977, canCurrentUserEditSsmaAction, canCurrentUserResolveSsmaAction, buildActionPlanViewData flags). The UI override at 12777-12780 is duplicate policy that may diverge: if Gestor de Equipe/Área tag lacks canCreate/canEdit/canDelete, `canManageSsmaOccurrences()` returns false → backend denies mutation, but UI shows buttons.
Also `$ssmaCanMutateActionPlan` is only used to build template vars (line 13268). The actual back-end endpoint guard is `canMutateSsmaActionPlan()`. So divergence real but conditional. Let me verify whether Gestor de Equipe tag usually has can_create. Let's look at how tags are seeded. Search for 'Gestor de Equipe' tag config.
Let me also verify `memberIsSsmaGestorAdministrador`.
But given previous review summary and prior confirmations, and the fact that the code comment at 12749-12750 says "(ssmaCanManageOccurrences = true via tag)" for Gestor de Equipe/Área, maybe the Gestor de Equipe tag does have canCreate. If it does, the backend `canMutateSsmaActionPlan()` returns true for them anyway via tag's can_create, so override is redundant but not divergent.
Hmm. Actually, wait: is there a scenario where a Gestor de Equipe tag has can_create for ssma-occurrences product? If yes then canManageSsmaOccurrences true. Let me look at how the permission tag is resolved and seeded. Given uncertainty, the real, more defensible finding: `canMutateSsmaActionPlan()` duplicates the tag-based policy in a different way (blocking only by name of supervisor tags but allowing by canManageSsmaOccurrences). The UI override makes it hard to know. This is a maintainability concern; the actual divergence depends on tag config.
Actually let me re-read. Previously (before this PR), `canAccessSsmaSupervisorSurface()` was used for create (mode !== 'edit' && !canAccessSsmaSupervisorSurface → 403). Now it's changed to `canMutateSsmaActionPlan()`. Note that supervisors previously could create via isSsmaViewer; now they cannot. That's the intended business change.
Now, for the UI: previously `$ssmaCanCreateLinkedActions = $ssmaCanManageOccurrences || $this->isSsmaViewer();` Now: `$ssmaCanCreateLinkedActions = $this->canMutateSsmaActionPlan();` then forced true for Gestor de Equipe/Área.
The key question: does `canMutateSsmaActionPlan()` return true for Gestor de Equipe/Área? It returns true if:
- not viewer
- tag name not supervisor
- canManageSsmaOccurrences()
canManageSsmaOccurrences for Gestor de Equipe tag with can_create → true. So they'd pass. If the tag has no can_create but they're "Gestor de Equipe" by role... Actually how is `ssmaProductTagName` resolved to 'Gestor de Equipe'? Via `resolveSsmaProductPermissionTagForMember`. The tag name is 'Gestor de Equipe'. Does such tag have can_create? Might vary per company config.
So, the divergence may or may not materialize at runtime; but code-level duplication of the policy between two sources is a real maintainability concern. The comment in the previous review summary flagged it as high. Given the possibility of divergence (UI override for tag Gestor de Equipe/Área while backend relies on canManageSsmaOccurrences), and the risk of 403 vs visible buttons, I'll keep it as a high/medium finding focused on the divergence & duplication.
Let me now check the template override line and the earlier flags. Actually 12777-12780 is in the diff. And 12612-12613 in the diff. And canMutateSsmaActionPlan in the diff (11459-11483).
I should double check the `ssmaIsTagTeamGestor` calculation uses `$ssmaProductTagName` which might be 'Gestor de Equipe' resolved from member tag. This is in the same block (not in diff but relevant context).
Let me look at line 1401 ssmaCurrentMemberPermissionTag to understand.
Actually, there's an important subtlety: `canMutateSsmaActionPlan()` calls `$this->ssmaCurrentMemberPermissionTag()?->getName()`. And separately `$ssmaProductTagName` (used for the flags) comes from `resolveSsmaProductPermissionTagForMember`. Are these the same tag? Probably, but the reviewer earlier confirmed the resolution. Let me look at ssmaCurrentMemberPermissionTag function.
Let me now read:
- line 1380-1430 (ssmaCurrentMemberPermissionTag)
- the JS file regions for the mine param and buildPanelParams and openActionViewOffcanvas
- templates to find offcanvas registration (ssma-ap-action-view / openOffcanvas)
Let me do these in parallel.
Tool Calls (3)
file_read
Show Details
Arguments
{"end_line": 1430, "file_path": "src/Controller/SsmaController.php", "start_line": 1380}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 1380-1430
1380| || $this->isGranted('ROLE_MANAGER_GESTOR')
1381| || $this->isGranted('ROLE_MANAGER_VIEWER')
1382| ) {
1383| return true;
1384| }
1385|
1386| if ($this->ssmaCurrentMemberPermissionTag() !== null) {
1387| return true;
1388| }
1389|
1390| $company = $this->getSsmaCompany();
1391| $user = $this->getUser();
1392| if (!$company instanceof Company || !$user instanceof User) {
1393| return false;
1394| }
1395|
1396| $member = $this->getCurrentCompanyMember($company, $user);
1397|
1398| return $this->ssmaStakeholderActionPermissionService->hasStakeholderAccess($member, $company);
1399| }
1400|
1401| private function ssmaCurrentMemberPermissionTag(): ?\App\Entity\PermissionTag
1402| {
1403| $user = $this->getUser();
1404| if (!$user instanceof User) {
1405| return null;
1406| }
1407|
1408| $company = $this->getSsmaCompany() ?? $user->getCompany();
1409| if (!$company instanceof Company) {
1410| return null;
1411| }
1412|
1413| $member = $this->getCurrentCompanyMember($company, $user);
1414| if (!$member) {
1415| return null;
1416| }
1417|
1418| return $this->resolveSsmaProductPermissionTagForMember($member);
1419| }
1420|
1421| /**
1422| * Alterações na Árvore respeitam can_create / can_edit / can_delete do produto ssma-cause-tree
1423| * (rotas ssma_cause_tree_*), sem o bypass global de ROLE_MANAGER_GESTOR de {@see canManageSsmaOccurrences()}.
1424| * Gestor de Equipe (tag em ssma-occurrences) também pode criar — espelha o botão na listagem.
1425| */
1426| private function canMutateSsmaCauseTreeFromProductTag(): bool
1427| {
1428| return $this->canCreateSsmaCauseTree();
1429| }
1430|
file_read
Show Details
Arguments
{"end_line": 430, "file_path": "public/js/ssma/action_plan_panel.js", "start_line": 355}
Result
File: public/js/ssma/action_plan_panel.js (Total lines: 2378)
IS_TRUNCATED: false
LINE_RANGE: 355-430
355| start = end;
356| end = temp;
357| }
358|
359| apOverviewStartDate = start;
360| apOverviewEndDate = end;
361| apOverviewPeriodMode = 'custom';
362| refreshOverviewPeriodLabel();
363| refreshOverviewPeriodPresetState();
364| return true;
365| }
366|
367| function applyOverviewPeriodPreset(preset) {
368| syncOverviewPeriodPresetUI(preset);
369| panelState.overviewPage = 1;
370| syncOverviewFilterState();
371| triggerPanelFilter('visao_geral');
372| }
373|
374| function buildFilterParams(view) {
375| var params = new URLSearchParams();
376| params.set('view', view || currentView);
377|
378| if ((view || currentView) === 'pendencias') {
379| params.set('period', getApPanelPeriodParam());
380| if (panelState.axis) {
381| params.set('axis', panelState.axis);
382| }
383| if (panelState.origin) {
384| params.set('origin', panelState.origin);
385| }
386| } else if ((view || currentView) === 'visao_geral') {
387| params.set('period', panelState.overviewPeriod);
388| params.set('page', String(panelState.overviewPage));
389| params.set('per_page', String(panelState.overviewPerPage || 10));
390| if (panelState.management) {
391| params.set('management', panelState.management);
392| }
393| if (panelState.origin) {
394| params.set('origin', panelState.origin);
395| }
396| } else if ((view || currentView) === 'comparativo') {
397| params.set('period', panelState.overviewPeriod);
398| }
399|
400| if (panelState.team) {
401| params.set('team', panelState.team);
402| }
403| if (panelState.vinculo) {
404| params.set('vinculo', panelState.vinculo);
405| }
406| if (panelState.unidade && panelState.unidade !== 'todas') {
407| params.set('unidade', panelState.unidade);
408| } else {
409| var viewKey = view || currentView;
410| if (viewKey === 'visao_geral' && document.getElementById('ap_overview_filter_unit')) {
411| params.set('unidade', panelState.unidade || 'todas');
412| } else if (viewKey === 'pendencias' && document.getElementById('ap_painel_filter_unidade')) {
413| params.set('unidade', panelState.unidade || 'todas');
414| }
415| }
416|
417| if (panelState.mine) {
418| params.set('mine', '1');
419| }
420|
421| return params;
422| }
423|
424| function showPanelToast(message, title, icon, tone) {
425| if (typeof window.showToast === 'function') {
426| window.showToast(message, title || 'Plano de Ação', icon || 'fas fa-info-circle', tone || 'bg-info');
427| }
428| }
429|
430| function runPanelFilterRequest(view) {
file_read
Show Details
Arguments
{"end_line": 2260, "file_path": "public/js/ssma/action_plan_panel.js", "start_line": 2210}
Result
File: public/js/ssma/action_plan_panel.js (Total lines: 2378)
IS_TRUNCATED: false
LINE_RANGE: 2210-2260
2210| if (!question || typeof window.ssmaAskAdrianaPanelQuestion !== 'function') {
2211| return;
2212| }
2213| window.ssmaAskAdrianaPanelQuestion(question, context);
2214| });
2215| }
2216|
2217| function openActionViewOffcanvas(btn) {
2218| var title = btn.getAttribute('data-action-title') || 'Ação';
2219| var origin = btn.getAttribute('data-action-origin') || '—';
2220| var deadline = btn.getAttribute('data-action-deadline') || '—';
2221| var pending = btn.getAttribute('data-action-pending') || '—';
2222| var description = btn.getAttribute('data-action-description') || 'Sem descrição.';
2223| var originUrl = btn.getAttribute('data-action-origin-url') || '';
2224| var executors = btn.getAttribute('data-action-executors') || '—';
2225| var validators = btn.getAttribute('data-action-validators') || '—';
2226| var id = btn.getAttribute('data-action-id') || '';
2227|
2228| var setText = function (elId, value) {
2229| var el = document.getElementById(elId);
2230| if (el) {
2231| el.textContent = value;
2232| }
2233| };
2234| setText('ssma-ap-action-view-title', title);
2235| setText('ssma-ap-action-view-id', id ? ('#' + id) : '');
2236| setText('ssma-ap-action-view-origin', origin);
2237| setText('ssma-ap-action-view-executors', executors || '—');
2238| setText('ssma-ap-action-view-validators', validators || '—');
2239| setText('ssma-ap-action-view-deadline', deadline);
2240| setText('ssma-ap-action-view-pending', pending);
2241| setText('ssma-ap-action-view-description', description);
2242|
2243| var originLink = document.getElementById('ssma-ap-action-view-origin-link');
2244| if (originLink) {
2245| if (originUrl) {
2246| originLink.href = originUrl;
2247| originLink.classList.remove('d-none');
2248| } else {
2249| originLink.classList.add('d-none');
2250| }
2251| }
2252|
2253| if (typeof window.openOffcanvasssmaApActionView === 'function') {
2254| window.openOffcanvasssmaApActionView();
2255| return;
2256| }
2257| var canvas = document.getElementById('ssmaApActionView-offcanvas-wrapper')
2258| || document.getElementById('ssmaApActionViewOffcanvas');
2259| if (!canvas) {
2260| return;
Request #28
deepseek-v4-flash
P:37.87K C:262 CR:35.71K CW:0
2400ms
Reasoning
Now I need to find:
1. The template that contains the offcanvas and its registered opener (if any), ids like ssma-ap-action-view-*.
2. The _tab_action_plan.html.twig opener.
Let me search templates for these.
Tool Calls (3)
code_search
Show Details
Arguments
{"file_patterns": ["templates/ssma/action_plan/"], "search_text": "openOffcanvas"}
Result
File: templates/ssma/action_plan/tabs/_tab_action_plan.html.twig
Match lines: 2
1638| if (typeof openOffcanvasSsmaActionPlanViewOffcanvas === 'function') {
1639| openOffcanvasSsmaActionPlanViewOffcanvas();
code_search
Show Details
Arguments
{"file_patterns": ["templates/ssma/action_plan/", "templates/"], "search_text": "ssma-ap-action-view"}
Result
No matches found
code_search
Show Details
Arguments
{"file_patterns": ["public/js/ssma/action_plan_panel.js"], "search_text": "openOffcanvas"}
Result
File: public/js/ssma/action_plan_panel.js
Match lines: 2
2253| if (typeof window.openOffcanvasssmaApActionView === 'function') {
2254| window.openOffcanvasssmaApActionView();
Request #29
deepseek-v4-flash
P:38.29K C:352 CR:38.02K CW:0
2991ms
Reasoning
Confirmed: There is no template element with `ssma-ap-action-view` ids. And there is a function `openOffcanvasSsmaActionPlanViewOffcanvas` referenced in `_tab_action_plan.html.twig` at line 1638-1639, which differs from the JS name `openOffcanvasssmaApActionView`.
Let me read that region in _tab_action_plan.html.twig to understand what offcanvas the template expects, and check whether it is a Bootstrap modal (#ssmaApActionView) used by the 'Ações' tab (existing table). This new JS in action_plan_panel.js is used in the Painel/Pendências table.
Let me read _tab_action_plan.html.twig around 1600-1700 to see the offcanvas markup registered there.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 1700, "file_path": "templates/ssma/action_plan/tabs/_tab_action_plan.html.twig", "start_line": 1580}
Result
File: templates/ssma/action_plan/tabs/_tab_action_plan.html.twig (Total lines: 2264)
IS_TRUNCATED: false
LINE_RANGE: 1580-1700
1580| '<div class="ssma-ap-action-details-history-content">' +
1581| '<strong>' + ssmaActionPlanEscapeHtml(item.title || '') + '</strong>' +
1582| '<p>' + ssmaActionPlanEscapeHtml(item.subtitle || '') + '</p>' +
1583| '</div>' +
1584| '</div>';
1585| }).join('');
1586| }
1587|
1588| function populateSsmaActionPlanViewOffcanvas(action) {
1589| action = resolveSsmaActionPlanActionData(action);
1590| var $root = $('#ssmaActionPlanViewOffcanvasBody');
1591| if (!$root.length) {
1592| return;
1593| }
1594|
1595| var executorId = (action.responsible_ids && action.responsible_ids.length)
1596| ? action.responsible_ids[0]
1597| : 0;
1598| var validatorId = action.validator_member_id || action.validator_id || 0;
1599| var deadlineStatus = action.card_status_label || action.deadline_bucket_label || '—';
1600|
1601| $root.find('[data-ap-detail="title"]').text(ssmaActionPlanDisplayValue(action.title));
1602| $root.find('[data-ap-detail="code"]').text(action.id ? ('#' + action.id) : '—');
1603| $root.find('[data-ap-detail="type_label"]').text(ssmaActionPlanDisplayValue(action.type_label));
1604| $root.find('[data-ap-detail="occurrence_type_label"]').text(ssmaActionPlanDisplayValue(action.occurrence_type_label));
1605| $root.find('[data-ap-detail="description"]').text(ssmaActionPlanDisplayValue(action.description));
1606| $root.find('[data-ap-detail="executor_name"]').text(ssmaActionPlanResolveMemberName(executorId));
1607| $root.find('[data-ap-detail="validator_name"]').text(ssmaActionPlanResolveMemberName(validatorId));
1608| $root.find('[data-ap-detail="deadline_label"]').text(ssmaActionPlanDisplayValue(action.deadline_label || action.deadline));
1609| $root.find('[data-ap-detail="deadline_status"]').text(ssmaActionPlanDisplayValue(deadlineStatus));
1610| $root.find('[data-ap-detail="validation_status_label"]').text(ssmaActionPlanDisplayValue(action.validation_status_label));
1611| $root.find('[data-ap-detail="solved_label"]').text(action.solved ? 'Resolvida' : 'Em aberto');
1612| $root.find('[data-ap-detail="project_name"]').text(
1613| action.has_project
1614| ? ssmaActionPlanDisplayValue(action.project_name || ('Projeto #' + (action.project_id || '')))
1615| : 'Sem projeto'
1616| );
1617| $root.find('[data-ap-detail="actions_taken_label"]').text(
1618| ssmaActionPlanDisplayValue(action.actions_taken_label || (action.has_project ? '0/0' : '—'))
1619| );
1620| $root.find('[data-ap-detail="occurrence_title"]').text(ssmaActionPlanDisplayValue(action.occurrence_title));
1621| $root.find('[data-ap-detail="control_hierarchy"]').text(ssmaActionPlanDisplayValue(action.control_hierarchy));
1622| $root.find('[data-ap-detail="project_priority"]').text(ssmaActionPlanDisplayValue(action.project_priority));
1623| $root.find('[data-ap-detail="history"]').html(renderSsmaActionPlanHistoryHtml(buildSsmaActionPlanHistoryItems(action)));
1624| }
1625|
1626| function openSsmaActionPlanViewOffcanvas(action) {
1627| populateSsmaActionPlanViewOffcanvas(action);
1628|
1629| if (typeof setupModalOffcanvas === 'function') {
1630| setupModalOffcanvas();
1631| }
1632|
1633| if (typeof openRegisteredOffcanvas === 'function') {
1634| openRegisteredOffcanvas('ssmaActionPlanViewOffcanvas');
1635| return;
1636| }
1637|
1638| if (typeof openOffcanvasSsmaActionPlanViewOffcanvas === 'function') {
1639| openOffcanvasSsmaActionPlanViewOffcanvas();
1640| }
1641| }
1642|
1643| function buildSsmaActionPlanOverflowMenuHtml(action) {
1644| var payloadStr = ssmaActionPlanEncodePayload(action);
1645| var canEdit = ssmaCanManageOccurrences || !!action.can_edit;
1646| var canResolve = !!action.can_resolve || (ssmaCanManageOccurrences && !action.solved && action.validation_status !== 'pending_validation');
1647| var canValidate = !!action.can_validate;
1648|
1649| var validateHtml = (canValidate && action.validation_status === 'pending_validation' && !action.solved)
1650| ? '<a class="dropdown-item js-ssma-action-plan-action" href="#" data-action-id="' + action.id + '" data-action-operation="validate" data-action-payload=\'' + payloadStr + '\'><i class="fas fa-clipboard-check mr-2"></i>Validar fechamento</a>'
1651| : '';
1652| var resolveHtml = '';
1653| if (canResolve) {
1654| if (action.solved) {
1655| resolveHtml = '<a class="dropdown-item js-ssma-action-plan-action" href="#" data-action-id="' + action.id + '" data-action-operation="reopen" data-action-payload=\'' + payloadStr + '\'><i class="fas fa-undo mr-2"></i>Reabrir ação</a>';
1656| } else if (action.validation_status !== 'pending_validation') {
1657| resolveHtml = '<a class="dropdown-item js-ssma-action-plan-action" href="#" data-action-id="' + action.id + '" data-action-operation="resolve" data-action-payload=\'' + payloadStr + '\'><i class="fas fa-check mr-2"></i>Resolver ação</a>';
1658| }
1659| }
1660| var projectHtml = '';
1661| if (canEdit) {
1662| projectHtml = action.has_project
1663| ? '<a class="dropdown-item js-ssma-action-plan-action" href="#" data-action-id="' + action.id + '" data-action-operation="go-project" data-action-payload=\'' + payloadStr + '\'><i class="fas fa-external-link-alt mr-2"></i>Ir para projeto</a>'
1664| : '<a class="dropdown-item js-ssma-action-plan-action" href="#" data-action-id="' + action.id + '" data-action-operation="create-project" data-action-payload=\'' + payloadStr + '\'><i class="fas fa-folder-plus mr-2"></i>Criar projeto</a>' +
1665| '<a class="dropdown-item js-ssma-action-plan-action" href="#" data-action-id="' + action.id + '" data-action-operation="link-project" data-action-payload=\'' + payloadStr + '\'><i class="fas fa-link mr-2"></i>Vincular a um plano de ação</a>';
1666| }
1667|
1668| var originHtml = buildGoOriginMenuHtml(action, payloadStr);
1669| var menuItems = '<a class="dropdown-item js-ssma-action-plan-action" href="#" data-action-id="' + action.id + '" data-action-operation="view" data-action-payload=\'' + payloadStr + '\'><i class="fas fa-eye mr-2"></i>Visualizar ação</a>';
1670| if (canEdit) {
1671| menuItems += '<a class="dropdown-item js-ssma-action-plan-action" href="#" data-action-id="' + action.id + '" data-action-operation="edit" data-action-payload=\'' + payloadStr + '\'><i class="fas fa-edit mr-2"></i>Editar ação</a>';
1672| }
1673| menuItems += resolveHtml + validateHtml + originHtml + projectHtml;
1674| if (canEdit) {
1675| menuItems += '<div class="dropdown-divider"></div>' +
1676| '<a class="dropdown-item text-danger js-ssma-action-plan-action" href="#" data-action-id="' + action.id + '" data-action-operation="delete" data-action-payload=\'' + payloadStr + '\'><i class="fas fa-trash-alt mr-2"></i>Deletar ação</a>';
1677| }
1678|
1679| return '<div class="d-flex justify-content-center"><div class="dropdown">' +
1680| '<button class="btn btn-default btn-sm ssma-action-plan-action-btn" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Ações"><i class="fas fa-ellipsis-v"></i></button>' +
1681| '<div class="dropdown-menu dropdown-menu-right shadow-sm">' + menuItems + '</div>' +
1682| '</div></div>';
1683| }
1684|
1685| function syncSsmaActionPlanChildTableColumns() {
1686| var dt = getSsmaActionPlanTableInstance();
1687| if (!dt) {
1688| return;
1689| }
1690|
1691| var widths = [];
1692| dt.columns().every(function () {
1693| if (!this.visible()) {
1694| return;
1695| }
1696| var header = this.header();
1697| widths.push(header ? $(header).outerWidth() : 0);
1698| });
1699|
1700| $('#ssmaActionPlanTable .ssma-ap-project-children-table').each(function () {
code_search
Show Details
Arguments
{"file_patterns": ["templates/ssma/action_plan/tabs/_tab_painel.html.twig"], "search_text": "offcanvas|modal|js-ssma-ap-panel-view-action"}
Result
No matches found
Request #30
deepseek-v4-flash
P:41.01K C:519 CR:38.53K CW:0
4180ms
Reasoning
The `_tab_painel.html.twig` has no offcanvas/modal or `js-ssma-ap-panel-view-action`. The new offcanvas that `openActionViewOffcanvas` tries to open relies on `window.openOffcanvasssmaApActionView` being registered or `#ssmaApActionView-offcanvas-wrapper`/`#ssmaApActionViewOffcanvas` elements. Since we didn't find `ssma-ap-action-view` ids anywhere in templates (the search for `ssma-ap-action-view` returned "No matches found" across templates dir), those `document.getElementById('ssma-ap-action-view-title')` calls would find nothing, meaning the offcanvas populates nothing. Wait — the second search was across `templates/` and found no matches for `ssma-ap-action-view`. And `_tab_painel.html.twig` search for offcanvas found nothing. So the Painel tab lacks the offcanvas markup.
Hmm, but `file_read_diff` shows only a limited review group; `_tab_painel.html.twig` is in review group. Let me search for `ssmaApActionView` across whole repo templates + js to be safe. Also check whether there's some generic offcanvas component used in _tab_painel.
Actually the openActionViewOffcanvas references ids `ssma-ap-action-view-title`, etc. If none exist, the view action button would silently do nothing when clicked (all setText no-op, no canvas to show). But maybe there's a generic modal opened via `openRegisteredOffcanvas('ssmaApActionView')`? The JS doesn't reference that.
Let me search entire repo for 'ssmaApActionView' and 'ssma-ap-action-view'.
Tool Calls (3)
code_search
Show Details
Arguments
{"search_text": "ssmaApActionView"}
Result
File: public/js/ssma/action_plan_panel.js
Match lines: 5
2253| if (typeof window.openOffcanvasssmaApActionView === 'function') {
2254| window.openOffcanvasssmaApActionView();
2257| var canvas = document.getElementById('ssmaApActionView-offcanvas-wrapper')
2258| || document.getElementById('ssmaApActionViewOffcanvas');
2263| window.jQuery('#ssmaApActionView').modal('show');
code_search
Show Details
Arguments
{"search_text": "ssma-ap-action-view"}
Result
File: public/js/ssma/action_plan_panel.js
Match lines: 9
2234| setText('ssma-ap-action-view-title', title);
2235| setText('ssma-ap-action-view-id', id ? ('#' + id) : '');
2236| setText('ssma-ap-action-view-origin', origin);
2237| setText('ssma-ap-action-view-executors', executors || '—');
2238| setText('ssma-ap-action-view-validators', validators || '—');
2239| setText('ssma-ap-action-view-deadline', deadline);
2240| setText('ssma-ap-action-view-pending', pending);
2241| setText('ssma-ap-action-view-description', description);
2243| var originLink = document.getElementById('ssma-ap-action-view-origin-link');
code_search
Show Details
Arguments
{"search_text": "js-ssma-ap-panel-view-action|ssma-ap-action-view-", "use_perl_regexp": true}
Result
File: public/js/ssma/action_plan_panel.js
Match lines: 11
916| + '<button type="button" class="ssma-ap-panel-table-action-btn js-ssma-ap-panel-view-action"'
2234| setText('ssma-ap-action-view-title', title);
2235| setText('ssma-ap-action-view-id', id ? ('#' + id) : '');
2236| setText('ssma-ap-action-view-origin', origin);
2237| setText('ssma-ap-action-view-executors', executors || '—');
2238| setText('ssma-ap-action-view-validators', validators || '—');
2239| setText('ssma-ap-action-view-deadline', deadline);
2240| setText('ssma-ap-action-view-pending', pending);
2241| setText('ssma-ap-action-view-description', description);
2243| var originLink = document.getElementById('ssma-ap-action-view-origin-link');
2275| root.querySelectorAll('.js-ssma-ap-panel-view-action').forEach(function (btn) {
File: templates/ssma/action_plan/tabs/_tab_painel.html.twig
Match lines: 1
492| class="ssma-ap-panel-table-action-btn js-ssma-ap-panel-view-action"
Request #31
deepseek-v4-flash
P:42.16K C:1.26K CR:41.47K CW:0
9590ms
Reasoning
So confirmed: The offcanvas markup (`ssma-ap-action-view-*` ids and wrapper `ssmaApActionViewOffcanvas`/`ssmaApActionView`) does NOT exist in any template. The JS added this PR references elements that are not in the template. And the template `_tab_painel.html.twig` at line 492 defines the button `.js-ssma-ap-panel-view-action` — that's the panel table button (this PR) bound in `bindTableViewButtons()` → openActionViewOffcanvas.
Wait — line 492 in `_tab_painel.html.twig` matches `js-ssma-ap-panel-view-action`. But `_tab_painel.html.twig` diff for this PR only showed the header area and filter and columns. Line 492 already existed? Actually the diff hunk at 495-522 modifies the header titles, so the table must exist in the template at ~480-500. Wait but earlier search in `_tab_painel.html.twig` for `offcanvas|modal|js-ssma-ap-panel-view-action` returned no matches... Hmm. That's strange, but search #2 in the third batch returned a match at line 492 in `_tab_painel.html.twig`. And my earlier combined search `offcanvas|modal|js-ssma-ap-panel-view-action` in file `_tab_painel.html.twig` returned "No matches found". Weird—maybe that search tool had issue with combined patterns or regex. Anyway, the current search confirms the button exists at 492.
Now, is the offcanvas rendered elsewhere, e.g., in `action_plan_panel` main template (index)? Let's search entire repo templates for offcanvas registration `ssmaApActionView` (found only in JS). So no offcanvas DOM. This suggests the visualização action button in the Painel's Pendências table opens... nothing. Unless `openOffcanvasssmaApActionView` is registered by generic `_modal_offcanvas.js` logic reading data attributes from an element in a parent template that we haven't searched. Let's search for `data-open-offcanvas` or similar in the panel parent template that includes these tabs, e.g. `_tab_painel.html.twig` is included within a parent. Let me find where the offcanvas could be defined: search templates for `openOffcanvas` generic registration or `data-offcanvas`. Actually there's `window.openOffcanvas`? Let me search for "Offcanvas" with camel, in templates & js.
We found only `_tab_action_plan.html.twig` line 1638 using `openOffcanvasSsmaActionPlanViewOffcanvas` (that's within the Ações tab, a different table's offcanvas that exists in `_tab_action_plan.html.twig` with `#ssmaActionPlanViewOffcanvas`).
Given the review group includes `_tab_painel.html.twig` only as diff hunks. The diff hunk for the table at lines 495-522 modifies only header titles and doesn't add offcanvas markup. The `openActionViewOffcanvas` function in JS reads `data-action-*` attributes that this PR adds in `buildPendenciasTableRowHtml`.
So the situation: clicking the eye button in the Pendências table calls `openActionViewOffcanvas(btn)`, which:
1. sets text of ids `ssma-ap-action-view-*` — if absent (they are absent), no-op
2. looks for `window.openOffcanvasssmaApActionView` — not registered (only `openOffcanvasSsmaActionPlanViewOffcanvas` in _tab_action_plan twig, in a `<script>` block which is only on the Ações tab, not the Painel/Pendências tab)
Actually wait, is `_tab_action_plan.html.twig` included on the same page as `_tab_painel.html.twig`? Both are tabs of the "Plano de Ação" page (the module). Tab Painel and tab Ações both rendered in the same page, maybe all tabs included simultaneously, with tab switching. If both tabs are on the same page, the function `openOffcanvasSsmaActionPlanViewOffcanvas` defined in `_tab_action_plan.html.twig`'s script would be defined (though referencing existing offcanvas #ssmaActionPlanViewOffcanvas from the Ações tab). But the JS `openActionViewOffcanvas` doesn't call that function; it only calls `window.openOffcanvasssmaApActionView`, which doesn't exist. So the offcanvas in Painel would never open.
Hmm — unless a generic mechanism registers `window["openOffcanvas"+fnSuffix]` functions. Earlier summaries said: "a infraestrutura genérica de abridores (`_modal_offcanvas.js` + data-attributes) registra funções `window["openOffcanvas"+fnSuffix]`". Let me check for generic offcanvas registration functions — search `openRegisteredOffcanvas` in js and where it's defined, and check the naming convention.
Let me search the JS for function that creates `window["openOffcanvas"`.
Tool Calls (3)
code_search
Show Details
Arguments
{"search_text": "openRegisteredOffcanvas"}
Result
File: public/js/metahuman-standard/components/_modal_offcanvas.js
Match lines: 4
77|function openRegisteredOffcanvas(modalId) {
135| openRegisteredOffcanvas(modalId);
215| openRegisteredOffcanvas(modalId);
225| openRegisteredOffcanvas(modalId);
File: public/js/shift-scheduling/index.js
Match lines: 18
399| if (typeof openRegisteredOffcanvas === 'function') {
400| openRegisteredOffcanvas('shiftSchedulingAddShiftOffcanvas');
408| if (typeof openRegisteredOffcanvas === 'function') {
409| openRegisteredOffcanvas('shiftSchedulingShiftDetailsOffcanvas');
417| if (typeof openRegisteredOffcanvas === 'function') {
418| openRegisteredOffcanvas('shiftSchedulingScheduleDetailsOffcanvas');
426| if (typeof openRegisteredOffcanvas === 'function') {
427| openRegisteredOffcanvas('shiftSchedulingAddModelOffcanvas');
435| if (typeof openRegisteredOffcanvas === 'function') {
436| openRegisteredOffcanvas('shiftSchedulingAddScheduleOffcanvas');
444| if (typeof openRegisteredOffcanvas === 'function') {
445| openRegisteredOffcanvas('shiftSchedulingModelDetailsOffcanvas');
1912| if (typeof openRegisteredOffcanvas === 'function') {
1913| openRegisteredOffcanvas('shiftSchedulingScheduleAssignmentOffcanvas');
1921| if (typeof openRegisteredOffcanvas === 'function') {
1922| openRegisteredOffcanvas('shiftSchedulingScheduleValidationOffcanvas');
1930| if (typeof openRegisteredOffcanvas === 'function') {
1931| openRegisteredOffcanvas('shiftSchedulingScheduleMemberActionsOffcanvas');
File: public/js/spaces_control/buildings/building_form.js
Match lines: 2
142| if (typeof window.openRegisteredOffcanvas === 'function') {
143| window.openRegisteredOffcanvas(formId);
File: templates/spaces_control/buildings/tabs/_tab_spaces.html.twig
Match lines: 2
418| if (typeof window.openRegisteredOffcanvas === 'function') {
419| window.openRegisteredOffcanvas(LOCATION_OFFCANVAS_ID);
File: templates/ssma/action_plan/tabs/_tab_action_plan.html.twig
Match lines: 2
1633| if (typeof openRegisteredOffcanvas === 'function') {
1634| openRegisteredOffcanvas('ssmaActionPlanViewOffcanvas');
code_search
Show Details
Arguments
{"search_text": "openOffcanvas\\w* = function|window\\[.openOffcanvas", "use_perl_regexp": true}
Result
File: public/js/metahuman-standard/components/_modal_offcanvas.js
Match lines: 1
224| window["openOffcanvas" + fnSuffix] = function () {
File: public/js/onboarding/utils.js
Match lines: 1
40| const openFn = window[`openOffcanvas${fnSuffix}`];
File: public/js/spaces_control/buildings/building_form.js
Match lines: 1
146| const openFn = window['openOffcanvas' + formId];
File: templates/ssma/prevention/partials/_meta_abono_section.html.twig
Match lines: 1
644| var openFn = window['openOffcanvas' + String(modalId).replace(/[-_]/g, '')];
file_find
Show Details
Arguments
{"query_name": "_modal_offcanvas.js"}
Result
public/js/metahuman-standard/components/_modal_offcanvas.js
Request #32
deepseek-v4-flash
P:44.17K C:224 CR:43.39K CW:0
2437ms
Reasoning
Let me read `_modal_offcanvas.js` around line 77-230 to understand the registration logic and how `fnSuffix` is derived, and how one would register `openOffcanvasSsmaActionPlanViewOffcanvas` vs `openOffcanvasssmaApActionView`.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 230, "file_path": "public/js/metahuman-standard/components/_modal_offcanvas.js", "start_line": 60}
Result
File: public/js/metahuman-standard/components/_modal_offcanvas.js (Total lines: 248)
IS_TRUNCATED: false
LINE_RANGE: 60-230
60| top: "",
61| left: "",
62| width: "",
63| height: "",
64| });
65| return;
66| }
67|
68| var rect = $appPageBody[0].getBoundingClientRect();
69| instance.$wrapper.css({
70| top: rect.top + "px",
71| left: rect.left + "px",
72| width: rect.width + "px",
73| height: rect.height + "px",
74| });
75|}
76|
77|function openRegisteredOffcanvas(modalId) {
78| if (!window.$) {
79| return;
80| }
81|
82| var instance = mhsOffcanvasRegistry[modalId];
83| if (!instance || !instance.$wrapper || !instance.$wrapper.length) {
84| return;
85| }
86|
87| updateOffcanvasWrapperPosition(modalId);
88|
89| if (instance.$appPageBody && instance.$appPageBody.length) {
90| instance.$appPageBody.addClass("offcanvas-active");
91| }
92|
93| instance.$wrapper.addClass("show");
94|}
95|
96|function closeRegisteredOffcanvas(modalId) {
97| if (!window.$) {
98| return;
99| }
100|
101| var instance = mhsOffcanvasRegistry[modalId];
102| if (!instance || !instance.$wrapper || !instance.$wrapper.length) {
103| return;
104| }
105|
106| instance.$wrapper.removeClass("show");
107|
108| if (instance.$appPageBody && instance.$appPageBody.length) {
109| instance.$appPageBody.removeClass("offcanvas-active");
110| }
111|
112| if (instance.$modal && instance.$modal.length) {
113| instance.$modal.trigger("hidden.bs.modal");
114| }
115|}
116|
117|function bindGlobalOffcanvasEvents() {
118| if (mhsOffcanvasEventsBound || !window.$) {
119| return;
120| }
121|
122| mhsOffcanvasEventsBound = true;
123|
124| $(document).on(
125| "click.mhsOffcanvas",
126| '[data-toggle="modal"][data-target^="#"]',
127| function (e) {
128| var modalId = ($(this).attr("data-target") || "").replace(/^#/, "");
129| if (!modalId || !mhsOffcanvasRegistry[modalId]) {
130| return;
131| }
132|
133| e.preventDefault();
134| e.stopPropagation();
135| openRegisteredOffcanvas(modalId);
136| }
137| );
138|
139| $(document).on("click.mhsOffcanvas", "[data-dismiss-offcanvas]", function () {
140| var modalId = $(this).attr("data-dismiss-offcanvas");
141| if (!modalId || !mhsOffcanvasRegistry[modalId]) {
142| return;
143| }
144|
145| closeRegisteredOffcanvas(modalId);
146| });
147|
148| $(document).on("keydown.mhsOffcanvas", function (e) {
149| if (e.key !== "Escape") {
150| return;
151| }
152|
153| var openModalIds = Object.keys(mhsOffcanvasRegistry).filter(function (id) {
154| var instance = mhsOffcanvasRegistry[id];
155| return instance && instance.$wrapper && instance.$wrapper.hasClass("show");
156| });
157|
158| if (!openModalIds.length) {
159| return;
160| }
161|
162| closeRegisteredOffcanvas(openModalIds[openModalIds.length - 1]);
163| });
164|
165| $(window).on("resize.mhsOffcanvas", function () {
166| clearTimeout(mhsOffcanvasResizeTimeout);
167| mhsOffcanvasResizeTimeout = setTimeout(function () {
168| Object.keys(mhsOffcanvasRegistry).forEach(function (modalId) {
169| var instance = mhsOffcanvasRegistry[modalId];
170| if (instance && instance.$wrapper && instance.$wrapper.hasClass("show")) {
171| updateOffcanvasWrapperPosition(modalId);
172| }
173| });
174| }, 50);
175| });
176|
177| var $appPageBody = getOffcanvasAppPageBody();
178| if ($appPageBody && $appPageBody.length) {
179| $appPageBody.off("scroll.mhsOffcanvas").on("scroll.mhsOffcanvas", function () {
180| Object.keys(mhsOffcanvasRegistry).forEach(function (modalId) {
181| var instance = mhsOffcanvasRegistry[modalId];
182| if (instance && instance.$wrapper && instance.$wrapper.hasClass("show")) {
183| updateOffcanvasWrapperPosition(modalId);
184| }
185| });
186| });
187| }
188|}
189|
190|function initializeOffcanvasInstance(wrapper) {
191| if (!window.$ || !wrapper) {
192| return;
193| }
194|
195| var modalId = deriveOffcanvasModalId(wrapper);
196| if (!modalId || mhsOffcanvasRegistry[modalId]) {
197| return;
198| }
199|
200| var $wrapper = $(wrapper);
201| var $modal = $("#" + modalId);
202| var fnSuffix = sanitizeOffcanvasFunctionSuffix(modalId);
203|
204| mhsOffcanvasRegistry[modalId] = {
205| modalId: modalId,
206| $wrapper: $wrapper,
207| $modal: $modal,
208| $appPageBody: getOffcanvasAppPageBody(),
209| };
210|
211| if ($modal.length) {
212| $modal.off("show.bs.modal.mhsOffcanvas").on("show.bs.modal.mhsOffcanvas", function (e) {
213| e.preventDefault();
214| e.stopPropagation();
215| openRegisteredOffcanvas(modalId);
216| return false;
217| });
218|
219| $modal.off("hide.bs.modal.mhsOffcanvas").on("hide.bs.modal.mhsOffcanvas", function () {
220| closeRegisteredOffcanvas(modalId);
221| });
222| }
223|
224| window["openOffcanvas" + fnSuffix] = function () {
225| openRegisteredOffcanvas(modalId);
226| };
227|
228| window["closeOffcanvas" + fnSuffix] = function () {
229| closeRegisteredOffcanvas(modalId);
230| };
file_read
Show Details
Arguments
{"end_line": 150, "file_path": "public/js/onboarding/utils.js", "start_line": 25}
Result
File: public/js/onboarding/utils.js (Total lines: 377)
IS_TRUNCATED: false
LINE_RANGE: 25-150
25| const appTabLink = document.getElementById(`${tabId}_tab`);
26| if (appTabLink) appTabLink.classList.add('active');
27|
28| if (tabId === 'personalizar' && typeof inicializarPersonalizar === 'function') {
29| inicializarPersonalizar();
30| }
31|}
32|
33|// Modal
34|function abrirModalComponente(modalId) {
35| const modal = document.getElementById(modalId);
36| const offcanvasWrapper = document.getElementById(`${modalId}-offcanvas-wrapper`);
37|
38| if (offcanvasWrapper) {
39| const fnSuffix = String(modalId || '').replace(/[-_]/g, '');
40| const openFn = window[`openOffcanvas${fnSuffix}`];
41|
42| if (typeof openFn === 'function') {
43| openFn();
44| } else {
45| offcanvasWrapper.classList.add('show');
46| document.querySelector('.app-page-body')?.classList.add('offcanvas-active');
47| }
48|
49| return;
50| }
51|
52| if (!modal) return;
53|
54| if (modal.classList.contains('modal') && typeof window.$ !== 'undefined') {
55| window.$(modal).modal('show');
56| return;
57| }
58|
59| modal.classList.remove('d-none');
60|}
61|
62|function fecharModal(modalId) {
63| const modal = document.getElementById(modalId);
64| const offcanvasWrapper = document.getElementById(`${modalId}-offcanvas-wrapper`);
65|
66| if (offcanvasWrapper) {
67| const fnSuffix = String(modalId || '').replace(/[-_]/g, '');
68| const closeFn = window[`closeOffcanvas${fnSuffix}`];
69|
70| if (typeof closeFn === 'function') {
71| closeFn();
72| } else {
73| offcanvasWrapper.classList.remove('show');
74| document.querySelector('.app-page-body')?.classList.remove('offcanvas-active');
75| }
76|
77| return;
78| }
79|
80| if (!modal) return;
81|
82| if (modal.classList.contains('modal') && typeof window.$ !== 'undefined') {
83| window.$(modal).modal('hide');
84| } else {
85| modal.classList.add('d-none');
86| }
87|
88| if (modalId === 'modalAtividade') {
89| const gerenciador = window.GerenciadorModalAtividade || window.GerenciadorModalAtividadeSemEtapa;
90| if (gerenciador && typeof gerenciador.limparDados === 'function') {
91| gerenciador.limparDados();
92| }
93| }
94|}
95|
96|function showConfirmationModal(titulo, texto, callbackConfirmacao) {
97| const modal = document.getElementById('modalConfirmacao');
98| const tituloEl = document.getElementById('confirmacaoTitulo');
99| const textoEl = document.getElementById('confirmacaoTexto');
100| const btnConfirmar = document.getElementById('btnConfirmarAcao');
101| const btnCancelar = document.getElementById('btnCancelarAcao');
102|
103| tituloEl.textContent = titulo || 'Confirmação';
104| textoEl.textContent = texto || 'Tem certeza que deseja prosseguir?';
105|
106| const novoBtnConfirmar = btnConfirmar.cloneNode(true);
107| btnConfirmar.parentNode.replaceChild(novoBtnConfirmar, btnConfirmar);
108|
109| novoBtnConfirmar.addEventListener('click', () => {
110| setButtonLoading(novoBtnConfirmar, true, 'Processando...');
111| if (btnCancelar) btnCancelar.disabled = true;
112|
113| Promise.resolve(callbackConfirmacao())
114| .then(() => fecharModal('modalConfirmacao'))
115| .catch(console.error)
116| .finally(() => {
117| setButtonLoading(novoBtnConfirmar, false);
118| if (btnCancelar) btnCancelar.disabled = false;
119| });
120| });
121|
122| abrirModalComponente('modalConfirmacao');
123|}
124|
125|// Form header toggle
126|function toggleForm(formId, arrowId) {
127| const form = document.getElementById(formId);
128| const arrow = document.getElementById(arrowId);
129| if (!form || !arrow) return;
130|
131| $(form).collapse('toggle');
132| arrow.classList.toggle('bi-chevron-down');
133| arrow.classList.toggle('bi-chevron-up');
134|}
135|
136|// Sorting
137|function ordenarListaPorCampo(lista, campo) {
138| return [...lista].sort((a, b) => {
139| const aVal = (a[campo] ?? '').toString().toLowerCase();
140| const bVal = (b[campo] ?? '').toString().toLowerCase();
141| return aVal.localeCompare(bVal);
142| });
143|}
144|
145|// Busca
146|function toggleBusca(inputId, labelId) {
147| const input = document.getElementById(inputId);
148| const label = document.getElementById(labelId);
149| if (!input || !label) return;
150|
Request #33
deepseek-v4-flash
P:47.24K C:966 CR:44.29K CW:0
7322ms
Reasoning
So `_modal_offcanvas.js` registers `window["openOffcanvas" + fnSuffix]` where fnSuffix = sanitizeOffcanvasFunctionSuffix(modalId). modalId is derived from the wrapper element (with attribute data-offcanvas-id presumably). The naming `openOffcanvasSsmaActionPlanViewOffcanvas` for offcanvas with id `ssmaActionPlanViewOffcanvas`. `openOffcanvasssmaApActionView` would correspond to id `ssmaApActionView`.
But there's no wrapper/markup for `ssmaApActionView` in the templates that belong to the Painel/Pendências table (the offcanvas button from this PR). However, we should confirm: is `_tab_painel.html.twig` on the same page as `_tab_action_plan.html.twig`? Both are "tabs" of the Plano de Ação page. If `_tab_action_plan.html.twig` includes `#ssmaActionPlanViewOffcanvas` markup and it's rendered on the same page, then the ids `ssma-ap-action-view-*` used in the new JS... wait those aren't the same ids as the existing offcanvas (`ssmaActionPlanViewOffcanvas`, `#ssmaActionPlanViewOffcanvasBody`, `[data-ap-detail=...]`). The new JS uses `ssma-ap-action-view-title` etc., which match nothing anywhere. So the offcanvas content would not be populated and would not open (function `window.openOffcanvasssmaApActionView` is undefined; wrapper `ssmaApActionViewOffcanvas` absent; `#ssmaApActionView` absent).
Wait — maybe the offcanvas markup is in a template file not included in the search because search patterns only searched file patterns default (whole codebase? search without file_patterns searches entire codebase). We searched entire codebase for `ssma-ap-action-view` and `ssmaApActionView` and results only in action_plan_panel.js. So the offcanvas markup truly does not exist anywhere.
This is a real, medium bug: clicking "Visualizar" in the Pendências table won't show anything. Unless there is some dynamically generated offcanvas from a partial template, but the JS references IDs. Let me double check whether the offcanvas could be rendered through `_modal_offcanvas` markup with data attributes where content is populated via the JS `ssma-ap-action-view-*`. Since the markup is missing from the repo (search results no matches), we can conclude: The view button added in this PR in the pendências table will call `openActionViewOffcanvas`, which finds no target offcanvas and does nothing. That's a real feature-blocking bug.
Hold on — wait, `_tab_painel.html.twig` search for `js-ssma-ap-panel-view-action` returned a match at line 492, meaning the table in `_tab_painel.html.twig` has this button in template. Let me look at the table markup around line 460-560 in _tab_painel to see how rows are rendered (perhaps DataTable with columns but rows built in JS from AJAX). Also check whether there's an offcanvas partial included in _tab_painel? Search for `include` of offcanvas in `_tab_painel.html.twig`.
Actually, since the PR adds data-action-* attrs and offcanvas population code but no offcanvas markup, and the review scope templates are limited, maybe offcanvas markup was meant to be added in `_tab_painel.html.twig` but wasn't. Let me look at full _tab_painel file for any offcanvas include or bottom script.
Let me read the surrounding area in _tab_painel (lines 430-560) and check includes at bottom (file read whole file up to 700?). Total lines? Let me find file length.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 560, "file_path": "templates/ssma/action_plan/tabs/_tab_painel.html.twig", "start_line": 440}
Result
File: templates/ssma/action_plan/tabs/_tab_painel.html.twig (Total lines: 570)
IS_TRUNCATED: false
LINE_RANGE: 440-560
440| <div class="ssma-ap-table-title-main">{{ row.title }}</div>
441| <div class="ssma-ap-table-title-sub">{{ row.action_id }}</div>
442| </div>
443| {% endset %}
444| {% set origin_cell %}
445| <span class="ssma-ap-panel-table-origin"
446| data-toggle="tooltip"
447| title="{{ origin_meta.title|default('Origem') }}"
448| aria-label="{{ origin_meta.title|default('Origem') }}">
449| {% include 'components/ui/_icon_badge.html.twig' with {
450| icon: origin_meta.icon|default('fa-link'),
451| size: 'md',
452| variant: origin_meta.variant|default('primary'),
453| rounded: true
454| } %}
455| </span>
456| {% endset %}
457| {% set mgmt_cell %}
458| <div>
459| <div class="ssma-ap-table-title-main">{{ row.management }}</div>
460| <div class="ssma-ap-table-mgmt-sub">{{ row.location }}</div>
461| </div>
462| {% endset %}
463| {% set priority_key = row.priority_key|default('baixa')|lower %}
464| {% set priority_color = priority_colors[priority_key] is defined ? priority_colors[priority_key] : 'gray' %}
465| {% set priority_cell %}
466| {% include 'components/ui/_pill.html.twig' with {
467| label: row.priority,
468| color: priority_color,
469| size: 'sm'
470| } %}
471| {% endset %}
472| {% set responsible_members = [] %}
473| {% for person in row.responsible|default([]) %}
474| {% set responsible_members = responsible_members|merge([{
475| name: person.name|default(person.initials|default('')),
476| avatar: person.avatar|default('')
477| }]) %}
478| {% endfor %}
479| {% set responsible_cell %}
480| {% include 'components/ui/_member_avatars_stack.html.twig' with {
481| members: responsible_members,
482| max_visible: 3,
483| size: 27,
484| empty_label: '—'
485| } %}
486| {% endset %}
487| {% set deadline_cell %}
488| <span class="ssma-ap-deadline--{{ row.deadline_overdue|default(false) ? 'overdue' : 'ok' }}">{{ row.deadline }}</span>
489| {% endset %}
490| {% set action_cell %}
491| <button type="button"
492| class="ssma-ap-panel-table-action-btn js-ssma-ap-panel-view-action"
493| data-action-id="{{ row.id }}"
494| data-toggle="tooltip"
495| title="Visualizar"
496| aria-label="Visualizar ação">
497| <i class="fas fa-eye" aria-hidden="true"></i>
498| </button>
499| {% endset %}
500| {% set ap_table_rows = ap_table_rows|merge([{
501| titulo: title_cell|trim,
502| origem: origin_cell|trim,
503| gerencia: mgmt_cell|trim,
504| prioridade: priority_cell|trim,
505| responsavel: responsible_cell|trim,
506| prazo: deadline_cell|trim,
507| pendencia: row.pending,
508| acoes: action_cell|trim
509| }]) %}
510| {% endfor %}
511|
512| <div class="row mb-3">
513| <div class="col-12">
514| {% include 'components/ui/_table_card.html.twig' with {
515| title: 'Plano de ação',
516| table_id: 'ssma-ap-panel-table',
517| headers: [
518| { title: 'Título da ação', responsivePriority: 1 },
519| { title: 'Origem', key: 'origem', class: 'text-center', responsivePriority: 3 },
520| { title: 'Gerência', responsivePriority: 2 },
521| { title: 'Prioridade', responsivePriority: 2 },
522| { title: 'Quem executa', responsivePriority: 3 },
523| { title: 'Quem valida', responsivePriority: 3 },
524| { title: 'Prazo', responsivePriority: 2 },
525| { title: 'Pendência', responsivePriority: 4 },
526| { title: 'Ações', key: 'acoes', class: 'text-center', responsivePriority: 1 }
527| ],
528| rows: ap_table_rows,
529| empty_message: 'Nenhuma ação encontrada.',
530| datatable_options: {
531| ordering: false,
532| searching: false,
533| pageLength: panel_table.page_length|default(10),
534| lengthMenu: [[10, 25, 50], [10, 25, 50]],
535| lengthChange: true,
536| language: {
537| emptyTable: 'Nenhuma ação encontrada.',
538| zeroRecords: 'Nenhuma ação corresponde aos filtros.',
539| info: 'Mostrando _END_ de _TOTAL_ ações',
540| infoEmpty: 'Mostrando 0 de 0 ações',
541| lengthMenu: 'Resultados por página _MENU_',
542| paginate: { previous: '<', next: '>' }
543| }
544| }
545| } %}
546| </div>
547| </div>
548|
549| {% include 'ssma/action_plan/partials/_action_plan_semantic_adriana.html.twig' with {
550| view_mode: 'pendencias',
551| semantic: panel_semantic,
552| adriana: panel_adriana,
553| context: 'action_plan',
554| row_id: 'ssma-ap-semantic-adriana-pendencias'
555| } %}
556| </div>
557|
558| <div data-ap-panel-view="visao_geral" class="d-none">
559| {% include 'ssma/action_plan/tabs/_tab_painel_visao_geral.html.twig' %}
560| </div>
file_find
Show Details
Arguments
{"query_name": "_tab_painel.html.twig"}
Result
templates/ssma/action_plan/tabs/_tab_painel.html.twig
Request #34
deepseek-v4-flash
P:49.77K C:1.19K CR:48.13K CW:0
9579ms
Reasoning
The `_tab_painel.html.twig` includes the datatable with server-side/initial rows from Twig, with an eye button lacking `data-action-*` attributes (those are only in the JS `buildPendenciasTableRowHtml` used after AJAX refresh?). Note the template button at line 491-498 does not have data-action-title, etc. So if the Twig initial render is used, the JS `openActionViewOffcanvas(btn)` would read attributes → missing → defaults like 'Ação' etc. But more importantly no offcanvas markup.
Hmm, wait, but there's a subtlety: maybe rows are re-rendered by JS using `updatePendenciasTable` after AJAX, with `buildPendenciasTableRowHtml`, which includes `data-action-*` attributes. And the button binding `bindTableViewButtons` uses event delegation (document-level? line 2274 uses root.querySelectorAll after each update). Where is `bindTableViewButtons` called? Let's check for calling context and where the offcanvas should exist.
Regardless, the offcanvas markup with the ids `ssma-ap-action-view-*` or `ssmaApActionView` does not exist in the codebase. Therefore clicking the view button opens nothing.
But wait — maybe `window.openOffcanvasssmaApActionView` gets registered if there is a wrapper for `ssmaApActionView`... but wrapper `#ssmaApActionView-offcanvas-wrapper` also absent. So the fallback `window.jQuery('#ssmaApActionView').modal('show')` - would do nothing if no element.
So this PR adds a "Visualizar" button that visually triggers nothing. This is a functional bug worth a comment. Where best to place it? In the JS `openActionViewOffcanvas` (lines 2217-2264) — the offcanvas elements referenced don't exist in any template. And `_tab_painel.html.twig` at line 490-498 has the button but no offcanvas markup, plus its button lacks the data-action-* attributes, meaning the offcanvas can't even get values on initial page load.
However, need to verify that there is no offcanvas include at the end of _tab_painel file (total 570 lines). The file ends at line 570 with include of visao_geral view at line 558-560. There is no offcanvas include. Good.
Also let me verify the initial render rows are used on first page load (server-rendered via `ap_table_rows`), and the JS updates via AJAX. The template button lacks data-action attributes; the diff to the template didn't add those attributes; but the JS `updatePendenciasTable` probably re-renders rows from AJAX using `buildPendenciasTableRowHtml` — the twig table uses `_table_card` with initial rows. When AJAX refresh occurs, JS presumably replaces table body with HTML from `updatePendenciasTable` (which builds rows using the new function). So on initial load (before any filter change), buttons are from Twig (no data-action attrs, but still bound via bindTableViewButtons since it queries `.js-ssma-ap-panel-view-action`). openActionViewOffcanvas would set defaults and then fail to open because no offcanvas.
OK. This is the medium finding #5 from previous summary. Let me confirm how bindTableViewButtons is called — to see whether it re-binds after update (else delegation issue). Read lines 2264-2280 of the JS and where updatePendenciasTable and bindTableViewButtons get called.
Also, we must review the mine filter double payload computation (issue 4 - low). And check the origin filter regression for `refusal` (previously confirmed that chart seeds drop 'refusal' and 'occurrence', but extra categories are preserved in chart because presentSeededOriginChart only replaces seeds if isset($seed[$key])? Wait, presentSeededOriginChart loops over originCount and only adds into $seed if isset($seed[$key]). If originCount has 'refusal' and seed does not contain it, then... let me check the code again: presentSeededOriginChart seeds the array; then `foreach ($originCount as $key => $row) { if (isset($seed[$key])) { $seed[$key]['count'] += $row['count']? ... } }`. Let me read lines 1441-1460 fully.
Actually, from the diff:
```
private function presentSeededOriginChart(array $originCount): array
{
$seed = [ ... ];
foreach ($originCount as $key => $row) {
if (isset($seed[$key])) {
```
Let me read the code after that, to determine whether counts outside the seed are discarded.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 1470, "file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 1320}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648)
IS_TRUNCATED: false
LINE_RANGE: 1320-1470
1320| 'approved' => ['label' => 'Aprovado', 'color' => 'green'],
1321| 'rejected' => ['label' => 'Reprovada', 'color' => 'red'],
1322| default => ['label' => 'Em andamento', 'color' => 'gray'],
1323| };
1324| }
1325|
1326| private function resolveOriginKey(string $origem, string $eventType = ''): string
1327| {
1328| $event = strtoupper(trim($eventType));
1329| if (str_contains($event, 'QUASE') || $event === (defined(SsmaEvent::class . '::TYPE_QUASE_ACIDENTE') ? SsmaEvent::TYPE_QUASE_ACIDENTE : 'QUASE_ACIDENTE')) {
1330| return 'near_miss';
1331| }
1332| if (str_contains($event, 'PESSOAL') || str_contains($event, 'PERSONAL')) {
1333| return 'accident_personal';
1334| }
1335| if (str_contains($event, 'MATERIAL')) {
1336| return 'accident_material';
1337| }
1338| if (str_contains($event, 'ACIDENTE')) {
1339| return 'accident_personal';
1340| }
1341| if ($event === SsmaEvent::TYPE_ROS || str_contains($event, 'ROS')) {
1342| return 'ros';
1343| }
1344|
1345| $normalized = ActionOrigemEnum::normalize($origem);
1346| if ($normalized === ActionOrigemEnum::INSPECAO) {
1347| return 'inspection';
1348| }
1349| if ($normalized === ActionOrigemEnum::ABORDAGEM) {
1350| return 'approach';
1351| }
1352|
1353| $value = mb_strtolower(trim($origem));
1354|
1355| return match (true) {
1356| str_contains($value, 'inspe') => 'inspection',
1357| str_contains($value, 'abord') => 'approach',
1358| str_contains($value, 'quase') => 'near_miss',
1359| str_contains($value, 'material') => 'accident_material',
1360| str_contains($value, 'pessoal') || str_contains($value, 'acidente') => 'accident_personal',
1361| str_contains($value, 'ros') => 'ros',
1362| str_contains($value, 'recusa') || str_contains($value, 'refusal') => 'refusal',
1363| str_contains($value, 'ocorr') => 'accident_personal',
1364| default => 'other',
1365| };
1366| }
1367|
1368| private function resolveOriginLabel(string $origem, string $eventType = ''): string
1369| {
1370| return match ($this->resolveOriginKey($origem, $eventType)) {
1371| 'inspection' => 'Inspeção',
1372| 'approach' => 'Abordagem',
1373| 'accident_personal' => 'Acidente pessoal',
1374| 'accident_material' => 'Acidente material',
1375| 'near_miss' => 'Quase acidente',
1376| 'accident' => 'Acidente pessoal',
1377| 'ros' => 'ROS',
1378| 'refusal' => 'Direito de Recusa',
1379| default => $origem !== '' ? $origem : 'Outro',
1380| };
1381| }
1382|
1383| /**
1384| * @return array<string, array{icon: string, variant: string, title: string}>
1385| */
1386| private function originIconsMap(): array
1387| {
1388| return [
1389| 'inspection' => ['icon' => 'fa-clipboard-check', 'variant' => 'primary', 'title' => 'Inspeção'],
1390| 'approach' => ['icon' => 'fa-users', 'variant' => 'info', 'title' => 'Abordagem'],
1391| 'ros' => ['icon' => 'fa-file-lines', 'variant' => 'warning', 'title' => 'ROS'],
1392| 'accident' => ['icon' => 'fa-triangle-exclamation', 'variant' => 'danger', 'title' => 'Acidente pessoal'],
1393| 'accident_personal' => ['icon' => 'fa-triangle-exclamation', 'variant' => 'danger', 'title' => 'Acidente pessoal'],
1394| 'accident_material' => ['icon' => 'fa-car-burst', 'variant' => 'danger', 'title' => 'Acidente material'],
1395| 'near_miss' => ['icon' => 'fa-bolt', 'variant' => 'warning', 'title' => 'Quase acidente'],
1396| 'occurrence' => ['icon' => 'fa-triangle-exclamation', 'variant' => 'danger', 'title' => 'Ocorrência'],
1397| 'refusal' => ['icon' => 'fa-hand', 'variant' => 'company', 'title' => 'Direito de Recusa'],
1398| ];
1399| }
1400|
1401| /**
1402| * @param array<string, mixed> $action
1403| */
1404| private function resolveOriginUrl(array $action): string
1405| {
1406| $originKey = $this->resolveOriginKey(
1407| (string) ($action['origem'] ?? ''),
1408| (string) ($action['event_type'] ?? '')
1409| );
1410| $origemId = (int) ($action['origem_id'] ?? 0);
1411|
1412| if ($originKey === 'inspection' && $origemId > 0) {
1413| return '/manager/ssma/inspections/' . $origemId . '/view';
1414| }
1415| if ($originKey === 'approach' && $origemId > 0) {
1416| return '/manager/ssma/abordagens/' . $origemId . '/view';
1417| }
1418|
1419| $occurrenceId = (int) ($action['occurrence_id'] ?? 0);
1420| if ($occurrenceId > 0) {
1421| return '/manager/ssma/ocorrencias/' . $occurrenceId;
1422| }
1423|
1424| if ($origemId > 0 && in_array($originKey, ['accident_personal', 'accident_material', 'near_miss', 'ros', 'accident'], true)) {
1425| return '/manager/ssma/ocorrencias/' . $origemId;
1426| }
1427|
1428| $eventId = (int) ($action['event_id'] ?? 0);
1429| if ($eventId > 0) {
1430| return '/manager/ssma/ocorrencias?event=' . $eventId;
1431| }
1432|
1433| return '';
1434| }
1435|
1436| /**
1437| * @param array<string, array{label: string, count: int}> $originCount
1438| *
1439| * @return list<array{label: string, count: int}>
1440| */
1441| private function presentSeededOriginChart(array $originCount): array
1442| {
1443| $seed = [
1444| 'accident_personal' => ['label' => 'Acidente pessoal', 'count' => 0],
1445| 'accident_material' => ['label' => 'Acidente material', 'count' => 0],
1446| 'near_miss' => ['label' => 'Quase acidente', 'count' => 0],
1447| 'inspection' => ['label' => 'Inspeção', 'count' => 0],
1448| 'ros' => ['label' => 'ROS', 'count' => 0],
1449| 'approach' => ['label' => 'Abordagem', 'count' => 0],
1450| ];
1451| foreach ($originCount as $key => $row) {
1452| if (isset($seed[$key])) {
1453| $seed[$key]['count'] = (int) ($row['count'] ?? 0);
1454| continue;
1455| }
1456| if (($row['count'] ?? 0) > 0) {
1457| $seed[$key] = ['label' => (string) ($row['label'] ?? $key), 'count' => (int) $row['count']];
1458| }
1459| }
1460| $total = array_sum(array_map(static fn (array $row): int => (int) $row['count'], $seed));
1461| if ($total === 0) {
1462| return [];
1463| }
1464|
1465| return array_values($seed);
1466| }
1467|
1468| /**
1469| * @param list<array<string, mixed>> $allActions
1470| * @param list<array<string, mixed>> $filteredPendencias
file_read
Show Details
Arguments
{"end_line": 2378, "file_path": "public/js/ssma/action_plan_panel.js", "start_line": 2260}
Result
File: public/js/ssma/action_plan_panel.js (Total lines: 2378)
IS_TRUNCATED: false
LINE_RANGE: 2260-2378
2260| return;
2261| }
2262| if (window.jQuery) {
2263| window.jQuery('#ssmaApActionView').modal('show');
2264| return;
2265| }
2266| canvas.classList.add('show');
2267| canvas.style.visibility = 'visible';
2268| }
2269|
2270| function bindTableViewButtons() {
2271| var root = getRoot();
2272| if (!root) {
2273| return;
2274| }
2275| root.querySelectorAll('.js-ssma-ap-panel-view-action').forEach(function (btn) {
2276| btn.addEventListener('click', function () {
2277| openActionViewOffcanvas(btn);
2278| });
2279| });
2280| }
2281|
2282| function onPainelTabVisible() {
2283| if (initialized) {
2284| switchView(currentView);
2285| return;
2286| }
2287| initialized = true;
2288| initPanelConfig();
2289| if (typeof window.initAllCustomSelectWrappers === 'function') {
2290| window.initAllCustomSelectWrappers();
2291| }
2292| bindViewPills();
2293| bindAxisFilter();
2294| bindPendenciasPeriodPopover();
2295| bindPendenciasFilters();
2296| bindOverviewFilters();
2297| bindOverviewPagination();
2298| bindAdrianaQuestions();
2299| bindTableViewButtons();
2300| toggleHeaderFilters(currentView);
2301| syncApPainelPeriodPresetUI(panelState.period && panelState.period.indexOf('pend:range:') !== 0 ? panelState.period : 'next_month');
2302| syncOverviewPeriodPresetUI(panelState.overviewPeriod || 'last_3_months');
2303| updateAxisOptionsForPeriod(panelState.period || 'next_month');
2304| switchView(currentView);
2305| if (!panelData || !panelData.charts) {
2306| triggerPanelFilter(currentView);
2307| } else {
2308| var ssrLabels = (
2309| panelData.charts.critical_pending_by_deadline &&
2310| panelData.charts.critical_pending_by_deadline.labels
2311| ) || [];
2312| if (!ssrLabels.length) {
2313| triggerPanelFilter(currentView);
2314| }
2315| }
2316| }
2317|
2318| function observePainelTab() {
2319| var painelPanel = document.getElementById('tab_plano_painel_content');
2320| if (!painelPanel) {
2321| return;
2322| }
2323|
2324| if (painelPanel.offsetParent !== null && !painelPanel.classList.contains('d-none')) {
2325| onPainelTabVisible();
2326| }
2327|
2328| document.addEventListener('click', function (ev) {
2329| var link = ev.target && ev.target.closest ? ev.target.closest('#plano_acao_tabs .app-tab-link') : null;
2330| if (!link) {
2331| return;
2332| }
2333| var target = link.getAttribute('data-target-div') || '';
2334| if (target.indexOf('tab_plano_painel_content') !== -1) {
2335| window.setTimeout(onPainelTabVisible, 60);
2336| }
2337| });
2338|
2339| if (window.$ || window.jQuery) {
2340| (window.$ || window.jQuery)(document).on('tabShown', function (ev, tabId) {
2341| if (tabId === 'tab_plano_painel') {
2342| window.setTimeout(onPainelTabVisible, 60);
2343| }
2344| });
2345| }
2346|
2347| window.addEventListener('resize', function () {
2348| if (!initialized) {
2349| return;
2350| }
2351| if (currentView === 'pendencias') {
2352| reflowCharts(PENDENCIAS_CHART_KEYS);
2353| reflowDistributionCharts();
2354| } else if (currentView === 'visao_geral') {
2355| reflowCharts(OVERVIEW_CHART_KEYS);
2356| reflowDistributionCharts();
2357| }
2358| });
2359| }
2360|
2361| document.addEventListener('DOMContentLoaded', function () {
2362| initPanelConfig();
2363| panelData = parsePanelData();
2364| window.ssmaApPanelSetPeriod = function (value) {
2365| applyApPainelPeriodPreset(value || panelState.period || 'next_month');
2366| };
2367| var activePill = document.querySelector('.ssma-ap-panel-view-pill.is-active');
2368| if (activePill) {
2369| currentView = activePill.getAttribute('data-view') || 'pendencias';
2370| }
2371| observePainelTab();
2372| var _painelInitPanel = document.getElementById('tab_plano_painel_content');
2373| if (_painelInitPanel && _painelInitPanel.offsetParent !== null) {
2374| onPainelTabVisible();
2375| }
2376| });
2377|})(window, document);
2378|
Request #35
deepseek-v4-flash
P:54.58K C:4.73K CR:50.94K CW:0
35464ms
Reasoning
Now I have a complete picture of the JS. The offcanvas elements referenced don't exist anywhere in templates. So clicking the view button opens nothing. But wait, could the offcanvas be generated by an include in `_tab_painel_visao_geral.html.twig` or main page `action_plan.html.twig`? Let's search in entire codebase including all templates, for the wrapper `offcanvas-wrapper` and for id `ssmaApActionView`, already did: only JS matches. Also search `_tab_painel.html.twig` inclusion parent to see if an offcanvas may be defined at the page level referencing generic partial. But since we searched all templates for `ssma-ap-action-view` and got none, it's clear those ids never exist; and `ssmaApActionView` also only in JS. So the offcanvas markup is missing.
Hold on — is it possible the offcanvas markup uses `data-ap-detail` with a shared existing offcanvas from `_tab_action_plan.html.twig`? In `_tab_action_plan.html.twig`, the offcanvas for action details is `#ssmaActionPlanViewOffcanvas` and content has `[data-ap-detail="title"]`, etc. `populateSsmaActionPlanViewOffcanvas` uses `$('#ssmaActionPlanViewOffcanvasBody')`. But the new `openActionViewOffcanvas` references `ssma-ap-action-view-title`, not `data-ap-detail`. So mismatched.
But — wait — perhaps the two tabs (Painel, Ações) live in the same page: The main page for Plano de Ação with tabs. If the eye button in the pendencias table is rendered within the `_tab_painel.html.twig` (Painel tab), and `_tab_action_plan.html.twig` (Ações tab) is another tab on the same page, both markup are in the DOM. The `openActionViewOffcanvas` sets text of `ssma-ap-action-view-*` ids (none) then calls `window.openOffcanvasssmaApActionView` (undefined) — fallback: canvas = `ssmaApActionView-offcanvas-wrapper` (none) — fallback `window.jQuery('#ssmaApActionView').modal('show')` (none) — nothing happens.
So indeed it's broken, unless the diff added an offcanvas markup in some file not in our review group (other_changed_files). Wait! Other changed files "not in this review group" is empty (`<other_changed_files></other_changed_files>`). The review_files include 5 files. Templates include `_tab_painel.html.twig` and the partial. None contains offcanvas markup.
So there is a real risk the "Visualizar ação" button in the Painel/Pendências table does nothing. But wait — is it possible the offcanvas markup lives in a shared component included by the parent (e.g., `action_plan.html.twig` at page level with `{% include '_offcanvas' %}`)? We searched all of `templates/` and `public/` via code_search for `ssma-ap-action-view` — no matches besides JS. Search for `ssmaApActionView` — matches only JS. If markup existed anywhere, it would have matched at least one of those patterns (e.g., id="ssmaApActionViewOffcanvas"). But hmm, could markup use bootstrap modal with id like `ssmaApActionViewOffcanvas`? That would contain "ssmaApActionView". No matches. Confirmed missing.
Actually, wait. Let me reconsider: maybe the same page previously used a different approach where the row's eye button was `js-ssma-ap-panel-view-action` bound in this JS file, and the offcanvas markup exists in `_tab_painel.html.twig` but we saw the whole file (570 lines). No offcanvas there. The partial `_action_plan_overflow_menu.html.twig` also no. The page parent `templates/ssma/action_plan/...` may include `_modal_offcanvas.html.twig` generic. Let me find where the Painel's content lives in DOM and whether a page-level offcanvas include exists. Search parent `action_plan` templates for "offcanvas".
Let's search all templates for `data-offcanvas-id` or `offcanvas-wrapper` maybe there is a generic shell. But since the ids referenced by the JS don't exist, whatever generic shell exists won't match.
OK, I'm confident this is a genuine medium/high functional issue: new "Visualizar" button opens nothing because the offcanvas it targets doesn't exist in the templates (ids ssma-ap-action-view-* / ssmaApActionView never defined). This deserves a code comment on the JS `openActionViewOffcanvas` (added lines) or on template `_tab_painel.html.twig`. I'll place comment on the JS function since that's the added code that depends on missing markup.
Now, let me confirm remaining issues:
Issue 1 (mine filter fail-open + double payload): controller lines 503-546. When `mine=1` and user not resolved (mineId=0), the payload built at 503 (with memberScope from resolveActionPlanPanelMemberScope which may already be restricted for non-managers) is returned, so the `mine` filter doesn't apply. For managers, memberScope is null so full list returned — fail-open. Also, when mineId>0, buildFilterPayload runs twice (503 and 527) — duplicate work. The duplicate compute is wasteful but not blocking; combine into one comment on line 522 with the fail-open issue as the main concern (medium severity). Actually, wait — a nuance: the first buildFilterPayload at 503 uses resolveActionPlanPanelMemberScope($company). Let me check resolveActionPlanPanelMemberScope — per previous summary, for canManageSsmaOccurrences users scope is null (no restriction), for others [memberId => true]. So when a supervisor or regular member marks "mine", if their member resolves, the second call filters properly to [mineId=>true]. When not a member of the company (e.g., platform user without company member), mineId=0 → the first payload (already with member scope perhaps null for ROLE_MANAGER etc.) is returned unfiltered. This is fail-open. For a ROLE_SUPER_ADMIN/ROLE_MANAGER without a company member, mine=1 returns everything. That contradicts "minhas ações". Good comment.
Issue 2 (refusal regression): The filter options `origin` and `overview_origins` removed 'refusal'/Direito de Recusa. But resolveOriginKey still returns 'refusal'. presentSeededOriginChart no longer seeds refusal but preserves extra keys with count>0, so the Visão Geral chart still shows "Direito de Recusa" if actions exist (since extra seeds are preserved). Wait but that behavior: `$seed['refusal'] = ...` if count>0 in originCount — so refusal still appears in chart. So chart regression isn't an issue for existing refusal data. However the new pendencias filter select cannot filter by refusal; also with the new origin filter on Pendências: any refusal actions would appear under "Todas" but can't be selected alone. Minor UX. But actually is refusal a relevant origin for the panel? The original `overview_origins` had 'refusal' as option; this PR changed to 'acidente pessoal/material', near_miss, removed 'refusal'. Also changed 'accident' to accident_personal etc. The chart seed previously had refusal. Given the PR intent is to split accident by type, dropping refusal from the seed means chart ordering changes but refusal still present if data. Hmm — in the new seed they also removed 'refusal' so when there are zero refusal actions it doesn't matter; when there are some, they still appear appended at end. But for the filter options, you cannot select Direito de Recusa. But is 'refusal' a type of origin the pendências filter should support? Data model has origem enum including? Let's check ActionOrigemEnum. If origem can be "Direito de Recusa" / "recusa" for actions, then those actions are invisible to the filter. Is that a regression of an existing select? The origin select is new in this PR (in _tab_painel). `overview_origins` previously existed (from #701) with 'refusal'. The change removes refusal option from overview filter too. So it's a real removal of an existing filter option from Visão Geral. But Visão Geral's filter by origin — does template use overview_origins? The earlier review summary says need to check whether Visão Geral consumes overview_origins. Let me check _tab_painel_visao_geral.html.twig. Actually not critical; the medium severity comment stands about refusal no longer selectable though resolveOriginKey still emits 'refusal' for origem "Direito de Recusa". Also note the pendencias origin select options don't include 'refusal' or 'other' or 'occurrence'. But 'other'/'occurrence' were also never in options before. Refusal specifically existed as an option in overview_origins and was removed. So comment worth medium/low.
Wait — actually before this PR, `overview_origins` list (from base) was: '' Origem, accident, inspection, approach, ros, refusal. Wait the old list per diff (removed lines): '' 'Origem', 'accident' 'Acidente', 'near_miss'? Let me look again:
Old:
```
'overview_origins' => [
['value' => '', 'text' => 'Origem'],
['value' => 'accident', 'text' => 'Acidente'],
['value' => 'inspection', 'text' => 'Inspeção'],
['value' => 'approach', 'text' => 'Abordagem'],
['value' => 'ros', 'text' => 'ROS'],
['value' => 'refusal', 'text' => 'Direito de Recusa'],
],
```
New:
```
'overview_origins' => [
['value' => '', 'text' => 'Todas'],
['value' => 'accident_personal', 'text' => 'Acidente pessoal'],
['value' => 'accident_material', 'text' => 'Acidente material'],
['value' => 'near_miss', 'text' => 'Quase acidente'],
['value' => 'ros', 'text' => 'ROS'],
['value' => 'inspection', 'text' => 'Inspeção'],
['value' => 'approach', 'text' => 'Abordagem'],
],
```
So yes, removed 'refusal' and renamed 'accident'. 'accident' → new keys. Any stored action rows using old origin key 'accident' — resolveOriginKey maps origem text → now accident_personal etc. Actually resolveOriginKey returns keys used by filter comparison, and the options list uses the same keys. Old key 'accident' remains mapped for icons/labels. Data with origem = 'Acidente' maps to accident_personal now.
The `resolveOriginKey` returns 'accident' only in... let's check: event ACIDENTE → accident_personal; string match acidente → accident_personal; ocorr → accident_personal. So 'accident' is no longer returned except never (only kept for legacy labels/icons). Good. And 'refusal' still returned for origem containing 'recusa'/'refusal'. So filtering options removed refusal but data can still be refusal-type. And the pendencias filter uses `resolveOriginKey($action['origem'], event_type) === $originFilter` for each row — since origin filter option list doesn't include refusal, user can't filter those; but they'll show in "Todas". It's a UX gap: the filter can't find refusal rows. Since PR explicitly reworked the origem taxonomy from "Acidente/refusal" to personal/material/near-miss, maybe refusal was intentionally dropped? The background says "filtra as pendências pelo tipo de ocorrência de origem da ação (acidente, quase acidente, observação etc.)". It doesn't mention recusa. Hmm. But the removal of refusal from overview_origins in the Visão Geral (which previously had it) is a behavior change. I'll include this as medium with wording: "ações de origem 'Direito de Recusa' (recusa/refusal) ainda são classificadas por resolveOriginKey mas não podem mais ser selecionadas no filtro novo de Origem nem no seletor da Visão Geral (que antes tinha a opção) — usuários que precisam filtrar recusas perdem a capacidade; e o gráfico passa a não ter mais posição fixa...". Actually chart still displays them. Keep medium/low.
Let me reconsider the severity: probably low-medium. I'll use medium given data visibility regression for existing data.
Issue 3: `buildFilterPayload` executed twice for mine (line 503 and 527). Performance: buildFilterPayload likely queries DB? Let's check whether buildFilterPayload runs queries. If it just builds the payload used by buildPendenciasData, probably queries run inside presentFilterResponse via panel service? Actually the name suggests builds payload; queries happen inside. The first call at 503 is fully wasted when mine resolves. Given the function `buildFilterPayload` executes DB queries (fetch actions), it is double the cost for the "mine" use. Worth low severity note. Let me verify buildFilterPayload signature — is the member filter param name; check the service method.
Let me read service buildFilterPayload definition to verify the parameter semantics (that [$mineId=>true] restricts to responsible or validator). The previous summary says filterByMemberScope covers both responsible_ids and validator_member_id, so `mine` returns both executor and validator actions. Good — no bug there.
Now, the question of whether to pass [$mineId=>true] or maybe the whole scope replaced. Confirm the param is memberScope. Read service around buildFilterPayload and member scope handling.
Issue 4: offcanvas missing - confirmed.
Issue 5: tests missing. Search tests for action plan.
Let me also verify the mine handling in the JS syncPendenciasFilterState: sets panelState.mine from #ap_painel_filter_mine checkbox. And buildFilterParams adds mine regardless of view. So in visao_geral requests, mine is also sent. Is that an issue? The pendencias uses mine filter for the table; the visao_geral could also be filtered by mine via backend (buildFilterPayload applies member scope to all views? The mine member scope filter is applied in service before view branching — filterByMemberScope likely in buildPendenciasData? Actually memberScope is passed to buildFilterPayload which presumably calls buildPendenciasData and overview with member filter). If mine is applied to overview, the charts would show only user's actions. Might be intended for "minhas ações" to also scope overview charts. Given unclear, keep low severity note or drop. Actually if a user marks "Minhas ações" in the pendências filters then switches to Visão Geral, mine persists (panelState.mine) and charts get filtered — maybe desired. I'd drop this to avoid noise, or fold into a note. Actually the more relevant issue: the checkbox lives in the pendências filter header only (visible only for pendencias view). If user checks and then switches to visao_geral, the header filter switches and checkbox may be hidden but state persists → Visão Geral charts filtered by mine without any visible indicator. That's a mild UX inconsistency. Severity low. But given review guidance to focus on real issues and avoid too many comments, maybe skip.
Now issue 1 permissions divergence — let me verify whether Gestor de Equipe can pass canManageSsmaOccurrences. canManageSsmaOccurrences: checks roles ROLE_SUPER_ADMIN/ROLE_MANAGER/ROLE_MANAGER_GESTOR/ROLE_TENANT → true. For tag-based users: memberIsSsmaGestorAdministrador(member) → true for 'Gestor Administrador'. Then tag = ssmaCurrentMemberPermissionTag(); can_create/edit/delete → true. Also request attributes can_create/can_edit/can_delete.
Where do request attributes get set? Possibly in a route config attribute mapping like `can_create: true`? Actually attributes set on the request for the route maybe from a URL like `_can_create`. Since the UI forces $ssmaCanMutateActionPlan true for Gestor de Equipe/Área regardless of canManageSsmaOccurrences, but backend uses canMutateSsmaActionPlan for create/edit/resolve endpoints (createAction at 7977, canCurrentUserEditSsmaAction at 16138-16141, canCurrentUserResolveSsmaAction at 16269-16272). For those endpoints, request attributes could be present (e.g., the route might be tagged can_create). If the action create route has can_create request attribute, canManageSsmaOccurrences returns true for anyone with a permission tag, hmm no — canManageSsmaOccurrences returns true if request attribute can_create is set regardless of tag, meaning basically anyone would pass on that endpoint?! Wait: line 11370-11377: if request && (can_create or can_edit or can_delete attributes) → return true. This is a wide bypass... but presumably these attributes are set only for authorized requests, set by middleware after permission check, OR set on routes for managers. It is not in scope.
Given the context, the precise divergence:
- UI flag override (12777-12780): For tag Gestor de Equipe/Área force true.
- Backend canMutateSsmaActionPlan: blocks viewers and supervisors by tag name; else delegates to canManageSsmaOccurrences. A Gestor de Equipe/Área whose tag has can_create on ssma-occurrences → passes (since request attr can_create maybe set, or tag canCreate true). If not, fails.
Since we can't confirm Gestor de Equipe tag config, and the two sources of truth now exist, the reviewer earlier flagged this as high. Given the diff comment says "Gestor de Equipe/Área continua podendo mutar", but canMutateSsmaActionPlan does not explicitly allow Gestor de Equipe/Área (only implicitly through canManageSsmaOccurrences), there's potential mismatch: If Gestor de Equipe doesn't have can_create in ssma-occurrences tag but is recognized as Gestor de Equipe by name, backend denies. The UI override still shows buttons. Risk of 403 after clicking — a bug users will face depending on tag configuration. This is exactly the type of divergence to flag with medium/high severity. I'll comment high? Let's keep [high] but focus: "as duas fontes divergem".
Actually, wait: does the UI override matter for create/edit buttons on the Painel? The flags ssmaCanCreateLinkedActions is used in Ocorrências tab & occurrence_view for "Criar ação" button; ssmaCanMutateActionPlan used in the action_plan overflow menu (edit/resolve). The overflow menu's can_edit_action/can_resolve_action = ssmaCanMutateActionPlan || action_item.can_edit. Backend createAction uses canMutateSsmaActionPlan; canCurrentUserEditSsmaAction uses canMutateSsmaActionPlan; resolve uses canMutateSsmaActionPlan.
If Gestor de Equipe's tag has can_create (ssma-occurrences product) then canManageSsmaOccurrences is true → canMutate true → fine, the UI override redundant but consistent. If it doesn't, then the menu shows but 403. Uncertain but maintainability/duplication is a genuine concern. I'll frame the comment around duplication + potential divergence and recommend centralizing.
Now also note canMutateSsmaActionPlan was used in buildActionPlanViewData? Actually the diff at 12612-12613 sets UI flags from canMutateSsmaActionPlan then overrides at 12777-12780 for Gestor de Equipe/Área.
Now: is there a test coverage? Search tests.
Let me also verify the ActionOrigemEnum values to see if 'refusal'/'Direito de Recusa' is a legit origem. And SsmaEvent type constants TYPE_ROS, TYPE_QUASE_ACIDENTE.
Let me also check where 'mine' and 'origin' params interplay: for pendencias, resolveActionPlanPanelMemberScope is already applied on line 512 for member scope default. For members, the default scope is their own actions. If they click "Minhas ações", same. For supervisors with team scope? Hmm. For supervisors, what's resolveActionPlanPanelMemberScope? Could be restricted by team; mine then overrides to member. Fine.
Let me read buildFilterPayload signature and filterByMemberScope quickly plus ActionOrigemEnum.
Let me also search tests directory.
Tool Calls (3)
code_search
Show Details
Arguments
{"file_patterns": ["src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php"], "search_text": "function buildFilterPayload|function filterByMemberScope|memberScope", "use_perl_regexp": true}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php
Match lines: 11
32| * @param array<int, true>|null $memberScopeIds null = sem restrição por membro
36| public function buildFilterPayload(
45| ?array $memberScopeIds,
58| if ($memberScopeIds !== null) {
59| $allActions = $this->filterByMemberScope($allActions, $memberScopeIds);
363| * @param array<int, true> $memberScopeIds
367| private function filterByMemberScope(array $actions, array $memberScopeIds): array
369| if ($memberScopeIds === []) {
373| return array_values(array_filter($actions, function (array $action) use ($memberScopeIds): bool {
375| if ($validatorId > 0 && isset($memberScopeIds[$validatorId])) {
379| if (isset($memberScopeIds[(int) $id])) {
file_find
Show Details
Arguments
{"query_name": "ActionPlan"}
Result
src/Controller/DecisionSystem/RiskIntelligence/SignalActionPlanController.php src/Controller/DecisionSystem/RiskIntelligence/SignalActionPlanRequestParser.php src/Controller/GoalActionPlanItemController.php src/Entity/GoalActionPlanItem.php src/Repository/GoalActionPlanItemRepository.php src/Service/Effectiveness/Alert/NeuralAlertActionPlanReader.php src/Service/PeopleAnalytics/BehavioralIndicatorActionPlanApplicationService.php src/Service/PeopleAnalytics/Exception/BehavioralIndicatorActionPlanException.php src/Service/PeopleAnalytics/Exception/NeuralAlertActionPlanException.php src/Service/PeopleAnalytics/NeuralAlertActionPlanApplicationService.php src/Service/Ssma/ActionPlan/SsmaActionPlanPanelPresenter.php src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php src/Service/Ssma/SsmaActionPlanExecutiveReportBuilder.php src/Service/Ssma/SsmaActionPlanLlmService.php src/Service/Ssma/SsmaActionPlanMutatePermissionService.php src/Service/Ssma/SsmaActionPlanPreviewService.php src/Service/Ssma/SsmaActionPlanSubmitService.php tests/Controller/DecisionSystem/RiskIntelligence/SignalActionPlanControllerTest.php tests/Service/PeopleAnalytics/BehavioralIndicatorActionPlanApplicationServiceTest.php tests/Service/PeopleAnalytics/NeuralAlertActionPlanApplicationServiceTest.php tests/Unit/Product/Alert/NeuralAlertActionPlanReaderTest.php tests/Unit/Product/Ssma/SsmaActionPlanMutatePermissionServiceTest.php
file_find
Show Details
Arguments
{"query_name": "ActionOrigemEnum"}
Result
src/Enum/Ssma/ActionOrigemEnum.php tests/Unit/Product/Ssma/ActionOrigemEnumTest.php
Request #36
deepseek-v4-flash
P:59.94K C:341 CR:59.26K CW:0
2698ms
Reasoning
Let me read the service's filterByMemberScope region (355-390) and filterByMemberScope semantics, plus buildFilterPayload. Also examine ActionOrigemEnum. Also look at SsmaActionPlanMutatePermissionService (the mutate permission service may already centralize permission logic - a single source of truth exists!). Let me read that service to see if canMutateSsmaActionPlan should delegate there.
Tool Calls (3)
file_read
Show Details
Arguments
{"end_line": 100, "file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 28}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648)
IS_TRUNCATED: false
LINE_RANGE: 28-100
28|
29| /**
30| * @param list<Company> $scopeCompanies
31| * @param array<string, mixed> $actionTypeMeta
32| * @param array<int, true>|null $memberScopeIds null = sem restrição por membro
33| *
34| * @return array<string, mixed>
35| */
36| public function buildFilterPayload(
37| array $scopeCompanies,
38| Company $dataCompany,
39| string $view,
40| string $period,
41| string $axis,
42| string $team,
43| string $vinculo,
44| array $actionTypeMeta,
45| ?array $memberScopeIds,
46| int $page = 1,
47| int $perPage = 10,
48| string $management = '',
49| string $area = '',
50| string $execResponsible = '',
51| string $valResponsible = '',
52| string $originFilter = '',
53| ): array {
54| $today = new \DateTimeImmutable('today');
55| $meta = $this->loadPanelMeta($dataCompany);
56| $allActions = $this->loadActionsForCompanies($scopeCompanies);
57|
58| if ($memberScopeIds !== null) {
59| $allActions = $this->filterByMemberScope($allActions, $memberScopeIds);
60| }
61|
62| $allActions = $this->filterByTeamAndVinculo($allActions, $team, $vinculo, $meta);
63|
64| if ($view === 'comparativo') {
65| return [
66| 'view' => 'comparativo',
67| 'panel_data' => $this->buildComparativoData($scopeCompanies, $allActions, $period, $today),
68| 'filters' => $this->buildFilterOptions($dataCompany),
69| 'available_axes' => [],
70| 'active_axis' => '',
71| ];
72| }
73|
74| if ($view === 'visao_geral') {
75| [$fromStr, $toStr] = $this->resolveOverviewPeriodBounds($period, $today);
76| $filtered = $this->filterByCreatedAtRange($allActions, $fromStr, $toStr);
77| $filtered = $this->applyOverviewDimensionFilters(
78| $filtered,
79| $management,
80| $area,
81| $execResponsible,
82| $valResponsible,
83| $originFilter,
84| $meta
85| );
86|
87| [$prevFrom, $prevTo] = $fromStr !== null
88| ? $this->comparisonPeriodResolver->resolveYmd($fromStr, $toStr, fn (): int => count($filtered))
89| : [null, null];
90| $prevFiltered = ($prevFrom !== null && $prevTo !== null)
91| ? $this->filterByCreatedAtRange($allActions, $prevFrom, $prevTo)
92| : [];
93|
94| $availableAxes = $this->resolveAvailableAxes($view, $period);
95| if (!in_array($axis, $availableAxes, true)) {
96| $axis = $availableAxes[0];
97| }
98|
99| return [
100| 'view' => 'visao_geral',
file_read
Show Details
Arguments
{"end_line": 395, "file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 355}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648)
IS_TRUNCATED: false
LINE_RANGE: 355-395
355| return PersonTypeEnum::PRESTADOR;
356| }
357|
358| return PersonTypeEnum::COLABORADOR;
359| }
360|
361| /**
362| * @param list<array<string, mixed>> $actions
363| * @param array<int, true> $memberScopeIds
364| *
365| * @return list<array<string, mixed>>
366| */
367| private function filterByMemberScope(array $actions, array $memberScopeIds): array
368| {
369| if ($memberScopeIds === []) {
370| return [];
371| }
372|
373| return array_values(array_filter($actions, function (array $action) use ($memberScopeIds): bool {
374| $validatorId = (int) ($action['validator_member_id'] ?? 0);
375| if ($validatorId > 0 && isset($memberScopeIds[$validatorId])) {
376| return true;
377| }
378| foreach ((array) ($action['responsible_ids'] ?? []) as $id) {
379| if (isset($memberScopeIds[(int) $id])) {
380| return true;
381| }
382| }
383|
384| return false;
385| }));
386| }
387|
388| /**
389| * @param list<array<string, mixed>> $actions
390| * @param array{teams: list<array<string, mixed>>, member_vinculo: array<int, string>} $meta
391| *
392| * @return list<array<string, mixed>>
393| */
394| private function filterByTeamAndVinculo(array $actions, string $team, string $vinculo, array $meta): array
395| {
file_read
Show Details
Arguments
{"end_line": 120, "file_path": "src/Service/Ssma/SsmaActionPlanMutatePermissionService.php", "start_line": 1}
Result
File: src/Service/Ssma/SsmaActionPlanMutatePermissionService.php (Total lines: 111)
IS_TRUNCATED: false
LINE_RANGE: 1-111
1|<?php
2|
3|declare(strict_types=1);
4|
5|namespace App\Service\Ssma;
6|
7|use App\Entity\Company;
8|use App\Entity\CompanyMembers;
9|use App\Entity\SsmaAction;
10|use App\Entity\User;
11|use Doctrine\ORM\EntityManagerInterface;
12|use Symfony\Component\HttpFoundation\Request;
13|
14|/**
15| * Libera rotas de resolver/validar ação no gate global quando o membro
16| * é executor ou validador designado, mesmo com tag SSMA só leitura.
17| * A validação fina permanece em {@see SsmaStakeholderActionPermissionService} e no controller.
18| */
19|final class SsmaActionPlanMutatePermissionService
20|{
21| /** @var list<string> */
22| private const MUTATION_ROUTES = [
23| 'admin_ssma_action_resolve',
24| 'admin_ssma_action_validate',
25| ];
26|
27| public function __construct(
28| private EntityManagerInterface $entityManager,
29| private SsmaStakeholderActionPermissionService $stakeholderActionPermissionService,
30| ) {}
31|
32| public function isMutationRoute(string $route): bool
33| {
34| return in_array($route, self::MUTATION_ROUTES, true);
35| }
36|
37| public function canMutateForRoute(
38| User $user,
39| Company $company,
40| CompanyMembers $member,
41| string $route,
42| ?Request $request = null,
43| ): bool {
44| if (!$this->isMutationRoute($route)) {
45| return false;
46| }
47|
48| $action = $this->resolveActionForRoute($company, $request);
49| if ($action === null) {
50| return false;
51| }
52|
53| if ($route === 'admin_ssma_action_validate') {
54| return $this->stakeholderActionPermissionService->canValidateAsDesignatedValidator($action, $member);
55| }
56|
57| if ($route === 'admin_ssma_action_resolve') {
58| if (in_array($this->resolveOperation($request), ['evaluate', 'reopen'], true)) {
59| return false;
60| }
61|
62| return $this->stakeholderActionPermissionService->canResolveAsResponsible($action, $member);
63| }
64|
65| return false;
66| }
67|
68| private function resolveActionForRoute(Company $company, ?Request $request): ?SsmaAction
69| {
70| if ($request === null) {
71| return null;
72| }
73|
74| $id = $request->attributes->get('id');
75| if (!is_numeric($id)) {
76| return null;
77| }
78|
79| $action = $this->entityManager->find(SsmaAction::class, (int) $id);
80| if (!$action || (int) $action->getCompany()->getId() !== (int) $company->getId()) {
81| return null;
82| }
83|
84| return $action;
85| }
86|
87| private function resolveOperation(?Request $request): string
88| {
89| if ($request === null) {
90| return 'resolve';
91| }
92|
93| $content = $request->getContent();
94| if (!is_string($content) || $content === '') {
95| return 'resolve';
96| }
97|
98| try {
99| $data = json_decode($content, true, 512, JSON_THROW_ON_ERROR);
100| } catch (\JsonException) {
101| return 'resolve';
102| }
103|
104| if (!is_array($data)) {
105| return 'resolve';
106| }
107|
108| return (string) ($data['operation'] ?? 'resolve');
109| }
110|}
111|
Request #37
deepseek-v4-flash
P:62.58K C:857 CR:60.16K CW:0
7118ms
Reasoning
Good context. `buildFilterPayload` loads all actions (`loadActionsForCompanies`) and then filters in memory; it's expensive (loads actions) but the double call only when `mine` valid. Confirm this is a DB query per call → double cost. Yes, `loadActionsForCompanies` executes DB queries each time.
So the mine branch could avoid the second DB load by refactoring buildFilterPayload to accept memberScope, but the first call already needed for default. Actually better approach: compute memberScope first then single call. This double-execution is a real performance waste: each request with `mine` loads actions twice. Medium-low. I'll mention as part of the mine comment (issue #2). Also note: mine should apply only after resolving member to avoid fail-open.
Now, regarding permissions duplication, there is an existing `SsmaActionPlanMutatePermissionService` that centralizes mutation route logic for stakeholders but only covers resolve/validate routes. The new `canMutateSsmaActionPlan()` is a new controller private method. Fine.
Also should I check where `ssmaCanMutateActionPlan` is consumed in templates (overflow menu). In the diff for `_action_plan_overflow_menu.html.twig`: can_edit_action = ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false)) or action_item.can_edit. So the menu uses ssmaCanMutateActionPlan. This menu is used where? Search. It's probably used in the Ações tab table row, where each row has an overflow. When a Gestor de Equipe is forced to true for flag, the menu shows Edit/Resolve/Delete, while backend endpoints use canMutateSsmaActionPlan → if that returns false (tag without can_create), the user gets 403. This is the divergence. I'm confident enough.
Now, more importantly, let me double-check that create/action endpoints are guarded with canMutateSsmaActionPlan:
- createAction line ~7977-7980: `if ($mode !== 'edit' && !$this->canMutateSsmaActionPlan()) { return 403; }` — wait, only when mode !== 'edit'? Actually diff shows the create method has `$mode` param. In edit mode probably edit permission check happens later via canCurrentUserEditSsmaAction. Read region 7950-8060.
- canCurrentUserEditSsmaAction → canMutateSsmaActionPlan (16138-16141)
- canCurrentUserResolveSsmaAction → canMutateSsmaActionPlan (16269-16272)
But the SsmaActionPlanMutatePermissionService allows stakeholders (executor/validator) to resolve/validate even with read-only tags — through the global route gate (isMutationRoute). But now canCurrentUserResolveSsmaAction uses canMutateSsmaActionPlan which returns false for supervisor tags and viewer... Wait but resolve for a responsible executor who is a supervisor? Previously canManageSsmaOccurrences? Let me read canCurrentUserResolveSsmaAction fully. It may OR with stakeholder permission. Let me read 16240-16320.
Let me read those regions: 7950-8000 (createAction guard) and 16120-16300.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 8070, "file_path": "src/Controller/SsmaController.php", "start_line": 7940}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 7940-8070
7940| }
7941|
7942| // ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
7943| // Action CRUD
7944| // ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
7945|
7946| /**
7947| * Retorna somente o HTML do modal "Criar ação" para ser carregado via AJAX
7948| * em páginas externas ao módulo SSMA (ex.: Projetos).
7949| */
7950| public function actionModalPartial(): Response
7951| {
7952| $viewData = $this->buildSsmaViewData();
7953| return new Response($this->renderView('ssma/partials/_modal_action.html.twig', [
7954| 'occurrences' => $viewData['occurrences'] ?? [],
7955| 'allMembers' => $viewData['allMembers'] ?? [],
7956| 'action_type_config' => $viewData['action_type_config'] ?? ['types' => []],
7957| ]));
7958| }
7959|
7960| // ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
7961|
7962| public function createAction(Request $request): JsonResponse
7963| {
7964| /** @var User|null $user */
7965| $user = $this->getUser();
7966| if (!$user) {
7967| return new JsonResponse(['success' => false, 'message' => 'Não autenticado.'], 401);
7968| }
7969|
7970| $company = $this->getSsmaCompany();
7971| if (!$company) {
7972| return new JsonResponse(['success' => false, 'message' => 'Empresa não encontrada.'], 400);
7973| }
7974|
7975| $data = json_decode($request->getContent(), true) ?? [];
7976| $mode = $data['mode'] ?? 'create';
7977| $title = trim((string) ($data['title'] ?? ''));
7978| $existingProject = null;
7979|
7980| // Criar: gestor/admin. Supervisor só visualiza — Brenda áudio 6.
7981| if ($mode !== 'edit' && !$this->canMutateSsmaActionPlan()) {
7982| return new JsonResponse(['success' => false, 'message' => 'Sem permissão para criar ação SSMA.'], 403);
7983| }
7984|
7985| $teamScopeError = $this->validateSsmaActionPayloadAgainstTeamScope($data, $company, $user);
7986| if ($teamScopeError !== null) {
7987| return new JsonResponse(['success' => false, 'message' => $teamScopeError], 422);
7988| }
7989|
7990| if ($title === '') {
7991| $title = 'Sem titulo';
7992| }
7993|
7994| if ($mode !== 'edit' && !empty($data['create_project_with_plan'])
7995| && empty($data['occurrence_id']) && empty($data['event_id'])
7996| && (string) ($data['related_event_type'] ?? '') !== ActionOrigemEnum::OUTRO) {
7997| return new JsonResponse(['success' => false, 'message' => 'Evento relacionado obrigatório ao criar novo plano.'], 422);
7998| }
7999|
8000| if ($mode !== 'edit' && !empty($data['existing_project_id'])) {
8001| $existingProject = $this->entityManager->find(Project::class, (int) $data['existing_project_id']);
8002| if (!$existingProject || $existingProject->getCompany()->getId() !== $company->getId()) {
8003| return new JsonResponse(['success' => false, 'message' => 'Plano existente não encontrado.'], 404);
8004| }
8005|
8006| // Regra: no plano existente, usar ocorrência raiz como padrão quando não informada.
8007| if (empty($data['occurrence_id'])) {
8008| $rootOccurrence = $this->findProjectRootOccurrence((int) $existingProject->getId(), $company);
8009| if (!empty($rootOccurrence['id'])) {
8010| $data['occurrence_id'] = (int) $rootOccurrence['id'];
8011| }
8012| }
8013| }
8014|
8015| $this->ensureSsmaActionSchema();
8016|
8017| try {
8018| $previousResponsibleIds = [];
8019| if ($mode === 'edit' && !empty($data['id'])) {
8020| $action = $this->entityManager->find(SsmaAction::class, (int) $data['id']);
8021| if (!$action || $action->getCompany()->getId() !== $company->getId()) {
8022| return new JsonResponse(['success' => false, 'message' => 'Ação não encontrada.'], 404);
8023| }
8024| if (!$this->canCurrentUserEditSsmaAction($action, $company, $user)) {
8025| return new JsonResponse(['success' => false, 'message' => 'Sem permissão para editar ações.'], 403);
8026| }
8027| $previousResponsibleIds = array_map('intval', $action->getResponsibleIds() ?? []);
8028| $message = 'Ação atualizada com sucesso.';
8029| } else {
8030| $action = new SsmaAction();
8031| $action->setCompany($company);
8032| $message = 'Ação criada com sucesso.';
8033| }
8034|
8035| $action->setTitle($title);
8036| $action->setDescription($data['description'] ?? null);
8037| $canonicalType = $this->canonicalizeSsmaActionType((string) ($data['type'] ?? ''));
8038| $action->setType($canonicalType !== '' ? $canonicalType : null);
8039| $action->setSolved((bool) ($data['solved'] ?? false));
8040| $action->setHasProject((bool) ($data['has_project'] ?? false));
8041| $responsibleIds = array_values(array_unique(array_filter(
8042| array_map('intval', (array) ($data['responsible_ids'] ?? [])),
8043| static fn (int $id): bool => $id > 0
8044| )));
8045| $isProjectOnlyPayload = !empty($data['create_project_with_plan']) || !empty($data['existing_project_id']);
8046| if (!$isProjectOnlyPayload) {
8047| if (count($responsibleIds) !== 1) {
8048| return new JsonResponse([
8049| 'success' => false,
8050| 'message' => 'Informe exatamente um responsável pela execução.',
8051| ], 422);
8052| }
8053| $validatorMemberId = (int) ($data['validator_id'] ?? $data['validator_member_id'] ?? 0);
8054| if ($validatorMemberId <= 0) {
8055| return new JsonResponse([
8056| 'success' => false,
8057| 'message' => 'Informe o responsável pela validação.',
8058| ], 422);
8059| }
8060| if ($validatorMemberId === $responsibleIds[0]) {
8061| return new JsonResponse([
8062| 'success' => false,
8063| 'message' => 'Execução e validação devem ser pessoas diferentes.',
8064| ], 422);
8065| }
8066| } else {
8067| $validatorMemberId = (int) ($data['validator_id'] ?? $data['validator_member_id'] ?? 0);
8068| $responsibleIds = array_slice($responsibleIds, 0, 1);
8069| }
8070| $action->setResponsibleIds($responsibleIds);
file_read
Show Details
Arguments
{"end_line": 16320, "file_path": "src/Controller/SsmaController.php", "start_line": 16125}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 16125-16320
16125| private function isCurrentUserSsmaActionResponsible(SsmaAction $action, Company $company, ?User $user): bool
16126| {
16127| $member = $user ? $this->getCurrentCompanyMember($company, $user) : null;
16128|
16129| return $this->ssmaStakeholderActionPermissionService->canResolveAsResponsible($action, $member);
16130| }
16131|
16132| private function isCurrentUserSsmaActionValidator(SsmaAction $action, Company $company, ?User $user): bool
16133| {
16134| $member = $user ? $this->getCurrentCompanyMember($company, $user) : null;
16135|
16136| return $this->ssmaStakeholderActionPermissionService->canValidateAsDesignatedValidator($action, $member);
16137| }
16138|
16139| private function canCurrentUserEditSsmaAction(SsmaAction $action, Company $company, ?User $user): bool
16140| {
16141| return $this->canMutateSsmaActionPlan();
16142| }
16143|
16144| private function canCurrentUserResolveSsmaAction(
16145| SsmaAction $action,
16146| Company $company,
16147| ?User $user,
16148| string $operation = 'resolve'
16149| ): bool {
16150| return $this->ssmaStakeholderActionPermissionService->canUserResolveAction(
16151| $action,
16152| $company,
16153| $user,
16154| $this->canManageSsmaOccurrences(),
16155| $operation
16156| );
16157| }
16158|
16159| private function canCurrentUserValidateSsmaAction(SsmaAction $action, Company $company, ?User $user): bool
16160| {
16161| return $this->ssmaStakeholderActionPermissionService->canUserValidateAction(
16162| $action,
16163| $company,
16164| $user,
16165| $this->canManageSsmaOccurrences()
16166| );
16167| }
16168|
16169| /**
16170| * @return array<string, mixed>|null
16171| */
16172| private function tryLoadOccurrenceViewRowForActionStakeholder(
16173| int $id,
16174| ?string $kind,
16175| Company $company,
16176| User $user
16177| ): ?array {
16178| $member = $this->getCurrentCompanyMember($company, $user);
16179| $memberId = (int) ($member?->getId() ?? 0);
16180| if ($memberId <= 0) {
16181| return null;
16182| }
16183|
16184| [, $teams] = $this->loadCompanyMembersAndTeamsLite($company);
16185| $teamsById = array_column($teams, null, 'id');
16186|
16187| if ($kind === 'event') {
16188| $event = $this->entityManager->getRepository(SsmaEvent::class)->find($id);
16189| if (!$event instanceof SsmaEvent || $event->getCompany()->getId() !== $company->getId()) {
16190| return null;
16191| }
16192| $row = $this->mapSsmaEventToOccurrenceListRow($event, $teamsById);
16193| if (!$this->isOccurrenceVisibleToMember($row, $memberId, $company)) {
16194| return null;
16195| }
16196|
16197| return $row;
16198| }
16199|
16200| $occurrence = $this->entityManager->getRepository(SsmaOccurrence::class)->find($id);
16201| if (!$occurrence instanceof SsmaOccurrence || $occurrence->getCompany()->getId() !== $company->getId()) {
16202| return null;
16203| }
16204| $row = $this->mapSsmaOccurrenceEntityToListRow($occurrence, $teamsById);
16205| if (!$this->isOccurrenceVisibleToMember($row, $memberId, $company)) {
16206| return null;
16207| }
16208|
16209| return $row;
16210| }
16211|
16212| /**
16213| * Carrega a linha de detalhe se o usuário tem permissão técnica do tipo da ocorrência
16214| * ({@see resolveCurrentUserTechnicalTypes}), sem exigir vínculo como stakeholder/membro.
16215| *
16216| * @return array<string, mixed>|null
16217| */
16218| private function tryLoadOccurrenceViewRowForTechnicalType(
16219| int $id,
16220| ?string $kind,
16221| Company $company,
16222| User $user
16223| ): ?array {
16224| $technicalTypes = $this->resolveCurrentUserTechnicalTypes($company, $user);
16225| if ($technicalTypes === []) {
16226| return null;
16227| }
16228|
16229| $techTypesSet = array_flip($technicalTypes);
16230| [, $teams] = $this->loadCompanyMembersAndTeamsLite($company);
16231| $teamsById = array_column($teams, null, 'id');
16232|
16233| if ($kind === 'event') {
16234| $event = $this->entityManager->getRepository(SsmaEvent::class)->find($id);
16235| if (!$event instanceof SsmaEvent || $event->getCompany()->getId() !== $company->getId()) {
16236| return null;
16237| }
16238| $row = $this->mapSsmaEventToOccurrenceListRow($event, $teamsById);
16239| $type = (string) ($row['type_value'] ?? $event->getType() ?? '');
16240|
16241| return isset($techTypesSet[$type]) ? $row : null;
16242| }
16243|
16244| $occurrence = $this->entityManager->getRepository(SsmaOccurrence::class)->find($id);
16245| if ($occurrence instanceof SsmaOccurrence && $occurrence->getCompany()->getId() === $company->getId()) {
16246| $row = $this->mapSsmaOccurrenceEntityToListRow($occurrence, $teamsById);
16247| $type = (string) ($row['type_value'] ?? $occurrence->getType() ?? '');
16248| if (isset($techTypesSet[$type])) {
16249| return $row;
16250| }
16251| }
16252|
16253| // Links sem kind=event ainda podem apontar para SsmaEvent (ROS / Quase Acidente).
16254| $event = $this->entityManager->getRepository(SsmaEvent::class)->find($id);
16255| if (!$event instanceof SsmaEvent || $event->getCompany()->getId() !== $company->getId()) {
16256| return null;
16257| }
16258| $row = $this->mapSsmaEventToOccurrenceListRow($event, $teamsById);
16259| $type = (string) ($row['type_value'] ?? $event->getType() ?? '');
16260|
16261| return isset($techTypesSet[$type]) ? $row : null;
16262| }
16263|
16264| private function resolveActionDeadlineEditMeta(SsmaAction $action, Company $company, ?User $user): array
16265| {
16266| $isAdmin = $this->canManageSsmaConfig();
16267| $member = $user ? $this->getCurrentCompanyMember($company, $user) : null;
16268| $memberId = $member ? (int) $member->getId() : 0;
16269| $respIds = $action->getResponsibleIds() ?? [];
16270| $isResponsible = $memberId > 0 && in_array($memberId, $respIds, true);
16271| $isValidator = $this->isCurrentUserSsmaActionValidator($action, $company, $user);
16272| $canManage = $this->canMutateSsmaActionPlan();
16273| $pendingValidation = $action->getValidationStatus() === 'pending_validation';
16274| $canEditByPolicy = $action->canEditDeadline($isAdmin);
16275| $canEdit = $canEditByPolicy && ($isAdmin || $isResponsible);
16276|
16277| $deadlineMax = null;
16278| if ($canEdit && !$isAdmin && $action->getDeadline() instanceof \DateTimeInterface) {
16279| $deadlineMax = (clone $action->getDeadline())->modify('+7 days')->format('Y-m-d');
16280| }
16281|
16282| return [
16283| 'can_edit_deadline' => $canEdit,
16284| 'is_accident_occurrence_action' => $action->isAccidentOccurrenceAction(),
16285| 'deadline_edit_count' => $action->getDeadlineEditCount(),
16286| 'deadline_history' => $action->getDeadlineHistory(),
16287| 'is_admin' => $isAdmin,
16288| 'is_responsible' => $isResponsible,
16289| 'is_validator' => $isValidator,
16290| 'can_edit' => $canManage,
16291| 'can_resolve' => $this->canCurrentUserResolveSsmaAction($action, $company, $user),
16292| 'can_validate' => $this->canCurrentUserValidateSsmaAction($action, $company, $user),
16293| 'deadline_max' => $deadlineMax,
16294| ];
16295| }
16296|
16297| private function loadActions(Company $company): array
16298| {
16299| /** @var SsmaAction[] $rows */
16300| $rows = $this->entityManager->getRepository(SsmaAction::class)
16301| ->findBy(['company' => $company], ['createdAt' => 'DESC']);
16302|
16303| /** @var User|null $user */
16304| $user = $this->getUser();
16305|
16306| return $this->mapSsmaActionEntitiesToListArrays($rows, $company, $user instanceof User ? $user : null);
16307| }
16308|
16309| private function buildProjectTaskCounters(array $projectIds): array
16310| {
16311| if ($projectIds === []) {
16312| return [];
16313| }
16314|
16315| $rows = $this->entityManager->getRepository(ProjectTasks::class)
16316| ->createQueryBuilder('pt')
16317| ->select('IDENTITY(pt.project) AS project_id', 'pt.status AS status')
16318| ->where('pt.project IN (:projectIds)')
16319| ->setParameter('projectIds', $projectIds)
16320| ->getQuery()
Request #38
deepseek-v4-flash
P:68.25K C:854 CR:63.36K CW:0
7044ms
Reasoning
Interesting nuance at line 16269-16272 in resolveActionDeadlineEditMeta: `$canManage = $this->canMutateSsmaActionPlan();` and `can_edit` set to canManage. But wait: canCurrentUserResolveSsmaAction still uses `ssmaStakeholderActionPermissionService->canUserResolveAction(... $this->canManageSsmaOccurrences(), $operation)`, NOT canMutateSsmaActionPlan. So resolve still passes canManageSsmaOccurrences, meaning supervisors who are responsible/validator may still resolve via stakeholder service. Good—not fully consistent with "Supervisor só visualiza" though, but that's separate.
Also createAction edit path: `if ($mode !== 'edit' && !canMutateSsmaActionPlan())` → for edit mode, check happens inside canCurrentUserEditSsmaAction → canMutateSsmaActionPlan. So editing by a supervisor is blocked (403), consistent.
Now, the key point about Gestor de Equipe/Área: canMutateSsmaActionPlan → canManageSsmaOccurrences → tag can_create/edit/delete OR request attribute can_create on route OR role. If Gestor de Equipe tag is e.g. `Gestor de Equipe` with can_create in ssma-occurrences, they pass. If the tag only grants edit but not create, createAction denies while UI override shows create button. And canCurrentUserEditSsmaAction passes if tag can_edit... etc.
So divergence potential remains real but dependent on tag config. The more robust statement: two sources of truth for the same policy; the controller method used by endpoints does NOT name Gestor de Equipe/Área tags as allowed (unlike UI override which hard-codes them), so if those tags carry only read permissions on ssma-occurrences, UI shows buttons but endpoints return 403; conversely if tags carry can_* then both are consistent. Recommend centralizing.
Actually wait — I should check whether the request attribute `can_create` etc. is set for the createAction route. Those attributes appear to be per-route capability declarations (like `defaults: { can_create: true }` in route config or generated from a security check). If createAction route sets can_create attribute, then ANY user with any permission tag passes canManageSsmaOccurrences()... hmm but then supervisors would also pass because line 11370-11377 returns true before tag-name check in canMutate? Wait canMutateSsmaActionPlan checks viewer first, supervisor tag-name first, then canManageSsmaOccurrences. So supervisor tags get blocked before the request attribute check. For Gestor de Equipe it goes to canManageSsmaOccurrences. If the createAction route had can_create attr set to true in the request attributes, canManageSsmaOccurrences returns true even without tag permission. Then Gestor de Equipe always passes regardless. But then canManageSsmaOccurrences would return true for any member with a permission tag on that route. Where is can_create attribute set? Let me check route/security: search in config/routes for can_create or in controller for `attributes->set('can_create'`.
Let me search for `'can_create'` set to check.
Tool Calls (3)
code_search
Show Details
Arguments
{"search_text": "set\\('can_create'"}
Result
No matches found
code_search
Show Details
Arguments
{"file_patterns": ["config/"], "search_text": "can_create"}
Result
No matches found
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "can_create"}
Result
File: src/Controller/SsmaController.php
Match lines: 15
1422| * Alterações na Árvore respeitam can_create / can_edit / can_delete do produto ssma-cause-tree
1467| (bool) $request->attributes->get('can_create', false)
3343| // (ex.: can_create de plataforma) tiver removido a linha do hub.
10116| // Cobre tags como "Supervisor" ou qualquer tag com can_view=1 e can_create/edit/delete=0,
10147| && !(bool) $request->attributes->get('can_create', false)
11372| (bool) $request->attributes->get('can_create', false)
11487| * Não usar {@see canAccessSsmaSupervisorSurface()} aqui: ele inclui Membro com can_create na tag
11548| * Colaborador com can_create na tag (só inspeção/abordagem) fica de fora.
11566| // Gestor Administrador: edita tabela Metas com can_view (não exige can_create em prevenção).
11990| * Não usa canManageSsmaOccurrences()/ROLE_MANAGER — can_create de Membro não libera 2ª etapa.
12528| // Não exige !$canManageEarly: can_create de Membro / ROLE_* de plataforma
12615| // NÃO incluir isSsmaViewer() aqui. Usa produto ssma-cause-tree (não can_create de ssma-occurrences).
12672| // mesmo com can_create na tag. Só roles de gestão na empresa ou tag Gestor de Equipe / G. Administrador com manage.
12782| // Tabela de metas por pessoa (aba Metas): edição global só para gestão; membro com can_create não gere metas alheias.
12909| // Importante: NÃO exigir !$ssmaCanManageOccurrences. can_create na tag Membro / ROLE de
Request #39
deepseek-v4-flash
P:69.59K C:1.23K CR:68.99K CW:0
10522ms
Reasoning
The request attribute can_create likely comes from a security voter/listener mapping that sets attributes per route; it may not be in source under that string (could be from template or kernel listener) or simply no routes use it and attribute defaults to false. Let me check `_modal_action` usage: how does createAction route get access? The guard for non-edit is canMutateSsmaActionPlan. Gestor de Equipe passes if canManageSsmaOccurrences → depends on tag canCreate or roles. Since Gestor de Equipe is likely ROLE_USER + tag 'Gestor de Equipe' with can_create (as the comment at 12750 states "ssmaCanManageOccurrences = true via tag"), then canMutate passes. So the duplication may be benign in default config but remains fragile.
Given ambiguity, I'll downgrade this finding a bit but still flag duplication with potential divergence, severity medium. Actually previous review summaries flagged high. However, we must be accurate. Let me examine one more source: line 1467 context around SsmaAreaLimitationScope usage and the "request attribute can_create" origin. It says `$request->attributes->get('can_create', false)` used at several places including isSsmaAreaRestricted? Not important.
Decision: The cleanest defensible issue: policy duplication between controller method `canMutateSsmaActionPlan()` (used by backend endpoints) and Twig flag overrides (lines 12777-12780). In case tags for Gestor de Equipe/Área lack can_create/can_edit/can_delete on ssma-occurrences (which the code comment at 12672 suggests "Só roles de gestão na empresa ou tag Gestor de Equipe / G. Administrador com manage"), a Gestor de Equipe would see action buttons but get 403. Conversely, resolveActionDeadlineEditMeta's `can_edit` uses canMutate, but menu can_edit in _tab_action_plan.html.twig (line 1645) uses `ssmaCanManageOccurrences` — wait that's in `_tab_action_plan.html.twig` JS (existing), which is outside diff but uses ssmaCanManageOccurrences for edit button. Actually the diff only modifies `_action_plan_overflow_menu.html.twig` (server-rendered menu used where?). `_tab_action_plan` builds the overflow menu in JS at 1643-1683 with its own logic using ssmaCanManageOccurrences. Hmm... That's interesting: _tab_action_plan JS `buildSsmaActionPlanOverflowMenuHtml` at 1645: canEdit = ssmaCanManageOccurrences || action.can_edit. This wasn't updated to ssmaCanMutateActionPlan. Is that JS variable `ssmaCanManageOccurrences` a JS global from template? If supervisor is still able to edit action via the Ações tab overflow menu (backend now 403) - this is exactly the front/back divergence again! But is `_tab_action_plan.html.twig` within scope of review files? No. But the cross-file comment could still reference that file. The rules: comments must address code within review_files; cross-file observations are encouraged if pointing at code in review_files. The changed file `_action_plan_overflow_menu.html.twig` handles the server-rendered menu. The `_tab_action_plan.html.twig` JS menu is outside review group but is a consumer of the permission change. Since canCurrentUserEditSsmaAction now returns false for supervisor, but `_tab_action_plan` JS shows edit if ssmaCanManageOccurrences (which is true for supervisor? canManageSsmaOccurrences for supervisor with tag can_create? Actually supervisor tag "Supervisor" - canManageSsmaOccurrences returns true if tag canCreate... hmm supervisors might have can_create on some products but viewer... This is complex.
Given scope and need for precision, the strongest and simplest to justify comments:
1. [Alta/média] Divergência de permissão UI/backend: `_action_plan_overflow_menu.html.twig` changed to use `ssmaCanMutateActionPlan`, but the JS menu in `_tab_action_plan.html.twig` (not updated in this PR) still uses `ssmaCanManageOccurrences || action.can_edit` for can_edit and `ssmaCanManageOccurrences` for resolve. That means supervisors who were previously allowed to create (viewer) but now blocked on the server still see "Editar"/"Resolver" in the Ações tab menu and receive 403. Actually wait — is the overflow menu used in the Ações tab? The `_action_plan_overflow_menu.html.twig` is probably used in the pendências table on desktop and `_tab_action_plan` uses JS-built menu. Hard to tell which template uses the partial. Let's search where _action_plan_overflow_menu is included.
Let me search templates for `_action_plan_overflow_menu` include and `ssmaCanMutateActionPlan` usage in templates.
Tool Calls (2)
code_search
Show Details
Arguments
{"file_patterns": ["templates/"], "search_text": "_action_plan_overflow_menu"}
Result
File: templates/ssma/action_plan/partials/_action_plan_table.html.twig
Match lines: 2
145| {% include 'ssma/action_plan/partials/_action_plan_overflow_menu.html.twig' with {
333| {% include 'ssma/action_plan/partials/_action_plan_overflow_menu.html.twig' with {
code_search
Show Details
Arguments
{"file_patterns": ["templates/"], "search_text": "ssmaCanMutateActionPlan|ssmaCanCreateLinkedActions"}
Result
No matches found
Request #40
deepseek-v4-flash
P:70.93K C:398 CR:70.78K CW:0
3408ms
Reasoning
Interesting: The `ssmaCanMutateActionPlan` variable isn't found in templates (search found no match). But the diff changed `_action_plan_overflow_menu.html.twig` to use `ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false))`. Wait, the search returned "No matches found" for `ssmaCanMutateActionPlan|ssmaCanCreateLinkedActions` in templates/! That's surprising. Perhaps because the regex alternation interpreted differently, or the template uses it via a context variable name that's passed as `_ssma`? Actually controller passes 'ssmaCanMutateActionPlan' => ... at line ~13268 to Twig global in buildSsmaViewData. Then the template `_action_plan_overflow_menu.html.twig` references `ssmaCanMutateActionPlan`. So the search should have matched the file itself. Let me search each pattern separately.
Wait — maybe file read of _action_plan_overflow_menu in diff is accurate: `{% set can_edit_action = ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false)) or action_item.can_edit|default(false) %}`. Search "ssmaCanMutateActionPlan" should find it. Unless the templates directory indexing... The earlier code_search with file_patterns ["templates/"] may have excluded? Search without file_patterns.
Let me search across whole repo.
Tool Calls (2)
code_search
Show Details
Arguments
{"search_text": "ssmaCanMutateActionPlan"}
Result
File: src/Controller/SsmaController.php
Match lines: 3
12613| $ssmaCanMutateActionPlan = $ssmaCanCreateLinkedActions;
12779| $ssmaCanMutateActionPlan = true;
13268| 'ssmaCanMutateActionPlan' => $ssmaCanMutateActionPlan,
File: templates/ssma/action_plan/partials/_action_plan_overflow_menu.html.twig
Match lines: 2
1|{% set can_edit_action = ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false)) or action_item.can_edit|default(false) %}
2|{% set can_resolve_action = action_item.can_resolve|default(false) or (ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false)) and not action_item.solved and action_item.validation_status != 'pending_validation') %}
code_search
Show Details
Arguments
{"search_text": "ssmaCanCreateLinkedActions"}
Result
File: src/Controller/SsmaController.php
Match lines: 8
12609| // ssmaCanCreateLinkedActions: botão "Criar ação" na aba Ocorrências e occurrence_view.
12612| $ssmaCanCreateLinkedActions = $this->canMutateSsmaActionPlan();
12613| $ssmaCanMutateActionPlan = $ssmaCanCreateLinkedActions;
12656| $ssmaCanCreateLinkedActions = false;
12778| $ssmaCanCreateLinkedActions = true;
12787| // Alinhado com ssmaCanCreateLinkedActions (Plano de Ações): quem não pode criar
12789| $ssmaPreventionCanCreateLinkedActions = $ssmaCanCreateLinkedActions;
13267| 'ssmaCanCreateLinkedActions' => $ssmaCanCreateLinkedActions,
File: src/Service/Ssma/ViewData/SsmaPermissionContextResolver.php
Match lines: 1
22| 'ssmaCanCreateLinkedActions',
File: templates/ssma/cause_tree/tree_view/tabs/_tab_action_plan.html.twig
Match lines: 1
225| {% set can_select_this_row = ssmaCanCreateLinkedActions|default(false) and is_action_complete and not has_ssma_action and not has_linked_project %}
File: templates/ssma/occurrence/occurrence_view.html.twig
Match lines: 2
662| {% if ssmaCanCreateLinkedActions|default(false) %}
839| {% if ssmaCanCreateLinkedActions|default(false) %}
File: templates/ssma/occurrence/tabs/_tab_occurrences.html.twig
Match lines: 3
15|{% set canCreateLinkedActions = ssmaCanCreateLinkedActions|default(canManageOccurrences) %}
1017| var ssmaCanCreateLinkedActions = {{ canCreateLinkedActions ? 'true' : 'false' }};
1266| return !!ssmaCanCreateLinkedActions;
Request #41
deepseek-v4-flash
P:71.99K C:306 CR:71.3K CW:0
2859ms
Reasoning
So `ssmaCanMutateActionPlan` is used only in `_action_plan_overflow_menu.html.twig`, which is included from `_action_plan_table.html.twig`. This partial `_action_plan_table.html.twig` is the table for the "Ações" tab probably. But the older `_tab_action_plan.html.twig` uses a JS `buildSsmaActionPlanOverflowMenuHtml` with `canEdit = ssmaCanManageOccurrences || !!action.can_edit;`. So where is `_action_plan_table.html.twig` used? Let me check where the overflow menu's action_item comes from and which pages render `_action_plan_table`. Search for includes of `_action_plan_table`.
Tool Calls (2)
code_search
Show Details
Arguments
{"file_patterns": ["templates/"], "search_text": "_action_plan_table.html.twig"}
Result
File: templates/ssma/action_plan/tabs/_tab_action_plan.html.twig
Match lines: 1
213| {% include 'ssma/action_plan/partials/_action_plan_table.html.twig' with {
code_search
Show Details
Arguments
{"file_patterns": ["templates/ssma/action_plan/tabs/_tab_painel.html.twig"], "search_text": "overflow|action_item"}
Result
No matches found
Request #42
deepseek-v4-flash
P:72.38K C:1.32K CR:72.19K CW:0
10550ms
Reasoning
So the overflow menu partial is used by `_tab_action_plan.html.twig` (the "Ações" tab) at line 213, including `_action_plan_table.html.twig` which in turn includes the overflow menu at lines 145/333. And `_tab_action_plan.html.twig` also has the JS-based `buildSsmaActionPlanOverflowMenuHtml` for mobile/some contexts. Two menu builders exist in the Ações tab. The overflow menu partial now uses `ssmaCanMutateActionPlan`, but JS `buildSsmaActionPlanOverflowMenuHtml` at line 1645 still uses `ssmaCanManageOccurrences`.
Note `ssmaCanManageOccurrences` inside the JS is set at 1017/1266? Actually that's _tab_occurrences. In `_tab_action_plan.html.twig`, need to see how the JS var is declared. Probably `var ssmaCanManageOccurrences = {{ ssmaCanManageOccurrences ? 'true':'false' }}`. If supervisor (viewer) had ssmaCanManageOccurrences false in JS... Supervisors previously created actions via isSsmaViewer; in JS menu, canEdit = ssmaCanManageOccurrences || action.can_edit. For a viewer-supervisor, ssmaCanManageOccurrences maybe true (viewer tag can have can_view; canManageSsmaOccurrences false). action.can_edit may be set by server when the action is theirs? could_edit for supervisor? Now backend denies edit for all supervisors via canMutate. If server previously marked can_edit on actions for supervisors (based on old permission), it may still; but action.can_edit comes from mapSsmaActionEntitiesToListArrays which uses canCurrentUserEditSsmaAction? Wait `canCurrentUserEditSsmaAction` is used in loadActions/map; it now returns canMutateSsmaActionPlan (false for supervisor). So action.can_edit should now be false server-side for supervisors. Good, so the JS menu's action.can_edit for a supervisor is false, and ssmaCanManageOccurrences is false for viewer-supervisor, so JS menu won't show edit for them. Hmm, but for a "Supervisor" tag with can_create on ssma-occurrences (some supervisors have can_create for inspections etc.) canManageSsmaOccurrences returns true via tag canCreate, so JS menu shows edit — but backend canMutate blocks because tag name is 'Supervisor'. Divergence again.
OK so the core divergence is broad: `canManageSsmaOccurrences()` (used by many pre-existing UI spots: JS menu, maybe elsewhere) returns true for supervisor-tagged users with can_create in their tag (because supervisors register inspections/approaches with can_create). The new `canMutateSsmaActionPlan()` explicitly blocks those same supervisor tags. This is exactly the reason canMutate was introduced. But any leftover UI using ssmaCanManageOccurrences (like the `_tab_action_plan` JS menu at line 1645-1646 and 1661-1677) will still show create/edit/delete to supervisors. Wait, was `_tab_action_plan.html.twig` JS menu's `ssmaCanManageOccurrences` also updated elsewhere? This file is not part of the PR diff. So the Ações tab's JS overflow menu still grants a supervisor with can_create-tag the edit/delete options → server returns 403 (canCurrentUserEditSsmaAction false). This is a concrete, defensible divergence! However, the rule says comments must target code within review_files. But we can point at `_action_plan_overflow_menu.html.twig` (in review) — the fix updated only this partial; but `_tab_action_plan.html.twig` has a second (JS) menu not updated → inconsistent; since can't comment on _tab_action_plan (outside), we can still raise the cross-file observation anchored to the changed template lines, referencing the other consumer. The instructions: "Cross-file observations within <review_files> are encouraged — look for inconsistencies, missing updates..." and "Context tools are for gathering background. Your comments must address code within <review_files> — never produce comments targeting files outside it." So comment anchored in `_action_plan_overflow_menu.html.twig` pointing at the JS menu in `_tab_action_plan.html.twig` is allowed as an inconsistency in the reviewed change (the fix is incomplete).
Let me verify the JS in _tab_action_plan uses ssmaCanManageOccurrences at 1645/1646. Already read: line 1645 canEdit = ssmaCanManageOccurrences || !!action.can_edit; 1646 canResolve = !!action.can_resolve || (ssmaCanManageOccurrences && ...). Yes.
But wait: is that menu in _tab_action_plan used for desktop rows? The partial is included at line 213 in _tab_action_plan at line 213. The partial's server-side menu `_action_plan_table.html.twig` uses overflow partial at 145/333. The JS buildSsmaActionPlanOverflowMenuHtml at 1643 might be for child tables / project rows. Both are relevant.
Let me quickly verify how `action.can_edit` and `action.can_resolve` are computed server-side in mapSsmaActionEntitiesToListArrays, to see whether they already match the new policy. If action.can_edit uses canCurrentUserEditSsmaAction (which uses canMutate) → for supervisor false. Search for `'can_edit' =>` in map. Let's search `can_edit' => $this->can` etc.
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "canCurrentUserEditSsmaAction|canCurrentUserResolveSsmaAction|canCurrentUserValidateSsmaAction"}
Result
No matches found
Request #43
deepseek-v4-flash
P:73.71K C:281 CR:73.6K CW:0
3005ms
Reasoning
Hmm, no matches? That's odd. It matched earlier at 16141 etc. because we read the file. Wait, earlier code_search in this same file found canMutateSsmaActionPlan matches. But now searching canCurrentUserEditSsmaAction returns none? Maybe the search tool treats `|` as regex and our text had no `|`. Actually our search_text = "canCurrentUserEditSsmaAction|canCurrentUserResolveSsmaAction|canCurrentUserValidateSsmaAction" without use_perl_regexp - it's literal text, so it's searching for that exact string with pipes, unlikely. My mistake - I included pipes as alternation but didn't enable regex. Let me redo individually or with regex enabled.
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "canCurrentUserEditSsmaAction|canCurrentUserResolveSsmaAction|canCurrentUserValidateSsmaAction|canMutateSsmaActionPlan", "use_perl_regexp": true}
Result
File: src/Controller/SsmaController.php
Match lines: 13
7981| if ($mode !== 'edit' && !$this->canMutateSsmaActionPlan()) {
8024| if (!$this->canCurrentUserEditSsmaAction($action, $company, $user)) {
9296| if (!$this->canCurrentUserResolveSsmaAction($action, $company, $user, $operation)) {
11467| private function canMutateSsmaActionPlan(): bool
12612| $ssmaCanCreateLinkedActions = $this->canMutateSsmaActionPlan();
16139| private function canCurrentUserEditSsmaAction(SsmaAction $action, Company $company, ?User $user): bool
16141| return $this->canMutateSsmaActionPlan();
16144| private function canCurrentUserResolveSsmaAction(
16159| private function canCurrentUserValidateSsmaAction(SsmaAction $action, Company $company, ?User $user): bool
16272| $canManage = $this->canMutateSsmaActionPlan();
16291| 'can_resolve' => $this->canCurrentUserResolveSsmaAction($action, $company, $user),
16292| 'can_validate' => $this->canCurrentUserValidateSsmaAction($action, $company, $user),
28299| if (!$this->canCurrentUserValidateSsmaAction($action, $action->getCompany(), $user)) {
Request #44
deepseek-v4-flash
P:74.33K C:140 CR:73.98K CW:0
2119ms
Reasoning
Let me check where action rows get `can_edit` (mapSsmaActionEntitiesToListArrays). Search `'can_edit'` in SsmaController.
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "'can_edit' =>|\"can_edit\" =>", "use_perl_regexp": true}
Result
File: src/Controller/SsmaController.php Match lines: 3 3566| 'can_edit' => false, 3622| 'can_edit' => $canEdit, 16290| 'can_edit' => $canManage,
Request #45
deepseek-v4-flash
P:74.54K C:2.99K CR:74.37K CW:0
23761ms
Reasoning
The mapSsmaActionEntitiesToListArrays maybe in another service or at line 3566/3622. Not critical.
Time to finalize. I'll settle on these comments with precise anchors:
1. [ALTA] SsmaController canMutateSsmaActionPlan + Twig override duplication divergence (lines 11467-11483 and 12777-12780). Anchor at 12777-12780 in the diff (these lines are in the diff? Check: diff shows 12775-12780 context lines: `// Árvore de causas...` and `if ($ssmaIsTagTeamGestor || $ssmaIsTagAreaGestor) { $ssmaCanCreateLinkedActions = true; $ssmaCanMutateActionPlan = true; }`. In the diff hunk "@@ -12725,6 +12776,7 @@" lines added `$ssmaCanMutateActionPlan = true;` at 12779 and context lines. Actually diff shows:
```
if ($ssmaIsTagTeamGestor || $ssmaIsTagAreaGestor) {
$ssmaCanCreateLinkedActions = true;
+ $ssmaCanMutateActionPlan = true;
}
```
So new line is `$ssmaCanMutateActionPlan = true;` (line 12779). Good anchor.
Also the canMutate method is entirely new (lines 11462-11483). Anchor there, or better anchor at 12779 for the duplicated override. I'll comment at the method definition (new lines 11467-11483) since it's the core policy, plus reference to UI override. Actually the divergence means one comment may suffice: place at the added override line 12779 (`$ssmaCanMutateActionPlan = true;`).
2. [MÉDIA] mine fail-open (lines 522-546). Anchor on `if ($request->query->getBoolean('mine')) {`. Include double-execution suggestion: only compute when member resolved; when not, return empty list or treat as no-op with clear messaging. Also mention duplicate buildFilterPayload.
Wait, actually double execution: even in the good path we compute payload twice. That is waste. Suggest refactoring: compute effective scope first, single call.
3. [MÉDIA] offcanvas markup missing (JS lines 2234-2264): ids `ssma-ap-action-view-*` and offcanvas `ssmaApActionView`/`openOffcanvasssmaApActionView` are not present in any template; clicking "Visualizar" in Pendências will not display anything. Anchor on `setText('ssma-ap-action-view-title', title);` or the whole block. Anchor at line 2234 (new code). Include the fact that template's `_tab_painel.html.twig` eye button (also newly reachable) has no corresponding offcanvas. Suggest either adding the offcanvas markup to `_tab_painel` (with existing component `_modal_offcanvas`) or reusing the existing Ações-tab offcanvas and aligning ids. Also note the template button in _tab_painel.html.twig at line 490-498 does not include data-action-* attributes at all (only data-action-id), so even the offcanvas content would be blank on the initial server-rendered table. Actually wait, is _tab_painel's datatable rows rendered server side and the button lacks data-action-title etc. Actually this matters for the offcanvas. But when user triggers a filter, JS re-renders table rows using buildPendenciasTableRowHtml with data-action-* attributes. So initial rows still need offcanvas. The openActionViewOffcanvas would fall back to default values 'Ação', '—' etc., but still no offcanvas exists. So main issue: no offcanvas. Keep one comment.
4. [MÉDIA/BAIXA] refusal option removed from filter options in the service (lines 212-227 area). The `origin` filter select added in this PR and overview_origins no longer include Direito de Recusa, while resolveOriginKey still returns 'refusal' for actions originated from recusa; as a result such actions can't be selected/filtered (they only appear under "Todas"). Also 'occurrence'/'other' aren't filterable either but those existed as default. Note that the new pendencias origin filter uses resolveOriginKey equality, so any action classified 'other'/'refusal'/'occurrence' is excluded when a filter is chosen. Severity: medium-low. Anchor at buildFilterOptions origin options lines 218-225 (new code in diff at around 214-225). We'll comment on the `'origin' => [` array block in the diff.
Wait, but should we? The refusal type might be rare, but the requirement is "tipo de ocorrência de origem (acidente, quase acidente, observação etc.)". Given they removed Direito de Recusa from overview filter (pre-existing from #701), it's a real regression of filterability. Medium/low. I'll include with low-medium; mark medium because data visibility regression for existing rows; but keep as low maybe. I'll mark medium for filter parity gap. Hmm to avoid over-claiming, given the previous review summary said chart still shows refusal rows (extra seeds preserved), the issue is only about the filter/select options. I'll mark low severity.
5. [MÉDIA] Test coverage missing for permission changes. Anchor at controller canMutate method (11467). Suggest adding tests. Severity low-medium. Actually check for existing SsmaControllerTest coverage? There's tests/Unit/Product/Ssma/SsmaActionPlanMutatePermissionServiceTest.php, tests/Unit/Product/Ssma/ActionOrigemEnumTest.php. No SsmaControllerTest. Comment as low? The instruction says permission flow change without automated test is Atenção; user rules says "Mudança de comportamento sem teste automatizado... em fluxo de autorização... é Crítico" (for PHP controller rules, under regras específicas). Wait user-specific rules for Controller: "Mudança de comportamento sem teste automatizado cobrindo o fluxo real... em fluxo de autorização, dinheiro, exclusão ou estado é Crítico." Hmm — but "suggest tests only for concrete changed failure modes" in system rules. I'll include as medium severity (não bloqueante but flagged). Let me include one comment as low/medium.
But we should be mindful about number of comments. Let me include the strongest findings:
1. Divergência de permissão (alta)
2. mine fail-open + double compute (média)
3. offcanvas inexistente (média) — actually arguably high since a visible feature doesn't work, but since there may be missing template include, I'll go medium/high. I'll set medium.
4. refusal filter regression (low)
5. JS: mine applied to all views (low) — skip maybe; combine with #2? #2 is about backend. The JS mine being added outside pendencias branch is a separate low note. Also panelState.mine persists when switching to visão geral, silently filtering charts without visible indicator. Might skip to keep focused, or include as low.
Also consider: `formatPeopleNames` / `row.action_id || row.id` etc. Also, `origin` state in panelState.origin set from select 'ap_painel_filter_origem' in syncPendenciasFilterState; but buildFilterParams for visao_geral also uses panelState.origin (line 393-395). Visão Geral previously used overview origin filter? It may have had its own select for origin in visão geral header. In `_tab_painel.html.twig`, visão geral filters maybe reuse ap_painel_filter_origem? Actually buildFilterParams reads `panelState.origin` for both pendencias and visao_geral. panelState.origin is read from '#ap_painel_filter_origem' (the Pendências header select). If the user is on Visão Geral sub-aba, is `#ap_painel_filter_origem` visible? The Pendências filter header presumably hidden when visão_geral active. syncPendenciasFilterState is only called for pendências filters. So when on visão_geral, panelState.origin would remain whatever was last (from pendências). This causes visão_geral requests to carry a stale origin filter from Pendências header — silently filtering the Visão Geral charts! Also panelState.team, vinculo are also appended globally in buildFilterParams (pre-existing lines 400-405) - so already the design applies these to overview? Actually lines 400-405 are global, so team/vinculo already applied to all views. origin is now similarly included for visao_geral at 393-395 within visao_geral branch. Before this PR, was origin added for visão geral? Before, visao_geral branch set period, page, per_page, management... origin? No, origin was new. And pendencias branch added origin (new). So origin now filters visão_geral charts based on state last set from the Pendências select. Is that intended? The Visão Geral section probably has its own origin dimension filter? Let me check visão geral filter header in template (around line 156-210). Hmm.
Actually, wait, panelState.origin is set in syncPendenciasFilterState (line 1085) reading from '#ap_painel_filter_origem'. But there's possibly also a 'ap_overview_filter_origem' select? Not in diff. In the template, the filters for visão geral are separate (same subheader as pendencias per comment "# Filtros desktop — Visão Geral (mesmo subheader das Pendências)"). Hmm, this is getting too deep. The origin for overview: the backend applyOverviewDimensionFilters uses originFilter (existing parameter). So Visão Geral already supports an origin filter; maybe it had its own select with id? Let me check the template for visão geral header filters, to see if there's an origin select bound to something else.
Given the low impact, I'll drop this specific concern to avoid noise, or include the "mine persists across views" as low. Actually #6 from plan. Let me verify the backend: mine filter applies member scope for all views (buildFilterPayload filters before branch). For visao_geral, panelState.mine is true only if the checkbox in pendências header was checked; header likely hidden in visão_geral but state persists. So switching to Visão Geral after checking "Minhas ações" filters the entire overview charts to user's actions. Could be intended ("Minhas ações" implies everything). Hmm.
I'll keep the review focused on 5 comments:
1. [high] Permission duplication UI vs backend (canMutateSsmaActionPlan vs flags override), which can show buttons that 403.
Actually let me re-examine: with request attributes can_create not set anywhere (search returned none), the attribute path never triggers for these routes; then Gestor de Equipe/Área must have tag can_create/can_edit/can_delete to pass. If their tag is configured as read-only (can_view only), backend blocks but UI forces true → menu shows actions → 403. Since the same situation for supervisor tags is the exact motivation for creating canMutate (Supervisor tags may have can_create for inspections, so canManageSsmaOccurrences is true — that's why it had to name-block them!). By symmetry, Gestor de Equipe/Área tags likely also have can_create (for inspections) so canMutate would return true anyway and the UI override is harmless redundancy. However, canManageSsmaOccurrences also returns true for supervisor 'Supervisor de Equipe' when request has can_create... canMutate blocks them by tag name first. For Gestor de Equipe tags the tag name allow in override (12777) but no name handling in canMutate → relies on can_create. Both would return true then. So maybe not divergent in practice for Gestor de Equipe. But the fact remains it's duplicated policy where the UI override at 12777-12780 exists to guarantee mutation for those tags regardless of canManageSsmaOccurrences - meaning the author intended that those tags mutate even without canManage. But backend canMutate can return false in that scenario (e.g., Gestor de Equipe tag configured can_view only + they cannot have ROLE_MANAGER). Hmm. Real but conditional.
There is a second, even more clear-cut divergence: the pre-existing JS overflow menu in `_tab_action_plan.html.twig` (Ações tab) still gates edit/delete on `ssmaCanManageOccurrences || action.can_edit`, which will now be false for supervisors IF server action.can_edit is computed with canMutate. But is action.can_edit server side computed via canCurrentUserEditSsmaAction? Let's check where map rows set can_edit. Search for "can_edit" around 3566/3622. Those lines might belong to a different mapping (occurrence). Let me check quickly.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 3630, "file_path": "src/Controller/SsmaController.php", "start_line": 3540}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 3540-3630
3540| ]));
3541| }
3542|
3543| /**
3544| * Flags do botão +Aprofundamento na view da ocorrência.
3545| *
3546| * @param array<string, mixed> $occurrence
3547| *
3548| * @return array{
3549| * show: bool,
3550| * pending: bool,
3551| * finalized: bool,
3552| * can_edit: bool,
3553| * is_admin: bool,
3554| * validation_ready: bool
3555| * }
3556| */
3557| private function resolveOccurrenceViewAprofundamentoFlags(
3558| array $occurrence,
3559| ?Company $company,
3560| ?User $user
3561| ): array {
3562| $empty = [
3563| 'show' => false,
3564| 'pending' => false,
3565| 'finalized' => false,
3566| 'can_edit' => false,
3567| 'is_admin' => false,
3568| 'validation_ready' => true,
3569| ];
3570| if (!$company || !$user || empty($occurrence['is_ssma_event'])) {
3571| return $empty;
3572| }
3573|
3574| $type = strtoupper(trim((string) ($occurrence['type_value'] ?? $occurrence['type'] ?? '')));
3575| $requires = in_array($type, ['ROS', 'QUASE_ACIDENTE', 'ACIDENTE_PESSOAL', 'ACIDENTE_MATERIAL', 'ACIDENTE_AMBIENTAL'], true);
3576| if (!$requires) {
3577| return $empty;
3578| }
3579|
3580| $details = [];
3581| $eventEntity = null;
3582| $eventId = (int) ($occurrence['id'] ?? 0);
3583| if ($eventId > 0) {
3584| $eventEntity = $this->entityManager->getRepository(SsmaEvent::class)->find($eventId);
3585| if ($eventEntity instanceof SsmaEvent) {
3586| $details = is_array($eventEntity->getDetails()) ? $eventEntity->getDetails() : [];
3587| }
3588| }
3589| if ($details === [] && is_array($occurrence['details'] ?? null)) {
3590| $details = $occurrence['details'];
3591| }
3592|
3593| $status = strtolower(trim((string) ($details['aprofundamento_status'] ?? '')));
3594| $finalized = $status === 'finalized' || !empty($details['aprofundamento_complete']);
3595| $fieldsIncomplete = $eventEntity instanceof SsmaEvent
3596| ? $this->ssmaEventAprofundamentoPending($eventEntity)
3597| : !empty($occurrence['aprofundamento_pending']);
3598| $pending = !$finalized && (
3599| $fieldsIncomplete
3600| || $status === 'draft'
3601| || $status === ''
3602| );
3603|
3604| $isAdmin = $this->isSsmaAprofundamentoAdmin($company, $user);
3605| $canAccess = $this->canAccessSsmaEventAprofundamento(
3606| $company,
3607| $user,
3608| $type,
3609| $details,
3610| (int) ($occurrence['created_by_id'] ?? 0)
3611| );
3612| $canEdit = $canAccess && (!$finalized || $isAdmin);
3613| $rosResolved = $type === 'ROS' && !empty($details['ros_resolved']);
3614| // Campos completos bastam. Sem flag (legado / save da 1ª etapa) não bloqueia;
3615| // só draft explícito continua pendente de "Finalizar aprofundamento".
3616| $validationReady = $rosResolved || (!$fieldsIncomplete && $status !== 'draft');
3617|
3618| return [
3619| 'show' => $canAccess,
3620| 'pending' => $pending,
3621| 'finalized' => $finalized,
3622| 'can_edit' => $canEdit,
3623| 'is_admin' => $isAdmin,
3624| 'validation_ready' => $validationReady,
3625| ];
3626| }
3627|
3628| /**
3629| * Resolve "responsável da área" a partir do local da ocorrência.
3630| * 1) location_responsibles (Controle de Espaço / config SSMA)
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "function mapSsmaActionEntitiesToListArrays"}
Result
File: src/Controller/SsmaController.php Match lines: 1 14738| private function mapSsmaActionEntitiesToListArrays(array $rows, Company $company, ?User $user): array
Request #46
deepseek-v4-flash
P:78.77K C:162 CR:77.44K CW:0
2018ms
Reasoning
Let me read mapSsmaActionEntitiesToListArrays to see the can_edit/can_resolve computation for actions, which is used in loadActions for the Ações tab and Pendências? Actually panel table data comes from panel service (not map). But loadActions is used in the Ações tab list. Let me read around 14738-14900.
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 14950, "file_path": "src/Controller/SsmaController.php", "start_line": 14738}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 14738-14950
14738| private function mapSsmaActionEntitiesToListArrays(array $rows, Company $company, ?User $user): array
14739| {
14740| $projectIds = array_values(array_unique(array_filter(array_map(
14741| static fn (SsmaAction $row): ?int => $row->getProjectId(),
14742| $rows
14743| ))));
14744| $taskCountersByProject = $this->buildProjectTaskCounters($projectIds);
14745| $projectNamesById = [];
14746| if ($projectIds !== []) {
14747| $projectEntities = $this->entityManager->getRepository(Project::class)->findBy(['id' => $projectIds]);
14748| foreach ($projectEntities as $projectEntity) {
14749| $projectNamesById[(int) $projectEntity->getId()] = (string) ($projectEntity->getName() ?? '');
14750| }
14751| }
14752|
14753| $result = [];
14754| foreach ($rows as $row) {
14755| $responsibleIds = $row->getResponsibleIds() ?? [];
14756|
14757| $projectId = $row->getProjectId();
14758| $linkedProject = $row->isHasProject() && $projectId;
14759| $projectUrl = $linkedProject ? '/projects/project_steps/' . $projectId : null;
14760| $taskCounters = $linkedProject ? ($taskCountersByProject[$projectId] ?? ['total' => 0, 'completed' => 0]) : ['total' => 0, 'completed' => 0];
14761|
14762| $relatedEventType = $row->resolveRelatedEventType();
14763|
14764| $result[] = array_merge([
14765| 'id' => $row->getId(),
14766| 'occurrence_id' => $row->getOccurrence()?->getId(),
14767| 'event_id' => $row->getEvent()?->getId(),
14768| 'related_event_type' => $relatedEventType,
14769| 'title' => $row->getTitle(),
14770| 'description' => $row->getDescription() ?? '',
14771| 'type' => $row->getType() ?? '',
14772| 'responsible_ids' => $responsibleIds,
14773| 'deadline' => $row->getDeadline()?->format('Y-m-d'),
14774| 'solved' => $row->isSolved(),
14775| 'has_project' => $row->isHasProject(),
14776| 'project_id' => $projectId,
14777| 'project_url' => $projectUrl,
14778| 'project_name' => $linkedProject ? ($projectNamesById[(int) $projectId] ?? ('Projeto #' . $projectId)) : '',
14779| 'project_start_date' => $row->getProjectStartDate()?->format('Y-m-d') ?? '',
14780| 'project_priority' => $row->getProjectPriority() ?? '',
14781| 'control_hierarchy' => $row->getControlHierarchy() ?? '',
14782| 'created_at' => $row->getCreatedAt()->format('Y-m-d'),
14783| 'updated_at' => $row->getUpdatedAt()->format('Y-m-d'),
14784| 'actions_taken_completed' => $taskCounters['completed'],
14785| 'actions_taken_total' => $taskCounters['total'],
14786| 'validation_status' => $row->getValidationStatus() ?? '',
14787| 'validator_member_id' => $row->getValidatorMemberId(),
14788| 'closing_evidence' => $row->getClosingEvidence() ?? '',
14789| 'resolution_rating' => $row->getResolutionRating() ?? '',
14790| 'resolution_note' => $this->extractLastSsmaActionResolutionNote($row->getDescription()),
14791| 'cc_demand_id' => $row->getCcDemandId(),
14792| 'rejection_note' => $row->getRejectionNote() ?? '',
14793| ], $this->resolveActionDeadlineEditMeta($row, $company, $user));
14794| }
14795|
14796| return $result;
14797| }
14798|
14799| /**
14800| * @param list<array<string, mixed>> $allMembers
14801| * @param list<array<string, mixed>> $teams
14802| *
14803| * @return list<array<string, mixed>>
14804| */
14805| private function loadOccurrences(
14806| Company $company,
14807| array $allMembers,
14808| array $teams,
14809| ?int $limit = null,
14810| int $offset = 0
14811| ): array {
14812| $membersById = array_column($allMembers, null, 'id');
14813| $teamsById = array_column($teams, null, 'id');
14814|
14815| // Carga completa (filtros de equipe/membro depois): mantém findBy por company.
14816| if ($limit === null) {
14817| /** @var SsmaOccurrence[] $rows */
14818| $rows = $this->entityManager->getRepository(SsmaOccurrence::class)
14819| ->findBy(['company' => $company], ['createdAt' => 'DESC']);
14820|
14821| $result = [];
14822| foreach ($rows as $row) {
14823| $result[] = $this->mapSsmaOccurrenceEntityToListRow($row, $teamsById);
14824| }
14825|
14826| /** @var SsmaEvent[] $events */
14827| $events = $this->entityManager->getRepository(SsmaEvent::class)
14828| ->findBy(['company' => $company], ['eventDatetime' => 'DESC']);
14829| foreach ($events as $event) {
14830| $result[] = $this->mapSsmaEventToOccurrenceListRow($event, $teamsById);
14831| }
14832|
14833| usort($result, static function (array $a, array $b): int {
14834| return strcmp($b['date'] ?? '', $a['date'] ?? '');
14835| });
14836|
14837| foreach ($result as $idx => $row) {
14838| $result[$idx] = $this->enrichOccurrenceManagerFields($row, $membersById, $company);
14839| }
14840|
14841| return $result;
14842| }
14843|
14844| // Página (visão completa sem pós-filtro): UNION + hydrate só dos IDs da página.
14845| $companyId = (int) $company->getId();
14846| $conn = $this->entityManager->getConnection();
14847| $safeLimit = max(0, (int) $limit);
14848| $safeOffset = max(0, (int) $offset);
14849| $keys = $conn->fetchAllAssociative(
14850| 'SELECT id, kind, sort_date FROM (
14851| SELECT id, \'o\' AS kind, created_at AS sort_date
14852| FROM ssma_occurrences
14853| WHERE company_id = ?
14854| UNION ALL
14855| SELECT id, \'e\' AS kind, event_datetime AS sort_date
14856| FROM ssma_events
14857| WHERE company_id = ?
14858| ) u
14859| ORDER BY sort_date DESC
14860| LIMIT ' . $safeLimit . ' OFFSET ' . $safeOffset,
14861| [$companyId, $companyId]
14862| );
14863| if ($keys === []) {
14864| return [];
14865| }
14866|
14867| $occIds = [];
14868| $evtIds = [];
14869| foreach ($keys as $key) {
14870| $id = (int) ($key['id'] ?? 0);
14871| if ($id <= 0) {
14872| continue;
14873| }
14874| if (($key['kind'] ?? '') === 'e') {
14875| $evtIds[] = $id;
14876| } else {
14877| $occIds[] = $id;
14878| }
14879| }
14880|
14881| $occById = [];
14882| if ($occIds !== []) {
14883| /** @var SsmaOccurrence[] $occRows */
14884| $occRows = $this->entityManager->getRepository(SsmaOccurrence::class)->findBy(['id' => $occIds]);
14885| foreach ($occRows as $row) {
14886| $occById[(int) $row->getId()] = $this->mapSsmaOccurrenceEntityToListRow($row, $teamsById);
14887| }
14888| }
14889|
14890| $evtById = [];
14891| if ($evtIds !== []) {
14892| /** @var SsmaEvent[] $evtRows */
14893| $evtRows = $this->entityManager->getRepository(SsmaEvent::class)->findBy(['id' => $evtIds]);
14894| foreach ($evtRows as $event) {
14895| $evtById[(int) $event->getId()] = $this->mapSsmaEventToOccurrenceListRow($event, $teamsById);
14896| }
14897| }
14898|
14899| $result = [];
14900| foreach ($keys as $key) {
14901| $id = (int) ($key['id'] ?? 0);
14902| if (($key['kind'] ?? '') === 'e') {
14903| if (isset($evtById[$id])) {
14904| $result[] = $evtById[$id];
14905| }
14906| continue;
14907| }
14908| if (isset($occById[$id])) {
14909| $result[] = $occById[$id];
14910| }
14911| }
14912|
14913| foreach ($result as $idx => $row) {
14914| $result[$idx] = $this->enrichOccurrenceManagerFields($row, $membersById, $company);
14915| }
14916|
14917| return $result;
14918| }
14919|
14920| private function countCompanyOccurrencesAndEvents(Company $company): int
14921| {
14922| $companyId = (int) $company->getId();
14923| $conn = $this->entityManager->getConnection();
14924| $occ = (int) $conn->fetchOne(
14925| 'SELECT COUNT(*) FROM ssma_occurrences WHERE company_id = ?',
14926| [$companyId]
14927| );
14928| $evt = (int) $conn->fetchOne(
14929| 'SELECT COUNT(*) FROM ssma_events WHERE company_id = ?',
14930| [$companyId]
14931| );
14932|
14933| return $occ + $evt;
14934| }
14935|
14936| /**
14937| * Formato compatível com cards/tabela de ocorrências (legado).
14938| *
14939| * @param array<string, array<string, mixed>> $teamsById
14940| *
14941| * @return array<string, mixed>
14942| */
14943| /**
14944| * @return int[]
14945| */
14946| private function ssmaExtractIdListFromDetails(mixed $raw): array
14947| {
14948| if (empty($raw)) {
14949| return [];
14950| }
Request #47
deepseek-v4-flash
P:81.8K C:877 CR:78.85K CW:0
7141ms
Reasoning
OK. The Ações tab (loadActions) uses mapSsmaActionEntitiesToListArrays which merges resolveActionDeadlineEditMeta → can_edit = canMutate, can_resolve = stakeholder service with canManageSsmaOccurrences. Since can_edit now canMutate (supervisor false), the JS `buildSsmaActionPlanOverflowMenuHtml` uses `ssmaCanManageOccurrences || action.can_edit`. So a supervisor with can_create in the tag (canManageSsmaOccurrences true) sees edit but backend 403? Wait — canManageSsmaOccurrences true for supervisors with can_create tag. And action.can_edit false. Then JS menu shows Edit because `ssmaCanManageOccurrences` true. And backend denies edit (403). But was that also true before this PR? Before, can_edit was computed via canManageSsmaOccurrences as well (canCurrentUserEditSsmaAction returned canManageSsmaOccurrences). Wait — BEFORE this PR, `canCurrentUserEditSsmaAction` returned canManageSsmaOccurrences, and supervisors with can_create tag would also have edit allowed (backend). The old overflow menu had can_edit_action = ssmaCanManageOccurrences or action.can_edit. So before: backend edit allowed for supervisors with can_create; UI matched. Now: backend denies (canMutate blocks supervisor tags by name), but the JS overflow menu still shows edit for those supervisors because it uses ssmaCanManageOccurrences (unchanged). That is a genuine UI/backend divergence introduced by this PR for the Ações tab's JS menu.
Wait, but `_action_plan_overflow_menu.html.twig` (the partial) was updated to ssmaCanMutateActionPlan. But the JS menu at line 1645 in `_tab_action_plan.html.twig` was NOT updated. Both menus are on the same Ações tab (partial for table rows, JS for something else—child tables / actions taken?). Let me verify where the JS menu is used: it's built in JS and appended to DOM probably for expanded rows. Regardless, it is a second consumer that wasn't updated → supervisor still sees edit options → 403 on submit. This is strong evidence of the incomplete migration and it's a concrete, likely real issue (supervisor can_create tag scenario). It is exactly what the "Brenda áudio 6" change is about.
But careful: comments must target files in review group. The anchor for the fix would be `_action_plan_overflow_menu.html.twig` changed lines (in group) — we can say: this partial was migrated to ssmaCanMutateActionPlan, but the parallel JS menu `buildSsmaActionPlanOverflowMenuHtml` in `_tab_action_plan.html.twig` (Ações tab) still computes canEdit with ssmaCanManageOccurrences, so supervisors with can_create na tag SSMA continuam vendo Editar/Deletar e levando 403. Also the actual backend gate for those routes uses canMutate. Suggest to migrate the JS menu too.
Hmm wait — but actually does `ssmaCanManageOccurrences` JS var exist in _tab_action_plan context? Earlier search for the phrase "ssmaCanCreateLinkedActions" in templates/_tab_occurrences line 1017 sets JS var. For _tab_action_plan, need to confirm var ssmaCanManageOccurrences is set in JS scope. Let me search _tab_action_plan for `var ssmaCanManageOccurrences`.
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["templates/ssma/action_plan/tabs/_tab_action_plan.html.twig"], "search_text": "var ssmaCanManageOccurrences|ssmaCanMutateActionPlan", "use_perl_regexp": true}
Result
File: templates/ssma/action_plan/tabs/_tab_action_plan.html.twig
Match lines: 1
293| var ssmaCanManageOccurrences = {{ ssmaCanManageOccurrences|default(false) ? 'true' : 'false' }};
Request #48
deepseek-v4-flash
P:82.75K C:4.13K CR:82.56K CW:0
29091ms
Reasoning
Confirmed: `_tab_action_plan.html.twig` line 293 declares JS `ssmaCanManageOccurrences` from the Twig var. And line 1645 uses it for canEdit and line 1646 canResolve.
So this PR changed `ssmaCanManageOccurrences` semantics? No — the Twig var ssmaCanManageOccurrences unchanged. But backend canCurrentUserEditSsmaAction now uses canMutate, so a supervisor-tagged user who had can_create on tag (thus canManageOccurrences true) is now blocked at the API (create/edit/resolve)... wait resolve uses stakeholder service with canManage — supervisors with can_create can still resolve? canUserResolveAction with canManage true → probably allows. Hmm. But create and edit are now blocked for supervisors with can_create tag.
Hold on, need to double check whether createAction is the endpoint used by Ações tab create modal. Yes `createAction` handles mode create/edit (single endpoint). Old guard was: mode !== 'edit' && !canAccessSsmaSupervisorSurface → viewer-supervisors could create. Supervisors with can_create tag could also create via canManageSsmaOccurrences. Both categories are now blocked by canMutate. The new `_action_plan_overflow_menu.html.twig` properly hides the menu options for supervisors because it reads ssmaCanMutateActionPlan, which is computed with the tag-name blocking... wait for a supervisor with can_create tag, $ssmaCanMutateActionPlan initially = canMutate() = false (name blocked). So menu partial hides.
For the Ações tab JS menu (`_tab_action_plan` line 1645): canEdit = ssmaCanManageOccurrences(JS var) || action.can_edit. For supervisor with can_create tag, ssmaCanManageOccurrences (Twig var from canManageSsmaOccurrences()) = true (tag can_create). action.can_edit = false (since server canMutate false). So JS menu shows Edit & Delete. But server denies. So yes — divergence in Ações tab JS menu. But note the edit buttons for rows in _tab_action_plan actually come from the overflow menu partial (included at 213 via _action_plan_table), not the JS builder? There appear to be two row rendering paths (desktop table + "mobile"/child). The JS menu at 1643 is used maybe for project task children rows. Enough to raise.
Given constraints about not commenting on files outside review group: anchor to `_action_plan_overflow_menu.html.twig` lines 1-2 (new). In the comment, note the sibling JS builder not migrated, and also note the permission policy is duplicated in controller (canMutate) vs UI flags. This is one coherent high finding.
Now let me finalize comments and their locations in the diff hunks (need exact code snippet for matching). We must choose `existing_code` that appears in the diff and is newly added lines.
Let me enumerate precise new lines for anchors:
**A. SsmaController canMutate method (new lines 11462-11483):** The whole method is new in the diff. Anchor snippet:
```
return $this->canManageSsmaOccurrences();
}
```
But the method start: `private function canMutateSsmaActionPlan(): bool`. Let me anchor on lines added:
```
private function canMutateSsmaActionPlan(): bool
{
if ($this->isSsmaViewer()) {
return false;
}
```
These are added lines (part of new method). Good.
**B. SsmaController mine (added lines 522-546):** Anchor:
```
if ($request->query->getBoolean('mine')) {
$user = $this->getUser();
```
**C. JS offcanvas (added lines 2234-2264):** anchor e.g.
```
setText('ssma-ap-action-view-title', title);
```
or the block with originLink. Anchor line 2234-2241? Choose a couple of lines:
```
setText('ssma-ap-action-view-title', title);
setText('ssma-ap-action-view-id', id ? ('#' + id) : '');
```
**D. Service refusal removal / origin options (added lines in buildFilterOptions around 212-225).** Anchor on:
```
'origin' => [
['value' => '', 'text' => 'Origem'],
```
Hmm the diff hunk shows:
```
+ 'origin' => [
+ ['value' => '', 'text' => 'Origem'],
+ ['value' => 'accident_personal', 'text' => 'Acidente pessoal'],
...
```
Wait but these are inside `overview_origins` block replaced and new `'origin'` block appended. In the diff, added lines at 212-224: The hunk:
```
'overview_origins' => [
- ['value' => '', 'text' => 'Origem'],
- ['value' => 'accident', 'text' => 'Acidente'],
+ ['value' => '', 'text' => 'Todas'],
+ ['value' => 'accident_personal', 'text' => 'Acidente pessoal'],
+ ['value' => 'accident_material', 'text' => 'Acidente material'],
+ ['value' => 'near_miss', 'text' => 'Quase acidente'],
+ ['value' => 'ros', 'text' => 'ROS'],
['value' => 'inspection', 'text' => 'Inspeção'],
['value' => 'approach', 'text' => 'Abordagem'],
+ ],
+ 'origin' => [
+ ['value' => '', 'text' => 'Origem'],
+ ['value' => 'accident_personal', 'text' => 'Acidente pessoal'],
+ ['value' => 'accident_material', 'text' => 'Acidente material'],
+ ['value' => 'near_miss', 'text' => 'Quase acidente'],
['value' => 'ros', 'text' => 'ROS'],
- ['value' => 'refusal', 'text' => 'Direito de Recusa'],
+ ['value' => 'inspection', 'text' => 'Inspeção'],
+ ['value' => 'approach', 'text' => 'Abordagem'],
],
```
So added lines for the 'origin' array block exist. Anchor:
```
'origin' => [
['value' => '', 'text' => 'Origem'],
['value' => 'accident_personal', 'text' => 'Acidente pessoal'],
```
**E. Overflow menu partial (new lines 1-2):** anchor:
```
{% set can_edit_action = ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false)) or action_item.can_edit|default(false) %}
```
**F. Test coverage absence:** anchor on the canMutate method too? Could combine with A or add separate comment at canMutate. To avoid double comment at same location, combine A + test note? Actually A is about duplication with UI flags; F about missing tests. If both anchored on same method, ok but might be noise. Let me combine? No—distinct issues. But maybe simpler: place A comment on the added Twig override in the buildSsmaViewData hunk:
```
if ($ssmaIsTagTeamGestor || $ssmaIsTagAreaGestor) {
$ssmaCanCreateLinkedActions = true;
$ssmaCanMutateActionPlan = true;
}
```
The added line is `$ssmaCanMutateActionPlan = true;`. Anchor to that line plus previous context? The tool requires existing_code to exist in diff. In this hunk, the `$ssmaCanMutateActionPlan = true;` is newly added (has +). `$ssmaCanCreateLinkedActions = true;` is context (unchanged) - not allowed (must be newly added lines). So anchor only `$ssmaCanMutateActionPlan = true;`.
Place comment A here (the duplication). This is precise: UI override forces true for Gestor de Equipe/Área, while server's canMutate doesn't special-case those tags by name.
For the missing-tests finding, anchor on canMutate method added lines.
Let's also reconsider whether issue A might be wrong: Actually let me reconsider whether canManageSsmaOccurrences returns true for Gestor de Equipe because request attribute might not exist... For the action create/edit endpoints there's no can_create attribute. Gestor de Equipe tag in ssma-occurrences may have can_edit (editar ocorrências) maybe yes. So canManage would be true. If the tags are only granted read, UI override would create mismatch. But is Gestor de Equipe possibly given via role ROLE_MANAGER_GESTOR? In canManageSsmaOccurrences ROLE_MANAGER_GESTOR passes true. If Gestor de Equipe is purely tag-based (ROLE_USER), it depends on tag permission. So mismatch depends on the tag's can flags. Given the explicit override in the view, there is at least a code smell of a policy living in two places that can diverge — but whether it's currently a bug in production depends on tag config.
The high-severity framing: "O método novo no servidor nega para tags 'Supervisor de Equipe', 'Supervisor', e 'Supervisor de Área' por nome, mas para Gestor de Equipe/Área não há liberação por nome — só via canManageSsmaOccurrences. Já a montagem dos flags da tela libera Gestor de Equipe/Área incondicionalmente (12777-12780). Se a tag do Gestor de Equipe/Área não tiver can_create/edit/delete de ssma-occurrences, ele vê os botões e o backend responde 403." Good.
But note the _action_plan_overflow_menu partial change uses default(ssmaCanManageOccurrences) for fallback when flag absent (e.g., contexts that don't pass the new var like occurrence_view or cause_tree pages where only ssmaCanCreateLinkedActions is set). There, ssmaCanMutateActionPlan missing → fallback to ssmaCanManageOccurrences — this preserves old behavior for viewers in those contexts, meaning supervisors could still see create button on occurrence_view! Wait — occurrence_view uses ssmaCanCreateLinkedActions (changed to canMutate) for "Criar ação" button at line 662/839 of occurrence_view.html.twig, not the overflow partial. But the overflow partial fallback ssmaCanManageOccurrences appears where the partial is included without the new flag. Where is the partial included? Only in `_action_plan_table.html.twig`, which is included from `_tab_action_plan.html.twig` — a context where `ssmaCanMutateActionPlan` IS provided (buildSsmaViewData). So fallback rarely used.
Now regarding the missing offcanvas comment: we must be careful: since templates may be in other files within the module that could include the offcanvas but we searched whole repo and found no `ssma-ap-action-view`/`ssmaApActionView` anywhere outside this JS. So the offcanvas for this new view doesn't exist at all. Since _tab_painel.html.twig itself has the view button and NO offcanvas markup, clicking does nothing. Confirmed.
But wait: could openActionViewOffcanvas actually rely on a Bootstrap modal opened by `window.jQuery('#ssmaApActionView').modal('show')`? No #ssmaApActionView element. Could there be a dynamically-injected modal partial that includes #ssmaApActionView (like modal_action)? Search entire repo for id="ssmaApActionView" (partial) found nothing. So confirmed.
I'll also double check the anchor for JS comment matches new lines in the diff. The added function openActionViewOffcanvas lines 2217-2268 are all new. The snippet with `setText('ssma-ap-action-view-title', title);` appears at line 2234 (new). In the diff, the function text shown includes lines from `function openActionViewOffcanvas(btn) {` through `}`. The tool matches consecutive lines in the diff. I'll give 3-4 lines.
For the refusal comment (D), we may consider severity low. Also consider whether it should instead flag that when the user selects an origin, rows classified as `other` or `occurrence` are also excluded (they were previously included under "Todas" but with a specific filter they'd never match anyway—that's fine). The issue is only refusal no longer selectable. Also note new pendencias select excludes 'refusal' but data can be classified refusal; but also the origin select list in _tab_painel has fallback options that don't include refusal. It's just about options. There could be a minor issue: pendencias origin filter values must match backend resolveOriginKey output; options include accident_personal, accident_material, near_miss, ros, inspection, approach. All match. Good.
Now, is there anything about `buildResponsibleStackHtml(row.validators || [])` for validators? resolveResponsibleDisplay with validator id gives name. formatPeopleNames uses person.name||person.initials. OK.
One more check: `row.action_id || row.id` where action_id is e.g. "SSMA-123"? For actions without an action_id field? Panel service returns 'action_id'? Let me see resolvePendenciasData building rows with action_id? Search service for 'action_id'. Actually old code used row.action_id already at line 875-879 (existing), only changed to fallback row.id. OK.
Let me also verify `buildResponsibleStackHtml` exists and handles arrays of {name, initials}; and that `row.responsible` used for the responsible cell in twig initial table. Not an issue.
I think we now have enough. Let me also quickly verify issue about duplicate computation and fail-open severity, plus look at what the fallback payload uses as memberScope when mineId==0 for a supervisor/manager. resolveActionPlanPanelMemberScope: for users that pass canManageSsmaOccurrences → returns null (full scope). For a ROLE_MANAGER/SUPER_ADMIN that isn't an SSMA member in that company, mineId==0 → returns full list. So a platform manager marking "Minhas ações" (they aren't members) receives ALL actions of the company — contradicts the filter label, and reveals data of all actions (but they already had access to everything via panel). Security impact modest because they could already see everything. But semantically wrong and fail-open for the "minhas" filter. For regular users, member scope default restricts to their own; fine. So it's a medium/low correctness issue, most relevant for managers not linked as members. I'd keep medium? It's a "filtro não aplica" bug. Medium fine, but the security exposure claim should be softened because the users who hit the fail-open path are those whose memberScope is null (full access). Hmm, wait: could a non-member regular user reach the panel? Probably the panel requires membership/supervisor; a plain user without member wouldn't have access to panel anyway (resolveActionPlanPanelMemberScope likely gates). Actually the panel endpoint may be accessible to stakeholders? Possibly "member/stakeholder vê apenas suas ações". If member doesn't resolve to a CompanyMembers but still passes earlier access control (maybe via ROLE_USER within company's subsidiary?), they'd see all actions. Ambiguous. Frame comment focusing: when member is not found, filter ignored silently → returns unfiltered instead of empty; and duplicate compute.
Let me set severity medium for fail-open (matches previous) but carefully worded: "quando o usuário logado não tem CompanyMembers na empresa (mineId = 0), o filtro 'minhas ações' é silenciosamente ignorado e o payload inicial (que para gestores é sem restrição) é devolvido".
Now missing tests (F): I'll mark medium? Given the strong user-rule: "em fluxo de autorização... é Crítico" regarding missing automated test, but as a reviewer, we should suggest adding tests for permission change. Given this is a bug-catch recommendation and no suite exists for the controller; adding integration tests is large. I'll mark low-medium and concise. Let me set severity medium.
Actually to limit the number of comments and keep to the strongest: I'll deliver 6 comments:
1. A (high): Divergence UI override vs canMutate for Gestor de Equipe/Área. Anchor at `$ssmaCanMutateActionPlan = true;`.
2. B (medium): mine fail-open + duplicate build. Anchor at `if ($request->query->getBoolean('mine')) {` block.
3. C (medium): offcanvas missing markup. Anchor at `setText('ssma-ap-action-view-title', title);` lines.
4. D (low): refusal removed from origin filter options (service).
5. E (high→medium): JS overflow menu in Ações tab not migrated (still ssmaCanManageOccurrences) → supervisors with can_create on tag still see edit/resolve/delete and get 403. Anchor at changed partial lines 1-2 in review group.
6. F (low/medium): missing automated test for permission change. Anchor at canMutate method new lines.
Wait, #5 and #1 both permission-related; combine to avoid double counting? #1 is about Gestor de Equipe/Área duplication; #5 is about supervisor residual JS menu. They are distinct concrete problems. Both are valuable. But #5 anchors in the overflow partial which is the same file as #? overflow partial only has these two lines; fine.
Actually, reconsider #5's reach: JS builder `buildSsmaActionPlanOverflowMenuHtml` in `_tab_action_plan.html.twig` — where is it used? If it's used to render rows for the table (mobile?) while the desktop rows use server-side partial... I should check where this function is called to gauge impact. Let me search in that file for calls to buildSsmaActionPlanOverflowMenuHtml.
Tool Calls (2)
code_search
Show Details
Arguments
{"file_patterns": ["templates/ssma/action_plan/tabs/_tab_action_plan.html.twig"], "search_text": "buildSsmaActionPlanOverflowMenuHtml"}
Result
File: templates/ssma/action_plan/tabs/_tab_action_plan.html.twig
Match lines: 3
1643| function buildSsmaActionPlanOverflowMenuHtml(action) {
1735| '<td class="ssma-ap-child-col--actions">' + buildSsmaActionPlanOverflowMenuHtml(child) + '</td>' +
2077| buildSsmaActionPlanOverflowMenuHtml(action),
code_search
Show Details
Arguments
{"file_patterns": ["templates/ssma/action_plan/tabs/_tab_action_plan.html.twig"], "search_text": "ssmaCanManageOccurrences"}
Result
File: templates/ssma/action_plan/tabs/_tab_action_plan.html.twig
Match lines: 8
112| {% if ssmaCanManageOccurrences|default(false) %}
136|{% if ssmaCanManageOccurrences|default(false) %}
216| ssmaCanManageOccurrences: ssmaCanManageOccurrences|default(false)
220| ssmaCanManageOccurrences: ssmaCanManageOccurrences|default(false)
293| var ssmaCanManageOccurrences = {{ ssmaCanManageOccurrences|default(false) ? 'true' : 'false' }};
1645| var canEdit = ssmaCanManageOccurrences || !!action.can_edit;
1646| var canResolve = !!action.can_resolve || (ssmaCanManageOccurrences && !action.solved && action.validation_status !== 'pending_validation');
1801| if (ssmaCanManageOccurrences && children[0]) {
Request #49
deepseek-v4-flash
P:87.21K C:239 CR:86.78K CW:0
2285ms
Reasoning
The `buildSsmaActionPlanOverflowMenuHtml` is used at line 2077 for rows and 1735 for child tables. Let me read around 2050-2090 to see where the JS menu is used in the main table rendering vs server-side rows.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 2120, "file_path": "templates/ssma/action_plan/tabs/_tab_action_plan.html.twig", "start_line": 2020}
Result
File: templates/ssma/action_plan/tabs/_tab_action_plan.html.twig (Total lines: 2264)
IS_TRUNCATED: false
LINE_RANGE: 2020-2120
2020|
2021| function buildSsmaActionOccurrenceTypeTagHtml(action) {
2022| var label = action && action.occurrence_type_label ? String(action.occurrence_type_label) : '';
2023| if (!label) {
2024| return '<span class="text-muted">—</span>';
2025| }
2026| return '<span class="ssma-shared-tag ssma-shared-tag--sm ssma-ap-occurrence-type-tag">' +
2027| '<span class="ssma-shared-tag-dot"></span>' + ssmaActionPlanEscapeHtml(label) + '</span>';
2028| }
2029|
2030| function buildGoOriginMenuHtml(action, payloadStr) {
2031| if (!actionHasOriginOccurrence(action)) {
2032| return '';
2033| }
2034| return '<a class="dropdown-item js-ssma-action-plan-action" href="#" data-action-id="' + action.id + '" data-action-operation="go-origin" data-action-payload=\'' + payloadStr + '\'><i class="fas fa-eye mr-2"></i>Ir para a ocorrência de origem</a>';
2035| }
2036|
2037| function buildSsmaActionPlanRowCells(action) {
2038| var typeIconRaw = (action.type_icon || 'fa-list-check');
2039| var typeIconClass = typeIconRaw.replace(/fa-solid\s+/g, '').replace(/fa-regular\s+/g, '').replace(/^fa\s+/, '');
2040|
2041| var typeLabel = ssmaActionPlanEscapeHtml(action.type_label || '');
2042| var titleCell =
2043| '<div class="d-flex align-items-start ssma-action-plan-summary" style="gap:12px;">' +
2044| '<span class="js-ssma-action-plan-type-tooltip icon-badge icon-badge-md icon-badge-primary" style="flex:0 0 auto;" title="' + typeLabel + '" data-toggle="tooltip" data-placement="top">' +
2045| '<i class="fa ' + typeIconClass + '" style="font-size:1.1rem;"></i>' +
2046| '</span>' +
2047| '<div class="ssma-action-plan-summary-text">' +
2048| '<div class="ssma-action-plan-title text-truncate d-block js-ssma-action-plan-title-tooltip" data-full-text="' + ssmaActionPlanEscapeHtml(action.title || '') + '">' + ssmaActionPlanEscapeHtml(action.title || '') + '</div>' +
2049| '<div style="font-size:11px;color:#6c757d;">#' + ssmaActionPlanEscapeHtml(String(action.id || '')) + '</div>' +
2050| '<div class="ssma-action-plan-subtitle text-truncate d-block">' + ssmaActionPlanEscapeHtml(action.occurrence_title || '') + '</div>' +
2051| '</div>' +
2052| '</div>';
2053|
2054| var deadlineCell =
2055| '<div class="ssma-action-plan-deadline">' +
2056| '<div class="ssma-action-plan-date">' + ssmaActionPlanEscapeHtml(action.deadline_label || '—') + '</div>' +
2057| '<div class="ssma-action-plan-deadline-tag" style="color:' + (action.deadline_bucket_color || '#8B9199') + ';">' +
2058| ssmaActionPlanEscapeHtml(action.deadline_bucket_label || '') +
2059| '</div>' +
2060| '</div>';
2061|
2062| var takenCell = action.has_project
2063| ? '<div class="ssma-action-plan-taken"><div class="ssma-action-plan-taken-value">' + (action.actions_taken_label || '0/0') + '</div><div class="ssma-action-plan-taken-label">Ações Tomadas</div></div>'
2064| : '<div class="ssma-action-plan-taken-tag"><span class="ssma-shared-tag ssma-shared-tag--neutral"><span class="ssma-shared-tag-dot"></span>Sem Projeto</span></div>';
2065|
2066| return [
2067| titleCell,
2068| ssmaActionPlanEscapeHtml(action.type_label || ''),
2069| buildSsmaActionOccurrenceTypeTagHtml(action),
2070| ssmaActionPlanEscapeHtml(action.occurrence_type_label || ''),
2071| ssmaActionPlanEscapeHtml(action.occurrence_title || ''),
2072| deadlineCell,
2073| action.deadline_sort || '99999999',
2074| ssmaActionPlanEscapeHtml(action.card_status_label || ''),
2075| takenCell,
2076| buildSsmaActionPlanResponsibleIconsHtml(action),
2077| buildSsmaActionPlanOverflowMenuHtml(action),
2078| buildSsmaActionPlanValidationHtml(action)
2079| ];
2080| }
2081|
2082| $(document).off('ssma-action-created.actionPlan').on('ssma-action-created.actionPlan', function (_, actionPayload, actionPlanData) {
2083| if (!actionPlanData) { return; }
2084|
2085| if (!getSsmaActionPlanTableInstance()) {
2086| window.location.reload();
2087| return;
2088| }
2089|
2090| applySsmaActionPlanData(actionPlanData);
2091| });
2092|
2093| $(document).off('ssma-action-resolution-submitted.actionPlan').on('ssma-action-resolution-submitted.actionPlan', function (_, payload, response) {
2094| var actionId = String(payload.action_id);
2095| var isSolved = response ? !!response.solved : true;
2096| var newValidationStatus = (response && response.validation_status) || (isSolved ? '' : 'pending_validation');
2097|
2098| ssmaActionPlanState.actions = $.map(ssmaActionPlanState.actions || [], function (action) {
2099| if (String(action.id) === actionId) {
2100| return $.extend({}, action, {
2101| solved: isSolved,
2102| validation_status: newValidationStatus,
2103| can_resolve: isSolved ? !!action.can_resolve : false
2104| });
2105| }
2106| return action;
2107| });
2108|
2109| var resolvedNow = 0;
2110| var openNow = 0;
2111| $.each(ssmaActionPlanState.actions || [], function (_, a) {
2112| if (a.solved) { resolvedNow++; } else { openNow++; }
2113| });
2114|
2115| ssmaActionPlanState.kpis = $.extend({}, ssmaActionPlanState.kpis, {
2116| resolved_actions: resolvedNow,
2117| open_actions: openNow
2118| });
2119|
2120| rebuildSsmaActionPlanTable(ssmaActionPlanState.actions);
file_read
Show Details
Arguments
{"end_line": 240, "file_path": "templates/ssma/action_plan/tabs/_tab_action_plan.html.twig", "start_line": 200}
Result
File: templates/ssma/action_plan/tabs/_tab_action_plan.html.twig (Total lines: 2264)
IS_TRUNCATED: false
LINE_RANGE: 200-240
200| </span>
201| <div style="min-width: 0;">
202| <div class="ssma-action-plan-recommendation-label mb-1">Recomendação</div>
203| <div class="ssma-action-plan-recommendation-text js-ssma-action-plan-recommendation-text" data-toggle="tooltip">
204| {{ recommendation_text }}
205| </div>
206| </div>
207| </div>
208| </div>
209| </div>
210| </div>
211|
212| <div class="row" id="ssma-action-plan-main-row">
213| {% include 'ssma/action_plan/partials/_action_plan_table.html.twig' with {
214| action_plan_data: action_plan_data,
215| allMembers: allMembers,
216| ssmaCanManageOccurrences: ssmaCanManageOccurrences|default(false)
217| } %}
218| </div>
219| {% include 'ssma/partials/_modal_action_rejected.html.twig' with {
220| ssmaCanManageOccurrences: ssmaCanManageOccurrences|default(false)
221| } %}
222| {% include 'ssma/action_plan/partials/_action_plan_view_offcanvas.html.twig' %}
223|
224| {# Modal: Vincular ação a um plano de ação existente #}
225| <div class="modal fade" id="ssmaLinkProjectModal" tabindex="-1" role="dialog" aria-labelledby="ssmaLinkProjectModalLabel" aria-hidden="true">
226| <div class="modal-dialog modal-dialog-centered" role="document">
227| <div class="modal-content">
228| <div class="modal-header">
229| <h5 class="modal-title" id="ssmaLinkProjectModalLabel">
230| <i class="fas fa-link mr-2"></i>Vincular a um plano de ação
231| </h5>
232| <button type="button" class="close" data-dismiss="modal" aria-label="Fechar">
233| <span aria-hidden="true">×</span>
234| </button>
235| </div>
236| <div class="modal-body">
237| <div id="ssmaLinkProjectLoadingState" class="text-center py-3" style="display:none;">
238| <i class="fas fa-spinner fa-spin mr-1"></i> Carregando planos...
239| </div>
240| <div id="ssmaLinkProjectContent">
Request #50
deepseek-v4-flash
P:89.82K C:4.7K CR:87.42K CW:0
36567ms
Reasoning
Note line 222: `{% include 'ssma/action_plan/partials/_action_plan_view_offcanvas.html.twig' %}` — this is the Ações tab offcanvas (#ssmaActionPlanViewOffcanvas). And row JS `buildSsmaActionPlanOverflowMenuHtml` is used at 2077 for building DataTable rows (the Ações tab table). Also `_action_plan_table.html.twig` included at line 213 with the overflow partial... both present? Possibly table at 213 is a twig-served initial and JS builds rows on interactions. Both menu builders used in the same table's refresh cycle.
So the JS menu (line 1645) still uses ssmaCanManageOccurrences; in the Ações tab initial context, supervisores with can_create na tag → ssmaCanManageOccurrences true (server variable). This means after a JS rebuild, supervisor sees edit/delete again. Meanwhile server-side can_edit for rows (action.can_edit) false. The JS sets canEdit true because ssmaCanManageOccurrences is true → shows edit/delete → user clicks → createAction edit → 403.
Wait actually if ssmaCanManageOccurrences (the server Twig var, not overridden by the new canMutate-based logic) is true for these supervisors with can_create. It is. So yes.
Is this a change this PR introduced? Before this PR, ssmaCanManageOccurrences in the Ações tab matched the backend (edit allowed for supervisors via canAccessSsmaSupervisorSurface/canManage). Now backend blocks supervisors. So this PR must also update the JS menu, but only the Twig partial was updated. That's a concrete incomplete change, worth flagging as medium/high. Given that this JS menu is on `_tab_action_plan.html.twig` (not in the review group), but the fix anchor is the partial in review group.
Actually wait — we should be careful: does canManageSsmaOccurrences() return true for a "Supervisor" tag? It depends on tag canCreate/canEdit/canDelete. Comments at 12750 says supervisor registers inspeções (can_create on prevention product). But canManageSsmaOccurrences checks the current member's SSMA product tag (ssma-occurrences). Supervisors on ssma-occurrences may have can_view only (not canCreate). Then canManageSsmaOccurrences false → JS menu hides. Which supervisors have canCreate on ssma-occurrences? The ssmaProductTagName 'Supervisor' might have canCreate for registering? Actually comment at 12672 says "Registrar ocorrência: Membro não cria (planilha), mesmo com can_create na tag". Hmm this suggests even with can_create on the tag, Membro doesn't register occurrences. And viewer supervisors? Viewers = ROLE_MANAGER_VIEWER maybe? The main "viewer" concept in canMutate blocking is `isSsmaViewer()`. isSsmaViewer() likely means roles/viewer tags (read-only). So isSsmaViewer probably corresponds to users with can_view only.
In canManageSsmaOccurrences, the tag check only returns true if canCreate/canEdit/canDelete. A pure viewer (can_view=1) returns false → ssmaCanManageOccurrences false in JS menu → menu hidden already. Hmm, so the practical scenario for #5 may not materialize if supervisors/viewers never have can_create on ssma-occurrences.
This weakens #5. But canMutate blocks by tag NAME: 'Supervisor de Equipe', 'Supervisor', TAG_SUPERVISOR_AREA — regardless of can flags. Which means if any of those tags has can_create/can_edit (e.g., 'Supervisor de Equipe' may have can_edit for own team actions?), canManageSsmaOccurrences returns true, JS menu shows edit/delete. Before this PR that was consistent. Now blocked by canMutate but JS menu still shows. The controller author deliberately added the name-block because they knew these tags could otherwise pass canManageSsmaOccurrences. So the JS menu divergence is real for those tags with can flags.
I'll present #5 with medium severity and make it about incomplete migration of the second UI consumer (JS menu) rather than claiming supervisors are always affected.
Given limited info, maybe it's cleaner to merge #5 into #1's comment: "a política de mutação agora vive em três pontos: canMutate (servidor), flags de UI (12777-12780) e o menu JS da aba Ações (_tab_action_plan.html.twig:1645) que ainda usa ssmaCanManageOccurrences; os dois últimos podem divergir do backend". This keeps one strong permission comment instead of two overlapping ones. But the instructions say comments pinpointed per issue; two separate comments at different anchors is fine, and previous reviewer flagged high. To reduce noise while covering each, I'll keep #1 (high) on controller Twig override and fold #5's JS menu mention into #1's text. And keep test note as a separate low comment maybe. Actually I'll keep the test comment because permission change without tests is called critical by user rules; low-medium.
Let me also mention in #1 the resolution/deadline meta `can_edit` also uses canMutate so consistent for API, but JS menu not.
Let me also reconcile #1 claim about Gestor de Equipe/Área: The override forces canMutate=true for those tags in UI; but server canMutate doesn't explicitly allow those tags — however in practice Gestor de Equipe/Área probably pass canManageSsmaOccurrences (they manage). If not, 403. Combined with the name-block asymmetry (only supervisor tags named), there's a structural inconsistency: server lists supervisor tags as denied; UI lists gestor tags as allowed. If we want a single source of truth, canMutate should explicitly allow Gestor de Equipe/Área tag names or UI override removed. I'll phrase accordingly, medium-high.
OK now let me also double check the `_action_plan_overflow_menu.html.twig` change uses `ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false))` but for occurrence_view/cause_tree contexts where the flag isn't present, the fallback to ssmaCanManageOccurrences means supervisors still get edit in those contexts if the partial is included elsewhere... it's only in _tab_action_plan. Fine.
One more: The menu `can_resolve_action` now requires ssmaCanMutateActionPlan for non-supervisor users who are not designated can_resolve. But resolve endpoint is allowed for stakeholders (executor) via stakeholder service even for read-only tags? Wait — canCurrentUserResolveSsmaAction uses ssmaStakeholderActionPermissionService->canUserResolveAction(... canManageSsmaOccurrences ...). If supervisor (executor) has can_manage false, stakeholder canUserResolveAction may still allow as responsible. In that case the overflow menu's can_resolve_action for executor supervisor: action.can_resolve is computed server side (resolveActionDeadlineEditMeta can_resolve = canCurrentUserResolveSsmaAction = stakeholder true if executor) → action.can_resolve true → menu shows resolve via `action_item.can_resolve`. Good, resolve remains available for designated executor/validator even if can't mutate (only create/edit/delete blocked). Great, that design intends supervisors can't edit but can resolve/validate their own? Wait no: 'Supervisor só visualiza' per PR description... but canUserResolveAction lets designated responsible resolve. Possibly for a supervisor who is responsible executor on an action, resolving is still allowed (their own task). Not contradictory to "não editar". OK.
Now #2 mine: one nuance - when mineId>0, the scope is replaced with [$mineId=>true], dropping team scope etc. That's intended "only my actions". Good.
Additionally, the pendencias default memberScope from resolveActionPlanPanelMemberScope would already restrict e.g. regular members to their actions, supervisor to team? Let's not dwell.
Now finalize: Let me also verify the anchor snippet text matches the diff exactly (whitespace). For the mine comment the added lines:
```
+ if ($request->query->getBoolean('mine')) {
+ $user = $this->getUser();
+ $member = ($user instanceof User) ? $this->getCurrentCompanyMember($company, $user) : null;
+ $mineId = (int) ($member?->getId() ?? 0);
```
Provide snippet of 2-4 added lines exactly.
For the Twig override anchor added line `$ssmaCanMutateActionPlan = true;`.
Wait, in the file the line is ` $ssmaCanMutateActionPlan = true;` with 12 spaces indentation (inside if). Let me confirm exact indentation from file read: line 12779 ` $ssmaCanMutateActionPlan = true;`. Yes 12 spaces.
For the canMutate method anchor lines 11467-11469:
```
private function canMutateSsmaActionPlan(): bool
{
if ($this->isSsmaViewer()) {
```
Good; added lines.
For service origin options added lines: from the file at lines 214-224:
```
'origin' => [
['value' => '', 'text' => 'Origem'],
['value' => 'accident_personal', 'text' => 'Acidente pessoal'],
['value' => 'accident_material', 'text' => 'Acidente material'],
['value' => 'near_miss', 'text' => 'Quase acidente'],
['value' => 'ros', 'text' => 'ROS'],
['value' => 'inspection', 'text' => 'Inspeção'],
['value' => 'approach', 'text' => 'Abordagem'],
],
```
Need exact indentation (4 spaces + 'origin'? Actually inside array of buildFilterOptions: `'origin' => [` at 12 spaces?). Let me verify from file reading lines 203-227. We haven't read exact lines. The diff hunk shows within `overview_origins` and `origin`. I'll just anchor on the exact diff-added lines as printed in the diff:
From the diff hunk added lines:
```
+ 'origin' => [
+ ['value' => '', 'text' => 'Origem'],
+ ['value' => 'accident_personal', 'text' => 'Acidente pessoal'],
```
That's exact.
For JS offcanvas anchor added lines 2234-2235:
```
setText('ssma-ap-action-view-title', title);
setText('ssma-ap-action-view-id', id ? ('#' + id) : '');
```
Good.
For overflow partial anchor, added line 1 (both lines are replaced/new): entire line:
```
{% set can_edit_action = ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false)) or action_item.can_edit|default(false) %}
```
Now decide final set of comments:
1. high — permission duplication/divergence anchored at `$ssmaCanMutateActionPlan = true;` (SsmaController). Mention server canMutate not recognizing tags by name + JS menu in _tab_action_plan still on ssmaCanManageOccurrences.
Hmm but if I anchor the divergence comment to the Twig override line but then talk about JS menu in another file, that's cross-file but anchored in review file. OK.
2. medium — mine fail-open & double compute. Anchor in controller mine block.
3. medium — offcanvas missing markup (JS). Anchor on setText.
4. low — refusal removed from filter options (service).
5. low — tests absent (controller canMutate method anchor). Perhaps keep only if not too noisy. I think include since rules weight it.
Additionally #6 low about `mine` param applied in buildFilterParams for all views — skip to avoid noise? Include maybe as low? We already have many comments. But it's a valid behavior concern: pendencias header select for origin is also sent to visao_geral (panelState.origin) — stale state. Actually origin for overview branch at 393-395 was added; meaning when on visão geral sub-aba, the origin select isn't visible (pendências header) but panelState.origin persists; that filters overview charts silently. Wait is the filter header for visão geral the same DOM? In _tab_painel, the comment in JS says filters desktop visão geral "mesmo subheader das Pendências" — maybe two sets of controls; syncPendenciasFilterState reads #ap_painel_filter_origem; the overview controls have their own ids with prefix ap_overview_filter_*. Actually panelState.origin is set only from ap_painel_filter_origem. The visao_geral branch (393-395) includes panelState.origin — but who sets panelState.origin for overview? Possibly an overview select with different id sets panelState.origin? In syncOverviewFilterState? Not shown in diff. panelState.origin only from syncPendenciasFilterState. So the visão geral request could include origin from the pendências filter (last selected) even though the user didn't set it for the overview. That might be buggy UX but we can't be sure there's no overview origin control syncing panelState.origin. Actually maybe the overview sub-header shares the same filter ids (the filters HTML at line ~156-180 in template is for Pendências; overview filters presumably separate with same ids? There could be duplicate ids problem too.
Given uncertainty and low value, skip #6.
Let me check template lines 150-200 to see whether overview has its own origin filter control. Actually we saw in template the block is under pendências header. Skip.
Now write comments in pt-BR, per format. Keep them concise.
Comment 1 (high): On line `$ssmaCanMutateActionPlan = true;`.
Content draft:
"Os endpoints de criar/editar ação passaram a exigir `canMutateSsmaActionPlan()`, que nega supervisor pelo nome da tag e, para os demais, delega a `canManageSsmaOccurrences()` — sem liberar Gestor de Equipe/Área pelo nome. Aqui, porém, a tela força essas duas flags para tags 'Gestor de Equipe' e 'Gestor de Área' incondicionalmente. Se a tag do gestor não tiver can_create/edit/delete de ssma-occurrences, ele vê botões de criar/editar no menu e recebe 403 no salvamento; o oposto também ocorre no menu JS da aba Ações (`_tab_action_plan.html.twig`, `buildSsmaActionPlanOverflowMenuHtml`), que continua usando `ssmaCanManageOccurrences` e pode exibir editar/deletar para supervisor que agora é negado no servidor. Recomendo concentrar a política em um único método (ex.: `canMutateSsmaActionPlan()` reconhecer explicitamente Gestor de Equipe/Área) e derivar todas as flags/menus dele."
Hmm, that is long but per format: simple first sentence. Let me write final comments in the tool with content.
Comment 2 (medium) mine: content: "Quando o filtro 'minhas ações' é marcado e o usuário logado não resolve um CompanyMembers da empresa (mineId = 0), o bloco `if` não entra e o payload montado antes (que para gestores/admin é sem restrição) é devolvido como se nada tivesse sido pedido — o filtro falha em silêncio. Para um gestor sem vínculo de membro, marcar 'minhas ações' retorna a lista completa da empresa em vez de vazio. Além disso, quando o membro existe o payload é montado duas vezes (linhas 503 e 527), duplicando a consulta de ações. Sugestão: resolver o escopo de membro antes do primeiro build e, quando o membro não for encontrado, devolver lista vazia (ou 403/erro claro), nunca o escopo sem restrição."
Comment 3 (medium) offcanvas: "O botão 'Visualizar' das pendências chama `openActionViewOffcanvas`, que preenche ids `ssma-ap-action-view-*` e abre `#ssmaApActionView`/`ssmaApActionView-offcanvas-wrapper` — mas nenhum template (nem `_tab_painel.html.twig`, que contém o botão) possui esse markup ou registra `openOffcanvasssmaApActionView`. Na prática, clicar no olho não abre nada e os dados nem são exibidos. É preciso incluir o offcanvas de leitura no template do Painel (pode reutilizar o componente `_modal_offcanvas`/offcanvas já usado na aba Ações e alinhar os ids), senão a feature principal da PR fica inoperante."
Comment 4 (low) refusal: "O seletor de origem novo e o da Visão Geral deixaram de oferecer 'Direito de Recusa', mas `resolveOriginKey()` ainda classifica ações cuja origem contém 'recusa/refusal' como `refusal`. Com isso, essas ações existentes não podem mais ser selecionadas/filtradas — só aparecem em 'Todas' — enquanto no código anterior a opção existia no seletor da Visão Geral. Se a categoria continua existindo no domínio, mantenha a opção (e o seed do gráfico); se foi descontinuada, precisa de migração/justificativa explícita, senão é regressão de filtrabilidade."
Comment 5 (low) tests: "Mudança de política de autorização (quem cria/edita/resolve ação) sem teste automatizado cobrindo os cenários: supervisor negado, gestor/equipe liberado e membro comum negado. Como a regra foi implementada em dois pontos (método do controller + flags de tela), uma regressão silenciosa é provável em PRs futuras. Recomendo um teste de integração no controller/fluxo AJAX (ou no service de permissão) validando os três perfis."
Maybe combine comment 1 & 5 anchors would overlap (same method region) - comment 1 anchors at 12779 (Twig override), comment 5 anchors at canMutate method. OK distinct lines.
Actually also need to double check that anchor "private function canMutateSsmaActionPlan" added lines exist in the diff. The diff added whole method 11459-11483 area; the lines `private function canMutateSsmaActionPlan(): bool` present as new. Good.
Now, regarding severity for comment 1: high. Comment 3: medium (feature inoperante, but only if truly missing; high?). I'll set medium since we can't run the app; but missing markup is objective (searched all templates). Could set high. Actually the feature "Visualizar ação" added in the PR is its own deliverable and would be broken; that's arguably high. But there is a small chance the offcanvas is dynamically created elsewhere (search found nothing). Set high? Previous summary marked medium. I'll keep medium to be safe? Given the review plan says "possible break", and offcanvas is a primary feature of PR, I'll use high for visibility? I'll set medium given prior summary and uncertainty about page-level includes in other modules that we may not have searched (search covered whole repo for both tokens, so none). I'll set high then? Hmm. Let me set medium severity; it's a UX/feature-blocking bug but not data/security.
Let me produce the code_comment calls now. All anchors are new lines in diff. Let's be exact with indentation in `existing_code`.
For the controller Twig override line, added in diff with 12 spaces: ` $ssmaCanMutateActionPlan = true;` — but in the diff the plus line is `+ $ssmaCanMutateActionPlan = true;`. The snippet must match content without the '+' and with leading spaces. We'll give `$ssmaCanMutateActionPlan = true;`? The tool matches the code line as it appears in the file (with indentation). Provide exactly as file line: ` $ssmaCanMutateActionPlan = true;`.
For mine block lines (from file) 522-525:
```
if ($request->query->getBoolean('mine')) {
$user = $this->getUser();
$member = ($user instanceof User) ? $this->getCurrentCompanyMember($company, $user) : null;
```
8 spaces indentation.
For canMutate lines 11467-11470:
```
private function canMutateSsmaActionPlan(): bool
{
if ($this->isSsmaViewer()) {
return false;
}
```
For the service 'origin' added lines in buildFilterOptions: Need exact indentation. Let me read lines 205-230 of the service to copy exact.
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 232, "file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 203}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648) IS_TRUNCATED: false LINE_RANGE: 203-232 203| ['value' => PersonTypeEnum::TERCEIRO, 'text' => 'Terceirizado'], 204| ], 205| 'unit' => $units, 206| 'overview_period' => [ 207| ['value' => 'last_month', 'text' => 'Mês atual'], 208| ['value' => 'last_3_months', 'text' => 'Últimos 3 meses'], 209| ['value' => 'last_6_months', 'text' => 'Últimos 6 meses'], 210| ['value' => 'last_year', 'text' => 'Último ano'], 211| ['value' => 'total', 'text' => 'Todo o período'], 212| ], 213| 'overview_members' => $memberOptions, 214| 'overview_origins' => [ 215| ['value' => '', 'text' => 'Todas'], 216| ['value' => 'accident_personal', 'text' => 'Acidente pessoal'], 217| ['value' => 'accident_material', 'text' => 'Acidente material'], 218| ['value' => 'near_miss', 'text' => 'Quase acidente'], 219| ['value' => 'ros', 'text' => 'ROS'], 220| ['value' => 'inspection', 'text' => 'Inspeção'], 221| ['value' => 'approach', 'text' => 'Abordagem'], 222| ], 223| 'origin' => [ 224| ['value' => '', 'text' => 'Origem'], 225| ['value' => 'accident_personal', 'text' => 'Acidente pessoal'], 226| ['value' => 'accident_material', 'text' => 'Acidente material'], 227| ['value' => 'near_miss', 'text' => 'Quase acidente'], 228| ['value' => 'ros', 'text' => 'ROS'], 229| ['value' => 'inspection', 'text' => 'Inspeção'], 230| ['value' => 'approach', 'text' => 'Abordagem'], 231| ], 232| ];
Request #51
deepseek-v4-flash
P:95.07K C:3.61K CR:94.46K CW:0
22566ms
Reasoning
Good. Anchor for refusal comment: lines 214-223? Use:
```
'overview_origins' => [
['value' => '', 'text' => 'Todas'],
['value' => 'accident_personal', 'text' => 'Acidente pessoal'],
```
But overview_origins block lines 214-222: line 214 is 'overview_origins' => [ which is unchanged? In diff the old line `'overview_origins' => [` existed unchanged; the removed lines are inside; new lines 215-221 are added. Anchor with:
```
['value' => '', 'text' => 'Todas'],
['value' => 'accident_personal', 'text' => 'Acidente pessoal'],
['value' => 'accident_material', 'text' => 'Acidente material'],
```
These are added lines. Good.
Now, let me build all comments in one call.
Also include category/severity/path.
For the JS offcanvas comment, `existing_code` must be a snippet in the diff. Use:
```
setText('ssma-ap-action-view-title', title);
setText('ssma-ap-action-view-id', id ? ('#' + id) : '');
```
Check those lines exist as added in diff: yes within the new function (all added lines).
Also note that in diff, setText block appears as added lines (whole function new). Good.
For the overflow partial (template), new lines:
```
{% set can_edit_action = ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false)) or action_item.can_edit|default(false) %}
{% set can_resolve_action = action_item.can_resolve|default(false) or (ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false)) and not action_item.solved and action_item.validation_status != 'pending_validation') %}
```
I'll not add a comment there separately since I folded #5 into #1.
Final comment list:
1. SsmaController.php high (bug/permission) at line 12779 anchor.
2. SsmaController.php medium (mine) at lines 522-524.
3. public/js/ssma/action_plan_panel.js medium (offcanvas) at lines 2234-2235.
4. SsmaActionPlanPanelService.php low (refusal) at lines 215-217.
5. SsmaController.php low (tests) at canMutate method lines.
Wait — comment #1 and #5 both in SsmaController but different lines. Good.
Actually for comment #1, anchor line `$ssmaCanMutateActionPlan = true;` — single line is okay.
Also should we mention duplicate `$ssmaCanCreateLinkedActions`? No.
Let me now write the code_comment tool call.
Also double-check category values: use 'bug' for permission? Permission divergence maybe 'security'. I'll use 'bug' for mine/offcanvas, 'security' for permission divergence? It's about authorization → 'security'. Tests → 'test'.
Severity: #1 high; #2 medium; #3 medium; #4 low; #5 low.
Wait reconsider #1's certainty once more. Key uncertain scenario: Gestor de Equipe tag lacking can flags on ssma-occurrences → UI override shows buttons but backend denies. Is there any guard to ensure Gestor de Equipe is always canManage? The controller comment at 12750 states ssmaCanManageOccurrences = true via tag for Gestor de Equipe/Área, meaning these tags likely DO have can flags. So the override might be belt-and-braces. But it's still true that the server does NOT explicitly allow Gestor de Equipe/Área by name; and the name-based supervisor block in canMutate strongly suggests tag names matter. The override in UI indicates the author's intent that these tags mutate regardless. This asymmetry is a genuine maintainability/consistency risk with real 403 potential. I'll keep high but word carefully: "se a tag não tiver as permissões can_*, ou se a configuração variar por empresa (tags são configuráveis), o gestor vê botões e leva 403" — permission tags configurable per company makes it real. Yes, permission tags are per-company configurable → divergence real for some companies.
I'll finalize the comment content in pt-BR respecting the required style: start with the practical impact, not the method name.
Let me draft each comment:
#1 (anchor: `$ssmaCanMutateActionPlan = true;`)
"Gestores de Equipe/Área podem ver botões de criar/editar/resolver que o servidor vai negar, ou o contrário, porque a mesma regra de permissão está em dois lugares com critérios diferentes. Aqui a tela libera as tags 'Gestor de Equipe'/'Gestor de Área' incondicionalmente, enquanto o `canMutateSsmaActionPlan()` usado nos endpoints só reconhece essas tags indiretamente (se a tag tiver can_create/edit/delete de ssma-occurrences ou role de gestão). Como as tags são configuráveis por empresa, basta uma empresa configurar o Gestor de Equipe só com leitura para o usuário ver os botões no painel/menu e receber 403 ao salvar. Aproveite para derivar os menus da mesma fonte: o menu JS da aba Ações (`buildSsmaActionPlanOverflowMenuHtml` em `_tab_action_plan.html.twig`) ainda usa `ssmaCanManageOccurrences`, então um supervisor com can_create na tag continua vendo 'Editar/Deletar' mesmo com o backend negando. Sugestão: `canMutateSsmaActionPlan()` deve ser a fonte única (liberando Gestor de Equipe/Área por nome) e todas as flags/menus devem ser derivados dela."
#2 (mine)
"Quando 'Minhas ações' é marcado e o usuário logado não tem vínculo de membro na empresa (mineId = 0), o filtro é silenciosamente ignorado: o payload montado antes do `if`, que para gestores/admin é sem restrição de membro, é devolvido intacto. Na prática, um gestor sem CompanyMembers marcando 'Minhas ações' recebe a lista completa da empresa em vez de lista vazia (ou 403), quebrando a promessa do filtro. De quebra, quando o membro existe o payload é construído duas vezes (linhas 503 e 527), dobrando a carga das ações. Resolva o escopo do membro antes do primeiro build e, sem membro, devolva lista vazia/mensagem clara."
#3 (offcanvas)
"O botão 'Visualizar' adicionado na tabela de Pendências não abre nada: a função preenche ids `ssma-ap-action-view-*` e tenta abrir `#ssmaApActionView`/`ssmaApActionView-offcanvas-wrapper`, mas nenhum template (inclusive `_tab_painel.html.twig`, que contém o botão) define esse markup nem registra `openOffcanvasssmaApActionView`. Resultado: clicar no ícone de olho não exibe os dados da ação — a entrega principal da PR fica inoperante. É preciso adicionar o offcanvas de leitura no template do Painel (reaproveitando o componente usado na aba Ações) e alinhar os ids, ou reutilizar o offcanvas existente da aba Ações (`ssmaActionPlanViewOffcanvas`)."
#4 (refusal)
"Ações de origem 'Direito de Recusa' (recusa/refusal) continuam sendo classificadas como `refusal` pelo `resolveOriginKey()`, mas as opções de filtro de origem (nova e da Visão Geral) não trazem mais essa categoria, que antes existia no seletor da Visão Geral. Com isso, dados antigos desse tipo não podem mais ser isolados por filtro — só aparecem em 'Todas' — sem qualquer migração ou justificativa. Mantenha a opção (e o seed do gráfico) enquanto o valor de domínio existir, ou documente a descontinuação e trate os registros antigos."
#5 (tests)
"Política de permissão alterada (quem cria/edita/resolve ação) sem teste automatizado cobrindo os cenários reais: supervisor negado, gestor de equipe liberado e membro comum negado. Como a regra vive em mais de um ponto e mexe em rotas de mutação, uma regressão silenciosa é provável. Adicione teste de integração (controller/AJAX ou service de permissão) validando os três perfis antes do merge."
Now, code_comment requires each item to include 'content', 'existing_code', 'category', 'severity', 'path'. Optionally 'suggestion_code'. I'll skip suggestion_code.
Let me issue the tool call with all comments.
Double-check that the anchor for #2 (mine block lines) matches diff-added lines exactly:
From diff:
```
+ if ($request->query->getBoolean('mine')) {
+ $user = $this->getUser();
+ $member = ($user instanceof User) ? $this->getCurrentCompanyMember($company, $user) : null;
+ $mineId = (int) ($member?->getId() ?? 0);
```
Use first 2-3 lines. Provide:
```
if ($request->query->getBoolean('mine')) {
$user = $this->getUser();
$member = ($user instanceof User) ? $this->getCurrentCompanyMember($company, $user) : null;
```
Yes 8-space indent matches file.
#1 anchor line 12779: exactly ` $ssmaCanMutateActionPlan = true;` 12 spaces.
Let's do it.
Tool Calls (1)
code_comment
Show Details
Arguments
{"comments": [{"content": "Gestores de Equipe/Área podem ver botões de criar/editar/resolver que o servidor vai negar (ou o contrário), porque a mesma regra de permissão passou a viver em dois pontos com critérios diferentes. Aqui a tela força as flags para as tags \"Gestor de Equipe\"/\"Gestor de Área\" incondicionalmente, enquanto o método usado nos endpoints (`canMutateSsmaActionPlan()`) só libera essas tags indiretamente — se a tag tiver can_create/edit/delete de ssma-occurrences ou role de gestão. Como as tags de permissão são configuráveis por empresa, basta uma empresa configurar Gestor de Equipe só com leitura para o usuário ver os botões no menu e receber 403 ao salvar. A migração também ficou incompleta no menu JS da aba Ações (`buildSsmaActionPlanOverflowMenuHtml`, em `_tab_action_plan.html.twig`), que ainda usa `ssmaCanManageOccurrences` e pode exibir Editar/Deletar para um supervisor que agora é negado no servidor. Sugestão: fazer de `canMutateSsmaActionPlan()` a fonte única da política (liberando Gestor de Equipe/Área por nome) e derivar todas as flags e menus dela.", "existing_code": " $ssmaCanMutateActionPlan = true;", "category": "security", "severity": "high", "path": "src/Controller/SsmaController.php"}, {"content": "Quando \"Minhas ações\" é marcado e o usuário logado não tem vínculo de membro na empresa (mineId = 0), o filtro é silenciosamente ignorado: o payload montado antes do `if` — que para gestores/admin é sem restrição de membro — é devolvido intacto. Na prática, um gestor sem CompanyMembers marcando \"Minhas ações\" recebe a lista completa da empresa em vez de lista vazia ou erro, quebrando a promessa do filtro. De quebra, quando o membro existe o payload é construído duas vezes (linhas 503 e 527), dobrando a carga das ações no mesmo request. Resolva o escopo do membro antes do primeiro build e, quando não houver membro, devolva lista vazia (ou mensagem clara), nunca o escopo sem restrição.", "existing_code": " if ($request->query->getBoolean('mine')) {\n $user = $this->getUser();\n $member = ($user instanceof User) ? $this->getCurrentCompanyMember($company, $user) : null;", "category": "bug", "severity": "medium", "path": "src/Controller/SsmaController.php"}, {"content": "O botão \"Visualizar\" adicionado na tabela de Pendências não abre nada: a função preenche ids `ssma-ap-action-view-*` e tenta abrir `#ssmaApActionView`/`ssmaApActionView-offcanvas-wrapper`, mas nenhum template (inclusive `_tab_painel.html.twig`, que contém o botão) define esse markup nem registra o abridor `openOffcanvasssmaApActionView`. Resultado: clicar no ícone de olho não exibe os dados da ação — a entrega principal da PR fica inoperante. É preciso incluir o offcanvas de leitura no template do Painel (reaproveitando o componente de offcanvas já usado na aba Ações) e alinhar os ids, ou reutilizar o offcanvas existente da aba Ações (`ssmaActionPlanViewOffcanvas`).", "existing_code": " setText('ssma-ap-action-view-title', title);\n setText('ssma-ap-action-view-id', id ? ('#' + id) : '');", "category": "bug", "severity": "medium", "path": "public/js/ssma/action_plan_panel.js"}, {"content": "Ações de origem \"Direito de Recusa\" (recusa/refusal) continuam sendo classificadas como `refusal` pelo `resolveOriginKey()`, mas as opções de filtro de origem — a nova e a da Visão Geral — não trazem mais essa categoria, que antes existia no seletor da Visão Geral. Com isso, dados antigos desse tipo não podem mais ser isolados por filtro, só aparecem em \"Todas\", sem migração ou justificativa na PR. Mantenha a opção (e o seed do gráfico) enquanto o valor de domínio existir, ou documente a descontinuação e trate os registros antigos de forma explícita.", "existing_code": " ['value' => '', 'text' => 'Todas'],\n ['value' => 'accident_personal', 'text' => 'Acidente pessoal'],\n ['value' => 'accident_material', 'text' => 'Acidente material'],", "category": "bug", "severity": "low", "path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php"}, {"content": "Política de permissão alterada (quem cria/edita/resolve ação, com bloqueio explícito de supervisor/viewer) sem teste automatizado cobrindo os cenários reais: supervisor negado, gestor/equipe liberado e membro comum negado. Como a regra foi implementada em mais de um ponto e protege rotas de mutação, o risco de regressão silenciosa em PRs futuras é alto. Adicione um teste de integração no fluxo do controller/AJAX (ou no service de permissão) validando os três perfis antes do merge.", "existing_code": " private function canMutateSsmaActionPlan(): bool\n {\n if ($this->isSsmaViewer()) {\n return false;\n }", "category": "test", "severity": "low", "path": "src/Controller/SsmaController.php"}]}
Result
(async)
Request #52
deepseek-v4-flash
P:98.7K C:1.82K CR:98.56K CW:0
14887ms
Reasoning
Comments placed. Let me verify all five review files got their pass:
1. public/js/ssma/action_plan_panel.js — reviewed (offcanvas comment, plus visual verification of mine param, buildFilterParams, openActionViewOffcanvas, table row html). Comment placed there. ✓
2. src/Controller/SsmaController.php — reviewed (mine block, permission divergence, canMutate; placed 3 comments). ✓
3. src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php — reviewed (origin keys, filter options, origin filter, presentSeededOriginChart, resolveOriginUrl, executors/validators); refusal comment placed. ✓
4. templates/ssma/action_plan/partials/_action_plan_overflow_menu.html.twig — reviewed; covered within the permission comment (migration incomplete); should I place a comment on this file itself? The change from ssmaCanManageOccurrences to ssmaCanMutateActionPlan with a fallback default. The fallback default(ssmaCanManageOccurrences) preserves old behavior when new flag missing — in contexts that include this partial without the new flag (i.e., only via _action_plan_table from _tab_action_plan which DOES pass it through global). Actually is ssmaCanMutateActionPlan accessible as a global in templates included via context? It's passed through buildSsmaViewData rendering vars to the template root, then included partials inherit context. _tab_action_plan is rendered from buildSsmaViewData → has the var. Fine.
Hmm, but the overflow partial uses fallback `|default(ssmaCanManageOccurrences|default(false))` — for contexts where new flag isn't set. In `_action_plan_table` (only consumer) rendered from _tab_action_plan, the new flag is available. So the fallback matters only if some other page includes the table directly. There's also line 333 in _action_plan_table (second usage). OK, no additional comment needed. The file has been reviewed though not flagged on its own — I should still give it its own pass mentally: The partial change mirrors the controller flag change; consistent with the new variable naming. But in case `action_item.can_edit` false for supervisors and new flag false → menu correctly hides. When new flag undefined elsewhere, fallback restores old (canManage) behavior → could diverge. But since only consumer is the action plan tab (has the flag), acceptable.
I did not place a comment targeting the twig partial file directly. Given rule "give every file its own pass" — the file itself is small; the issue about menu migration anchors to _tab_action_plan (outside review). I might place a low comment directly on the overflow partial lines to note the sibling JS menu not updated and the fallback divergence? My high comment #1 already mentions the JS menu; but it's anchored in SsmaController. The tooling allows cross-file content but the comment should be placed in file where the issue exists. The issue for the menu is really in `_tab_action_plan.html.twig` (not in review). Anchoring on `_action_plan_overflow_menu` is legitimate: the fix was applied here but the equivalent menu builder elsewhere wasn't. I think it's cleaner to add one comment on the partial to make the incomplete migration visible in the diff. Let me add a short medium/low comment on the overflow partial lines.
Actually, I want to be careful not to over-comment. But the review instructions: "Cross-file observations within <review_files> are encouraged — look for inconsistencies, missing updates." An inconsistency: the server-rendered menu uses new policy, but the JS-built menu in the same tab doesn't. That's precisely an inconsistency in the reviewed change. I'll add it on the partial.
5. templates/ssma/action_plan/tabs/_tab_painel.html.twig — reviewed. It adds the origin select, mine checkbox, columns. Any issue? The mine checkbox label "Minhas ações" custom-switch. This is standard markup using existing classes; fine. The select fallback list (default options in Twig) duplicates backend options — maintainability but low. Could mention that filter options are duplicated between Twig default and backend options list (two sources of truth for option values, must be kept in sync) — but the template uses `panel_filters.origin|default([...])`, so backend normally supplies them; the fallback array duplicates values. That's acceptable as a fallback. Skip.
Given the review task, the previous summaries indicated the off-canvas naming divergence anchored in _tab_action_plan.html.twig:1638 which is NOT in the review group; anchored instead in JS. Done.
Let me add the partial comment about the JS menu inconsistency.
Actually, wait: I already covered this in the controller comment. Adding another comment repeating the JS menu issue on a different file might be redundant but each comment must be anchored in its own file for the respective issue. The partial's own issue: it now uses `ssmaCanMutateActionPlan` with fallback to `ssmaCanManageOccurrences`. Because the fallback reintroduces old semantics where the flag isn't passed, contexts that still render this partial without the new flag keep allowing supervisors. But the only consumer passes the flag, so this is not a real issue. I'll skip a separate comment for the partial to avoid a false positive, since the actual gap is in `_tab_action_plan.html.twig` (outside group). The JS menu point is already embedded in comment #1 anchored on the controller.
However, per "give every file its own pass", I should confirm I considered it - yes, I've reviewed its two lines.
Now, did I review every file for the mine param being sent on all views (issue #6 low)? I decided to skip. That's acceptable.
Everything is in place. Call task_done.
Comentários de revisão registrados. Resumo do que foi analisado por arquivo:
- **`public/js/ssma/action_plan_panel.js`** — verificado `buildFilterParams`, `syncPendenciasFilterState`, `buildPendenciasTableRowHtml` (escape via `escapeHtml` aplicado a atributos/URLs) e o novo `openActionViewOffcanvas`. Confirmado que os ids `ssma-ap-action-view-*`/`ssmaApActionView` e o abridor `openOffcanvasssmaApActionView` não existem em nenhum template — comentário de média prioridade registrado.
- **`src/Controller/SsmaController.php`** — confirmado o filtro `mine` fail-open quando o membro não resolve (e o payload montado duas vezes), além da divergência de política entre `canMutateSsmaActionPlan()` e os overrides das flags de UI para Gestor de Equipe/Área (com o menu JS da aba Ações ainda em `ssmaCanManageOccurrences`). Também sinalizada a ausência de teste para a mudança de autorização.
- **`src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php`** — confirmado que `resolveOriginKey()` ainda classifica ações como `refusal`, que o filtro de pendências por `origin` usa comparação por chave e que `presentSeededOriginChart()` preserva categorias extras com contagem > 0 (sem regressão no gráfico); a regressão real está nas opções de filtro, comentário de baixa prioridade registrado.
- **`templates/ssma/action_plan/partials/_action_plan_overflow_menu.html.twig`** — a migração para `ssmaCanMutateActionPlan` está correta no partial; a inconsistência remanescente (menu JS da aba Ações) foi tratada no comentário de permissões do controller, pois o ponto exato da divergência está fora do grupo de revisão.
- **`templates/ssma/action_plan/tabs/_tab_painel.html.twig`** — filtros (Origem/Minhas ações) e colunas novas conferidos; sem problemas adicionais além dos apontados (ex.: botão de visualizar sem offcanvas correspondente).
Tool Calls (1)
task_done
Show Details
Arguments
{"state": "DONE"}
Request #53
deepseek-v4-flash
P:22.11K C:5.88K CR:15.49K CW:0
38693ms
Reasoning
Let me review the code changes carefully. The review files are:
1. `public/js/ssma/action_plan_panel.js`
2. `src/Controller/SsmaController.php`
3. `src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php`
4. `templates/ssma/action_plan/partials/_action_plan_overflow_menu.html.twig`
5. `templates/ssma/action_plan/tabs/_tab_painel.html.twig`
There are already confirmed findings (1-5) that I should NOT repeat:
1. JS: openActionViewOffcanvas doesn't find markup.
2. PHP: ssmaCanMutateActionPlan duplicated logic issue (screen flags forced for team/area gestor).
3. PHP: mine filter silently ignored when mineId = 0.
4. PHP: permission policy change without tests.
5. PHP: refusal origin category removed from filter options.
I need to review all files and find other real issues. Let me start by reading the files for context.
Let me analyze each file's diff carefully.
### File 1: `public/js/ssma/action_plan_panel.js`
Diff additions:
- `mine: false` in panelState.
- `params.set('origin', panelState.origin)` in filter building.
- `params.set('mine', '1')` if `panelState.mine`.
- `formatPeopleNames` function.
- `buildPendenciasTableRowHtml` builds new columns with executors, validators, origin button.
- `syncPendenciasFilterState` reads `#ap_painel_filter_origem` and `#ap_painel_filter_mine`.
- Change event listener now includes `#ap_painel_filter_origem` and mine checkbox.
- `openActionViewOffcanvas` function.
- `bindTableViewButtons` calls `openActionViewOffcanvas`.
Let me examine some aspects:
1. In `buildPendenciasTableRowHtml`:
```js
var originUrl = row.origin_url || '';
var executorNames = formatPeopleNames(row.executors || row.responsible || []);
var validatorNames = formatPeopleNames(row.validators || []);
var originBtn = originUrl
? '<a class="ssma-ap-panel-table-action-btn" href="' + escapeHtml(originUrl) + '" title="Ir para origem" aria-label="Ir para origem">'
+ '<i class="fas fa-external-link-alt" aria-hidden="true"></i></a>'
: '';
```
Then:
```js
+ '<td>' + buildResponsibleStackHtml(row.executors || row.responsible) + '</td>'
+ '<td>' + buildResponsibleStackHtml(row.validators || []) + '</td>'
```
Wait, `buildResponsibleStackHtml` — I need to check that function. Note that `row.executors` returned from backend is `resolveResponsibleDisplay(...)`, which returns names? Let me check. In service, `'executors' => $this->resolveResponsibleDisplay(...)`. In the old code the table used `buildResponsibleStackHtml(row.responsible)`. Now `row.executors` value is the same as `row.responsible` (both call resolveResponsibleDisplay). So `buildResponsibleStackHtml` expects... maybe array of person objects? Let me read the JS file to understand.
Also `formatPeopleNames` uses `person.name || person.initials`, implying people are objects. And `buildResponsibleStackHtml(row.executors || row.responsible)` — if executors is array of objects with name/initials, then buildResponsibleStackHtml probably builds stacks. OK.
But wait — data attributes on button: `data-action-executors` value is `executorNames` (joined comma names), then `openActionViewOffcanvas` reads attribute and sets text. That's fine.
Potential issue: `originUrl` placed in an attribute escaped with escapeHtml. Fine.
2. `panelState.origin = getSelectValue('ap_painel_filter_origem');` inside `syncPendenciasFilterState`. `getSelectValue` likely returns '' if no element. Fine.
3. There's a subtle bug maybe: `panelState.origin` filter param set when `view === 'pendencias'`? Let's look at the diff context: In `buildPanelFilterParams` (or similar), we have:
```js
if (panelState.axis) {
params.set('axis', panelState.axis);
}
if (panelState.origin) {
params.set('origin', panelState.origin);
}
} else if ((view || currentView) === 'visao_geral') {
```
So the origin param is added in the `view === 'pendencias'` branch presumably.
Then:
```js
if (panelState.mine) {
params.set('mine', '1');
}
return params;
```
The `mine` param is added regardless of view. Hmm—if a user is on another view (e.g., visao_geral) and `panelState.mine` is true from prior pendencias selection? Well, `mine` is a property of panelState updated only in syncPendenciasFilterState; the filter only exists in pendencias sub-header? Actually there is a filter for pendencias and visao_geral both in the template? The checkbox `ap_painel_filter_mine` is in the pendencias filter. So state only meaningful there. But if `view` changes, `mine` might still be set... but probably fine. However, the `mine` flag is added to all views (params always get mine='1' if set), meaning if a user goes to visao_geral after toggling mine in pendencias, requests to visao_geral will include mine=1. If the backend handler for visao_geral ignores 'mine', fine. This is potential minor. Not significant.
4. `openActionViewOffcanvas` sets text via `document.getElementById`; if elements not exist, no-op. Already finding #1 covers that the markup doesn't exist.
Actually the confirmed finding #1 says the button opens nothing because no template defines markup `ssmaApActionView-offcanvas-wrapper` etc. That is a bug already reported. But we shouldn't repeat. Wait, but if the offcanvas markup is added in another file not in this review group? The confirmed finding says "nenhum template (inclusive _tab_painel.html.twig, que contém o botão) define esse markup". So it was already verified. Don't repeat.
Let me look for new issues in the JS.
Check `escapeHtml` usage: `data-action-origin-url="' + escapeHtml(originUrl) + '"'`. originUrl comes from backend `resolveOriginUrl`, which is internal URL path - safe but escaping okay.
Now let's check the `mine` filter semantics in JS: `panelState.mine = !!(mineEl && mineEl.checked);` OK.
Now, another consideration: When clicking "Visualizar", the button opens offcanvas with data attributes. But confirmed finding says offcanvas markup missing. Also origin button click may navigate. Fine.
Wait — Actually, let me re-check: the offcanvas function tries to call `window.openOffcanvasssmaApActionView` — defined somewhere? Search maybe in templates. Already finding #1 verified not present. Not repeating.
Now check JS for bug in `buildPendenciasTableRowHtml` — new columns added but the header also updated in template (5 columns + 1 = 6 data columns plus Actions). Let's compare: header columns in template: Título, Origem, Gerência, Prioridade, Quem executa, Quem valida, Prazo, Pendência, Ações. The row builder: title, origin icon, management/location, priority, executors, validators, deadline, pending, actions. Matches.
Wait, template title columns: 'Quem executa', 'Quem valida' were added. But the row is now built with `row.executors || row.responsible`. OK.
Hmm, potential issue: `formatPeopleNames(row.executors || row.responsible || [])` — if executors is array of person objects with `name` and `initials`, fine. But `resolveResponsibleDisplay` in the service returns an array of... Let me check what it returns. It might return array of {id, name} or strings. Let me read service to see.
Let me read the service file to verify `resolveResponsibleDisplay` return type and how `buildResponsibleStackHtml` works in JS. Both the old `responsible` and new `executors` use it, so it's consistent.
Let me read actual code to confirm.
### File 2: SsmaController.php
Diff additions:
- AJAX endpoint filter for `mine`.
- `canMutateSsmaActionPlan()` method replacing `canManageSsmaOccurrences()` in create action check.
- Presentation of flags.
- `canCurrentUserEditSsmaAction` uses `canMutateSsmaActionPlan`.
- `canCurrentUserResolveSsmaAction` uses `canMutateSsmaActionPlan` for `$canManage`.
Potential issues to explore:
- In the create/edit `saveActionPlan` handler (line ~7977): changing guard to `canMutateSsmaActionPlan()`. But then later in code, there may be other checks using `canManageSsmaOccurrences()` that still allow supervisors to mutate... but probably fine.
- The rule with team/area gestor override: The method `canMutateSsmaActionPlan()` returns false for supervisors/viewer tags and then `return $this->canManageSsmaOccurrences();`. But "Gestor de Equipe/Área continua podendo mutar" comment says they can mutate via `canManageSsmaOccurrences()`. Actually `canMutateSsmaActionPlan` calls `canManageSsmaOccurrences()` at the end, which presumably returns true for gestor de equipe? Hmm. The confirmed finding #2 covers the duplication in template flags where team/area gestor flags are forced true regardless.
Let me analyze `mine` filter block more:
```php
if ($request->query->getBoolean('mine')) {
$user = $this->getUser();
$member = ($user instanceof User) ? $this->getCurrentCompanyMember($company, $user) : null;
$mineId = (int) ($member?->getId() ?? 0);
if ($mineId > 0) {
$payload = $this->ssmaActionPlanPanelService->buildFilterPayload(...);
}
}
```
Confirmed finding #3: when mineId = 0 the payload built before is returned (i.e., filter ignored). Already reported.
But there is another subtlety: When `mine` is true and mineId > 0, the controller rebuilds `$payload` overriding the one built earlier. But `$payload` was computed with default params before. Actually they override when mine is checked. OK.
Now, is there a concern that when 'mine' is set, `buildFilterPayload` is called twice (once before, once after) duplicating work? Only when mine > 0. That's an efficiency issue but minor.
Another point: The `mine` param only applies if member exists. The endpoint query `getBoolean('mine')`. Fine.
Now let me consider the bigger concern: the buildFilterPayload has many args; they need to match. Let me look at the existing buildFilterPayload call earlier in the function to compare parameter ordering. The code added before `$filterOptions`:
Earlier presumably:
```php
$payload = $this->ssmaActionPlanPanelService->buildFilterPayload(
$scopeCompanies,
$dataCompany,
$view,
$period,
$axis,
$team,
$vinculo,
$this->getActionTypeMetadata(),
??? members
$page,
$perPage,
...
);
```
We need to read the actual function to verify the parameter list and that the second call passes `[$mineId => true]` in the right position (members?). In the added code: parameters are:
1. $scopeCompanies
2. $dataCompany
3. $view
4. $period
5. $axis
6. $team
7. $vinculo
8. $this->getActionTypeMetadata()
9. [$mineId => true]
10. $page
11. $perPage
12. trim management
13. trim area
14. trim exec_responsible
15. trim val_responsible
16. trim origin
I need to read the file to compare with the first call. Let me read around lines 460-540.
### File 3: Service
Diff additions:
- origin filter in pendencias branch of buildFilterPayload.
- filter options with origin options.
- query selects more fields.
- build filter options include 'overview_origins' & 'origin'.
- payload per action row adds executors, validators, origin_label, description, origin_url.
- `resolveOriginKey` logic changed: `QUASE`, `PESSOAL`, `MATERIAL`, etc.
- `resolveOriginLabel` map.
- `resolveOriginIcon` map.
- `resolveOriginUrl` new.
- `presentSeededOriginChart` seed.
Potential issues:
1. In `buildPendenciasTableRowHtml`, validators uses `buildResponsibleStackHtml(row.validators || [])`. But if validators empty, `resolveResponsibleDisplay([])` returns [] and formatPeopleNames returns '—'. But in row, `buildResponsibleStackHtml(row.validators || [])` — if empty array, what does buildResponsibleStackHtml render? Might render empty cell or '—'. Need to see the JS function.
2. Origin filter: In service buildFilterPayload 'pendencias' section, it filters by origin after deadline filter:
```php
if ($originFilter !== '') {
$filtered = array_values(array_filter(
$filtered,
fn (array $action): bool => $this->resolveOriginKey(
(string) ($action['origem'] ?? ''),
(string) ($action['event_type'] ?? '')
) === $originFilter
));
}
```
Note `$action['origem']` etc keys — in pendencias list from fetch, array keys? Let's see the fetch SQL selects `a.origem`, `e.type AS event_type`. But the row is normalized in `fetchPendencias...`? There may be an intermediate `$result[]` array with keys 'origem' and 'event_type'. Yes. So fine.
But wait — where is this filter applied? It says "// pendencias (default)". Actually `$view` could be 'pendencias' or 'visao_geral' or 'actions'? The filter is inside the pendencias branch. But the JS sets origin param only for view==='pendencias' (first branch). Wait the JS code where origin param set: it is inside `if (view === 'pendencias')`? Let's re-read diff:
```
@@ -379,6 +380,9 @@
if (panelState.axis) {
params.set('axis', panelState.axis);
}
+ if (panelState.origin) {
+ params.set('origin', panelState.origin);
+ }
} else if ((view || currentView) === 'visao_geral') {
```
So the origin param only added in the pendencias (view === 'pendencias') branch. But the filter UI exists in both Pendencias and Visão Geral subheaders? In template, the select `ap_painel_filter_origem` appears in Pendencias filters. There's also an overview origins filter that existed in Visão Geral (overview_origins). The overview uses `panelState.overviewOrigin` probably. Not relevant.
3. Origin option list changes: 'overview_origins' changed values from accident/inspection/approach/ros/refusal to the new keys, with text 'Todas'. But is the overview filter consuming origin keys as `accident_personal`, etc.? And does the overview chart/present use new keys? There's a `resolveOriginKey` mapping from old keys to new keys in label/icon maps (they keep 'accident' as fallback). But the seed `presentSeededOriginChart` only includes new keys. If there's other code counting origins by old keys (e.g., 'accident'), those counts would fall into default? Actually seed loop `foreach ($originCount as $key => $row) { if (isset($seed[$key])) ... }`. If originCount has key 'accident' (old), then seed doesn't include it and count lost. But the service now resolves keys to new values before counting? Need to check where originCount computed. Possibly `resolveOriginKey` used to aggregate. Let me read the service around those lines to see how the counts are computed, e.g. function that builds `$originCount`.
Wait, the concern: resolveOriginKey for 'QUASE_ACIDENTE' now returns 'near_miss' instead of 'accident'. Good. For legacy event types maybe fine.
But there's an interesting ordering bug in `resolveOriginKey`:
```php
$event = strtoupper(trim($eventType));
if (str_contains($event, 'QUASE') || $event === (defined(...) ? SsmaEvent::TYPE_QUASE_ACIDENTE : 'QUASE_ACIDENTE')) {
return 'near_miss';
}
if (str_contains($event, 'PESSOAL') || str_contains($event, 'PERSONAL')) {
return 'accident_personal';
}
if (str_contains($event, 'MATERIAL')) {
return 'accident_material';
}
if (str_contains($event, 'ACIDENTE')) {
return 'accident_personal';
}
```
Check: the constant for QUASE_ACIDENTE is maybe 'QUASE_ACIDENTE'. And strtoupper check 'QUASE' first catches QUASE_ACIDENTE. OK.
But what about an event type like "ACIDENTE MATERIAL" — does it contain 'MATERIAL'? Yes, returns accident_material (checked after PESSOAL/PERSONAL). Good, since MATERIAL check is before generic ACIDENTE check. What about "ACIDENTE PESSOAL"? Contains PESSOAL → accident_personal before generic ACIDENTE. Good. What about a type that contains both PESSOAL and MATERIAL? Not likely.
What about "ACIDENTE" generic (no qualifier)? returns accident_personal. Reasonable.
Now, but the filter options list includes both overview and pendencias? Actually, the filter origin list used by the table filter is in template via `panel_filters.origin`, matching service's 'origin' key. And options match resolveOriginKey values: accident_personal, accident_material, near_miss, ros, inspection, approach. Wait template fallback list lacks 'refusal'; service list too. Confirmed finding #5 mentions refusal removed. Already reported.
Hmm what about missing 'refusal' from `presentSeededOriginChart`? The seed removed 'refusal' too! Previously chart seed had 'refusal'? Actually earlier seed had refusal? diff shows removed 'refusal' from seed. Wait seed removed: 'accident','refusal' and 'occurrence'? Actually the original seed: accident, inspection, ros, approach, refusal. New seed: accident_personal, accident_material, near_miss, inspection, ros, approach. So 'refusal' removed, 'accident' replaced.
If any origin count with key 'refusal' exists (from resolveOriginKey returning 'refusal' for recusa/refusal), then presentSeededOriginChart won't display it because not in seed; counts lost. But the JS chart may still show that slice? Actually seed loop only adds known keys; 'refusal' key would be dropped. That could hide Direito de Recusa data in the Visão Geral origin chart. Is that part of Visão Geral? The change is on chart seed in the service for overview. But overview options removed refusal too. This relates to confirmed finding #5 (option categories removed) — but seed removal is a distinct manifestation? #5 said "as opções de filtro de origem — a nova e a da Visão Geral — não trazem mais essa categoria". So it covers filter options. The chart seed removal means 'refusal' count no longer appears in chart either. Might be same root cause; but could be a separate finding: Visão Geral chart hides recusa counts. Hmm but maybe same. Let me not repeat; maybe mention as separate? Careful: The confirmed finding #5 states filter options removed the category, and actions classified as 'refusal' can't be filtered. The chart seed removal is a related consequence but different code. I could raise it as additional nuance? Given rules "Do not repeat them", better to focus on new issues not covered. The seed removal is arguably part of the same "refusal category dropped" issue. I'll consider whether to add a new comment about the origin URL or the resolver.
4. `resolveOriginUrl`:
```php
if ($originKey === 'inspection' && $origemId > 0) {
return '/manager/ssma/inspections/' . $origemId . '/view';
}
```
Potential issue: hardcoded URL paths in a service, vs route generation. It's a maintainability point but routes may be correct. Hardcoding may break if route changes. Rules say business-related hardcoded strings are prohibited especially URL paths. This is a URL path. But it's in backend service. Hmm, worth flagging as low/medium: should use router (generate URL) rather than hardcoding. In Symfony, the service could use the Router. Since controller has access. But service-level hardcoded URLs. Could be flagged as maintainability (medium/low). Let me verify routes exist: `/manager/ssma/inspections/...`. Hard to verify route naming without searching. Let's search routes.
Actually it may be fine. But `'/manager/ssma/ocorrencias?event=' . $eventId` as a URL with query param - If eventId is an int, safe.
5. Now a bigger correctness bug candidate: In `buildPendencias...` (service row payload), `validators` is built from `validator_member_id` single id. But `resolveResponsibleDisplay` expects ids array of member ids, returns names? Let's read it. And the JS `formatPeopleNames` expects objects with name/initials. But if `resolveResponsibleDisplay` returns array of strings (names), then `person.name` would be undefined → uses `person.initials` undefined → returns ''. But they filter Boolean and join. Wait if it returns strings, String(person.name || person.initials) is `String(undefined)` = "undefined"? Actually `(person && (person.name || person.initials))` — if person is a string, person.name is undefined → `undefined || undefined` = undefined → `String(undefined)` = "undefined" which is truthy! Then name would be "undefined" string — filtered Boolean includes "undefined"! Hmm. But need to see resolveResponsibleDisplay's return type. Let me read.
But note `buildResponsibleStackHtml(row.responsible)` was used before with `responsible` field = `resolveResponsibleDisplay(...)`, so its return type must be array of objects (person: {name, initials}) for the stack html to render. So `executors` same type. So formatPeopleNames(person.name || person.initials) fine.
Let me read files to confirm.
6. In the row: `'origin_label' => $origemLabel,` but wait: they compute `$originLabel = $origemLabel ?: 'Outro';` AFTER the array. Let's see order.
```php
'origin_label' => $origemLabel,
...
'description' => ...,
'origin_url' => ...,
];
$originLabel = $origemLabel ?: 'Outro';
```
Hmm — they put `'origin_label' => $origemLabel` before assigning `$originLabel = $origemLabel ?: 'Outro'`; if `$origemLabel` is '' or null (default), then origin_label would be '' empty, while chart key shows 'Outro'. And in the JS button, `data-action-origin` = `row.origin_label || row.occurrence_title || ''`. If origin_label empty and occurrence_title present (occurrence may be from an event?) then fallback used. Actually row.origin_label is included in buildPendenciasTableRowHtml as the data attribute origin; else JS reads attr with default '—'. Hmm.
Wait, in the JS diff, in buildPendenciasTableRowHtml:
```js
+ ' data-action-origin="' + escapeHtml(row.origin_label || row.occurrence_title || '') + '"'
```
The row passed is from service `presentPendencias` result? Let's see what field names: 'origin_label', plus 'origem' maybe. But JS refers to `row.occurrence_title`, which may not exist in the response... Actually maybe tableData rows have occurrence_title? Not sure. Let me read the JS to see full row builder and where data comes from, to check keys used (description, pending, deadline, etc.) exist in service response.
Let me now read files for ground truth. Let me start reading.
### Plan
Read the relevant snippets:
- SsmaActionPlanPanelService around buildFilterPayload (lines ~100-300), fetch query (230-300), row mapping (~650-720), resolveOriginKey area (~1320-1450).
- JS action_plan_panel.js around the functions: getSelectValue, syncPendenciasFilterState, buildPanelFilterParams, buildResponsibleStackHtml, formatPeopleNames, openActionViewOffcanvas, escapeHtml.
- SsmaController around lines 480-560 and the presenter flags & permission helpers.
Let me do these reads.
Also check template `_tab_painel.html.twig` for the pendencias filter and table headers, and confirm new columns' HTML.
Let me begin reading.
Tool Calls (2)
file_read
Show Details
Arguments
{"file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 80, "end_line": 300}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648)
IS_TRUNCATED: false
LINE_RANGE: 80-300
80| $area,
81| $execResponsible,
82| $valResponsible,
83| $originFilter,
84| $meta
85| );
86|
87| [$prevFrom, $prevTo] = $fromStr !== null
88| ? $this->comparisonPeriodResolver->resolveYmd($fromStr, $toStr, fn (): int => count($filtered))
89| : [null, null];
90| $prevFiltered = ($prevFrom !== null && $prevTo !== null)
91| ? $this->filterByCreatedAtRange($allActions, $prevFrom, $prevTo)
92| : [];
93|
94| $availableAxes = $this->resolveAvailableAxes($view, $period);
95| if (!in_array($axis, $availableAxes, true)) {
96| $axis = $availableAxes[0];
97| }
98|
99| return [
100| 'view' => 'visao_geral',
101| 'panel_data' => [
102| 'overview' => $this->buildOverviewData(
103| $filtered,
104| $prevFiltered,
105| $allActions,
106| $actionTypeMeta,
107| $meta['members_by_id'],
108| $fromStr,
109| $toStr,
110| $axis,
111| $today,
112| $page,
113| $perPage
114| ),
115| ],
116| 'filters' => $this->buildFilterOptions($dataCompany),
117| 'available_axes' => $availableAxes,
118| 'active_axis' => $axis,
119| ];
120| }
121|
122| // pendencias (default)
123| [$deadlineFrom, $deadlineTo] = $this->resolvePendenciasDeadlineRange($period, $today);
124| $filtered = $this->filterPendenciasByDeadline($allActions, $deadlineFrom, $deadlineTo);
125| if ($originFilter !== '') {
126| $filtered = array_values(array_filter(
127| $filtered,
128| fn (array $action): bool => $this->resolveOriginKey(
129| (string) ($action['origem'] ?? ''),
130| (string) ($action['event_type'] ?? '')
131| ) === $originFilter
132| ));
133| }
134|
135| $availableAxes = $this->resolveAvailableAxes($view, $period);
136| if (!in_array($axis, $availableAxes, true)) {
137| $axis = $availableAxes[0];
138| }
139|
140| $panelData = $this->buildPendenciasData(
141| $filtered,
142| $allActions,
143| $actionTypeMeta,
144| $meta['members_by_id'],
145| $today,
146| $axis,
147| $period,
148| $deadlineTo
149| );
150| $panelData['available_axes'] = $availableAxes;
151| $panelData['active_axis'] = $axis;
152|
153| return [
154| 'view' => 'pendencias',
155| 'panel_data' => $panelData,
156| 'filters' => $this->buildFilterOptions($dataCompany),
157| ];
158| }
159|
160| /**
161| * @return array<string, mixed>
162| */
163| public function buildFilterOptions(Company $company): array
164| {
165| $meta = $this->loadPanelMeta($company);
166| $units = [['value' => '', 'text' => 'Unidade']];
167| $headOffice = $company->getHeadOffice() ?? $company;
168| $isHead = (int) $company->getId() === (int) $headOffice->getId();
169| if ($isHead) {
170| $units[] = ['value' => 'matriz', 'text' => 'Matriz'];
171| $subs = $this->entityManager->getRepository(Company::class)->findBy(['headOffice' => $headOffice]);
172| foreach ($subs as $sub) {
173| $units[] = [
174| 'value' => (string) $sub->getId(),
175| 'text' => $sub->getFantasyName() ?: $sub->getName() ?: ('Unidade #' . $sub->getId()),
176| ];
177| }
178| }
179|
180| $teamOptions = [['value' => '', 'text' => 'Equipe']];
181| foreach ($meta['teams'] as $team) {
182| $teamOptions[] = ['value' => (string) ($team['name'] ?? ''), 'text' => (string) ($team['name'] ?? '')];
183| }
184|
185| $memberOptions = [['value' => '', 'text' => 'Todos']];
186| foreach ($meta['members_by_id'] as $member) {
187| $memberOptions[] = ['value' => (string) $member['id'], 'text' => $member['name']];
188| }
189|
190| return [
191| 'period' => [
192| ['value' => 'next_month', 'text' => 'Próximo mês'],
193| ['value' => 'week', 'text' => 'Próxima semana'],
194| ['value' => 'fortnight', 'text' => 'Próximos 15 dias'],
195| ['value' => 'next_3_months', 'text' => 'Próximos 3 meses'],
196| ['value' => 'all_future', 'text' => 'Todo o futuro'],
197| ],
198| 'team' => $teamOptions,
199| 'bond' => [
200| ['value' => '', 'text' => 'Tipo de Vínculo'],
201| ['value' => PersonTypeEnum::COLABORADOR, 'text' => 'CLT'],
202| ['value' => PersonTypeEnum::PRESTADOR, 'text' => 'PJ / Prestador'],
203| ['value' => PersonTypeEnum::TERCEIRO, 'text' => 'Terceirizado'],
204| ],
205| 'unit' => $units,
206| 'overview_period' => [
207| ['value' => 'last_month', 'text' => 'Mês atual'],
208| ['value' => 'last_3_months', 'text' => 'Últimos 3 meses'],
209| ['value' => 'last_6_months', 'text' => 'Últimos 6 meses'],
210| ['value' => 'last_year', 'text' => 'Último ano'],
211| ['value' => 'total', 'text' => 'Todo o período'],
212| ],
213| 'overview_members' => $memberOptions,
214| 'overview_origins' => [
215| ['value' => '', 'text' => 'Todas'],
216| ['value' => 'accident_personal', 'text' => 'Acidente pessoal'],
217| ['value' => 'accident_material', 'text' => 'Acidente material'],
218| ['value' => 'near_miss', 'text' => 'Quase acidente'],
219| ['value' => 'ros', 'text' => 'ROS'],
220| ['value' => 'inspection', 'text' => 'Inspeção'],
221| ['value' => 'approach', 'text' => 'Abordagem'],
222| ],
223| 'origin' => [
224| ['value' => '', 'text' => 'Origem'],
225| ['value' => 'accident_personal', 'text' => 'Acidente pessoal'],
226| ['value' => 'accident_material', 'text' => 'Acidente material'],
227| ['value' => 'near_miss', 'text' => 'Quase acidente'],
228| ['value' => 'ros', 'text' => 'ROS'],
229| ['value' => 'inspection', 'text' => 'Inspeção'],
230| ['value' => 'approach', 'text' => 'Abordagem'],
231| ],
232| ];
233| }
234|
235| /**
236| * @param list<Company> $companies
237| *
238| * @return list<array<string, mixed>>
239| */
240| public function loadActionsForCompanies(array $companies): array
241| {
242| $all = [];
243| foreach ($companies as $company) {
244| $all = array_merge($all, $this->loadActionsForCompany($company));
245| }
246|
247| return $all;
248| }
249|
250| /**
251| * @return list<array<string, mixed>>
252| */
253| private function loadActionsForCompany(Company $company): array
254| {
255| $conn = $this->entityManager->getConnection();
256| $rows = $conn->executeQuery(
257| 'SELECT a.id, a.title, a.description, a.type, a.deadline, a.solved, a.project_priority,
258| a.responsible_ids, a.origem, a.origem_id, a.validation_status, a.validator_member_id,
259| a.created_at, a.updated_at, a.occurrence_id, a.event_id,
260| e.type AS event_type
261| FROM ssma_actions a
262| LEFT JOIN ssma_events e ON e.id = a.event_id
263| WHERE a.company_id = ?
264| ORDER BY a.deadline ASC, a.created_at DESC',
265| [$company->getId()]
266| )->fetchAllAssociative();
267|
268| $result = [];
269| foreach ($rows as $row) {
270| $result[] = [
271| 'id' => (int) $row['id'],
272| 'title' => (string) ($row['title'] ?? ''),
273| 'description' => (string) ($row['description'] ?? ''),
274| 'type' => (string) ($row['type'] ?? ''),
275| 'deadline' => $row['deadline'] ? substr((string) $row['deadline'], 0, 10) : null,
276| 'solved' => (bool) $row['solved'],
277| 'project_priority' => (string) ($row['project_priority'] ?? ''),
278| 'responsible_ids' => json_decode((string) ($row['responsible_ids'] ?? '[]'), true) ?? [],
279| 'origem' => (string) ($row['origem'] ?? ''),
280| 'origem_id' => (int) ($row['origem_id'] ?? 0),
281| 'event_type' => (string) ($row['event_type'] ?? ''),
282| 'validation_status' => (string) ($row['validation_status'] ?? ''),
283| 'validator_member_id' => (int) ($row['validator_member_id'] ?? 0),
284| 'created_at' => substr((string) ($row['created_at'] ?? ''), 0, 10),
285| 'updated_at' => substr((string) ($row['updated_at'] ?? ''), 0, 10),
286| 'occurrence_id' => (int) ($row['occurrence_id'] ?? 0),
287| 'event_id' => (int) ($row['event_id'] ?? 0),
288| 'company_id' => (int) $company->getId(),
289| ];
290| }
291|
292| return $result;
293| }
294|
295| /**
296| * @return array{teams: list<array<string, mixed>>, members_by_id: array<int, array{id: int, name: string, vinculo: string}>, member_vinculo: array<int, string>}
297| */
298| private function loadPanelMeta(Company $company): array
299| {
300| $conn = $this->entityManager->getConnection();
file_read
Show Details
Arguments
{"file_path": "public/js/ssma/action_plan_panel.js", "start_line": 300, "end_line": 470}
Result
File: public/js/ssma/action_plan_panel.js (Total lines: 2378)
IS_TRUNCATED: false
LINE_RANGE: 300-470
300| refreshOverviewPeriodPresetState();
301| return;
302| }
303| if (preset === 'custom') {
304| refreshOverviewPeriodLabel();
305| refreshOverviewPeriodPresetState();
306| return;
307| }
308|
309| apOverviewPeriodMode = preset || 'last_3_months';
310| var today = new Date();
311| today.setHours(0, 0, 0, 0);
312| var start = new Date(today.getTime());
313| var end = new Date(today.getTime());
314|
315| if (apOverviewPeriodMode === 'last_week') {
316| var weekday = today.getDay();
317| var mondayOffset = weekday === 0 ? 6 : weekday - 1;
318| start.setDate(start.getDate() - mondayOffset);
319| } else if (apOverviewPeriodMode === 'last_month') {
320| start.setDate(1);
321| } else if (apOverviewPeriodMode === 'last_6_months') {
322| start.setMonth(start.getMonth() - 6);
323| start.setDate(1);
324| } else if (apOverviewPeriodMode === 'last_year') {
325| start.setFullYear(start.getFullYear() - 1);
326| } else if (apOverviewPeriodMode === 'total') {
327| start.setFullYear(start.getFullYear() - 10);
328| } else {
329| apOverviewPeriodMode = 'last_3_months';
330| start.setMonth(start.getMonth() - 3);
331| start.setDate(1);
332| }
333|
334| apOverviewStartDate = start;
335| apOverviewEndDate = end;
336| refreshOverviewPeriodLabel();
337| refreshOverviewPeriodPresetState();
338| }
339|
340| function applyOverviewPeriodFromInputs() {
341| var startInput = document.getElementById('ap_overview_start_date');
342| var endInput = document.getElementById('ap_overview_end_date');
343| if (!startInput || !endInput) {
344| return false;
345| }
346|
347| var start = parseInputDate(startInput.value);
348| var end = parseInputDate(endInput.value);
349| if (!start || !end) {
350| return false;
351| }
352|
353| if (start > end) {
354| var temp = start;
355| start = end;
356| end = temp;
357| }
358|
359| apOverviewStartDate = start;
360| apOverviewEndDate = end;
361| apOverviewPeriodMode = 'custom';
362| refreshOverviewPeriodLabel();
363| refreshOverviewPeriodPresetState();
364| return true;
365| }
366|
367| function applyOverviewPeriodPreset(preset) {
368| syncOverviewPeriodPresetUI(preset);
369| panelState.overviewPage = 1;
370| syncOverviewFilterState();
371| triggerPanelFilter('visao_geral');
372| }
373|
374| function buildFilterParams(view) {
375| var params = new URLSearchParams();
376| params.set('view', view || currentView);
377|
378| if ((view || currentView) === 'pendencias') {
379| params.set('period', getApPanelPeriodParam());
380| if (panelState.axis) {
381| params.set('axis', panelState.axis);
382| }
383| if (panelState.origin) {
384| params.set('origin', panelState.origin);
385| }
386| } else if ((view || currentView) === 'visao_geral') {
387| params.set('period', panelState.overviewPeriod);
388| params.set('page', String(panelState.overviewPage));
389| params.set('per_page', String(panelState.overviewPerPage || 10));
390| if (panelState.management) {
391| params.set('management', panelState.management);
392| }
393| if (panelState.origin) {
394| params.set('origin', panelState.origin);
395| }
396| } else if ((view || currentView) === 'comparativo') {
397| params.set('period', panelState.overviewPeriod);
398| }
399|
400| if (panelState.team) {
401| params.set('team', panelState.team);
402| }
403| if (panelState.vinculo) {
404| params.set('vinculo', panelState.vinculo);
405| }
406| if (panelState.unidade && panelState.unidade !== 'todas') {
407| params.set('unidade', panelState.unidade);
408| } else {
409| var viewKey = view || currentView;
410| if (viewKey === 'visao_geral' && document.getElementById('ap_overview_filter_unit')) {
411| params.set('unidade', panelState.unidade || 'todas');
412| } else if (viewKey === 'pendencias' && document.getElementById('ap_painel_filter_unidade')) {
413| params.set('unidade', panelState.unidade || 'todas');
414| }
415| }
416|
417| if (panelState.mine) {
418| params.set('mine', '1');
419| }
420|
421| return params;
422| }
423|
424| function showPanelToast(message, title, icon, tone) {
425| if (typeof window.showToast === 'function') {
426| window.showToast(message, title || 'Plano de Ação', icon || 'fas fa-info-circle', tone || 'bg-info');
427| }
428| }
429|
430| function runPanelFilterRequest(view) {
431| if (!PANEL_FILTER_URL) {
432| return;
433| }
434|
435| var targetView = view || currentView;
436| var myGen = ++panelFilterGen;
437|
438| if (panelFilterAbort && typeof panelFilterAbort.abort === 'function') {
439| panelFilterAbort.abort();
440| }
441|
442| panelFilterAbort = new AbortController();
443| var params = buildFilterParams(targetView);
444|
445| fetch(PANEL_FILTER_URL + '?' + params.toString(), {
446| method: 'GET',
447| headers: { 'X-Requested-With': 'XMLHttpRequest' },
448| signal: panelFilterAbort.signal,
449| })
450| .then(function (response) {
451| return response.json();
452| })
453| .then(function (resp) {
454| if (myGen !== panelFilterGen) {
455| return;
456| }
457| if (!resp || !resp.success) {
458| showPanelToast(
459| (resp && resp.message) ? resp.message : 'Não foi possível carregar os dados do painel.',
460| 'Erro',
461| 'fas fa-times',
462| 'bg-danger'
463| );
464| return;
465| }
466| applyFilterResponse(resp);
467| })
468| .catch(function (err) {
469| if (myGen !== panelFilterGen || (err && err.name === 'AbortError')) {
470| return;
Request #54
deepseek-v4-flash
P:32.62K C:241 CR:27.9K CW:0
2471ms
Reasoning
Now let me read the rest of the JS around syncPendenciasFilterState, getSelectValue, buildResponsibleStackHtml, formatPeopleNames, escapeHtml, and openActionViewOffcanvas.
Also read service lines 600-760 to see presentPendencias / buildPendenciasData row mapping and resolveResponsibleDisplay.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 760, "file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 600}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648)
IS_TRUNCATED: false
LINE_RANGE: 600-760
600| 'last_week' => ['daily'],
601| 'last_month' => ['daily', 'weekly'],
602| 'last_3_months' => ['weekly', 'monthly'],
603| 'last_6_months' => ['monthly', 'quarterly'],
604| 'last_year' => ['monthly', 'quarterly'],
605| default => ['monthly', 'quarterly'],
606| };
607| }
608|
609| /**
610| * @param list<array<string, mixed>> $filtered
611| * @param list<array<string, mixed>> $allActions
612| * @param array<string, mixed> $actionTypeMeta
613| * @param array<int, array{id: int, name: string}> $membersById
614| *
615| * @return array<string, mixed>
616| */
617| private function buildPendenciasData(
618| array $filtered,
619| array $allActions,
620| array $actionTypeMeta,
621| array $membersById,
622| \DateTimeImmutable $today,
623| string $axis,
624| string $period = 'next_month',
625| ?string $deadlineTo = null
626| ): array {
627| $todayStr = $today->format('Y-m-d');
628| $openCount = $vencidas = $aguardandoVal = 0;
629| $proximoPrazo = null;
630| $bucketData = [];
631| $originCount = [];
632| $normalizedActions = [];
633| $kpiFooters = [
634| 'pending_exec' => 0, 'pending_val' => 0,
635| 'overdue_exec' => 0, 'overdue_val' => 0,
636| 'await_on_time' => 0, 'await_overdue' => 0,
637| ];
638|
639| foreach ($filtered as $action) {
640| if ((bool) ($action['solved'] ?? false)) {
641| continue;
642| }
643|
644| $deadline = $action['deadline'] ?? null;
645| $valStatus = (string) ($action['validation_status'] ?? '');
646| $isVal = $valStatus === 'pending_validation';
647| $isOverdue = $deadline !== null && $deadline < $todayStr;
648|
649| ++$openCount;
650| if ($isOverdue) {
651| ++$vencidas;
652| }
653| if ($isVal) {
654| ++$aguardandoVal;
655| }
656| if ($deadline !== null && $deadline >= $todayStr && ($proximoPrazo === null || $deadline < $proximoPrazo)) {
657| $proximoPrazo = $deadline;
658| }
659|
660| if ($isVal) {
661| ++$kpiFooters['pending_val'];
662| if ($isOverdue) {
663| ++$kpiFooters['overdue_val'];
664| ++$kpiFooters['await_overdue'];
665| } else {
666| ++$kpiFooters['await_on_time'];
667| }
668| } else {
669| ++$kpiFooters['pending_exec'];
670| if ($isOverdue) {
671| ++$kpiFooters['overdue_exec'];
672| }
673| }
674|
675| if ($deadline !== null) {
676| $bkt = $this->resolveChartBucketKey($deadline, $axis, $today, 'pendencias');
677| $key = $bkt['sort_key'];
678| if (!isset($bucketData[$key])) {
679| $bucketData[$key] = ['label' => $bkt['label'], 'execucao' => 0, 'validacao' => 0];
680| }
681| if ($isVal) {
682| ++$bucketData[$key]['validacao'];
683| } else {
684| ++$bucketData[$key]['execucao'];
685| }
686| }
687|
688| $validationMeta = $this->resolveValidationDisplay($valStatus);
689| $originKey = $this->resolveOriginKey((string) ($action['origem'] ?? ''), (string) ($action['event_type'] ?? ''));
690| $origemLabel = $this->resolveOriginLabel((string) ($action['origem'] ?? ''), (string) ($action['event_type'] ?? ''));
691|
692| $normalizedActions[] = [
693| 'id' => (int) ($action['id'] ?? 0),
694| 'title' => (string) ($action['title'] ?? ''),
695| 'action_id' => 'PA-' . substr((string) ($action['created_at'] ?? date('Y')), 2, 2) . '-' . str_pad((string) ($action['id'] ?? 0), 4, '0', STR_PAD_LEFT),
696| 'type_label' => $actionTypeMeta[$action['type'] ?? '']['label'] ?? ($action['type'] ?? ''),
697| 'occurrence_title' => $origemLabel,
698| 'origin' => $originKey,
699| 'management' => '—',
700| 'location' => '—',
701| 'priority' => ucfirst((string) ($action['project_priority'] ?? 'leve')),
702| 'priority_key' => strtolower((string) ($action['project_priority'] ?? 'leve')),
703| 'project_priority' => (string) ($action['project_priority'] ?? ''),
704| 'deadline_label' => $deadline ? (new \DateTimeImmutable($deadline))->format('d/m/Y') : '—',
705| 'deadline' => $deadline ? (new \DateTimeImmutable($deadline))->format('d/m/Y') : '—',
706| 'deadline_sort' => $deadline ? str_replace('-', '', $deadline) : '99999999',
707| 'deadline_overdue' => $isOverdue,
708| 'validation_status' => $valStatus,
709| 'validation_status_label' => $validationMeta['label'],
710| 'validation_status_color' => $validationMeta['color'],
711| 'pending' => $validationMeta['label'] ?: ($isOverdue ? 'Vencida' : 'Em andamento'),
712| 'responsible' => $this->resolveResponsibleDisplay((array) ($action['responsible_ids'] ?? []), $membersById),
713| 'executors' => $this->resolveResponsibleDisplay((array) ($action['responsible_ids'] ?? []), $membersById),
714| 'validators' => $this->resolveResponsibleDisplay(
715| array_values(array_filter([(int) ($action['validator_member_id'] ?? 0)])),
716| $membersById
717| ),
718| 'origin_label' => $origemLabel,
719| 'description' => (string) ($action['description'] ?? $action['title'] ?? ''),
720| 'origin_url' => $this->resolveOriginUrl($action),
721| ];
722|
723| $originLabel = $origemLabel ?: 'Outro';
724| if (!isset($originCount[$originKey])) {
725| $originCount[$originKey] = ['label' => $originLabel, 'count' => 0];
726| }
727| ++$originCount[$originKey]['count'];
728| }
729|
730| usort($normalizedActions, static fn (array $a, array $b): int => strcmp($a['deadline_sort'], $b['deadline_sort']));
731| ksort($bucketData);
732|
733| $totalGlobal = count($allActions);
734| $resolvedGlobal = count(array_filter($allActions, static fn (array $a): bool => (bool) ($a['solved'] ?? false)));
735| $resolutionRate = $totalGlobal > 0 ? (int) round($resolvedGlobal / $totalGlobal * 100) : 0;
736|
737| $figmaKpis = $this->buildPendenciasKpiCounts($allActions, $filtered, $today, $period, $deadlineTo);
738|
739| return [
740| 'kpis' => [
741| 'open_actions' => $openCount,
742| 'created_in_period' => $figmaKpis['created'],
743| 'completed' => $figmaKpis['completed'],
744| 'vencidas' => $vencidas,
745| 'aguardando_validacao' => $aguardandoVal,
746| 'period_end' => $figmaKpis['period_end'],
747| 'proximo_prazo' => $proximoPrazo ? (new \DateTimeImmutable($proximoPrazo))->format('d/m/Y') : '—',
748| 'recommendation' => $this->buildRecommendation($openCount, $resolutionRate),
749| 'trend' => [
750| 'created' => $figmaKpis['created_trend'],
751| 'completed' => $figmaKpis['completed_trend'],
752| 'awaiting' => $figmaKpis['awaiting_trend'],
753| ],
754| 'footer' => [
755| 'pending_to_date' => [
756| ['label' => 'Execução', 'value' => (string) $kpiFooters['pending_exec']],
757| ['label' => 'Validação', 'value' => (string) $kpiFooters['pending_val']],
758| ],
759| 'overdue' => [
760| ['label' => 'Execução', 'value' => (string) $kpiFooters['overdue_exec']],
file_read
Show Details
Arguments
{"end_line": 1160, "file_path": "public/js/ssma/action_plan_panel.js", "start_line": 760}
Result
File: public/js/ssma/action_plan_panel.js (Total lines: 2378)
IS_TRUNCATED: false
LINE_RANGE: 760-1160
760| + ' role="button" tabindex="0" title="' + escapeHtml(question) + '"'
761| + ' data-question="' + escapeHtml(question) + '" data-context="' + escapeHtml(context || 'action_plan') + '">'
762| + '<i class="fa-regular fa-sparkles suggestion-card__icon" aria-hidden="true"></i>'
763| + '<span class="suggestion-card__text">' + escapeHtml(question) + '</span></div>';
764| }).join('');
765| }
766|
767| function renderSemanticAdrianaRow(rowId, viewMode, semantic, adriana, context) {
768| var row = document.getElementById(rowId);
769| if (!row) {
770| return;
771| }
772|
773| var contentEl = row.querySelector('[data-ap-semantic-content]');
774| var insightsEl = row.querySelector('[data-ap-adriana-insights]');
775| var questionsEl = row.querySelector('[data-ap-adriana-questions]');
776| var emptyBody = viewMode === 'visao_geral'
777| ? 'Ajuste o período ou registre ações para que a Adriana identifique padrões e gere insights automáticos.'
778| : 'Ajuste os filtros ou aguarde novas pendências para visualizar a análise semântica e os insights.';
779|
780| if (contentEl) {
781| contentEl.innerHTML = viewMode === 'visao_geral'
782| ? buildOverviewSemanticHtml(semantic)
783| : buildPendenciasSemanticHtml(semantic);
784| }
785|
786| var insights = viewMode === 'visao_geral'
787| ? ((adriana && adriana.main_insights) || [])
788| : ((adriana && adriana.insights) || []);
789| var questions = viewMode === 'visao_geral'
790| ? ((adriana && adriana.follow_up_questions) || [])
791| : ((adriana && adriana.suggested_questions) || []);
792|
793| if (insightsEl) {
794| insightsEl.innerHTML = buildAdrianaInsightsHtml(insights, emptyBody);
795| }
796| if (questionsEl) {
797| questionsEl.innerHTML = buildAdrianaQuestionsHtml(questions, context);
798| }
799| }
800|
801| function updateSemanticAdriana(semantic, adriana) {
802| renderSemanticAdrianaRow(
803| 'ssma-ap-semantic-adriana-pendencias',
804| 'pendencias',
805| semantic,
806| adriana,
807| 'action_plan'
808| );
809| }
810|
811| function updateOverviewSemanticAdriana(semantic, adriana) {
812| renderSemanticAdrianaRow(
813| 'ssma-ap-semantic-adriana-visao-geral',
814| 'visao_geral',
815| semantic,
816| adriana,
817| 'action_plan_overview'
818| );
819| }
820|
821| function updateOperationalSummary(summary) {
822| var container = document.querySelector('[data-ap-panel-view="pendencias"] .ssma-ap-operational-summary');
823| if (!container || !summary) {
824| return;
825| }
826| var rowsHtml = (summary.rows || []).map(function (row) {
827| return '<div class="ssma-ap-op-row">'
828| + '<div class="ssma-ap-op-row-head"><span>' + escapeHtml(row.label) + '</span>'
829| + '<span class="ssma-ap-op-row-value">' + escapeHtml(row.count) + ' · ' + escapeHtml(row.percent) + '%</span></div>'
830| + '<div class="ssma-ap-op-progress" aria-hidden="true"><div class="ssma-ap-op-progress-fill" style="width: '
831| + escapeHtml(row.percent) + '%;"></div></div></div>';
832| }).join('');
833| var total = summary.total || {};
834| container.innerHTML = '<div class="ssma-ap-operational-summary-title">Resumo Operacional</div>'
835| + rowsHtml
836| + '<div class="ssma-ap-op-total"><span>' + escapeHtml(total.label || 'Total de pendências') + '</span>'
837| + '<span>' + escapeHtml(total.value || '0') + ' · ' + escapeHtml(total.percent || 100) + '%</span></div>';
838| }
839|
840| function priorityPillClass(key) {
841| var map = {
842| alta: 'red',
843| critica: 'red',
844| urgente: 'red',
845| moderada: 'teal',
846| media: 'teal',
847| medio: 'teal',
848| média: 'teal',
849| baixa: 'gray',
850| leve: 'gray',
851| };
852| return map[String(key || 'baixa').toLowerCase()] || 'gray';
853| }
854|
855| var MEMBER_AVATAR_COLORS = ['#EA151C', '#186073', '#25AD52', '#FFC107', '#6F42C1', '#FD7E14', '#20C997', '#DC3545'];
856|
857| function buildOriginIconHtml(originKey, originIcons) {
858| var meta = (originIcons && originIcons[originKey]) || {};
859| return '<span class="ssma-ap-panel-table-origin" title="' + escapeHtml(meta.title || 'Origem') + '">'
860| + '<span class="icon-badge icon-badge-md icon-badge-' + escapeHtml(meta.variant || 'primary') + ' icon-badge-rounded">'
861| + '<i class="fa ' + escapeHtml(meta.icon || 'fa-link') + '" aria-hidden="true"></i></span></span>';
862| }
863|
864| function buildResponsibleStackHtml(people) {
865| if (!people || !people.length) {
866| return '<span class="member-avatars-stack-empty">—</span>';
867| }
868| var visible = people.slice(0, 3);
869| var html = '<div class="member-avatars-stack">';
870| visible.forEach(function (person, index) {
871| var name = person.name || person.initials || '';
872| var initials = person.initials || '';
873| var color = MEMBER_AVATAR_COLORS[index % MEMBER_AVATAR_COLORS.length];
874| html += '<div class="member-avatar-circle position-relative overflow-hidden" title="' + escapeHtml(name) + '"'
875| + ' aria-label="' + escapeHtml(name) + '"'
876| + ' style="width:27px;height:27px;border-radius:100px;font-weight:700;font-size:12px;background:' + color + ';'
877| + (index > 0 ? 'margin-left:-6px;' : '') + '">'
878| + '<span class="member-avatar-initials d-flex align-items-center justify-content-center w-100 h-100">'
879| + escapeHtml(initials) + '</span></div>';
880| });
881| return html + '</div>';
882| }
883|
884| function formatPeopleNames(people) {
885| if (!people || !people.length) {
886| return '—';
887| }
888| var names = people.map(function (person) {
889| return String((person && (person.name || person.initials)) || '').trim();
890| }).filter(Boolean);
891| return names.length ? names.join(', ') : '—';
892| }
893|
894| function buildPendenciasTableRowHtml(row, originIcons) {
895| var deadlineClass = row.deadline_overdue ? 'overdue' : 'ok';
896| var originUrl = row.origin_url || '';
897| var executorNames = formatPeopleNames(row.executors || row.responsible || []);
898| var validatorNames = formatPeopleNames(row.validators || []);
899| var originBtn = originUrl
900| ? '<a class="ssma-ap-panel-table-action-btn" href="' + escapeHtml(originUrl) + '" title="Ir para origem" aria-label="Ir para origem">'
901| + '<i class="fas fa-external-link-alt" aria-hidden="true"></i></a>'
902| : '';
903| return '<tr>'
904| + '<td><div class="ssma-ap-table-title-main">' + escapeHtml(row.title) + '</div>'
905| + '<div class="ssma-ap-table-title-sub">' + escapeHtml(row.action_id || row.id) + '</div></td>'
906| + '<td class="text-center">' + buildOriginIconHtml(row.origin, originIcons) + '</td>'
907| + '<td><div class="ssma-ap-table-title-main">' + escapeHtml(row.management) + '</div>'
908| + '<div class="ssma-ap-table-mgmt-sub">' + escapeHtml(row.location) + '</div></td>'
909| + '<td><span class="mhs-pill mhs-pill--sm mhs-pill--' + priorityPillClass(row.priority_key) + '">'
910| + '<span class="mhs-pill-label">' + escapeHtml(row.priority) + '</span></span></td>'
911| + '<td>' + buildResponsibleStackHtml(row.executors || row.responsible) + '</td>'
912| + '<td>' + buildResponsibleStackHtml(row.validators || []) + '</td>'
913| + '<td><span class="ssma-ap-deadline--' + deadlineClass + '">' + escapeHtml(row.deadline) + '</span></td>'
914| + '<td>' + escapeHtml(row.pending) + '</td>'
915| + '<td class="text-center"><div class="d-inline-flex align-items-center" style="gap:6px;">'
916| + '<button type="button" class="ssma-ap-panel-table-action-btn js-ssma-ap-panel-view-action"'
917| + ' data-action-id="' + escapeHtml(row.id) + '"'
918| + ' data-action-title="' + escapeHtml(row.title || '') + '"'
919| + ' data-action-origin="' + escapeHtml(row.origin_label || row.occurrence_title || '') + '"'
920| + ' data-action-deadline="' + escapeHtml(row.deadline || '') + '"'
921| + ' data-action-pending="' + escapeHtml(row.pending || '') + '"'
922| + ' data-action-description="' + escapeHtml(row.description || '') + '"'
923| + ' data-action-origin-url="' + escapeHtml(originUrl) + '"'
924| + ' data-action-executors="' + escapeHtml(executorNames) + '"'
925| + ' data-action-validators="' + escapeHtml(validatorNames) + '"'
926| + ' title="Visualizar" aria-label="Visualizar ação">'
927| + '<i class="fas fa-eye" aria-hidden="true"></i></button>'
928| + originBtn
929| + '</div></td></tr>';
930| }
931|
932| function updatePendenciasTable(tableData, originIcons) {
933| var table = document.getElementById('ssma-ap-panel-table');
934| if (!table) {
935| return;
936| }
937| var tbody = table.querySelector('tbody');
938| if (!tbody) {
939| return;
940| }
941| var rows = (tableData && tableData.rows) || [];
942| var $ = window.jQuery;
943| if ($ && $.fn && $.fn.DataTable && $.fn.DataTable.isDataTable('#ssma-ap-panel-table')) {
944| $('#ssma-ap-panel-table').DataTable().clear().destroy();
945| }
946| tbody.innerHTML = rows.map(function (row) {
947| return buildPendenciasTableRowHtml(row, originIcons);
948| }).join('');
949| bindTableViewButtons();
950| if (window.MetahumanDataTables && typeof window.MetahumanDataTables.whenReady === 'function') {
951| window.MetahumanDataTables.whenReady('ssma-ap-panel-table', function () {
952| if ($ && $.fn && $.fn.DataTable && !$.fn.DataTable.isDataTable('#ssma-ap-panel-table')) {
953| $('#ssma-ap-panel-table').DataTable({
954| ordering: false,
955| searching: false,
956| pageLength: (tableData && tableData.page_length) || 10,
957| lengthMenu: [[10, 25, 50], [10, 25, 50]],
958| lengthChange: true,
959| language: {
960| emptyTable: 'Nenhuma ação encontrada.',
961| zeroRecords: 'Nenhuma ação corresponde aos filtros.',
962| info: 'Mostrando _END_ de _TOTAL_ ações',
963| infoEmpty: 'Mostrando 0 de 0 ações',
964| lengthMenu: 'Resultados por página _MENU_',
965| paginate: { previous: '<', next: '>' },
966| },
967| });
968| }
969| });
970| }
971| }
972|
973| function updateAxisFilterOptions(chartData) {
974| var select = document.getElementById('ssma-ap-chart-axis-filter');
975| if (!select || !chartData || !chartData.axes) {
976| return;
977| }
978| select.innerHTML = chartData.axes.map(function (axis) {
979| var selected = axis.selected ? ' selected' : '';
980| return '<option value="' + escapeHtml(axis.value) + '"' + selected + '>' + escapeHtml(axis.label) + '</option>';
981| }).join('');
982| panelState.axis = chartData.default_axis || panelState.axis;
983| }
984|
985| function applyPendenciasDom(panel) {
986| if (!panel) {
987| return;
988| }
989| updateKpiRow(panel.kpis || []);
990| updateRecommendationBlock(panel.recommendation || {});
991| updateOperationalSummary(panel.operational_summary || {});
992| updateSemanticAdriana(panel.semantic || {}, panel.adriana || {});
993| updateAxisFilterOptions((panel.charts || {}).critical_pending_by_deadline || {});
994| updatePendenciasTable(panel.table || {}, panel.origin_icons || {});
995| }
996|
997| function buildOverviewTableRowHtml(row, originIcons) {
998| var originMeta = (originIcons && originIcons[row.origin_type]) || {};
999| return '<tr>'
1000| + '<td>' + escapeHtml(row.code) + '</td>'
1001| + '<td>' + escapeHtml(row.action) + '</td>'
1002| + '<td><span class="action-plan-overview__origin-cell" title="' + escapeHtml(originMeta.title || row.origin) + '">'
1003| + '<span class="icon-badge icon-badge-sm icon-badge--' + escapeHtml(originMeta.variant || 'primary') + ' icon-badge--rounded">'
1004| + '<i class="fas ' + escapeHtml(originMeta.icon || 'fa-link') + '" aria-hidden="true"></i></span></span></td>'
1005| + '<td>' + escapeHtml(row.created_at) + '</td>'
1006| + '<td>' + escapeHtml(row.completed_at) + '</td>'
1007| + '<td class="text-center"><span class="action-plan-overview__time action-plan-overview__time--'
1008| + escapeHtml(row.fulfillment_time_class || 'ok') + '">' + escapeHtml(row.fulfillment_time) + ' dias</span></td>'
1009| + '<td class="text-center"><span class="action-plan-overview__time action-plan-overview__time--ok">'
1010| + escapeHtml(row.validation_time) + ' dias</span></td>'
1011| + '<td>' + escapeHtml(row.responsible) + '</td></tr>';
1012| }
1013|
1014| function updateOverviewTable(overview) {
1015| var table = document.getElementById('ssma-ap-overview-table');
1016| if (!table || !overview) {
1017| return;
1018| }
1019| var tbody = table.querySelector('tbody');
1020| if (!tbody) {
1021| return;
1022| }
1023| var originIcons = (panelData && panelData.origin_icons) || {};
1024| tbody.innerHTML = (overview.action_details || []).map(function (row) {
1025| return buildOverviewTableRowHtml(row, originIcons);
1026| }).join('');
1027| }
1028|
1029| function applyOverviewDom(overview) {
1030| if (!overview) {
1031| return;
1032| }
1033| var periodLabel = document.getElementById('ap_overview_period_label');
1034| if (periodLabel && overview.filters && overview.filters.period_label) {
1035| periodLabel.textContent = overview.filters.period_label;
1036| }
1037| var indicators = overview.indicators || [];
1038| updateOverviewKpiRow(indicators);
1039|
1040| var pagination = overview.pagination || {};
1041| var container = document.getElementById('ssma-ap-overview-pagination');
1042| if (container) {
1043| container.setAttribute('data-per-page', String(pagination.per_page || 10));
1044| container.setAttribute('data-total', String(pagination.total || 0));
1045| container.setAttribute('data-current-page', String(pagination.current_page || 1));
1046| container.setAttribute('data-last-page', String(pagination.last_page || 1));
1047| panelState.overviewPerPage = Number(pagination.per_page || panelState.overviewPerPage || 10);
1048| var perPageSelect = document.getElementById('ssma-ap-overview-per-page');
1049| if (perPageSelect) {
1050| perPageSelect.value = String(panelState.overviewPerPage);
1051| }
1052| updateOverviewPagination(Number(pagination.current_page || 1));
1053| }
1054| updateOverviewTable(overview);
1055| updateOverviewSemanticAdriana(overview.semantic_analysis || {}, overview.adriana_insights || {});
1056| }
1057|
1058| function renderComparativoView(data) {
1059| var root = document.getElementById('ssma-ap-comparativo-root');
1060| if (!root) {
1061| return;
1062| }
1063| var overviewText = (data.overview && data.overview.text) ? data.overview.text : 'Sem dados para comparativo.';
1064| var units = data.units || [];
1065| if (!units.length) {
1066| root.innerHTML = '<p class="mb-0">' + escapeHtml(overviewText) + '</p>';
1067| return;
1068| }
1069| var rows = units.map(function (unit) {
1070| return '<tr><td>' + escapeHtml(unit.unit_name) + '</td><td>' + escapeHtml(unit.open) + '</td>'
1071| + '<td>' + escapeHtml(unit.overdue) + '</td><td>' + escapeHtml(unit.total) + '</td>'
1072| + '<td>' + escapeHtml(unit.resolution_rate) + '%</td></tr>';
1073| }).join('');
1074| root.innerHTML = '<p class="mb-3">' + escapeHtml(overviewText) + '</p>'
1075| + '<div class="table-responsive"><table class="table table-sm mb-0"><thead><tr>'
1076| + '<th>Unidade</th><th>Abertas</th><th>Vencidas</th><th>Total</th><th>Taxa resolução</th></tr></thead><tbody>'
1077| + rows + '</tbody></table></div>';
1078| }
1079|
1080| function syncPendenciasFilterState() {
1081| panelState.team = getSelectValue('ap_painel_filter_team');
1082| panelState.vinculo = getSelectValue('ap_painel_filter_vinculo');
1083| var unidadeEl = document.getElementById('ap_painel_filter_unidade');
1084| panelState.unidade = unidadeEl ? (getSelectValue('ap_painel_filter_unidade') || 'todas') : '';
1085| panelState.origin = getSelectValue('ap_painel_filter_origem');
1086| var mineEl = document.getElementById('ap_painel_filter_mine');
1087| panelState.mine = !!(mineEl && mineEl.checked);
1088| panelState.axis = getSelectValue('ssma-ap-chart-axis-filter') || panelState.axis;
1089| panelState.period = getApPanelPeriodParam();
1090| }
1091|
1092| function syncOverviewFilterState() {
1093| panelState.team = getSelectValue('ap_overview_filter_team');
1094| panelState.management = getSelectValue('ap_overview_filter_management');
1095| panelState.origin = getSelectValue('ap_overview_filter_origin');
1096| var unitEl = document.getElementById('ap_overview_filter_unit');
1097| panelState.unidade = unitEl ? (getSelectValue('ap_overview_filter_unit') || 'todas') : '';
1098| panelState.overviewPeriod = getOverviewPeriodParam();
1099| }
1100|
1101| function parsePanelData() {
1102| var el = document.getElementById('ssma-ap-panel-data-json');
1103| if (!el || !el.textContent) {
1104| return null;
1105| }
1106| try {
1107| return JSON.parse(el.textContent);
1108| } catch (e) {
1109| return null;
1110| }
1111| }
1112|
1113| function getOverviewData() {
1114| return panelData && panelData.overview ? panelData.overview : null;
1115| }
1116|
1117| function destroyChart(key) {
1118| if (charts[key]) {
1119| try {
1120| charts[key].destroy();
1121| } catch (err) { /* noop */ }
1122| delete charts[key];
1123| }
1124| }
1125|
1126| function destroyChartKeys(keys) {
1127| keys.forEach(function (key) {
1128| destroyChart(key);
1129| });
1130| }
1131|
1132| function showChartEmpty(el, message) {
1133| if (!el) {
1134| return;
1135| }
1136| el.innerHTML = '<div class="empty-card-state empty-card-state--sm">'
1137| + '<div class="empty-card-icon"><i class="fa-solid fa-chart-simple" style="color:#adb5bd" aria-hidden="true"></i></div>'
1138| + '<h5 class="empty-card-title">' + escapeHtml(message || 'Nenhum dado encontrado') + '</h5>'
1139| + '</div>';
1140| }
1141|
1142| function clearChartEmpty(el) {
1143| if (!el) {
1144| return;
1145| }
1146| var empty = el.querySelector('.empty-card-state');
1147| if (empty) {
1148| el.innerHTML = '';
1149| }
1150| }
1151|
1152| function waitHighcharts(callback) {
1153| if (window.Highcharts) {
1154| callback();
1155| return;
1156| }
1157| var attempts = 0;
1158| var timer = window.setInterval(function () {
1159| attempts += 1;
1160| if (window.Highcharts) {
Request #55
deepseek-v4-flash
P:41.06K C:1.15K CR:32.77K CW:0
8287ms
Reasoning
Now I have a good view of the pendencias table row mapping in the service and JS.
Interesting: the service's buildPendenciasData row mapping uses `origin_key` for row['origin'], and JS buildOriginIconHtml uses `originIcons[originKey]`. The origin_icons come from panel origin_icons map (presented with new keys). OK.
Now, in JS buildPendenciasTableRowHtml: `row.origin_label || row.occurrence_title` — actually `occurrence_title` is `$origemLabel` (same value). Note this is a label, not the actual origin title. Fine.
Wait, `origin_label` uses `$origemLabel` variable which is set but may be '' if resolveOriginLabel returns ''? Let's examine resolveOriginLabel:
```php
return match ($this->resolveOriginKey($origem, $eventType)) {
'inspection' => 'Inspeção',
...
'refusal' => 'Direito de Recusa',
default => $origem !== '' ? $origem : 'Outro',
};
```
Wait the diff shows default => $origem !== '' ? $origem : 'Outro'. Let me confirm the actual code at lines ~1370. Actually the diff shows:
```
return match ($this->resolveOriginKey($origem, $eventType)) {
'inspection' => 'Inspeção',
'approach' => 'Abordagem',
+ 'accident_personal' => 'Acidente pessoal',
+ 'accident_material' => 'Acidente material',
+ 'near_miss' => 'Quase acidente',
+ 'accident' => 'Acidente pessoal',
'ros' => 'ROS',
'refusal' => 'Direito de Recusa',
default => $origem !== '' ? $origem : 'Outro',
};
```
Hmm, so 'default' returns origem raw or 'Outro'. So origin_label would rarely be empty. So `'origin_label' => $origemLabel` fine.
Now about origin_icons metadata in JS: `panelData.origin_icons` and chart seeding etc.
Let me consider the key mismatch bug: In the service's `resolveOriginKey`, the mapping returns 'near_miss', 'accident_personal', etc. And icons include those keys. But are these JS/backend contract changes applied consistently in the visao_geral path? The confirmed finding #5 says filter option removed the refusal category. Let's look for other consumers of origin keys across the file: In `buildOverviewData` maybe uses resolveOriginKey and chart seed. Let me read buildOverviewData and presentSeededOriginChart & where origin_icons is built and whether it's used by the overview chart render in JS.
Let me also read the JS for origin icons map keys used in chart (maybe a different origin key set for charts). And the JS build chart data uses `panelData.origin_icons`. Let me search JS for `origin_icons` or `origin_type`.
Let me look at the broader picture: the diff includes changes to the JS overview filters? In the template, overview filter has `ap_overview_filter_origin` maybe. syncOverviewFilterState reads `ap_overview_filter_origin` into panelState.origin. Wait, but this new origin select in template is `ap_painel_filter_origem` (pendencias). And panelState.origin is shared between pendencias and overview. In `buildFilterParams`, for `visao_geral` branch it also sets origin param if panelState.origin. Hmm, so when visiting visao_geral, if panelState.origin set (e.g., a pendencias origin filter), the overview requests will include origin param too. And overview_origins options are used in overview filter with id maybe `ap_overview_filter_origin`. However, service only applies origin filter in pendencias branch (per the diff at line 125) and overview branch earlier may use different filter via buildOverviewData params? The overview branch of buildFilterPayload appears to handle origin differently. Let me check the top part of buildFilterPayload (lines 1-85). In the overview branch, `originFilter` may be applied via a different filter function.
Actually, wait — service buildFilterPayload overview branch (visao_geral) returns at line 99-120 before pendencias branch. Does it use $originFilter? Let me read lines 1-80.
Let me read the file from the top.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 80, "file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 1}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648)
IS_TRUNCATED: false
LINE_RANGE: 1-80
1|<?php
2|
3|declare(strict_types=1);
4|
5|namespace App\Service\Ssma\ActionPlan;
6|
7|use App\Entity\Company;
8|use App\Entity\CompanyMembers;
9|use App\Entity\CompanyTeam;
10|use App\Entity\SsmaEvent;
11|use App\Enum\Ssma\ActionOrigemEnum;
12|use App\Enum\Ssma\PersonTypeEnum;
13|use App\Service\Ssma\SsmaPanelComparisonPeriodResolver;
14|use Doctrine\ORM\EntityManagerInterface;
15|
16|/**
17| * Agregação real do Painel do Plano de Ação SSMA (endpoint /panel/filter).
18| */
19|final class SsmaActionPlanPanelService
20|{
21| private const RESPONSIBLE_COLORS = ['#08788A', '#EA151C', '#FBC02D', '#388E3C', '#7B1FA2', '#1565C0', '#E64A19'];
22|
23| public function __construct(
24| private EntityManagerInterface $entityManager,
25| private SsmaPanelComparisonPeriodResolver $comparisonPeriodResolver,
26| ) {
27| }
28|
29| /**
30| * @param list<Company> $scopeCompanies
31| * @param array<string, mixed> $actionTypeMeta
32| * @param array<int, true>|null $memberScopeIds null = sem restrição por membro
33| *
34| * @return array<string, mixed>
35| */
36| public function buildFilterPayload(
37| array $scopeCompanies,
38| Company $dataCompany,
39| string $view,
40| string $period,
41| string $axis,
42| string $team,
43| string $vinculo,
44| array $actionTypeMeta,
45| ?array $memberScopeIds,
46| int $page = 1,
47| int $perPage = 10,
48| string $management = '',
49| string $area = '',
50| string $execResponsible = '',
51| string $valResponsible = '',
52| string $originFilter = '',
53| ): array {
54| $today = new \DateTimeImmutable('today');
55| $meta = $this->loadPanelMeta($dataCompany);
56| $allActions = $this->loadActionsForCompanies($scopeCompanies);
57|
58| if ($memberScopeIds !== null) {
59| $allActions = $this->filterByMemberScope($allActions, $memberScopeIds);
60| }
61|
62| $allActions = $this->filterByTeamAndVinculo($allActions, $team, $vinculo, $meta);
63|
64| if ($view === 'comparativo') {
65| return [
66| 'view' => 'comparativo',
67| 'panel_data' => $this->buildComparativoData($scopeCompanies, $allActions, $period, $today),
68| 'filters' => $this->buildFilterOptions($dataCompany),
69| 'available_axes' => [],
70| 'active_axis' => '',
71| ];
72| }
73|
74| if ($view === 'visao_geral') {
75| [$fromStr, $toStr] = $this->resolveOverviewPeriodBounds($period, $today);
76| $filtered = $this->filterByCreatedAtRange($allActions, $fromStr, $toStr);
77| $filtered = $this->applyOverviewDimensionFilters(
78| $filtered,
79| $management,
80| $area,
file_read
Show Details
Arguments
{"end_line": 1460, "file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 1300}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648)
IS_TRUNCATED: false
LINE_RANGE: 1300-1460
1300| if ($diff <= 14) {
1301| return ['sort_key' => '2', 'label' => 'Semana 2'];
1302| }
1303| if ($diff <= 21) {
1304| return ['sort_key' => '3', 'label' => 'Semana 3'];
1305| }
1306| if ($diff <= 28) {
1307| return ['sort_key' => '4', 'label' => 'Semana 4'];
1308| }
1309|
1310| return ['sort_key' => '5', 'label' => 'Semana 5+'];
1311| }
1312|
1313| /**
1314| * @return array{label: string, color: string}
1315| */
1316| private function resolveValidationDisplay(string $validationStatus): array
1317| {
1318| return match ($validationStatus) {
1319| 'pending_validation' => ['label' => 'Pendência de validação', 'color' => 'warning'],
1320| 'approved' => ['label' => 'Aprovado', 'color' => 'green'],
1321| 'rejected' => ['label' => 'Reprovada', 'color' => 'red'],
1322| default => ['label' => 'Em andamento', 'color' => 'gray'],
1323| };
1324| }
1325|
1326| private function resolveOriginKey(string $origem, string $eventType = ''): string
1327| {
1328| $event = strtoupper(trim($eventType));
1329| if (str_contains($event, 'QUASE') || $event === (defined(SsmaEvent::class . '::TYPE_QUASE_ACIDENTE') ? SsmaEvent::TYPE_QUASE_ACIDENTE : 'QUASE_ACIDENTE')) {
1330| return 'near_miss';
1331| }
1332| if (str_contains($event, 'PESSOAL') || str_contains($event, 'PERSONAL')) {
1333| return 'accident_personal';
1334| }
1335| if (str_contains($event, 'MATERIAL')) {
1336| return 'accident_material';
1337| }
1338| if (str_contains($event, 'ACIDENTE')) {
1339| return 'accident_personal';
1340| }
1341| if ($event === SsmaEvent::TYPE_ROS || str_contains($event, 'ROS')) {
1342| return 'ros';
1343| }
1344|
1345| $normalized = ActionOrigemEnum::normalize($origem);
1346| if ($normalized === ActionOrigemEnum::INSPECAO) {
1347| return 'inspection';
1348| }
1349| if ($normalized === ActionOrigemEnum::ABORDAGEM) {
1350| return 'approach';
1351| }
1352|
1353| $value = mb_strtolower(trim($origem));
1354|
1355| return match (true) {
1356| str_contains($value, 'inspe') => 'inspection',
1357| str_contains($value, 'abord') => 'approach',
1358| str_contains($value, 'quase') => 'near_miss',
1359| str_contains($value, 'material') => 'accident_material',
1360| str_contains($value, 'pessoal') || str_contains($value, 'acidente') => 'accident_personal',
1361| str_contains($value, 'ros') => 'ros',
1362| str_contains($value, 'recusa') || str_contains($value, 'refusal') => 'refusal',
1363| str_contains($value, 'ocorr') => 'accident_personal',
1364| default => 'other',
1365| };
1366| }
1367|
1368| private function resolveOriginLabel(string $origem, string $eventType = ''): string
1369| {
1370| return match ($this->resolveOriginKey($origem, $eventType)) {
1371| 'inspection' => 'Inspeção',
1372| 'approach' => 'Abordagem',
1373| 'accident_personal' => 'Acidente pessoal',
1374| 'accident_material' => 'Acidente material',
1375| 'near_miss' => 'Quase acidente',
1376| 'accident' => 'Acidente pessoal',
1377| 'ros' => 'ROS',
1378| 'refusal' => 'Direito de Recusa',
1379| default => $origem !== '' ? $origem : 'Outro',
1380| };
1381| }
1382|
1383| /**
1384| * @return array<string, array{icon: string, variant: string, title: string}>
1385| */
1386| private function originIconsMap(): array
1387| {
1388| return [
1389| 'inspection' => ['icon' => 'fa-clipboard-check', 'variant' => 'primary', 'title' => 'Inspeção'],
1390| 'approach' => ['icon' => 'fa-users', 'variant' => 'info', 'title' => 'Abordagem'],
1391| 'ros' => ['icon' => 'fa-file-lines', 'variant' => 'warning', 'title' => 'ROS'],
1392| 'accident' => ['icon' => 'fa-triangle-exclamation', 'variant' => 'danger', 'title' => 'Acidente pessoal'],
1393| 'accident_personal' => ['icon' => 'fa-triangle-exclamation', 'variant' => 'danger', 'title' => 'Acidente pessoal'],
1394| 'accident_material' => ['icon' => 'fa-car-burst', 'variant' => 'danger', 'title' => 'Acidente material'],
1395| 'near_miss' => ['icon' => 'fa-bolt', 'variant' => 'warning', 'title' => 'Quase acidente'],
1396| 'occurrence' => ['icon' => 'fa-triangle-exclamation', 'variant' => 'danger', 'title' => 'Ocorrência'],
1397| 'refusal' => ['icon' => 'fa-hand', 'variant' => 'company', 'title' => 'Direito de Recusa'],
1398| ];
1399| }
1400|
1401| /**
1402| * @param array<string, mixed> $action
1403| */
1404| private function resolveOriginUrl(array $action): string
1405| {
1406| $originKey = $this->resolveOriginKey(
1407| (string) ($action['origem'] ?? ''),
1408| (string) ($action['event_type'] ?? '')
1409| );
1410| $origemId = (int) ($action['origem_id'] ?? 0);
1411|
1412| if ($originKey === 'inspection' && $origemId > 0) {
1413| return '/manager/ssma/inspections/' . $origemId . '/view';
1414| }
1415| if ($originKey === 'approach' && $origemId > 0) {
1416| return '/manager/ssma/abordagens/' . $origemId . '/view';
1417| }
1418|
1419| $occurrenceId = (int) ($action['occurrence_id'] ?? 0);
1420| if ($occurrenceId > 0) {
1421| return '/manager/ssma/ocorrencias/' . $occurrenceId;
1422| }
1423|
1424| if ($origemId > 0 && in_array($originKey, ['accident_personal', 'accident_material', 'near_miss', 'ros', 'accident'], true)) {
1425| return '/manager/ssma/ocorrencias/' . $origemId;
1426| }
1427|
1428| $eventId = (int) ($action['event_id'] ?? 0);
1429| if ($eventId > 0) {
1430| return '/manager/ssma/ocorrencias?event=' . $eventId;
1431| }
1432|
1433| return '';
1434| }
1435|
1436| /**
1437| * @param array<string, array{label: string, count: int}> $originCount
1438| *
1439| * @return list<array{label: string, count: int}>
1440| */
1441| private function presentSeededOriginChart(array $originCount): array
1442| {
1443| $seed = [
1444| 'accident_personal' => ['label' => 'Acidente pessoal', 'count' => 0],
1445| 'accident_material' => ['label' => 'Acidente material', 'count' => 0],
1446| 'near_miss' => ['label' => 'Quase acidente', 'count' => 0],
1447| 'inspection' => ['label' => 'Inspeção', 'count' => 0],
1448| 'ros' => ['label' => 'ROS', 'count' => 0],
1449| 'approach' => ['label' => 'Abordagem', 'count' => 0],
1450| ];
1451| foreach ($originCount as $key => $row) {
1452| if (isset($seed[$key])) {
1453| $seed[$key]['count'] = (int) ($row['count'] ?? 0);
1454| continue;
1455| }
1456| if (($row['count'] ?? 0) > 0) {
1457| $seed[$key] = ['label' => (string) ($row['label'] ?? $key), 'count' => (int) $row['count']];
1458| }
1459| }
1460| $total = array_sum(array_map(static fn (array $row): int => (int) $row['count'], $seed));
Request #56
deepseek-v4-flash
P:45.55K C:1.44K CR:42.11K CW:0
11369ms
Reasoning
OK, so the overview chart seeding: keys not in the seed are appended if count > 0 — e.g., 'refusal' with count > 0 would be appended. So refusal still shows in chart. Good, so the seed removal is not a data loss in the chart. The only problem is filter options not including refusal, which is confirmed finding #5 already.
Wait, but there's a subtlety in the origin filter for overview. Let me check the visao_geral branch: buildFilterPayload with `originFilter` param. In the visao_geral branch, does it apply $originFilter? Looking at lines 74-120: it computes $filtered = filterByCreatedAtRange, applyOverviewDimensionFilters(...) with args including $execResponsible, $valResponsible, $originFilter, $meta. So there is likely an overview dimension filter that uses $originFilter? Wait actually args passed: `$this->applyOverviewDimensionFilters($filtered, $management, $area, $execResponsible, $valResponsible, $originFilter, $meta)`. So origin filter is applied for overview as well presumably via resolveOriginKey. Need to verify applyOverviewDimensionFilters to see whether origin filter uses resolveOriginKey and whether options include near_miss etc. But confirmed finding #5 covers the removal from options.
Now, let me consider the overview chart vs overview filter options; not to repeat #5.
Let me now review the service concerns around new key changes and other consumers:
- originCount keys (pendencias). Where is originCount used? Probably presentSeededOriginChart is only for overview, whereas pendencias KPI? Let's check where originCount is consumed in buildPendenciasData: At the end of the loop, originCount keyed by originKey with label. Where is this returned? Let me search later in buildPendenciasData return for 'origin' chart. Might be part of 'charts' e.g. `origin_distribution`. It may include originCount with new keys, and JS chart renders. But for 'other' keys with count > 0 appended. OK.
Now, potential regression: The originCount keys changed from 'accident' to 'accident_personal'. Any other consumer (like the front-end chart axis or filter) that still uses 'accident'? Let me search JS for origin chart key handling ('accident', 'accident_personal', etc.) and see if the JS expected keys match. But this diff is about matching new keys; presumably updated.
Let's check the JS section that renders the origin chart for visao_geral, and how overview chart origins seeded. Since the diff includes the template fallback options. But maybe the chart filter uses keys.
Actually, the important concern: the JS `syncOverviewFilterState` reads `ap_overview_filter_origin` and stores in `panelState.origin`. And `buildFilterParams` for visao_geral adds origin param. And also adds `mine` param if set (shared state). This `mine` param from pendencias could leak into visao_geral and comparativo requests. But since mine is read only from pendencias checkbox; when user goes to Visão Geral without unchecking the mine box, requests to overview include mine=1. Would backend overview endpoint treat mine param? Looking at controller: `if ($request->query->getBoolean('mine')) {...}` is in the pendencias/panel AJAX endpoint. This controller endpoint (panel/filter) also handles visao_geral/comparativo. If a user checks "Minhas ações" in pendencias then switches to Visão Geral and triggers filter, params include mine=1 & origin (shared). Then the controller applies mine to overview: rebuilds payload for all views... The mine filter would then restrict overview data to user's own actions. Hmm. Is that intended? Actually it might be a bug: In Visão Geral, "Minhas ações" checkbox is not present, but the state remains from pendencias, so overview charts would suddenly only count user's actions. But this may be "leakage" of a filter. Is that a real issue worth reporting? Actually could be considered acceptable if filters persist across tabs (they also send team/vinculo/unidade for all views). Indeed `panelState.team`, `vinculo`, `unidade` are also applied in all views, so filter persistence across sub-views seems intended. For mine, if user checks, then overview restricted too. Hmm. Actually, wait: the mine param is added for ALL views, but the checkbox only exists in pendencias. If the user checked it and then goes to overview... it's arguably intended to keep filter (like team). But not obvious. This is subtle; maybe not the most important. Also the checkbox persists when revisiting. It's probably fine to persist.
But a more definite issue: in `buildFilterParams`, for the `pendencias` view, origin param is set. In service pendencias branch it filters via `$originFilter`. Good.
Now, is there a possibility that `origin` value is set for overview from syncOverviewFilterState (reads ap_overview_filter_origin), but the overview filter UI options might have different value set? Template options in 'overview_origins' are accident_personal etc. The overview filter select id ap_overview_filter_origin may exist (maybe in a separate template). It maps to same origin values. Then JS applies origin param in visao_geral requests too. In service, the overview branch passes originFilter to applyOverviewDimensionFilters? Let me confirm applyOverviewDimensionFilters uses it. Actually from line 80 args, $originFilter passed as param. Let me read that function quickly to see whether filtering is done with resolveOriginKey and whether the origin keys used in options align (i.e. near_miss etc.). Also check whether 'originFilter' applies to actions in overview.
Let me read applyOverviewDimensionFilters.
Tool Calls (2)
code_search
Show Details
Arguments
{"search_text": "function applyOverviewDimensionFilters", "file_patterns": ["src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php"]}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php Match lines: 1 499| private function applyOverviewDimensionFilters(
code_search
Show Details
Arguments
{"search_text": "origin_type|origin_icons|origin_url|occurrence_title", "file_patterns": ["public/js/ssma/action_plan_panel.js"], "use_perl_regexp": true}
Result
File: public/js/ssma/action_plan_panel.js
Match lines: 5
896| var originUrl = row.origin_url || '';
919| + ' data-action-origin="' + escapeHtml(row.origin_label || row.occurrence_title || '') + '"'
994| updatePendenciasTable(panel.table || {}, panel.origin_icons || {});
998| var originMeta = (originIcons && originIcons[row.origin_type]) || {};
1023| var originIcons = (panelData && panelData.origin_icons) || {};
Request #57
deepseek-v4-flash
P:47.18K C:112 CR:46.98K CW:0
1741ms
Reasoning
Let me read applyOverviewDimensionFilters to see how originFilter is applied for overview.
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 600, "file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 490}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648)
IS_TRUNCATED: false
LINE_RANGE: 490-600
490| }));
491| }
492|
493| /**
494| * @param list<array<string, mixed>> $actions
495| * @param array{members_by_id: array<int, array{id: int, name: string, vinculo: string}>} $meta
496| *
497| * @return list<array<string, mixed>>
498| */
499| private function applyOverviewDimensionFilters(
500| array $actions,
501| string $management,
502| string $area,
503| string $execResponsible,
504| string $valResponsible,
505| string $originFilter,
506| array $meta
507| ): array {
508| return array_values(array_filter($actions, function (array $action) use ($execResponsible, $valResponsible, $originFilter): bool {
509| if ($originFilter !== '' && $this->resolveOriginKey((string) ($action['origem'] ?? ''), (string) ($action['event_type'] ?? '')) !== $originFilter) {
510| return false;
511| }
512| if ($execResponsible !== '') {
513| $execId = (int) $execResponsible;
514| $ids = array_map('intval', (array) ($action['responsible_ids'] ?? []));
515| if (!in_array($execId, $ids, true)) {
516| return false;
517| }
518| }
519| if ($valResponsible !== '') {
520| if ((int) ($action['validator_member_id'] ?? 0) !== (int) $valResponsible) {
521| return false;
522| }
523| }
524|
525| return true;
526| }));
527| }
528|
529| /**
530| * @return array{0: string|null, 1: string|null}
531| */
532| private function resolvePendenciasDeadlineRange(string $period, \DateTimeImmutable $today): array
533| {
534| $todayStr = $today->format('Y-m-d');
535| if (str_starts_with($period, 'pend:range:')) {
536| $parts = explode(':', $period);
537| $from = $parts[2] ?? $todayStr;
538| $to = $parts[3] ?? $todayStr;
539| if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $from) && preg_match('/^\d{4}-\d{2}-\d{2}$/', $to)) {
540| return $from <= $to ? [$from, $to] : [$to, $from];
541| }
542| }
543|
544| $preset = str_starts_with($period, 'pend:') ? substr($period, 5) : $period;
545|
546| return match ($preset) {
547| 'week' => [$todayStr, $today->modify('+7 days')->format('Y-m-d')],
548| 'fortnight' => [$todayStr, $today->modify('+15 days')->format('Y-m-d')],
549| 'next_3_months' => [$todayStr, $today->modify('+90 days')->format('Y-m-d')],
550| 'all_future' => [null, null],
551| default => [$todayStr, $today->modify('+30 days')->format('Y-m-d')],
552| };
553| }
554|
555| /**
556| * @return array{0: ?string, 1: string}
557| */
558| private function resolveOverviewPeriodBounds(string $period, \DateTimeImmutable $today): array
559| {
560| $to = $today->format('Y-m-d');
561| if (str_starts_with($period, 'range:')) {
562| $parts = explode(':', $period);
563| $from = $parts[1] ?? null;
564| $end = $parts[2] ?? $to;
565| if ($from && preg_match('/^\d{4}-\d{2}-\d{2}$/', $from)) {
566| return [$from, $end];
567| }
568| }
569|
570| $from = match ($period) {
571| 'last_week' => $today->modify('monday this week')->format('Y-m-d'),
572| 'last_month' => $today->modify('first day of this month')->format('Y-m-d'),
573| 'last_3_months' => $today->modify('-3 months')->modify('first day of this month')->format('Y-m-d'),
574| 'last_6_months' => $today->modify('-6 months')->modify('first day of this month')->format('Y-m-d'),
575| 'last_year' => $today->modify('-1 year')->format('Y-m-d'),
576| default => null,
577| };
578|
579| return [$from, $to];
580| }
581|
582| /**
583| * @return list<string>
584| */
585| private function resolveAvailableAxes(string $view, string $period): array
586| {
587| if ($view === 'pendencias') {
588| $preset = str_starts_with($period, 'pend:') ? substr($period, 5) : $period;
589|
590| return match ($preset) {
591| 'week' => ['daily'],
592| 'fortnight' => ['daily', 'weekly'],
593| 'next_month' => ['daily', 'weekly'],
594| 'next_3_months' => ['weekly', 'monthly'],
595| default => ['weekly', 'monthly'],
596| };
597| }
598|
599| return match ($period) {
600| 'last_week' => ['daily'],
Request #58
deepseek-v4-flash
P:48.71K C:898 CR:47.23K CW:0
7270ms
Reasoning
OK, origin filter used in overview as well, with new keys. Good.
Now consider: In pendencias, origin filter works on actions that have origins, and it uses `$action['origem']` and `event_type`. Fine.
Now let me focus on concrete bugs. Let me list candidate issues found so far:
1. **JS: `panelState.origin` reused across views**. In `buildFilterParams`, for pendencias the origin select `ap_painel_filter_origem` sets panelState.origin; and in visao_geral, the overview origin select `ap_overview_filter_origin` overwrites panelState.origin. There may be a subtle bug: when pendencias filter runs after visiting overview where origin select defaulted to '', origin resets. It's okay.
But actually look: in buildFilterParams for pendencias, `params.set('origin', ...)` if panelState.origin set. In the template, only the pendencias filter select `ap_painel_filter_origem` exists (new). The overview filter `ap_overview_filter_origin` presumably exists in a different template file (`_tab_painel_visao_geral.html.twig`). syncOverviewFilterState reads it. When a user selects origin filter in pendencias then clicks an action maybe nothing. OK.
2. **`row.origin_label` and `row.occurrence_title`** both originate from `$origemLabel` which defaults to 'Outro' only in originCount usage after mapping; in normalizedActions, `'occurrence_title' => $origemLabel` where `$origemLabel = resolveOriginLabel(...)`. If resolveOriginLabel returns e.g. 'Outro' or origem text. Actually default returns origem raw if non-empty; if the key is 'other', default case returns $origem or 'Outro'. So origin_label empty? only if key unknown and origem empty and event_type empty → default 'Outro'. So it's never empty. Fine.
3. **Service field 'description' fallback to title** for the offcanvas; description may be long and stored in data attribute. Since the JS sets description as attribute escaped. Data attributes are fine as text. But if description contains newlines/quotes - escaped via escapeHtml in JS. But wait: this data attribute is set in JS buildPendenciasTableRowHtml and read back via getAttribute then textContent set — no HTML injection. OK.
4. **The `mine` param sent with GET endpoint while GET is used for a read endpoint.** Filtering AJAX GET is fine.
5. **Mine filtering semantics**: When mine is checked, the controller rebuilds payload with `[$mineId => true]` as memberScopeIds, which calls `filterByMemberScope($allActions, $memberScopeIds)` at the top (after loadActionsForCompanies) and then continues with team/vinculo and the view-specific filter (deadline, origin). But note, the first build of payload occurred before (without scope), and second replaces. But note: the second call is duplicated inside `if ($request->query->getBoolean('mine'))` block; if mine not true, the earlier payload is returned. Also the controller previously already passed `$view`, `$period`, etc. from the request. Fine.
6. **`mine` and scope**: The requirement says "Filtro 'Minhas ações': retorna apenas ações em que o usuário é executor ou validador". But `filterByMemberScope` filters actions by `responsible_ids`? Let's check `filterByMemberScope` implementation to see whether it includes validator member. If it only checks `responsible_ids`, then actions where the user is only validator would be excluded → bug relative to the documented rule. Let me check.
Let me search for filterByMemberScope.
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php"], "search_text": "function filterByMemberScope"}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php Match lines: 1 367| private function filterByMemberScope(array $actions, array $memberScopeIds): array
Request #59
deepseek-v4-flash
P:49.67K C:95 CR:49.54K CW:0
1584ms
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 400, "file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 360}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648)
IS_TRUNCATED: false
LINE_RANGE: 360-400
360|
361| /**
362| * @param list<array<string, mixed>> $actions
363| * @param array<int, true> $memberScopeIds
364| *
365| * @return list<array<string, mixed>>
366| */
367| private function filterByMemberScope(array $actions, array $memberScopeIds): array
368| {
369| if ($memberScopeIds === []) {
370| return [];
371| }
372|
373| return array_values(array_filter($actions, function (array $action) use ($memberScopeIds): bool {
374| $validatorId = (int) ($action['validator_member_id'] ?? 0);
375| if ($validatorId > 0 && isset($memberScopeIds[$validatorId])) {
376| return true;
377| }
378| foreach ((array) ($action['responsible_ids'] ?? []) as $id) {
379| if (isset($memberScopeIds[(int) $id])) {
380| return true;
381| }
382| }
383|
384| return false;
385| }));
386| }
387|
388| /**
389| * @param list<array<string, mixed>> $actions
390| * @param array{teams: list<array<string, mixed>>, member_vinculo: array<int, string>} $meta
391| *
392| * @return list<array<string, mixed>>
393| */
394| private function filterByTeamAndVinculo(array $actions, string $team, string $vinculo, array $meta): array
395| {
396| $teamMemberIds = null;
397| if ($team !== '') {
398| $teamMemberIds = [];
399| foreach ($meta['teams'] as $t) {
400| if (strcasecmp((string) ($t['name'] ?? ''), $team) === 0) {
Request #60
deepseek-v4-flash
P:50.25K C:237 CR:49.66K CW:0
2627ms
Reasoning
OK, filterByMemberScope includes both responsible and validator. So mine scope filtering is fine.
Now, look at the `filterByTeamAndVinculo` call. When 'mine' is checked, we pass memberScopeIds only; team and vinculo come from request. OK.
Now let me examine the controller code to understand the panel filter endpoint, and check a bug: in the controller 'mine' handling, when mine is set and the member scope is non-empty, the payload is rebuilt. But, if the earlier payload default memberScope (for regular members/stakeholders, the view scoping) already passed some members — need to see the initial build of the payload. Let's read the controller around lines 440-560.
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 560, "file_path": "src/Controller/SsmaController.php", "start_line": 430}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 430-560
430| if ($company instanceof Company) {
431| $this->syncSsmaLinkedProjectMembersForCompany($company);
432| }
433|
434| if ($request->query->get('executive_report') === '1') {
435| $company = $this->getSsmaCompany();
436|
437| return $this->render('ssma/action_plan/action_plan_report/index.html.twig', array_merge($viewData, [
438| 'company' => $company,
439| 'report' => $this->buildActionPlanExecutiveReportData(),
440| ]));
441| }
442|
443| $requestedTab = (string) $request->query->get('tab', 'tab_plano_acoes');
444| $allowedTabs = ['tab_plano_acoes', 'tab_plano_painel', 'tab_plano_config', 'tab_plano_permissao'];
445| if (!in_array($requestedTab, $allowedTabs, true)) {
446| $requestedTab = 'tab_plano_acoes';
447| }
448|
449| return $this->render('ssma/action_plan/index.html.twig', array_merge($viewData, [
450| 'ssmaPlanoAcaoActiveTab' => $requestedTab,
451| 'action_plan_panel_data' => $this->buildActionPlanPanelViewData($request),
452| ]));
453| }
454|
455| public function planoAcaoPainel(Request $request): Response
456| {
457| if (!$this->canAccessSsmaActionPlanHub()) {
458| throw $this->createAccessDeniedException('Sem permissão para acessar Plano de Ação SSMA.');
459| }
460|
461| $viewData = $this->buildSsmaViewData();
462| $company = $this->getSsmaCompany();
463| if ($company instanceof Company) {
464| $this->syncSsmaLinkedProjectMembersForCompany($company);
465| }
466|
467| return $this->render('ssma/action_plan/index.html.twig', array_merge($viewData, [
468| 'ssmaPlanoAcaoActiveTab' => 'tab_plano_painel',
469| 'action_plan_panel_data' => $this->buildActionPlanPanelViewData($request),
470| ]));
471| }
472|
473| public function planoAcaoPanelFilter(Request $request): JsonResponse
474| {
475| if (!$this->canAccessSsmaActionPlanHub()) {
476| return new JsonResponse(['success' => false, 'message' => 'Sem permissão.'], 403);
477| }
478|
479| $company = $this->getSsmaCompany();
480| if (!$company instanceof Company) {
481| $emptyPanel = $this->actionPlanPanelPresenter->presentFilterResponse([
482| 'view' => 'pendencias',
483| 'panel_data' => $this->buildEmptyActionPlanPanelData(),
484| ], []);
485|
486| return new JsonResponse(array_merge(['success' => true], $emptyPanel));
487| }
488|
489| $view = (string) $request->query->get('view', 'pendencias');
490| $period = (string) $request->query->get('period', $view === 'pendencias' ? 'next_month' : 'last_3_months');
491| $axis = (string) $request->query->get('axis', '');
492| $team = trim((string) $request->query->get('team', ''));
493| $vinculo = strtoupper(trim((string) $request->query->get('vinculo', '')));
494| $page = max(1, (int) $request->query->get('page', 1));
495| $perPage = max(1, min(100, (int) $request->query->get('per_page', 10)));
496|
497| $unidadeScope = $this->resolveSsmaUnidadeFilterScope($company, $request);
498| $scopeCompanies = $view === 'comparativo'
499| ? $this->resolveSsmaNetworkSubsidiaries($company)
500| : $unidadeScope['companies'];
501| $dataCompany = $unidadeScope['data_company'];
502|
503| $payload = $this->ssmaActionPlanPanelService->buildFilterPayload(
504| $scopeCompanies,
505| $dataCompany,
506| $view,
507| $period,
508| $axis,
509| $team,
510| $vinculo,
511| $this->getActionTypeMetadata(),
512| $this->resolveActionPlanPanelMemberScope($company),
513| $page,
514| $perPage,
515| trim((string) $request->query->get('management', '')),
516| trim((string) $request->query->get('area', '')),
517| trim((string) $request->query->get('exec_responsible', '')),
518| trim((string) $request->query->get('val_responsible', '')),
519| trim((string) $request->query->get('origin', '')),
520| );
521|
522| if ($request->query->getBoolean('mine')) {
523| $user = $this->getUser();
524| $member = ($user instanceof User) ? $this->getCurrentCompanyMember($company, $user) : null;
525| $mineId = (int) ($member?->getId() ?? 0);
526| if ($mineId > 0) {
527| $payload = $this->ssmaActionPlanPanelService->buildFilterPayload(
528| $scopeCompanies,
529| $dataCompany,
530| $view,
531| $period,
532| $axis,
533| $team,
534| $vinculo,
535| $this->getActionTypeMetadata(),
536| [$mineId => true],
537| $page,
538| $perPage,
539| trim((string) $request->query->get('management', '')),
540| trim((string) $request->query->get('area', '')),
541| trim((string) $request->query->get('exec_responsible', '')),
542| trim((string) $request->query->get('val_responsible', '')),
543| trim((string) $request->query->get('origin', '')),
544| );
545| }
546| }
547|
548| $filterOptions = $this->ssmaActionPlanPanelService->buildFilterOptions($dataCompany);
549| $presented = $this->actionPlanPanelPresenter->presentFilterResponse($payload, $filterOptions);
550|
551| return $this->ssmaJsonResponse(array_merge(['success' => true], $presented));
552| }
553|
554| /** @return array<string, mixed> */
555| private function buildActionPlanPanelViewData(Request $request): array
556| {
557| $company = $this->getSsmaCompany();
558| if (!$company instanceof Company) {
559| return $this->actionPlanPanelPresenter->presentDashboard(
560| ['panel_data' => $this->buildEmptyActionPlanPanelData()],
Request #61
deepseek-v4-flash
P:52.23K C:1.12K CR:50.43K CW:0
8925ms
Reasoning
OK, so the controller endpoint: The `mine` param overrides even member scope for non-gestors. But a nuance: an attacker could send `mine=1` with a user who is member of a different company? getCurrentCompanyMember($company, $user) uses current company. And member scope with mineId applies regardless of the user's actual access scope (e.g., a supervisor could set mine to see only own actions, which is a narrower scope — that's fine; a team leader? fine). No privilege escalation, only narrowing. OK.
Now let's check `resolveActionPlanPanelMemberScope` to see how default scope is determined (members vs all). Actually prior finding #3 covers the mineId=0 issue. Skip.
Now let me look at the JS diff again for the filter event binding. The change listener is bound to `#ap_painel_filter_origem` changes, calling `window.setCustomSelectValue`. But wait: does the custom select for `ap_painel_filter_origem` exist? `_custom_select.html.twig` with loading_enabled false. The change event triggers on the hidden native select or custom? Probably custom select component updates the hidden select and triggers change. OK.
Now, what about the checkbox `ap_painel_filter_mine`: they add a direct addEventListener for change. Fine.
Now consider a bug in `buildFilterParams`: origin param added only for pendencias and visao_geral. The checkbox `mine` param added unconditionally for all views. And `panelState.origin` also used by comparativo? Not set in comparativo branch. Fine.
But there's a subtle bug: origin and mine state loaded initially? When page loads, panelState.mine default false; syncPendenciasFilterState runs only when user changes something or trigger. Let's check the page-load flow - `parsePanelData`? There's `panelState` initialized at top with mine false. When a filter event triggers, syncPendenciasFilterState updates and buildFilterParams includes mine param. OK.
Now consider: after a pendencias filter request, the response updates DOM, and bindTableViewButtons attaches click handlers on `.js-ssma-ap-panel-view-action`. But there's `updatePendenciasTable` that re-renders rows & calls bindTableViewButtons. It also re-creates a DataTable. But after DataTable destroy + re-init, event binding etc. OK.
Now what about `updatePendenciasTable` used from applyPendenciasDom. There is also a DataTable plugin that re-renders? With `clear().destroy()`. OK.
Now the JS: origin button (link) placed inside a DataTable column "Ações" cell; clicking external link navigates away. Not a JS concern.
Now look at `openActionViewOffcanvas`: uses `window.jQuery('#ssmaApActionView').modal('show');` but the function's beginning already sets text; this offcanvas missing markup (finding #1). Not to repeat.
But here's a new observation regarding #1: the click handler on `.js-ssma-ap-panel-view-action` calls `openActionViewOffcanvas(btn)` which is fine only if offcanvas markup exists. Since the finding says no markup exists, it's confirmed duplicate. Not repeat.
Let me now check the template `_tab_painel.html.twig` for the DataTable header and pendencias table structure with the new columns and whether the actions column header 'Ações' had a specific key, plus whether the responsive tables (Responsive extension) might expect columns mapping for origin icons (e.g., render type). Template uses MetahumanDataTables responsive data columns config (columns: [{...}]) with keys 'origem' etc. In the table, row cells are just <td>; origin icons rendered. OK.
Now let's read template to see new filters etc. Let me read _tab_painel.html.twig lines 100-220 and the table header section 480-560. Also check for offcanvas markup existence in the whole file (to double check finding #1). Actually finding #1 says offcanvas not in _tab_painel; confirmed; don't repeat. But maybe offcanvas markup is elsewhere like `_tab_action_plan.html.twig`? Confirmed finding says none of the templates define it, presumably across all files. Don't repeat.
Let me read the template diff context anyway.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 240, "file_path": "templates/ssma/action_plan/tabs/_tab_painel.html.twig", "start_line": 60}
Result
File: templates/ssma/action_plan/tabs/_tab_painel.html.twig (Total lines: 570)
IS_TRUNCATED: false
LINE_RANGE: 60-240
60|}
61|
62|.ssma-action-plan-chart-title {
63| font-size: 16px;
64| font-weight: 700;
65| color: #5C5D5D;
66|}
67|
68|</style>
69|
70|{# ── Filtros desktop — Pendências ─────────────────────────────────────── #}
71|<div class="modern-header-actions has-mobile-fabs" id="ap_painel_controls">
72| <div class="filters-container tab-filters ml-auto align-items-center ssma-ap-panel-filters-row d-none{% if panel_default_view == 'pendencias' %} d-lg-flex{% endif %}" id="ap-painel-filters-pendencias">
73| <div class="filter-item">
74| {% include 'components/ui/_custom_select.html.twig' with {
75| id: 'ap_painel_filter_team',
76| name: 'ap_painel_filter_team',
77| label: 'Equipe',
78| options: ap_painel_team_options,
79| selected_value: '',
80| loading_enabled: true
81| } %}
82| </div>
83| <div class="filter-item">
84| {% include 'components/ui/_custom_select.html.twig' with {
85| id: 'ap_painel_filter_vinculo',
86| name: 'ap_painel_filter_vinculo',
87| label: 'Tipo de Vínculo',
88| options: ap_painel_vinculo_options,
89| selected_value: '',
90| loading_enabled: true
91| } %}
92| </div>
93| <div class="filter-item oc-painel-period-filter">
94| <button type="button" class="oc-period-trigger" id="ap_painel_period_trigger" aria-label="Filtrar período">
95| <i class="fas fa-calendar-alt" aria-hidden="true"></i>
96| <span id="ap_painel_period_label"></span>
97| </button>
98| <div class="oc-period-popover d-none" id="ap_painel_period_popover">
99| <div class="oc-period-popover-header">
100| <strong>Selecionar Período</strong>
101| <button type="button" class="oc-period-close" id="ap_painel_period_close" aria-label="Fechar">
102| <i class="fas fa-times"></i>
103| </button>
104| </div>
105| <div class="oc-period-popover-body">
106| <div class="oc-period-field">
107| <label for="ap_painel_start_date">Data inicial</label>
108| <div class="oc-period-input-wrap">
109| <input type="date" class="form-control" id="ap_painel_start_date" aria-label="Data inicial">
110| </div>
111| </div>
112| <div class="oc-period-field">
113| <label for="ap_painel_end_date">Data final</label>
114| <div class="oc-period-input-wrap">
115| <input type="date" class="form-control" id="ap_painel_end_date" aria-label="Data final">
116| </div>
117| </div>
118| <div class="oc-period-presets">
119| <span class="oc-period-presets-label">Atalhos de período</span>
120| <div class="oc-period-presets-row">
121| <button type="button" class="oc-period-preset ap-painel-period-preset" data-preset="next_month">Próximo mês</button>
122| <button type="button" class="oc-period-preset ap-painel-period-preset" data-preset="week">Próxima semana</button>
123| <button type="button" class="oc-period-preset ap-painel-period-preset" data-preset="fortnight">Próximos 15 dias</button>
124| <button type="button" class="oc-period-preset ap-painel-period-preset" data-preset="next_3_months">Próximos 3 meses</button>
125| <button type="button" class="oc-period-preset ap-painel-period-preset" data-preset="all_future">Todo o futuro</button>
126| </div>
127| </div>
128| <div class="oc-period-summary-row">
129| <button type="button" class="oc-period-apply-icon" id="ap_painel_period_apply" title="Aplicar período">
130| <i class="fas fa-calendar-alt"></i>
131| </button>
132| <div class="oc-period-summary">
133| <i class="fas fa-info-circle"></i>
134| <span id="ap_painel_period_summary"></span>
135| </div>
136| </div>
137| <div class="oc-period-comparison-info" style="grid-column:1/-1; font-size:12px; color:#5C5D5D; line-height:1.5; padding:10px 0 0; border-top:1px solid #EEF0F2; margin-top:4px;">
138| <i class="fas fa-info-circle" style="margin-right:4px;"></i>
139| O período considera o prazo das pendências a partir de hoje. Ajuste as datas ou use os atalhos para refinar o recorte.
140| </div>
141| </div>
142| </div>
143| </div>
144| {% if ssma_show_unidade_filter %}
145| <div class="filter-item ap-painel-unidade-filter">
146| {% include 'components/ui/_custom_select.html.twig' with {
147| id: 'ap_painel_filter_unidade',
148| name: 'ap_painel_filter_unidade',
149| label: 'Unidade',
150| options: ap_painel_unidade_options,
151| selected_value: 'todas',
152| loading_enabled: true
153| } %}
154| </div>
155| {% endif %}
156| <div class="filter-item">
157| {% include 'components/ui/_custom_select.html.twig' with {
158| id: 'ap_painel_filter_origem',
159| name: 'ap_painel_filter_origem',
160| label: 'Origem',
161| options: panel_filters.origin|default([
162| {'value': '', 'text': 'Origem'},
163| {'value': 'accident_personal', 'text': 'Acidente pessoal'},
164| {'value': 'accident_material', 'text': 'Acidente material'},
165| {'value': 'near_miss', 'text': 'Quase acidente'},
166| {'value': 'ros', 'text': 'ROS'},
167| {'value': 'inspection', 'text': 'Inspeção'},
168| {'value': 'approach', 'text': 'Abordagem'}
169| ]),
170| selected_value: '',
171| loading_enabled: false
172| } %}
173| </div>
174| <div class="filter-item d-flex align-items-center">
175| <div class="custom-control custom-switch mb-0">
176| <input type="checkbox" class="custom-control-input" id="ap_painel_filter_mine" name="ap_painel_filter_mine">
177| <label class="custom-control-label" for="ap_painel_filter_mine">Minhas ações</label>
178| </div>
179| </div>
180| </div>
181|
182| {# ── Filtros desktop — Visão Geral (mesmo subheader das Pendências) ── #}
183| <div class="filters-container tab-filters ml-auto align-items-center ssma-ap-panel-filters-row d-none{% if panel_default_view == 'visao_geral' %} d-lg-flex{% endif %}" id="ap-painel-filters-overview">
184| <div class="filter-item">
185| {% include 'components/ui/_custom_select.html.twig' with {
186| id: 'ap_overview_filter_team',
187| name: 'ap_overview_filter_team',
188| label: 'Equipe',
189| options: ov_filters.team|default([{'value': '', 'text': 'Equipe'}]),
190| selected_value: '',
191| loading_enabled: true
192| } %}
193| </div>
194| <div class="filter-item">
195| {% include 'components/ui/_custom_select.html.twig' with {
196| id: 'ap_overview_filter_management',
197| name: 'ap_overview_filter_management',
198| label: 'Gerência',
199| options: ov_filters.management|default([{'value': '', 'text': 'Gerência'}]),
200| selected_value: '',
201| loading_enabled: true
202| } %}
203| </div>
204| <div class="filter-item">
205| {% include 'components/ui/_custom_select.html.twig' with {
206| id: 'ap_overview_filter_origin',
207| name: 'ap_overview_filter_origin',
208| label: 'Origem',
209| options: ov_filters.origin|default([{'value': '', 'text': 'Origem'}]),
210| selected_value: '',
211| loading_enabled: true
212| } %}
213| </div>
214| <div class="filter-item oc-painel-period-filter">
215| <button type="button" class="oc-period-trigger" id="ap_overview_period_trigger" aria-label="Filtrar período">
216| <i class="fas fa-calendar-alt" aria-hidden="true"></i>
217| <span id="ap_overview_period_label">{{ ov_filters.period_label|default('') }}</span>
218| </button>
219| <div class="oc-period-popover d-none" id="ap_overview_period_popover">
220| <div class="oc-period-popover-header">
221| <strong>Selecionar Período</strong>
222| <button type="button" class="oc-period-close" id="ap_overview_period_close" aria-label="Fechar">
223| <i class="fas fa-times"></i>
224| </button>
225| </div>
226| <div class="oc-period-popover-body">
227| <div class="oc-period-field">
228| <label for="ap_overview_start_date">Data inicial</label>
229| <div class="oc-period-input-wrap">
230| <input type="date" class="form-control" id="ap_overview_start_date" aria-label="Data inicial">
231| </div>
232| </div>
233| <div class="oc-period-field">
234| <label for="ap_overview_end_date">Data final</label>
235| <div class="oc-period-input-wrap">
236| <input type="date" class="form-control" id="ap_overview_end_date" aria-label="Data final">
237| </div>
238| </div>
239| <div class="oc-period-presets">
240| <span class="oc-period-presets-label">Atalhos de período</span>
file_read
Show Details
Arguments
{"end_line": 560, "file_path": "templates/ssma/action_plan/tabs/_tab_painel.html.twig", "start_line": 460}
Result
File: templates/ssma/action_plan/tabs/_tab_painel.html.twig (Total lines: 570)
IS_TRUNCATED: false
LINE_RANGE: 460-560
460| <div class="ssma-ap-table-mgmt-sub">{{ row.location }}</div>
461| </div>
462| {% endset %}
463| {% set priority_key = row.priority_key|default('baixa')|lower %}
464| {% set priority_color = priority_colors[priority_key] is defined ? priority_colors[priority_key] : 'gray' %}
465| {% set priority_cell %}
466| {% include 'components/ui/_pill.html.twig' with {
467| label: row.priority,
468| color: priority_color,
469| size: 'sm'
470| } %}
471| {% endset %}
472| {% set responsible_members = [] %}
473| {% for person in row.responsible|default([]) %}
474| {% set responsible_members = responsible_members|merge([{
475| name: person.name|default(person.initials|default('')),
476| avatar: person.avatar|default('')
477| }]) %}
478| {% endfor %}
479| {% set responsible_cell %}
480| {% include 'components/ui/_member_avatars_stack.html.twig' with {
481| members: responsible_members,
482| max_visible: 3,
483| size: 27,
484| empty_label: '—'
485| } %}
486| {% endset %}
487| {% set deadline_cell %}
488| <span class="ssma-ap-deadline--{{ row.deadline_overdue|default(false) ? 'overdue' : 'ok' }}">{{ row.deadline }}</span>
489| {% endset %}
490| {% set action_cell %}
491| <button type="button"
492| class="ssma-ap-panel-table-action-btn js-ssma-ap-panel-view-action"
493| data-action-id="{{ row.id }}"
494| data-toggle="tooltip"
495| title="Visualizar"
496| aria-label="Visualizar ação">
497| <i class="fas fa-eye" aria-hidden="true"></i>
498| </button>
499| {% endset %}
500| {% set ap_table_rows = ap_table_rows|merge([{
501| titulo: title_cell|trim,
502| origem: origin_cell|trim,
503| gerencia: mgmt_cell|trim,
504| prioridade: priority_cell|trim,
505| responsavel: responsible_cell|trim,
506| prazo: deadline_cell|trim,
507| pendencia: row.pending,
508| acoes: action_cell|trim
509| }]) %}
510| {% endfor %}
511|
512| <div class="row mb-3">
513| <div class="col-12">
514| {% include 'components/ui/_table_card.html.twig' with {
515| title: 'Plano de ação',
516| table_id: 'ssma-ap-panel-table',
517| headers: [
518| { title: 'Título da ação', responsivePriority: 1 },
519| { title: 'Origem', key: 'origem', class: 'text-center', responsivePriority: 3 },
520| { title: 'Gerência', responsivePriority: 2 },
521| { title: 'Prioridade', responsivePriority: 2 },
522| { title: 'Quem executa', responsivePriority: 3 },
523| { title: 'Quem valida', responsivePriority: 3 },
524| { title: 'Prazo', responsivePriority: 2 },
525| { title: 'Pendência', responsivePriority: 4 },
526| { title: 'Ações', key: 'acoes', class: 'text-center', responsivePriority: 1 }
527| ],
528| rows: ap_table_rows,
529| empty_message: 'Nenhuma ação encontrada.',
530| datatable_options: {
531| ordering: false,
532| searching: false,
533| pageLength: panel_table.page_length|default(10),
534| lengthMenu: [[10, 25, 50], [10, 25, 50]],
535| lengthChange: true,
536| language: {
537| emptyTable: 'Nenhuma ação encontrada.',
538| zeroRecords: 'Nenhuma ação corresponde aos filtros.',
539| info: 'Mostrando _END_ de _TOTAL_ ações',
540| infoEmpty: 'Mostrando 0 de 0 ações',
541| lengthMenu: 'Resultados por página _MENU_',
542| paginate: { previous: '<', next: '>' }
543| }
544| }
545| } %}
546| </div>
547| </div>
548|
549| {% include 'ssma/action_plan/partials/_action_plan_semantic_adriana.html.twig' with {
550| view_mode: 'pendencias',
551| semantic: panel_semantic,
552| adriana: panel_adriana,
553| context: 'action_plan',
554| row_id: 'ssma-ap-semantic-adriana-pendencias'
555| } %}
556| </div>
557|
558| <div data-ap-panel-view="visao_geral" class="d-none">
559| {% include 'ssma/action_plan/tabs/_tab_painel_visao_geral.html.twig' %}
560| </div>
Request #62
deepseek-v4-flash
P:57.32K C:946 CR:53.25K CW:0
7044ms
Reasoning
Very important finding: The template `_tab_painel.html.twig` has a **server-side rendered initial table** (`_table_card.html.twig`) with headers columns: 'Título da ação', 'Origem', 'Gerência', 'Prioridade', 'Quem executa', 'Quem valida', 'Prazo', 'Pendência', 'Ações'. That's 9 columns now.
Look at the row building (server side): lines 460-509: rows built with `titulo`, `origem`, `gerencia`, `prioridade`, `responsavel`, `prazo`, `pendencia`, `acoes` — only 8 columns! And they map headers by position? Let's look at how _table_card renders rows: probably by keys matching the headers order? The header list: titulo, origem, gerencia, prioridade, **quem executa, quem valida**, prazo, pendencia, acoes.
The server-side row only sets 'responsavel' key (single responsible column) but not separate 'executores' and 'validadores'. If the _table_card component maps rows via keys matching the headers (e.g., `row[header.key]`)? Let's inspect `_table_card.html.twig` and `_dynamic_table.html.twig` to see how it renders columns from `rows` — by each header title? Usually tables render rows positionally (loop over columns). If positional, server row with 8 cells but 9 headers => misalignment: The first header 'Título da ação' gets titulo; 'Origem' gets origem; 'Gerência' gets gerencia; 'Prioridade' gets prioridade; 'Quem executa' gets responsavel; 'Quem valida' gets prazo; 'Prazo' gets pendencia; 'Pendência' gets acoes; 'Ações' empty. That is a misalignment regression for the server-rendered initial page (only initial render, since JS re-renders table on filter). On first load without any filter change, the table shows the server-side data. Hmm, but then updatePendenciasTable may run initially too? Let's check JS init: does it call applyPendenciasDom on load? The `applyFilterResponse` might be triggered on initial page load by `applyInitialPanelResponse` reading embedded JSON. If so the DataTable re-rendered from panelData rows (rows contain executors etc.). Possibly server-side rows are replaced on init.
Actually, wait. There are two pendencias table paths:
1. Server-side initial render in the Twig (lines ~450-510 building ap_table_rows, then _table_card).
2. JS updatePendenciasTable on AJAX/filter/init.
Given the mismatch, the header keys: 'Titulo da ação', 'Origem', 'Gerência', 'Prioridade', 'Quem executa', 'Quem valida', 'Prazo', 'Pendência', 'Ações'. But the server-side row keys include 'responsavel' not 'quem_executa'/'quem_valida'.
How does `_table_card.html.twig` render headers/rows? We need to read it to determine matching logic (by header index vs by column key mapping). Let's read `components/ui/_table_card.html.twig`.
Also note headers have no `key` for most; only 'origem' & 'acoes' have key. Actually looking: headers array: `{ title: 'Título da ação', responsivePriority: 1 }` no key; `{ title: 'Origem', key: 'origem', ...}`; `{ title: 'Gerência', responsivePriority: 2 }`; etc.
If the table card renders each row as: for each header column, cell = row[header.title]? Or by index? Need to check.
Let me read _table_card and _dynamic_table components.
Tool Calls (2)
code_search
Show Details
Arguments
{"file_patterns": ["templates/components/ui/_table_card.html.twig"], "search_text": "headers"}
Result
File: templates/components/ui/_table_card.html.twig
Match lines: 3
9| @param array headers - Default headers passed to the injected table component.
31| 'headers': [{'title': 'Nome'}, {'title': 'Status'}],
56| 'headers': headers|default([]),
file_find
Show Details
Arguments
{"query_name": "_table_card.html.twig"}
Result
templates/components/ui/_table_card.html.twig templates/evaluation/partials/_evaluations_table_card.html.twig
Request #63
deepseek-v4-flash
P:58.39K C:54 CR:58.24K CW:0
1233ms
Tool Calls (1)
file_read
Show Details
Arguments
{"file_path": "templates/components/ui/_table_card.html.twig"}
Result
File: templates/components/ui/_table_card.html.twig (Total lines: 252)
IS_TRUNCATED: false
LINE_RANGE: 1-252
1|{#
2| Reusable table card wrapper.
3|
4| Combines a card header (title + filters) with an injected table component.
5| Ideal for contexts where filters should stay inside the card instead of the global header actions row.
6|
7| @param string title - Título exibido no header do card.
8| @param string table_id - Default table ID for the injected table component.
9| @param array headers - Default headers passed to the injected table component.
10| @param array rows - Default rows passed to the injected table component.
11| @param array filters - Lista de filtros a exibir no header do card. Cada item pode ser:
12| - { type: 'search', id: 'my-search', placeholder: 'Buscar...' }
13| - { type: 'select', id: 'mySelect', label: 'Label', column: N, options: [{value:'', text:'Todos'}, ...] }
14| @param object datatable_options - Default DataTables options (optional).
15| @param string empty_message - Empty-state message (optional).
16| @param bool with_checkbox - Enables checkbox column (optional).
17| @param array bulk_actions - Bulk actions config (optional).
18| @param string table_template - Twig template used to render the table (optional).
19| @param array table_context - Full context override for the table template (optional).
20|
21| Styles are loaded from:
22| - public/css/metahuman-standard/components/_table_card.css
23|
24| JavaScript is loaded from:
25| - public/js/metahuman-standard/components/_table_card.js
26|
27| Usage:
28| {% include 'components/ui/_table_card.html.twig' with {
29| 'title': 'Relacionamento da Campanha',
30| 'table_id': 'myTable',
31| 'headers': [{'title': 'Nome'}, {'title': 'Status'}],
32| 'rows': rows,
33| 'filters': [
34| {'type': 'search', 'id': 'my-search', 'placeholder': 'Buscar...'},
35| {'type': 'select', 'id': 'mySelect', 'label': 'Status', 'column': 1, 'options': [
36| {'value': '', 'text': 'Todos'},
37| {'value': 'ACTIVE', 'text': 'Ativo'}
38| ]}
39| ]
40| } %}
41|#}
42|
43|{% set filters = filters|default([]) %}
44|{% set empty_message = empty_message|default('Nenhum dado encontrado.') %}
45|{% set with_checkbox = with_checkbox|default(false) %}
46|{% set bulk_actions = bulk_actions|default({}) %}
47|{% set checkbox_header_label = checkbox_header_label|default('') %}
48|{% set checkbox_control = checkbox_control|default('checkbox') %}
49|{% set show_select_all = show_select_all|default(true) %}
50|{% set default_table_id = table_id|default('table-card-' ~ random()) %}
51|{% set table_template = table_template|default('components/ui/_dynamic_table.html.twig') %}
52|{% set title_html = title_html|default(null) %}
53|{% set header_actions = header_actions|default(null) %}
54|{% set default_table_context = {
55| 'table_id': default_table_id,
56| 'headers': headers|default([]),
57| 'rows': rows|default([]),
58| 'datatable_options': datatable_options|default({}),
59| 'empty_message': empty_message,
60| 'with_checkbox': with_checkbox,
61| 'bulk_actions': bulk_actions,
62| '_table_card_context': true,
63| 'checkbox_header_label': checkbox_header_label,
64| 'checkbox_control': checkbox_control,
65| 'show_select_all': show_select_all
66|} %}
67|{% set table_context = default_table_context|merge(table_context|default({})) %}
68|{% set table_card_id = table_context.table_id|default(default_table_id) %}
69|
70|<style>
71| .mhs-table-card-header {
72| display: flex;
73| align-items: center;
74| justify-content: space-between;
75| padding: 12px 16px;
76| border-bottom: 1px solid #ECEEEE;
77| gap: 12px;
78| flex-wrap: wrap;
79| }
80|
81| .mhs-table-card-title {
82| font-size: 16px;
83| font-weight: 700;
84| color: #5C5D5D;
85| white-space: nowrap;
86| }
87|
88| .mhs-table-card-right {
89| display: flex;
90| align-items: center;
91| gap: 8px;
92| flex-wrap: wrap;
93| margin-left: auto;
94| }
95|
96| .mhs-table-card-filters {
97| display: flex;
98| align-items: center;
99| gap: 8px;
100| flex-wrap: wrap;
101| }
102|
103| .mhs-table-card-filters .filter-item {
104| display: flex;
105| align-items: center;
106| }
107|
108| .mhs-table-sort-icon {
109| font-size: 10px;
110| transition: transform 0.2s;
111| }
112|
113| button[data-direction="desc"] .mhs-table-sort-icon {
114| transform: rotate(180deg);
115| }
116|
117| @media (max-width: 768px) {
118| .mhs-table-card-header {
119| flex-direction: column;
120| align-items: flex-start;
121| }
122|
123| .mhs-table-card-filters {
124| width: 100%;
125| }
126|
127| .mhs-table-card-right {
128| width: 100%;
129| margin-left: 0;
130| }
131| }
132|</style>
133|
134|<div class="app-card-surface mb-3 mhs-table-card" data-table-card-id="{{ table_card_id }}" style="overflow-x: auto;">
135|
136| {# Card header: title + filters #}
137| <div class="mhs-table-card-header">
138| {% if title_html %}
139| <span class="mhs-table-card-title">{{ title_html|raw }}</span>
140| {% elseif title is defined and title %}
141| <span class="mhs-table-card-title">{{ title }}</span>
142| {% endif %}
143|
144| {% if filters|length > 0 or header_actions %}
145| <div class="mhs-table-card-right">
146| {% if filters|length > 0 %}
147| <div class="mhs-table-card-filters">
148| {% for filter in filters %}
149| {% if filter.type == 'select' %}
150| <div class="filter-item mhs-table-card-filter"
151| data-table-card-filter="true"
152| data-filter-type="select"
153| data-filter-id="{{ filter.id }}"
154| {% if filter.column is defined %}data-filter-column="{{ filter.column }}"{% endif %}>
155| {# `only`: evita herdar `title` do card (ex.: "Tipos de ação"), que virava title="" no select e tooltip errado. #}
156| {% include 'components/ui/_custom_select.html.twig' with {
157| 'id': filter.id,
158| 'name': filter.id,
159| 'label': filter.label|default('Filtrar'),
160| 'options': filter.options|default([])
161| } only %}
162| </div>
163| {% elseif filter.type == 'search' %}
164| <div class="filter-item mhs-table-card-filter"
165| data-table-card-filter="true"
166| data-filter-type="search"
167| data-filter-id="{{ filter.id }}">
168| {% include 'components/ui/_search_expandable.html.twig' with {
169| 'id': filter.id,
170| 'placeholder': filter.placeholder|default('Buscar...')
171| } only %}
172| </div>
173| {% elseif filter.type == 'sort' %}
174| <div class="filter-item mhs-table-card-filter"
175| data-table-card-filter="true"
176| data-filter-type="sort"
177| data-filter-id="{{ filter.id }}"
178| {% if filter.column is defined %}data-filter-column="{{ filter.column }}"{% endif %}>
179| <button type="button"
180| id="{{ filter.id }}"
181| class="select-btn custom-modern-select-trigger"
182| data-column="{{ filter.column }}"
183| data-direction="asc">
184| <span>{{ filter.label|default('Ordenar') }}</span>
185| <i class="fas fa-arrow-up mhs-table-sort-icon"></i>
186| </button>
187| </div>
188| {% endif %}
189| {% endfor %}
190| </div>
191| {% endif %}
192| {% if header_actions %}
193| {{ header_actions|raw }}
194| {% endif %}
195| </div>
196| {% endif %}
197| </div>
198|
199| {% include table_template with table_context %}
200|</div>
201|
202|{# Wire up filters to DataTables #}
203|{% if filters|length > 0 %}
204|<script>
205|(function () {
206| var tableId = {{ table_card_id|json_encode|raw }};
207|
208| if (window.initCustomSelects) {
209| window.initCustomSelects();
210| }
211|
212| function onTableReady(cb) {
213| if (window.MetahumanDataTables) {
214| window.MetahumanDataTables.whenReady(tableId, cb);
215| return;
216| }
217|
218| if (typeof $ !== 'undefined' && $.fn.DataTable && $.fn.DataTable.isDataTable('#' + tableId)) {
219| cb($('#' + tableId).DataTable());
220| return;
221| }
222|
223| setTimeout(function () { onTableReady(cb); }, 100);
224| }
225|
226| onTableReady(function (dt) {
227|
228| {% for filter in filters %}
229| {% if filter.type == 'search' %}
230| $(document).on('input', '#{{ filter.id }}-input', function () {
231| dt.search($(this).val()).draw();
232| });
233| {% elseif filter.type == 'select' and filter.column is defined %}
234| if (typeof setupTableSelectFilter === 'function') {
235| setupTableSelectFilter('#{{ filter.id }}', tableId, {{ filter.column }});
236| }
237| {% elseif filter.type == 'sort' %}
238| $(document).on('click', '#{{ filter.id }}', function () {
239| var $btn = $(this);
240| var col = {{ filter.column }};
241| var dir = $btn.data('direction') === 'asc' ? 'desc' : 'asc';
242|
243| $btn.data('direction', dir).attr('data-direction', dir).addClass('active');
244| dt.order([[col, dir]]).draw();
245| });
246| {% endif %}
247| {% endfor %}
248| });
249|})();
250|</script>
251|{% endif %}
252|
Request #64
deepseek-v4-flash
P:61.17K C:77 CR:58.37K CW:0
1767ms
Reasoning
Now read `_dynamic_table.html.twig` to see how rows are rendered (whether positional or keyed).
Tool Calls (1)
file_read
Show Details
Arguments
{"file_path": "templates/components/ui/_dynamic_table.html.twig"}
Result
File: templates/components/ui/_dynamic_table.html.twig (Total lines: 280)
IS_TRUNCATED: false
LINE_RANGE: 1-280
1|{# templates/components/ui/_dynamic_table.html.twig #}
2|
3|{#
4| Reusable dynamic table component with DataTables.
5|
6| Styles are loaded from:
7| - public/css/metahuman-standard/components/_dynamic_table.css
8|
9| JavaScript is loaded from:
10| - public/js/metahuman-standard/components/_dynamic_table.js
11|
12| @param array headers
13| @param array rows
14| @param string title
15| @param string table_id
16| @param bool with_checkbox
17| @param array datatable_options Optional DataTables options. Use skipResponsiveEdgeDefaults: true
18| to disable the default always-visible first data column and
19| high-priority (hideable) last column.
20| @param array bulk_actions
21|#}
22|
23|{% set headers = headers|default([]) %}
24|{% set rows = rows|default([]) %}
25|{% set title = title|default('') %}
26|{% set table_id = table_id|default('dynamic-table-' ~ random()) %}
27|{% set with_checkbox = with_checkbox|default(false) %}
28|{% set datatable_options = datatable_options|default({}) %}
29|{% set empty_message = empty_message|default('Nenhum dado encontrado.') %}
30|{% set header_checkbox_disabled = header_checkbox_disabled|default(false) %}
31|{% set custom_checkbox_style = custom_checkbox_style|default(false) %}
32|{% set checkbox_config = checkbox_config|default({}) %}
33|{% set bulk_actions = bulk_actions|default({}) %}
34|{% set checkbox_name = checkbox_name|default('row_id[]') %}
35|{% set checkbox_control = checkbox_control|default('checkbox') %}
36|{% set show_select_all = show_select_all|default(true) %}
37|{% set checkbox_header_label = checkbox_header_label|default('') %}
38|
39|<style>
40| .dynamic-table-component {
41| background: #FBFCFD;
42| border: 1px solid #ECEEEE;
43| border-radius: 5px !important;
44| font-family: 'Inter', sans-serif;
45| }
46|
47| /* Ancora o overlay de processamento ao wrapper; evita "Carregando..." solto perto do rodapé/paginação */
48| .dynamic-table-component .dataTables_wrapper {
49| position: relative;
50| }
51|
52| .dynamic-table-component .dataTables_processing {
53| display: none !important;
54| }
55|
56| /* Scoped overrides: ensure member-cell layout is never broken by external CSS
57| (e.g. crm_custom.css redefines .member-info without flex-direction, making
58| names appear centred / misaligned when both files are loaded on the same page) */
59| .dynamic-table-component .member-cell {
60| display: flex;
61| align-items: center;
62| gap: 6px;
63| }
64|
65| .dynamic-table-component .member-info {
66| display: flex;
67| flex-direction: column;
68| align-items: flex-start;
69| gap: 0;
70| }
71|
72| .table-figma {
73| width: 100%;
74| border-collapse: collapse;
75| border-radius: 5px !important;
76| }
77|
78| .table-figma thead {
79| background-color: #EAEEF3 !important;
80| }
81|
82| .table-figma th {
83| padding: 10px;
84| font-weight: 700;
85| font-size: 12px;
86| color: #5C5D5D;
87| text-align: left;
88| border-bottom: 1px solid #ECEEEE;
89| background-color: #EAEEF3 !important;
90| }
91|
92| .table-figma tbody tr {
93| border-bottom: 1px solid #ECEDED;
94| background-color: #FFFFFF !important;
95| }
96|
97| .table-figma tbody tr:nth-child(even) {
98| background-color: #FAFBFC !important;
99| }
100|
101| .table-figma tbody tr:last-child {
102| border-bottom: none;
103| }
104|
105| .table-figma td {
106| padding: 15px 10px;
107| vertical-align: middle;
108| background-color: transparent !important;
109| font-size: 14px;
110| }
111|
112| /* Footer layout — inline style wins over static external CSS order-wise.
113| Using .dataTables_wrapper prefix (0-2-0) beats DataTables CDN (0-2-0 tie)
114| only when this style block is stamped later; for the container itself,
115| specificity 0-1-0 is enough since CDN doesn't target our custom class. */
116| .datatable-footer {
117| display: flex !important;
118| justify-content: space-between !important;
119| align-items: center !important;
120| flex-wrap: nowrap !important;
121| gap: 8px !important;
122| width: 100% !important;
123| padding: 20px 10px !important;
124| background-color: #FBFCFD !important;
125| border-top: 1px solid #ECEEEE !important;
126| border-radius: 0 0 5px 5px !important;
127| font-size: 12px !important;
128| font-weight: 600 !important;
129| color: #5C5D5D !important;
130| }
131|
132| /* 0-3-0 specificity — always beats DataTables CDN responsive CSS
133| which uses .dataTables_wrapper .dataTables_xxx (0-2-0) */
134| .dataTables_wrapper .datatable-footer .dataTables_info,
135| .dataTables_wrapper .datatable-footer .dt-info {
136| flex: 0 0 auto !important;
137| font-size: 12px !important;
138| font-weight: 600 !important;
139| white-space: nowrap !important;
140| display: inline-block !important;
141| }
142|
143| .dataTables_wrapper .datatable-footer .dataTables_paginate,
144| .dataTables_wrapper .datatable-footer .dt-paging {
145| flex: 1 1 auto !important;
146| text-align: center !important;
147| display: flex !important;
148| justify-content: center !important;
149| align-items: center !important;
150| gap: 5px !important;
151| min-width: 0 !important;
152| }
153|
154| .dataTables_wrapper .datatable-footer .dataTables_length,
155| .dataTables_wrapper .datatable-footer .dt-length {
156| flex: 0 0 auto !important;
157| text-align: right !important;
158| margin: 0 !important;
159| display: flex !important;
160| align-items: center !important;
161| justify-content: flex-end !important;
162| gap: 8px !important;
163| white-space: nowrap !important;
164| }
165|
166| .dataTables_wrapper .datatable-footer .dataTables_length select,
167| .dataTables_wrapper .datatable-footer .dt-length select {
168| height: 28px !important;
169| padding: 2px 6px !important;
170| border: 1px solid #ECEEEE !important;
171| border-radius: 5px !important;
172| font-size: 12px !important;
173| font-weight: 600 !important;
174| background: #FFFFFF !important;
175| color: #5C5D5D !important;
176| cursor: pointer !important;
177| outline: none !important;
178| min-width: 55px !important;
179| }
180|
181| @media (max-width: 768px) {
182| .dynamic-table-component {
183| margin-bottom: 32px !important;
184| }
185|
186| .datatable-footer {
187| flex-direction: column !important;
188| align-items: center !important;
189| gap: 12px !important;
190| }
191|
192| .dataTables_wrapper .datatable-footer .dataTables_info,
193| .dataTables_wrapper .datatable-footer .dt-info,
194| .dataTables_wrapper .datatable-footer .dataTables_paginate,
195| .dataTables_wrapper .datatable-footer .dt-paging,
196| .dataTables_wrapper .datatable-footer .dataTables_length,
197| .dataTables_wrapper .datatable-footer .dt-length {
198| justify-content: center !important;
199| text-align: center !important;
200| }
201| }
202|</style>
203|
204|{% if with_checkbox and bulk_actions is not empty %}
205|<div class="bulk-actions-row" id="bulkActionsBar_{{ table_id }}" style="display: none;">
206| <span class="bulk-count"><strong id="selectedCount_{{ table_id }}">0</strong> Candidatos Selecionados:</span>
207|
208| {% if bulk_actions.primary is defined %}
209| <button type="button"
210| class="mhs-btn-table-action border"
211| id="btnBulkPrimary_{{ table_id }}"
212| {% if bulk_actions.primary.modal is defined %}data-toggle="modal" data-target="{{ bulk_actions.primary.modal }}"{% endif %}
213| {% if bulk_actions.primary.onclick is defined %}onclick="{{ bulk_actions.primary.onclick }}"{% endif %}>
214| {{ bulk_actions.primary.label|default('Ação') }}
215| </button>
216| {% endif %}
217|
218| {% if bulk_actions.danger is defined %}
219| <button type="button"
220| class="mhs-btn-table-action mhs-btn-table-action-outline-danger border"
221| id="btnBulkDanger_{{ table_id }}"
222| {% if bulk_actions.danger.modal is defined %}data-toggle="modal" data-target="{{ bulk_actions.danger.modal }}"{% endif %}
223| {% if bulk_actions.danger.onclick is defined %}onclick="{{ bulk_actions.danger.onclick }}"{% endif %}>
224| {{ bulk_actions.danger.label|default('Cancelar') }}
225| </button>
226| {% endif %}
227|
228| {% if bulk_actions.talent is defined %}
229| <button type="button"
230| class="mhs-btn-table-action border"
231| id="btnBulkTalent_{{ table_id }}"
232| style="display: none;"
233| {% if bulk_actions.talent.modal is defined %}data-toggle="modal" data-target="{{ bulk_actions.talent.modal }}"{% endif %}
234| {% if bulk_actions.talent.onclick is defined %}onclick="{{ bulk_actions.talent.onclick }}"{% endif %}>
235| {{ bulk_actions.talent.label|default('Incluir Talento') }}
236| </button>
237| {% endif %}
238|
239| {% if bulk_actions.show_clear is not defined or bulk_actions.show_clear %}
240| <button type="button" class="mhs-btn-table-action mhs-btn-table-action-secondary border" id="btnClearSelection_{{ table_id }}">
241| Limpar Seleção
242| </button>
243| {% endif %}
244|</div>
245|{% endif %}
246|
247|<div class="dynamic-table-component"
248| data-dynamic-table="true"
249| data-table-id="{{ table_id }}"
250| data-headers="{{ headers|json_encode|e('html_attr') }}"
251| data-datatable-options="{{ datatable_options|json_encode|e('html_attr') }}"
252| data-with-checkbox="{{ with_checkbox ? 'true' : 'false' }}"
253| data-has-rows="{{ rows|length > 0 ? 'true' : 'false' }}"
254| data-empty-message="{{ empty_message|e('html_attr') }}">
255| <table id="{{ table_id }}" class="table-figma display responsive striped-table" style="width:100%">
256| <thead>
257| <tr>
258| {% if with_checkbox %}
259| <th class="all" style="width: 10px; text-align:center;">
260| <input type="checkbox" class="select-all{% if custom_checkbox_style %} custom-checkbox{% endif %}" {% if header_checkbox_disabled %}disabled{% endif %}>
261| </th>
262| {% endif %}
263| {% for header in headers %}
264| <th class="{{ header.class|default('') }}">{{ header.title|raw }}</th>
265| {% endfor %}
266| </tr>
267| </thead>
268| {% include 'components/ui/partials/_table_body_rows.html.twig' with {
269| 'headers': headers,
270| 'rows': rows,
271| 'with_checkbox': with_checkbox,
272| 'custom_checkbox_style': custom_checkbox_style,
273| 'checkbox_name': checkbox_name,
274| 'checkbox_control': checkbox_control,
275| 'table_id': table_id,
276| 'empty_message': empty_message
277| } only %}
278| </table>
279|</div>
280|
Request #65
deepseek-v4-flash
P:64.47K C:78 CR:61.18K CW:0
1337ms
Reasoning
Now read `_table_body_rows.html.twig` to see how rows are matched to headers.
Tool Calls (1)
file_read
Show Details
Arguments
{"file_path": "templates/components/ui/partials/_table_body_rows.html.twig"}
Result
File: templates/components/ui/partials/_table_body_rows.html.twig (Total lines: 145)
IS_TRUNCATED: false
LINE_RANGE: 1-145
1|<tbody>
2| {% for row in rows %}
3| <tr {% if row.id is defined %}id="team_{{ row.id }}"{% endif %}{% if row._rowClass is defined and row._rowClass %} class="{{ row._rowClass|e('html_attr') }}"{% endif %}{% if row.tr_attributes is defined and row.tr_attributes is iterable %}{% for attr, value in row.tr_attributes %} {{ attr }}="{{ value|e('html_attr') }}"{% endfor %}{% endif %}{% for key, val in row %}{% if key[0:1] == '_' and key not in ['_canSelect', '_checked', '_rowClass'] and val is not iterable %} data-{{ key|slice(1) }}="{{ val|e('html_attr') }}"{% endif %}{% endfor %}>
4| {% if with_checkbox %}
5| {% set checkboxDisabled = row._canSelect is defined and row._canSelect == false %}
6| {% set checkboxChecked = row._checked is defined and row._checked %}
7| {% set rowCheckboxValue = row.id is defined ? row.id : ('[id]' in checkbox_name ? '1' : loop.index) %}
8| {% set rowCheckboxId = 'rowControl_' ~ table_id|default('table') ~ '_' ~ loop.index %}
9| <td style="text-align:center;">
10| {% if checkbox_control|default('checkbox') == 'switch' %}
11| <div class="form-toggle-switch mhs-table-row-switch justify-content-center" style="gap:0;">
12| <input type="checkbox"
13| id="{{ rowCheckboxId }}"
14| class="row-checkbox{% if custom_checkbox_style %} custom-checkbox{% endif %}"
15| name="{{ checkbox_name|replace({'[id]': '[' ~ row.id ~ ']'}) }}"
16| value="{{ rowCheckboxValue }}"
17| {% if checkboxChecked %}checked{% endif %}
18| {% if checkboxDisabled %}disabled{% endif %}>
19| <label for="{{ rowCheckboxId }}" aria-label="Alternar status"></label>
20| </div>
21| {% else %}
22| <input type="checkbox"
23| class="row-checkbox{% if custom_checkbox_style %} custom-checkbox{% endif %}"
24| name="{{ checkbox_name|replace({'[id]': '[' ~ row.id ~ ']'}) }}"
25| value="{{ rowCheckboxValue }}"
26| {% if checkboxChecked %}checked{% endif %}
27| {% if checkboxDisabled %}disabled{% endif %}>
28| {% endif %}
29| </td>
30| {% endif %}
31|
32| {% for key, cell in row %}
33| {% if key != 'id' and key[0:1] != '_' and key != 'tr_attributes' %}
34| {% set tdClass = loop.first ? 'dtr-control' : '' %}
35| {% for header in headers %}
36| {% set headerKey = header.key|default(header.title) %}
37| {% if headerKey == key and header.class|default('') %}
38| {% set tdClass = tdClass ~ (tdClass ? ' ' : '') ~ header.class %}
39| {% endif %}
40| {% endfor %}
41| <td{% if tdClass %} class="{{ tdClass }}"{% endif %}>
42| {% if key == 'member' %}
43| <div class="member-cell">
44| <div class="user-avatar-container {% if cell.hasCrown|default(false) %}has-crown{% endif %}">
45| {% if cell.hasCrown|default(false) %}
46| <img src="{{ asset('images/employee-advocacy/image.png') }}" class="crown-icon" alt="Crown">
47| {% endif %}
48| {% if cell.avatar is defined and cell.avatar is not empty and cell.avatar is not null %}
49| <img src="{{ asset(cell.avatar) }}" class="user-avatar-image {% if cell.hasCrown|default(false) %}crowned{% endif %}" onerror="this.onerror=null; this.style.display='none'; this.nextElementSibling.style.display='flex';">
50| <div class="user-avatar user-avatar-fallback {% if cell.hasCrown|default(false) %}crowned{% endif %}" style="display: none; background-color: {{ cell.avatar_bg | default('#CCCCCC') }};">
51| <span>{{ cell.name | first | upper }}</span>
52| </div>
53| {% else %}
54| <div class="user-avatar {% if cell.hasCrown|default(false) %}crowned{% endif %}" style="background-color: {{ cell.avatar_bg | default('#CCCCCC') }};">
55| <span>{{ cell.name | first | upper }}</span>
56| </div>
57| {% endif %}
58| {% if cell.online_status is defined and cell.online_status %}
59| <span class="user-status-indicator"
60| style="background-color: {{ cell.online_status == 'online' ? '#1E9E04' : (cell.online_status == 'offline' ? '#E2AE02' : '#B2B2B2') }};">
61| </span>
62| {% endif %}
63| </div>
64| <div class="member-info">
65| <div class="member-name">{{ cell.name }}</div>
66| {% if cell.email is defined and cell.email %}
67| <div class="member-email">{{ cell.email }}</div>
68| {% endif %}
69| </div>
70| </div>
71| {% elseif key == 'team' %}
72| {% if cell is not empty and cell is iterable %}
73| <div class="teams-container">
74| {% for team_name in cell %}
75| {% if team_name is not empty %}
76| <span class="team-badge">{{ team_name }}</span>
77| {% endif %}
78| {% endfor %}
79| </div>
80| {% else %}
81| <span></span>
82| {% endif %}
83| {% elseif key == 'actions' or key == 'Ações' %}
84| <div class="actions-cell">
85| {% for action in cell %}
86| {% if action.type == 'button' %}
87| <a href="{{ action.url | default('#') }}" class="btn btn-sm {{ action.class | default('mhs-btn-table-action border') }}"
88| {% if action.attributes is defined and action.attributes is iterable %}
89| {% for attr, value in action.attributes %}
90| {{ attr }}="{{ value }}"
91| {% endfor %}
92| {% endif %}>
93| {% if action.icon is defined and action.icon %}
94| <i class="{{ action.icon }}"></i>
95| {% endif %}
96| {% if action.label is defined and action.label and action.icon is defined and action.icon %}
97| <span class="ml-1">{{ action.label }}</span>
98| {% elseif action.label is defined and action.label %}
99| {{ action.label }}
100| {% endif %}
101| </a>
102| {% elseif action.type == 'dropdown' %}
103| <div class="dropdown d-inline-block">
104| <button class="btn btn-sm btn-default" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
105| <i class="fas fa-ellipsis-v"></i>
106| </button>
107| <div class="dropdown-menu dropdown-menu-right">
108| {% for item in action.items %}
109| <a class="dropdown-item {{ item.class|default('') }}" href="{{ item.url | default('#') }}"
110| {% if item.attributes is defined and item.attributes is iterable %}
111| {% for attr, value in item.attributes %}
112| {{ attr }}="{{ value }}"
113| {% endfor %}
114| {% endif %}>
115| {% if item.icon is defined and item.icon %}
116| <i class="{{ item.icon }}"></i>
117| {% endif %}
118| {{ item.label }}
119| </a>
120| {% endfor %}
121| </div>
122| </div>
123| {% endif %}
124| {% endfor %}
125| </div>
126| {% else %}
127| {{ cell|raw }}
128| {% endif %}
129| </td>
130| {% endif %}
131| {% endfor %}
132| </tr>
133| {% else %}
134| <tr class="datatable-empty-message">
135| {% set totalColumns = headers|length %}
136| {% if with_checkbox %}
137| {% set totalColumns = totalColumns + 1 %}
138| {% endif %}
139| <td colspan="{{ totalColumns }}" class="text-center text-muted" style="padding: 40px 20px;">
140| {{ empty_message }}
141| </td>
142| </tr>
143| {% endfor %}
144|</tbody>
145|
Request #66
deepseek-v4-flash
P:66.69K C:1.42K CR:64.51K CW:0
11692ms
Reasoning
This is the key finding! In `_table_body_rows.html.twig`, each row cell is rendered by iterating `for key, cell in row`, i.e., cells are created in the order the keys appear in the row array, NOT aligned to headers. It then assigns tdClass based on matching header keys. So the alignment of cells with the headers is positional.
In the template `_tab_painel.html.twig`, the row keys order is:
`titulo, origem, gerencia, prioridade, responsavel, prazo, pendencia, acoes` (8 keys), but the headers are now 9 columns: Título da ação, Origem, Gerência, Prioridade, Quem executa, Quem valida, Prazo, Pendência, Ações.
So server-rendered rows will have 8 <td> cells while the header has 9 <th>. Cells misalign: 'Prazo' column header will show the deadline content shifted one column left? Actually the <td> cells are rendered sequentially in the row: 8 cells. DataTables will then likely map them to the first 8 columns. The 9th header "Ações" would have no cell content. And 'Quem valida' column would display the prazo content. So columns misaligned.
Wait — but DataTables processes markup based on <td> count; with 8 <td> and 9 <th>, DataTables would throw an error or create empty. DataTables initialization on a table with mismatched column counts throws a DataTables warning (Requested unknown parameter) or just renders 8 columns while header has 9. In either case the display will be misaligned on the initial render.
Moreover, they DID add the two new headers but didn't update the server-side row building. Also `row.executors`/`validators` are computed in the JS renderer (updatePendenciasTable) and the panelData table rows are the source for JS. Wait — but is the initial Twig table generated server-side from the initial payload (panel_table) or from embedded JSON? The template row building uses `row.responsible` with avatars only. And headers columns were updated but rows not. This looks like a real regression: In the server-side rendering section (lines ~430-510), they need to add separate 'executors' and 'validators' cells to match the new headers, mirroring the JS version.
Let me read the beginning of the server-side rendering loop, lines ~420-510, to see how each row is created and whether responsible_cell is the only responsible column. I read 460-510. It shows at lines 472-486 `responsible_members` built from `row.responsible` and cell `responsible_cell`. Then lines 500-509 builds the ap_table_rows with keys titulo, origem, gerencia, prioridade, responsavel, prazo, pendencia, acoes. Indeed no executors/validators column. There is also a 'Quem executa' column now. But this row has only 'responsavel' which is the old column. So there's a column mismatch: Header has 9 columns; row provides 8 values. This yields misalignment: 'Quem executa' column will show responsible stack, 'Quem valida' column will show prazo content, 'Prazo' shows deadline, 'Pendência' shows pendencia, 'Ações' shows acoes but shifted into 'Pendência'? Wait count: row keys produce 8 tds; headers 9. The td order (excluding id): titulo, origem, gerencia, prioridade, responsavel, prazo, pendencia, acoes. Headers: Título, Origem, Gerência, Prioridade, Quem executa, Quem valida, Prazo, Pendência, Ações. So first 8 map: titulo→Título, origem→Origem, gerencia→Gerência, prioridade→Prioridade, responsavel→Quem executa, prazo→Quem valida, pendencia→Prazo, acoes→Pendência. Column 'Ações' empty. So the Ações header empty and the action button in 'Pendência' column. Misalignment indeed.
But wait — does the JS actually override this initial render with updatePendenciasTable on load? Let me check the init flow: in JS, after loading panel data JSON, when view pendencias active, does it call `applyPendenciasDom` or `updatePendenciasTable` on init? If yes, the initial server table would be replaced by the JS-built rows (9 tds, matching). Let me search in JS for initial DOM apply logic.
Actually the embedded initial data `parsePanelData()` returns the whole panel data (same shape as filter response). Then `applyFilterResponse`? Let's check the boot flow. Search "applyFilterResponse", "applyPendenciasDom", "init".
Let me read the JS around binding init to determine whether initial rows are replaced. But even if replaced, the DataTable is created via MetahumanDataTables after DOM ready; the initial server rows are what the DataTable sees unless the JS first destroys and rebuilds tbody. In `updatePendenciasTable`, it destroys the DataTable if exists then replaces tbody then re-init via whenReady. If run after page load with initial table already DataTables-initialized, they destroy & rebuild, then whenReady callback re-inits. So after JS runs, table corrected. But if updatePendenciasTable is only run on filter changes (not initial), then the initial server table remains misaligned. Need to check.
Let's find where updatePendenciasTable is triggered on initial load: search "updatePendenciasTable(" calls.
Given template row building was server-side initial, and diff updates the header adding two columns, but row builder wasn't updated - that's a real inconsistency in the template diff itself. Actually, since JS updatePendenciasTable handles re-render from the JSON data, the server-side render may still be the initial visible table before JS refresh.
Let me confirm initial data flow in JS - look for a call to apply response on load. Read the main init near end of file.
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["public/js/ssma/action_plan_panel.js"], "search_text": "applyFilterResponse|updatePendenciasTable\\(|panelData =|parsePanelData\\(\\)"}
Result
No matches found
Request #67
deepseek-v4-flash
P:68.12K C:229 CR:68.1K CW:0
2223ms
Reasoning
Let me search for those strings individually (perl may need different quoting). Let me use simpler search.
Tool Calls (3)
code_search
Show Details
Arguments
{"file_patterns": ["public/js/ssma/action_plan_panel.js"], "search_text": "applyFilterResponse"}
Result
File: public/js/ssma/action_plan_panel.js
Match lines: 2
466| applyFilterResponse(resp);
501| function applyFilterResponse(resp) {
code_search
Show Details
Arguments
{"file_patterns": ["public/js/ssma/action_plan_panel.js"], "search_text": "updatePendenciasTable"}
Result
File: public/js/ssma/action_plan_panel.js
Match lines: 2
932| function updatePendenciasTable(tableData, originIcons) {
994| updatePendenciasTable(panel.table || {}, panel.origin_icons || {});
code_search
Show Details
Arguments
{"file_patterns": ["public/js/ssma/action_plan_panel.js"], "search_text": "parsePanelData"}
Result
File: public/js/ssma/action_plan_panel.js
Match lines: 2
1101| function parsePanelData() {
2363| panelData = parsePanelData();
Request #68
deepseek-v4-flash
P:68.52K C:202 CR:68.22K CW:0
2308ms
Reasoning
Let me read lines 500-560 to see applyFilterResponse and how initial response is applied, and also the boot flow at lines 2340-2378.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 560, "file_path": "public/js/ssma/action_plan_panel.js", "start_line": 495}
Result
File: public/js/ssma/action_plan_panel.js (Total lines: 2378)
IS_TRUNCATED: false
LINE_RANGE: 495-560
495| var jsonEl = document.getElementById('ssma-ap-panel-data-json');
496| if (jsonEl) {
497| jsonEl.textContent = JSON.stringify(panelData);
498| }
499| }
500|
501| function applyFilterResponse(resp) {
502| if (!resp || !resp.panel) {
503| return;
504| }
505|
506| if (resp.view === 'visao_geral') {
507| mergePanelData({ overview: resp.panel.overview || {} });
508| applyOverviewDom(resp.panel.overview || {});
509| destroyOverviewCharts();
510| overviewChartsRendered = false;
511| renderOverviewCharts();
512| return;
513| }
514|
515| if (resp.view === 'comparativo') {
516| renderComparativoView(resp.panel.comparativo || {});
517| return;
518| }
519|
520| mergePanelData(resp.panel);
521| if (resp.active_axis) {
522| panelState.axis = resp.active_axis;
523| }
524| applyPendenciasDom(resp.panel);
525| renderPendenciasCharts();
526| }
527|
528| function kpiFooterText(footer) {
529| if (!footer || !footer.length) {
530| return '';
531| }
532| return footer.map(function (item) {
533| return (item.label || '') + ': ' + (item.value || '');
534| }).join(' | ');
535| }
536|
537| function buildKpiCardHtml(kpi) {
538| var trendLabel = kpi.trend && kpi.trend.label ? kpi.trend.label : '';
539| var footerText = kpi.footerText || kpiFooterText(kpi.footer);
540| var html = '<div class="col-12 col-md-6 col-xl-3 mb-2 mb-xl-0"><div class="mhs-card">'
541| + '<div class="mhs-card-header"><h2 class="mhs-card-title">' + escapeHtml(kpi.title || '') + '</h2></div>'
542| + '<div class="mhs-card-body"><h3 class="mhs-card-value">' + escapeHtml(kpi.value || '') + '</h3>'
543| + (trendLabel ? '<span>' + escapeHtml(trendLabel) + '</span>' : '')
544| + '</div>';
545| if (footerText) {
546| html += '<div class="mhs-card-footer"><div class="mhs-card-footer-row"><p class="mhs-card-details">'
547| + escapeHtml(footerText) + '</p></div></div>';
548| }
549| return html + '</div></div>';
550| }
551|
552| function updateKpiRow(kpis) {
553| var row = document.getElementById('ssma-ap-kpi-row');
554| if (!row || !kpis || !kpis.length) {
555| return;
556| }
557| var cards = row.querySelectorAll('.mhs-card');
558| if (!cards.length) {
559| row.innerHTML = kpis.map(buildKpiCardHtml).join('');
560| return;
file_read
Show Details
Arguments
{"end_line": 2378, "file_path": "public/js/ssma/action_plan_panel.js", "start_line": 2280}
Result
File: public/js/ssma/action_plan_panel.js (Total lines: 2378)
IS_TRUNCATED: false
LINE_RANGE: 2280-2378
2280| }
2281|
2282| function onPainelTabVisible() {
2283| if (initialized) {
2284| switchView(currentView);
2285| return;
2286| }
2287| initialized = true;
2288| initPanelConfig();
2289| if (typeof window.initAllCustomSelectWrappers === 'function') {
2290| window.initAllCustomSelectWrappers();
2291| }
2292| bindViewPills();
2293| bindAxisFilter();
2294| bindPendenciasPeriodPopover();
2295| bindPendenciasFilters();
2296| bindOverviewFilters();
2297| bindOverviewPagination();
2298| bindAdrianaQuestions();
2299| bindTableViewButtons();
2300| toggleHeaderFilters(currentView);
2301| syncApPainelPeriodPresetUI(panelState.period && panelState.period.indexOf('pend:range:') !== 0 ? panelState.period : 'next_month');
2302| syncOverviewPeriodPresetUI(panelState.overviewPeriod || 'last_3_months');
2303| updateAxisOptionsForPeriod(panelState.period || 'next_month');
2304| switchView(currentView);
2305| if (!panelData || !panelData.charts) {
2306| triggerPanelFilter(currentView);
2307| } else {
2308| var ssrLabels = (
2309| panelData.charts.critical_pending_by_deadline &&
2310| panelData.charts.critical_pending_by_deadline.labels
2311| ) || [];
2312| if (!ssrLabels.length) {
2313| triggerPanelFilter(currentView);
2314| }
2315| }
2316| }
2317|
2318| function observePainelTab() {
2319| var painelPanel = document.getElementById('tab_plano_painel_content');
2320| if (!painelPanel) {
2321| return;
2322| }
2323|
2324| if (painelPanel.offsetParent !== null && !painelPanel.classList.contains('d-none')) {
2325| onPainelTabVisible();
2326| }
2327|
2328| document.addEventListener('click', function (ev) {
2329| var link = ev.target && ev.target.closest ? ev.target.closest('#plano_acao_tabs .app-tab-link') : null;
2330| if (!link) {
2331| return;
2332| }
2333| var target = link.getAttribute('data-target-div') || '';
2334| if (target.indexOf('tab_plano_painel_content') !== -1) {
2335| window.setTimeout(onPainelTabVisible, 60);
2336| }
2337| });
2338|
2339| if (window.$ || window.jQuery) {
2340| (window.$ || window.jQuery)(document).on('tabShown', function (ev, tabId) {
2341| if (tabId === 'tab_plano_painel') {
2342| window.setTimeout(onPainelTabVisible, 60);
2343| }
2344| });
2345| }
2346|
2347| window.addEventListener('resize', function () {
2348| if (!initialized) {
2349| return;
2350| }
2351| if (currentView === 'pendencias') {
2352| reflowCharts(PENDENCIAS_CHART_KEYS);
2353| reflowDistributionCharts();
2354| } else if (currentView === 'visao_geral') {
2355| reflowCharts(OVERVIEW_CHART_KEYS);
2356| reflowDistributionCharts();
2357| }
2358| });
2359| }
2360|
2361| document.addEventListener('DOMContentLoaded', function () {
2362| initPanelConfig();
2363| panelData = parsePanelData();
2364| window.ssmaApPanelSetPeriod = function (value) {
2365| applyApPainelPeriodPreset(value || panelState.period || 'next_month');
2366| };
2367| var activePill = document.querySelector('.ssma-ap-panel-view-pill.is-active');
2368| if (activePill) {
2369| currentView = activePill.getAttribute('data-view') || 'pendencias';
2370| }
2371| observePainelTab();
2372| var _painelInitPanel = document.getElementById('tab_plano_painel_content');
2373| if (_painelInitPanel && _painelInitPanel.offsetParent !== null) {
2374| onPainelTabVisible();
2375| }
2376| });
2377|})(window, document);
2378|
Request #69
deepseek-v4-flash
P:70.68K C:294 CR:68.61K CW:0
3292ms
Reasoning
Look at `onPainelTabVisible`: if panelData exists with charts (labels), it does NOT call `triggerPanelFilter(currentView)` — it uses the SSR table? Let me see switchView → applyPendenciasDom? Actually switchView may call applyPendenciasDom on currentView with panelData already in memory. So if panelData (SSR embedded) has charts, they render from embedded data and table rows probably come from server-rendered rows (Twig). Wait, but applyFilterResponse is only called when a filter request happens. When switchView for pendencias, it might call updatePendenciasTable with panelData.table. Let me read switchView.
Actually the JS is complex; note that on first load when panelData exists with charts and labels non-empty, they don't trigger filter request. So the SSR table (built server-side in Twig from ap_table_rows) is what's displayed initially, unless switchView refreshes the table using panelData.table with JS row builder.
Let me look at switchView.
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["public/js/ssma/action_plan_panel.js"], "search_text": "function switchView"}
Result
File: public/js/ssma/action_plan_panel.js
Match lines: 1
1735| function switchView(viewId) {
Request #70
deepseek-v4-flash
P:71.02K C:92 CR:70.91K CW:0
1574ms
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 1830, "file_path": "public/js/ssma/action_plan_panel.js", "start_line": 1735}
Result
File: public/js/ssma/action_plan_panel.js (Total lines: 2378)
IS_TRUNCATED: false
LINE_RANGE: 1735-1830
1735| function switchView(viewId) {
1736| currentView = viewId;
1737| toggleHeaderFilters(viewId);
1738|
1739| if (viewId === 'pendencias') {
1740| destroyOverviewCharts();
1741| renderPendenciasCharts();
1742| return;
1743| }
1744|
1745| destroyPendenciasCharts();
1746|
1747| if (viewId === 'visao_geral') {
1748| var overviewData = getOverviewData();
1749| if (overviewData) {
1750| applyOverviewDom(overviewData);
1751| }
1752| if (!overviewChartsRendered) {
1753| renderOverviewCharts();
1754| } else {
1755| reflowCharts(OVERVIEW_CHART_KEYS);
1756| reflowDistributionCharts();
1757| }
1758| return;
1759| }
1760|
1761| destroyOverviewCharts();
1762|
1763| if (viewId === 'comparativo') {
1764| triggerPanelFilter('comparativo');
1765| }
1766| }
1767|
1768| function bindViewPills() {
1769| var root = getRoot();
1770| if (!root) {
1771| return;
1772| }
1773|
1774| var pills = root.querySelectorAll('.ssma-ap-panel-view-pill');
1775| var sections = root.querySelectorAll('[data-ap-panel-view]');
1776|
1777| pills.forEach(function (pill) {
1778| pill.addEventListener('click', function () {
1779| var viewId = pill.getAttribute('data-view') || '';
1780| pills.forEach(function (p) {
1781| var active = p === pill;
1782| p.classList.toggle('is-active', active);
1783| p.setAttribute('aria-selected', active ? 'true' : 'false');
1784| });
1785| sections.forEach(function (section) {
1786| var show = section.getAttribute('data-ap-panel-view') === viewId;
1787| section.classList.toggle('d-none', !show);
1788| });
1789| switchView(viewId);
1790| if (viewId === 'visao_geral') {
1791| syncOverviewFilterState();
1792| triggerPanelFilter('visao_geral');
1793| }
1794| });
1795| });
1796| }
1797|
1798| function bindAxisFilter() {
1799| var select = document.getElementById('ssma-ap-chart-axis-filter');
1800| if (!select) {
1801| return;
1802| }
1803| select.addEventListener('change', function () {
1804| panelState.axis = getSelectValue('ssma-ap-chart-axis-filter');
1805| triggerPanelFilter('pendencias');
1806| });
1807| }
1808|
1809| // ── Mapa período → eixos disponíveis (espelha backend resolveAvailableAxes) ──
1810| var AXIS_LABELS_MAP = { daily: 'Diário', weekly: 'Semanal', monthly: 'Mensal', quarterly: 'Trimestral' };
1811| var AXIS_BY_PERIOD = {
1812| week: ['daily'],
1813| fortnight: ['daily', 'weekly'],
1814| next_month: ['daily', 'weekly'],
1815| next_3_months: ['weekly', 'monthly'],
1816| all_future: ['weekly', 'monthly'],
1817| last_week: ['daily'],
1818| last_month: ['daily', 'weekly'],
1819| last_3_months: ['weekly', 'monthly'],
1820| last_6_months: ['monthly', 'quarterly'],
1821| last_year: ['monthly', 'quarterly'],
1822| total: ['monthly', 'quarterly']
1823| };
1824|
1825| function updateAxisOptionsForPeriod(period) {
1826| var select = document.getElementById('ssma-ap-chart-axis-filter');
1827| if (!select) {
1828| return;
1829| }
1830| var normalized = (period || '').replace(/^pend:/, '').replace(/^range:.*$/, 'last_3_months');
Request #71
deepseek-v4-flash
P:72.2K C:666 CR:71.04K CW:0
5784ms
Reasoning
So on initial load, if panelData.charts non-empty (SSR), `switchView('pendencias')` only renders charts; the table remains the server-rendered table (with Twig rows from `ap_table_rows`). So the SSR table is what users first see.
Given that the SSR rows in `_tab_painel.html.twig` were NOT updated for the new "Quem executa" / "Quem valida" columns (rows have only 8 cells/keys while headers now have 9 columns), this causes column misalignment in the SSR table initial render — a functional regression. Let me confirm the exact row building section for initial table: I need to read lines 420-510 fully. And also check what keys used. We saw line 500-509 set keys: titulo, origem, gerencia, prioridade, responsavel, prazo, pendencia, acoes. The header has 9 columns. This mismatch is an actual issue in _tab_painel.html.twig.
But wait — the diff in review only changed the header portion of _tab_painel.html.twig and the new filters. The row-building code is NOT in the diff (unchanged), so per the rules "Avoid commenting on unchanged code" — but this new header change (in diff) breaks the SSR rows. The header change is in the diff (added two header columns), so it's legitimately part of the review. The bug is: adding two columns to the headers while the server-side row-building still outputs one "Responsável" column causes misaligned SSR table. Actually wait: previously headers had one 'Responsável' column and rows had 8 keys. Now headers have 9 columns but rows still 8. So indeed mismatch introduced by this diff's header addition.
Hmm — but is the SSR table rebuilt via updatePendenciasTable before DataTables init (whenReady)? Let me check whether DataTable init happens on SSR then JS not replacing it. Actually, MetahumanDataTables auto-init occurs via some global? The JS whenReady triggers DataTable creation. If SSR has 8 tds and 9 ths, DataTables will emit warning "Requested unknown parameter" or "table has columns mismatch" and maybe produce an empty/invalid table.
Also, note the same applies when JS re-renders from JSON: JS buildPendenciasTableRowHtml writes 9 tds (matching headers). Good.
So the SSR path is broken. Let me verify the row building snippet in full (lines 430-510) to be sure there's no separate executor/validator columns added elsewhere (e.g., they might have added validators somewhere). Let me read 400-512.
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 512, "file_path": "templates/ssma/action_plan/tabs/_tab_painel.html.twig", "start_line": 380}
Result
File: templates/ssma/action_plan/tabs/_tab_painel.html.twig (Total lines: 570)
IS_TRUNCATED: false
LINE_RANGE: 380-512
380| <div class="ssma-dashboard-chart-subtitle">Top 10 por volume total de pendências</div>
381| </div>
382| <div class="ssma-ap-chart-wrap--hbar">
383| <div id="ssma-ap-chart-top-responsible" class="ssma-ap-chart-host ssma-ap-chart-host--hbar"></div>
384| </div>
385| </div>
386| </div>
387| <div class="col-12 col-lg-6">
388| <div class="app-card-surface ssma-dashboard-chart-card h-100">
389| <div class="px-3 py-2 border-bottom">
390| <div class="ssma-dashboard-chart-title">Pendências por origem</div>
391| <div class="ssma-dashboard-chart-subtitle">Distribuição do volume total de pendências</div>
392| </div>
393| <div class="p-2">
394| <div id="ssma-ap-chart-origin" class="ssma-ap-chart-host ssma-ap-chart-host--column"></div>
395| </div>
396| </div>
397| </div>
398| </div>
399|
400| <div class="row mb-3">
401| <div class="col-12">
402| <div class="ssma-ap-operational-summary">
403| <div class="ssma-ap-operational-summary-title">Resumo Operacional</div>
404| {% for row in panel_summary.rows|default([]) %}
405| <div class="ssma-ap-op-row">
406| <div class="ssma-ap-op-row-head">
407| <span>{{ row.label }}</span>
408| <span class="ssma-ap-op-row-value">{{ row.count }} · {{ row.percent }}%</span>
409| </div>
410| <div class="ssma-ap-op-progress" aria-hidden="true">
411| <div class="ssma-ap-op-progress-fill" style="width: {{ row.percent|default(25) }}%;"></div>
412| </div>
413| </div>
414| {% endfor %}
415| {% set total_row = panel_summary.total|default({}) %}
416| <div class="ssma-ap-op-total">
417| <span>{{ total_row.label|default('Total de pendências') }}</span>
418| <span>{{ total_row.value|default('') }} · {{ total_row.percent|default(100) }}%</span>
419| </div>
420| </div>
421| </div>
422| </div>
423|
424| {% set ap_table_rows = [] %}
425| {% set priority_colors = {
426| 'alta': 'red',
427| 'critica': 'red',
428| 'urgente': 'red',
429| 'moderada': 'teal',
430| 'media': 'teal',
431| 'medio': 'teal',
432| 'média': 'teal',
433| 'baixa': 'gray',
434| 'leve': 'gray'
435| } %}
436| {% for row in panel_table.rows|default([]) %}
437| {% set origin_meta = panel_origin_icons[row.origin|default('')] | default({}) %}
438| {% set title_cell %}
439| <div>
440| <div class="ssma-ap-table-title-main">{{ row.title }}</div>
441| <div class="ssma-ap-table-title-sub">{{ row.action_id }}</div>
442| </div>
443| {% endset %}
444| {% set origin_cell %}
445| <span class="ssma-ap-panel-table-origin"
446| data-toggle="tooltip"
447| title="{{ origin_meta.title|default('Origem') }}"
448| aria-label="{{ origin_meta.title|default('Origem') }}">
449| {% include 'components/ui/_icon_badge.html.twig' with {
450| icon: origin_meta.icon|default('fa-link'),
451| size: 'md',
452| variant: origin_meta.variant|default('primary'),
453| rounded: true
454| } %}
455| </span>
456| {% endset %}
457| {% set mgmt_cell %}
458| <div>
459| <div class="ssma-ap-table-title-main">{{ row.management }}</div>
460| <div class="ssma-ap-table-mgmt-sub">{{ row.location }}</div>
461| </div>
462| {% endset %}
463| {% set priority_key = row.priority_key|default('baixa')|lower %}
464| {% set priority_color = priority_colors[priority_key] is defined ? priority_colors[priority_key] : 'gray' %}
465| {% set priority_cell %}
466| {% include 'components/ui/_pill.html.twig' with {
467| label: row.priority,
468| color: priority_color,
469| size: 'sm'
470| } %}
471| {% endset %}
472| {% set responsible_members = [] %}
473| {% for person in row.responsible|default([]) %}
474| {% set responsible_members = responsible_members|merge([{
475| name: person.name|default(person.initials|default('')),
476| avatar: person.avatar|default('')
477| }]) %}
478| {% endfor %}
479| {% set responsible_cell %}
480| {% include 'components/ui/_member_avatars_stack.html.twig' with {
481| members: responsible_members,
482| max_visible: 3,
483| size: 27,
484| empty_label: '—'
485| } %}
486| {% endset %}
487| {% set deadline_cell %}
488| <span class="ssma-ap-deadline--{{ row.deadline_overdue|default(false) ? 'overdue' : 'ok' }}">{{ row.deadline }}</span>
489| {% endset %}
490| {% set action_cell %}
491| <button type="button"
492| class="ssma-ap-panel-table-action-btn js-ssma-ap-panel-view-action"
493| data-action-id="{{ row.id }}"
494| data-toggle="tooltip"
495| title="Visualizar"
496| aria-label="Visualizar ação">
497| <i class="fas fa-eye" aria-hidden="true"></i>
498| </button>
499| {% endset %}
500| {% set ap_table_rows = ap_table_rows|merge([{
501| titulo: title_cell|trim,
502| origem: origin_cell|trim,
503| gerencia: mgmt_cell|trim,
504| prioridade: priority_cell|trim,
505| responsavel: responsible_cell|trim,
506| prazo: deadline_cell|trim,
507| pendencia: row.pending,
508| acoes: action_cell|trim
509| }]) %}
510| {% endfor %}
511|
512| <div class="row mb-3">
Request #72
deepseek-v4-flash
P:74.56K C:1.12K CR:72.83K CW:0
9877ms
Reasoning
Confirmed: SSR row building (lines 424-510) hasn't been updated for the new headers, and it only outputs `responsavel` once, with keys in order titulo, origem, gerencia, prioridade, responsavel, prazo, pendencia, acoes = 8 keys vs 9 headers. This mismatch means the initial server-rendered table (which shows before a filter request) is misaligned: the columns Quem executa / Quem valida / Prazo / Pendência / Ações will shift.
However, careful: when the SSR table is DataTable-init'd, does MetahumanDataTables initialize from headers and rows? The number of <th> = 9, <td> = 8. DataTables init would raise an error: "DataTables warning: table id=ssma-ap-panel-table - Requested unknown parameter '7' for row..." Actually DataTables handles rows where cells fewer than columns by error. Typically DataTables throws a warning for each row and then column count determined by th count; it may show empty cells. Might be partially usable but misaligned. Either way it's a real regression.
This finding belongs to `_tab_painel.html.twig` (added headers). Wait, but the review rules for twig say comment on the diff; the headers change is in the diff. The suggested fix: update SSR row-building to include both executors and validators columns (or drop the two new headers from SSR), to align.
Actually wait — is this server-rendered table always replaced by the JS path at load? `onPainelTabVisible` triggers triggerPanelFilter only when panelData lacks charts or labels. Since this panel has charts (they exist in SSR data), it will not trigger filter, so the SSR rows remain. But wait, when tab is not visible at load, later visible triggers onPainelTabVisible → if initialized false... it calls switchView(currentView) which only re-renders charts, not table. So SSR rows remain as the table. DataTable is created by global init (MetahumanDataTables) presumably. So yes, the SSR table displays with misalignment.
Actually, let me double check that rows of SSR are rendered by _table_body_rows.html.twig, which loops each row keys as cells in the row (twig order preserved). Yes.
Also verify that DataTables auto-initializes `ssma-ap-panel-table` on page via MetahumanDataTables global; whenReady callback in updatePendenciasTable is only used when JS re-renders. There must be a generic auto-init for dynamic tables. It's plausible.
So this is finding: server-side row builder of `_tab_painel.html.twig` not updated to add executors and validators cells → column mismatch on initial load.
Let me also double check the row cells order: In _table_body_rows.html.twig, `{% for key, cell in row %}` iterates keys of each row. Keys order in Twig hash is insertion order. So titulo, origem, gerencia, prioridade, responsavel, prazo, pendencia, acoes → 8 tds. Meanwhile, `row.id` skipped. Yes.
Header count = 9. That means last header (Ações) gets no cell. Columns shift. So the "Quem valida" shows prazo cell, etc. Definitely an issue.
Great. This is a new issue #1.
Now check the JS `updatePendenciasTable` builds the same tds count as headers (9): title, origin, management, priority, executors, validators, deadline, pending, actions → 9. Yes matches.
Now the second issue I want to check: whether the 'Quem executa' / 'Quem valida' SSR building actually requires each server-rendered row to have avatars etc. But given the SSR row builder is broken, the fix could be to update SSR code to include both stacks (executors/validators) like JS. Since row.responsible exists and row.executors,row.validators likely exist in payload (rows have executors/validators from panel_table? Wait SSR panel_table rows come from presenter presentFilterResponse... The SSR table rows (panel_table.rows) include executors/validators? In service row mapping added executors/validators fields. The SSR table row building reads `row.responsible` and would read row.executors/row.validators if they were added. So a fix is feasible.
Now, let me check the filter reset behavior: `resetCustomSelect`? When filters reset button clears? New `ap_painel_filter_origem` and mine checkbox maybe need to be included in "Limpar" action so they reset. Let me search JS reset function for pendencias filters.
Let's search "Limpar" or "clear" filters in the JS.
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["public/js/ssma/action_plan_panel.js"], "search_text": "resetCustomSelect|ap_painel_filter_team|limpar|Limpar|clearFilters"}
Result
No matches found
Request #73
deepseek-v4-flash
P:75.7K C:144 CR:75.65K CW:0
1921ms
Reasoning
Search differently.
Tool Calls (2)
code_search
Show Details
Arguments
{"file_patterns": ["public/js/ssma/action_plan_panel.js"], "search_text": "reset"}
Result
File: public/js/ssma/action_plan_panel.js
Match lines: 35
118| function refreshApPeriodPresetState() {
123| $('#ap_painel_controls .ap-painel-period-preset').removeClass('is-active');
125| $('#ap_painel_controls .ap-painel-period-preset[data-preset="' + apPainelPeriodMode + '"]').addClass('is-active');
129| function syncApPainelPeriodPresetUI(preset) {
130| if (preset === 'custom') {
132| refreshApPeriodPresetState();
136| apPainelPeriodMode = preset || 'next_month';
158| refreshApPeriodPresetState();
226| refreshApPeriodPresetState();
230| function applyApPainelPeriodPreset(preset) {
231| syncApPainelPeriodPresetUI(preset);
237| function refreshOverviewPeriodPresetState() {
242| $('#ap-painel-filters-overview .ap-overview-period-preset').removeClass('is-active');
244| $('#ap-painel-filters-overview .ap-overview-period-preset[data-preset="' + apOverviewPeriodMode + '"]').addClass('is-active');
293| function syncOverviewPeriodPresetUI(preset) {
294| if (preset && preset.indexOf('range:') === 0) {
295| var rangeParts = preset.split(':');
300| refreshOverviewPeriodPresetState();
303| if (preset === 'custom') {
305| refreshOverviewPeriodPresetState();
309| apOverviewPeriodMode = preset || 'last_3_months';
337| refreshOverviewPeriodPresetState();
363| refreshOverviewPeriodPresetState();
367| function applyOverviewPeriodPreset(preset) {
368| syncOverviewPeriodPresetUI(preset);
1852| var defaultPreset = panelState.period && panelState.period.indexOf('pend:range:') !== 0
1855| syncApPainelPeriodPresetUI(defaultPreset);
1872| $(document).on('click', '#ap_painel_controls .ap-painel-period-preset', function (e) {
1874| applyApPainelPeriodPreset(String($(this).data('preset') || 'next_month'));
1919| function resetCustomSelect(selectId, defaultLabel) {
1959| $(document).on('click', '#ap-painel-filters-overview .ap-overview-period-preset', function (e) {
1961| applyOverviewPeriodPreset(String($(this).data('preset') || 'last_3_months'));
2301| syncApPainelPeriodPresetUI(panelState.period && panelState.period.indexOf('pend:range:') !== 0 ? panelState.period : 'next_month');
2302| syncOverviewPeriodPresetUI(panelState.overviewPeriod || 'last_3_months');
2365| applyApPainelPeriodPreset(value || panelState.period || 'next_month');
code_search
Show Details
Arguments
{"file_patterns": ["public/js/ssma/action_plan_panel.js"], "search_text": "setCustomSelectValue"}
Result
File: public/js/ssma/action_plan_panel.js
Match lines: 4
1903| if (e.originalEvent && typeof window.setCustomSelectValue === 'function') {
1904| window.setCustomSelectValue(this.id, this.value);
1983| if (e.originalEvent && typeof window.setCustomSelectValue === 'function') {
1984| window.setCustomSelectValue(this.id, this.value);
Request #74
deepseek-v4-flash
P:76.64K C:170 CR:75.78K CW:0
2183ms
Reasoning
Let's look at lines 1890-1930 (pendencias filter binding) and resetCustomSelect, and where reset happens for the pendencias filters (maybe via a "clear filters" button somewhere in template). We saw change handlers. Is there a reset control? Let me search the template for `ap_painel_clear` or similar in JS. Search "clear".
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["public/js/ssma/action_plan_panel.js"], "search_text": "clear|ap_painel_reset|ap_reset|limpar"}
Result
No matches found
Request #75
deepseek-v4-flash
P:76.83K C:117 CR:76.8K CW:0
1709ms
Reasoning
Let's look at the diff region 1855-2000 to read bindPendenciasFilters and bindOverviewFilters.
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 2000, "file_path": "public/js/ssma/action_plan_panel.js", "start_line": 1880}
Result
File: public/js/ssma/action_plan_panel.js (Total lines: 2378)
IS_TRUNCATED: false
LINE_RANGE: 1880-2000
1880| updateAxisOptionsForPeriod(panelState.period);
1881| syncPendenciasFilterState();
1882| triggerPanelFilter('pendencias');
1883| }
1884| });
1885|
1886| $(document).on('click', '#ap_painel_period_apply', function () {
1887| if (applyApPanelPeriodFromInputs()) {
1888| updateAxisOptionsForPeriod(panelState.period);
1889| syncPendenciasFilterState();
1890| $('#ap_painel_period_popover').addClass('d-none');
1891| triggerPanelFilter('pendencias');
1892| }
1893| });
1894| }
1895|
1896| function bindPendenciasFilters() {
1897| var $ = window.jQuery || window.$;
1898| if (!$) {
1899| return;
1900| }
1901|
1902| $(document).on('change', '#ap_painel_filter_team, #ap_painel_filter_vinculo, #ap_painel_filter_unidade, #ap_painel_filter_origem', function (e) {
1903| if (e.originalEvent && typeof window.setCustomSelectValue === 'function') {
1904| window.setCustomSelectValue(this.id, this.value);
1905| }
1906| syncPendenciasFilterState();
1907| triggerPanelFilter('pendencias');
1908| });
1909|
1910| var mineEl = document.getElementById('ap_painel_filter_mine');
1911| if (mineEl) {
1912| mineEl.addEventListener('change', function () {
1913| syncPendenciasFilterState();
1914| triggerPanelFilter('pendencias');
1915| });
1916| }
1917| }
1918|
1919| function resetCustomSelect(selectId, defaultLabel) {
1920| var hidden = document.getElementById(selectId);
1921| if (!hidden) {
1922| return;
1923| }
1924| hidden.value = '';
1925| var wrapper = hidden.closest('.custom-modern-select-wrapper');
1926| if (!wrapper) {
1927| return;
1928| }
1929| var labelEl = wrapper.querySelector('.custom-modern-select-label');
1930| if (labelEl && defaultLabel) {
1931| labelEl.textContent = defaultLabel;
1932| }
1933| wrapper.querySelectorAll('.custom-modern-option').forEach(function (opt) {
1934| opt.classList.toggle('selected', opt.getAttribute('data-value') === '');
1935| });
1936| }
1937|
1938| function bindOverviewFilters() {
1939| var $ = window.jQuery || window.$;
1940| if (!$) {
1941| return;
1942| }
1943|
1944| $(document).on('click', '#ap_overview_period_trigger', function (e) {
1945| e.preventDefault();
1946| $('#ap_overview_period_popover').toggleClass('d-none');
1947| });
1948|
1949| $(document).on('click', '#ap_overview_period_close', function () {
1950| $('#ap_overview_period_popover').addClass('d-none');
1951| });
1952|
1953| $(document).on('click', function (e) {
1954| if (!$(e.target).closest('#ap-painel-filters-overview .oc-painel-period-filter').length) {
1955| $('#ap_overview_period_popover').addClass('d-none');
1956| }
1957| });
1958|
1959| $(document).on('click', '#ap-painel-filters-overview .ap-overview-period-preset', function (e) {
1960| e.preventDefault();
1961| applyOverviewPeriodPreset(String($(this).data('preset') || 'last_3_months'));
1962| $('#ap_overview_period_popover').addClass('d-none');
1963| });
1964|
1965| $(document).on('change', '#ap_overview_start_date, #ap_overview_end_date', function () {
1966| if (applyOverviewPeriodFromInputs()) {
1967| panelState.overviewPage = 1;
1968| syncOverviewFilterState();
1969| triggerPanelFilter('visao_geral');
1970| }
1971| });
1972|
1973| $(document).on('click', '#ap_overview_period_apply', function () {
1974| if (applyOverviewPeriodFromInputs()) {
1975| panelState.overviewPage = 1;
1976| syncOverviewFilterState();
1977| $('#ap_overview_period_popover').addClass('d-none');
1978| triggerPanelFilter('visao_geral');
1979| }
1980| });
1981|
1982| $(document).on('change', '#ap_overview_filter_team, #ap_overview_filter_management, #ap_overview_filter_origin, #ap_overview_filter_unit', function (e) {
1983| if (e.originalEvent && typeof window.setCustomSelectValue === 'function') {
1984| window.setCustomSelectValue(this.id, this.value);
1985| }
1986| panelState.overviewPage = 1;
1987| syncOverviewFilterState();
1988| triggerPanelFilter('visao_geral');
1989| });
1990| }
1991|
1992| function getOverviewPaginationPages(currentPage, totalPages, maxButtons) {
1993| maxButtons = maxButtons || 7;
1994| var pages = [];
1995| var i;
1996|
1997| if (totalPages <= maxButtons) {
1998| for (i = 1; i <= totalPages; i++) {
1999| pages.push(i);
2000| }
Request #76
deepseek-v4-flash
P:78.38K C:215 CR:76.93K CW:0
2640ms
Reasoning
Now let's check getSelectValue function and whether overview 'ap_overview_filter_origin' has proper options to match new origin keys. In the template for overview (lines 205-212), options use `ov_filters.origin|default(...)`. Wait, in buildFilterOptions the service provides 'overview_origins' and 'origin', not 'origin'. The overview filter in template uses `ov_filters.origin` - not `overview_origins`. Hmm. Which variable is `ov_filters`? Possibly comes from presenter 'filters' keyed differently. Let me check what panel presenter passes: `presentFilterResponse($payload, $filterOptions)`. Let me read the presenter to see how filters map to `ov_filters`. Search for ActionPlanPanelPresenter.
Tool Calls (1)
file_find
Show Details
Arguments
{"query_name": "ActionPlanPanelPresenter"}
Result
src/Service/Ssma/ActionPlan/SsmaActionPlanPanelPresenter.php
Request #77
deepseek-v4-flash
P:78.62K C:92 CR:78.46K CW:0
1822ms
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["src/Service/Ssma/ActionPlan/SsmaActionPlanPanelPresenter.php"], "search_text": "overview_origins|'origin'|filters"}
Result
No matches found
Request #78
deepseek-v4-flash
P:78.73K C:89 CR:78.59K CW:0
1797ms
Reasoning
Search in that file for function names and usages.
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["src/Service/Ssma/ActionPlan/"], "search_text": "overview_origins"}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelPresenter.php Match lines: 1 203| 'origin' => $filterOptions['overview_origins'] ?? [['value' => '', 'text' => 'Origem']], File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php Match lines: 1 214| 'overview_origins' => [
Request #79
deepseek-v4-flash
P:78.93K C:95 CR:78.72K CW:0
1920ms
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 260, "file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelPresenter.php", "start_line": 150}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelPresenter.php (Total lines: 357)
IS_TRUNCATED: false
LINE_RANGE: 150-260
150| ],
151| [
152| 'id' => 'period_end',
153| 'title' => 'Final do Período',
154| 'value' => (string) ($kpisRaw['period_end'] ?? $kpisRaw['proximo_prazo'] ?? '—'),
155| 'is_date' => true,
156| 'trend' => ['direction' => 'neutral', 'label' => ''],
157| 'footer' => [],
158| ],
159| ],
160| 'recommendation' => [
161| 'title' => 'Recomendação da Adriana',
162| 'text' => $recommendation,
163| ],
164| 'charts' => [
165| 'critical_pending_by_deadline' => [
166| 'axes' => $this->presentAxisOptions($availableAxes, $activeAxis),
167| 'default_axis' => $activeAxis,
168| 'labels' => $deadlineChart['labels'] ?? [],
169| 'validation' => $deadlineChart['validacao'] ?? [],
170| 'execution' => $deadlineChart['execucao'] ?? [],
171| ],
172| 'top_responsible_pending' => $raw['responsible_chart'] ?? [],
173| 'pending_by_origin' => $this->presentOriginChart($raw['origin_chart'] ?? []),
174| ],
175| 'operational_summary' => $operationalSummary,
176| 'table' => [
177| 'rows' => $actions,
178| 'total' => count($actions),
179| 'showing' => count($actions),
180| 'page_length' => 10,
181| ],
182| 'semantic' => $this->buildPendenciasSemantic($operationalSummary, $openCount),
183| 'adriana' => $this->buildPendenciasAdriana($recommendation, $operationalSummary),
184| 'origin_icons' => $raw['origin_icons'] ?? $this->defaultOriginIcons(),
185| 'available_axes' => $availableAxes,
186| 'active_axis' => $activeAxis,
187| ];
188| }
189|
190| /**
191| * @param array<string, mixed> $overview
192| * @param array<string, mixed> $filterOptions
193| *
194| * @return array<string, mixed>
195| */
196| private function presentOverview(array $overview, array $filterOptions): array
197| {
198| return array_merge($overview, [
199| 'filters' => array_merge($overview['filters'] ?? [], [
200| 'period_presets' => $filterOptions['overview_period'] ?? [],
201| 'team' => $filterOptions['team'] ?? [['value' => '', 'text' => 'Equipe']],
202| 'management' => [['value' => '', 'text' => 'Gerência']],
203| 'origin' => $filterOptions['overview_origins'] ?? [['value' => '', 'text' => 'Origem']],
204| ]),
205| ]);
206| }
207|
208| /**
209| * @param list<string> $availableAxes
210| *
211| * @return list<array{value: string, label: string, selected: bool}>
212| */
213| private function presentAxisOptions(array $availableAxes, string $activeAxis): array
214| {
215| $options = [];
216| foreach ($availableAxes as $axis) {
217| $axis = (string) $axis;
218| $options[] = [
219| 'value' => $axis,
220| 'label' => self::AXIS_LABELS[$axis] ?? ucfirst($axis),
221| 'selected' => $axis === $activeAxis,
222| ];
223| }
224|
225| return $options;
226| }
227|
228| /**
229| * @param list<array<string, mixed>> $originChart
230| *
231| * @return list<array{label: string, value: int, percentage: float}>
232| */
233| private function presentOriginChart(array $originChart): array
234| {
235| $total = array_sum(array_map(static fn (array $item): int => (int) ($item['count'] ?? 0), $originChart));
236| $rows = [];
237|
238| foreach ($originChart as $item) {
239| $count = (int) ($item['count'] ?? 0);
240| $rows[] = [
241| 'label' => (string) ($item['label'] ?? ''),
242| 'value' => $count,
243| 'percentage' => $total > 0 ? round($count / $total * 100, 1) : 0.0,
244| ];
245| }
246|
247| return $rows;
248| }
249|
250| /**
251| * @param array<string, mixed> $operationalSummary
252| *
253| * @return array<string, mixed>
254| */
255| private function buildPendenciasSemantic(array $operationalSummary, int $openCount): array
256| {
257| $rows = $operationalSummary['rows'] ?? [];
258| $commonFactors = [];
259| $highRiskFactors = [];
260|
Request #80
deepseek-v4-flash
P:80.36K C:297 CR:78.98K CW:0
3177ms
Reasoning
The presenter maps filter option 'origin' → for overview filters uses 'overview_origins'. The overview filter in the template (ov_filters.origin) reads the overview origin options; and for pendencias, `panel_filters.origin`. Which variable is panel_filters in the pendencias SSR? The template uses `panel_filters.origin`. Is that provided for pendencias view? Let me look at the presenter's presentFilterResponse, and how SSR template data uses panel_filters.
Actually template line 161: `options: panel_filters.origin|default([...])`. Where does `panel_filters` come from? For SSR, the initial data (action_plan_panel_data) has filters presumably from `buildFilterOptions`. Need to check where the SSR view variables `panel_filters`, `ov_filters`, `panel_table` are built: probably in controller buildActionPlanPanelViewData. Let me read that part to see how they map filters for pendencias vs overview.
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 760, "file_path": "src/Controller/SsmaController.php", "start_line": 553}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 553-760
553|
554| /** @return array<string, mixed> */
555| private function buildActionPlanPanelViewData(Request $request): array
556| {
557| $company = $this->getSsmaCompany();
558| if (!$company instanceof Company) {
559| return $this->actionPlanPanelPresenter->presentDashboard(
560| ['panel_data' => $this->buildEmptyActionPlanPanelData()],
561| ['panel_data' => ['overview' => []]],
562| []
563| );
564| }
565|
566| $memberScope = $this->resolveActionPlanPanelMemberScope($company);
567| $filterOptions = $this->ssmaActionPlanPanelService->buildFilterOptions($company);
568| $unidadeScope = $this->resolveSsmaUnidadeFilterScope($company, $request);
569| $scopeCompanies = $unidadeScope['companies'];
570| $dataCompany = $unidadeScope['data_company'];
571| $actionTypeMeta = $this->getActionTypeMetadata();
572|
573| $pendenciasPayload = $this->ssmaActionPlanPanelService->buildFilterPayload(
574| $scopeCompanies,
575| $dataCompany,
576| 'pendencias',
577| 'next_month',
578| 'weekly',
579| '',
580| '',
581| $actionTypeMeta,
582| $memberScope
583| );
584| $overviewPayload = $this->ssmaActionPlanPanelService->buildFilterPayload(
585| $scopeCompanies,
586| $dataCompany,
587| 'visao_geral',
588| 'last_3_months',
589| 'weekly',
590| '',
591| '',
592| $actionTypeMeta,
593| $memberScope,
594| 1,
595| 10
596| );
597|
598| return $this->actionPlanPanelPresenter->presentDashboard(
599| $pendenciasPayload,
600| $overviewPayload,
601| $filterOptions
602| );
603| }
604|
605| /**
606| * Restringe ações do painel para membro/stakeholder/supervisor de equipe.
607| * null = sem restrição (gestor/admin).
608| *
609| * @return array<int, true>|null
610| */
611| private function resolveActionPlanPanelMemberScope(Company $company): ?array
612| {
613| $user = $this->getUser();
614| if (!$user instanceof User) {
615| return [];
616| }
617|
618| if ($this->canManageSsmaOccurrences()) {
619| return null;
620| }
621|
622| $member = $this->getCurrentCompanyMember($company, $user);
623| if ($this->memberIsSsmaGestorAdministrador($member)) {
624| return null;
625| }
626|
627| $ssmaProductTagName = $this->ssmaCurrentMemberPermissionTag()?->getName();
628| if (in_array($ssmaProductTagName, ['Supervisor de Equipe', 'Supervisor', 'Gestor de Equipe'], true)) {
629| $teamIds = $this->getSsmaOccurrenceDashboardTeamFilterIds($company, $user);
630| if ($teamIds !== null && $teamIds !== []) {
631| return $this->collectCompanyMemberIdsBelongingToCompanyTeams($company, $teamIds);
632| }
633| }
634|
635| $memberId = (int) ($member?->getId() ?? 0);
636|
637| return $memberId > 0 ? [$memberId => true] : [];
638| }
639|
640| /** @return array<string, mixed> */
641| private function buildEmptyActionPlanPanelData(): array
642| {
643| return [
644| 'kpis' => [
645| 'open_actions' => 0,
646| 'created_in_period' => 0,
647| 'completed' => 0,
648| 'vencidas' => 0,
649| 'aguardando_validacao' => 0,
650| 'period_end' => '—',
651| 'proximo_prazo' => '—',
652| 'recommendation' => '',
653| ],
654| 'actions' => [],
655| 'deadline_chart' => ['labels' => [], 'execucao' => [], 'validacao' => []],
656| 'responsible_chart' => [],
657| 'origin_chart' => [],
658| 'type_chart' => [],
659| 'operational_summary' => [
660| 'rows' => [],
661| 'total' => ['label' => 'Total de pendências', 'value' => '0', 'percent' => 100],
662| ],
663| 'available_axes' => ['weekly'],
664| 'active_axis' => 'weekly',
665| ];
666| }
667|
668| public function direitoRecusaIndex(Request $request): Response
669| {
670| $viewData = $this->buildSsmaViewData(['module' => 'occurrence']);
671| $company = $this->getSsmaCompany();
672| /** @var User|null $user */
673| $user = $this->getUser();
674| $member = $this->getCurrentCompanyMember($company, $user instanceof User ? $user : null);
675|
676| $refusalConfig = ['flow_a_member_ids' => [], 'flow_b_member_ids' => []];
677| $flowAccess = ['can_flow_a' => true, 'can_flow_b' => false, 'preferred_flow' => 'A'];
678| $records = [];
679| $recordsPayload = [];
680|
681| if ($company) {
682| try {
683| $refusalConfig = $this->ssmaRefusalRightService->getConfigForFrontend($company);
684| $flowAccess = $this->ssmaRefusalRightService->resolveMemberFlowAccess($company, $member);
685| $records = $this->ssmaRefusalRightService->listForCompany($company);
686| foreach ($records as $row) {
687| $item = $this->ssmaRefusalRightService->toFrontendArray($row);
688| $item['can_deepen'] = in_array($row->getStatus(), [
689| SsmaRefusalRight::STATUS_AWAITING_LEADER,
690| SsmaRefusalRight::STATUS_INTERRUPTED,
691| ], true)
692| && $row->getFlow() === SsmaRefusalRight::FLOW_A
693| && $this->ssmaRefusalRightService->memberCanDeepen($row, $member);
694| $recordsPayload[] = $item;
695| }
696| } catch (\Throwable $e) {
697| $this->ssmaLogger->error('[SSMA] Direito de Recusa hub indisponível: ' . $e->getMessage());
698| }
699| }
700|
701| $locationOptions = [['value' => '', 'text' => 'Selecione o local']];
702| foreach (($viewData['occurrence_type_config']['selected_locations'] ?? $viewData['occurrence_type_config']['locations'] ?? []) as $loc) {
703| if (is_string($loc) && $loc !== '') {
704| $locationOptions[] = ['value' => $loc, 'text' => $loc];
705| }
706| }
707|
708| $directLeader = $member?->getSuperior();
709| $consequenceOptions = [['value' => '', 'text' => 'Selecione']];
710| foreach (SsmaRefusalRightService::realConsequenceOptions() as $opt) {
711| $consequenceOptions[] = $opt;
712| }
713|
714| return $this->render('ssma/refusal/index.html.twig', array_merge($viewData, [
715| 'refusal_rights' => $records,
716| 'refusal_rights_json' => $recordsPayload,
717| 'refusal_panel' => $this->ssmaRefusalRightService->buildPanelSummary($records),
718| 'refusal_config' => $refusalConfig,
719| 'refusal_flow_access' => $flowAccess,
720| 'refusal_direct_leader' => $directLeader,
721| 'refusal_location_options' => $locationOptions,
722| 'refusal_consequence_options' => $consequenceOptions,
723| 'ssmaPermissionProduct' => 'ssma-occurrences',
724| 'ssmaRefusalNativeAutomationsEnabled' => class_exists('App\\Service\\Ssma\\SsmaRefusalAutomationCatalog'),
725| ]));
726| }
727|
728| public function createDireitoRecusa(Request $request): JsonResponse
729| {
730| $company = $this->getSsmaCompany();
731| if (!$company) {
732| return $this->json(['success' => false, 'message' => 'Empresa não encontrada.'], 400);
733| }
734|
735| /** @var User|null $user */
736| $user = $this->getUser();
737| $member = $this->getCurrentCompanyMember($company, $user instanceof User ? $user : null);
738| $payload = json_decode($request->getContent() ?: '{}', true);
739| if (!is_array($payload)) {
740| $payload = $request->request->all();
741| }
742|
743| $dangerous = trim((string) ($payload['dangerous_condition'] ?? ''));
744| $corrective = trim((string) ($payload['corrective_measure'] ?? ''));
745| if ($dangerous === '' || $corrective === '') {
746| return $this->json(['success' => false, 'message' => 'Preencha a condição perigosa e a medida corretiva.'], 422);
747| }
748|
749| if (empty($payload['direct_leader_member_id']) && $member && $member->getSuperior()) {
750| $payload['direct_leader_member_id'] = $member->getSuperior()->getId();
751| }
752|
753| try {
754| $entity = $this->ssmaRefusalRightService->createFromPayload($company, $member, $payload);
755| } catch (\InvalidArgumentException $e) {
756| return $this->json(['success' => false, 'message' => $e->getMessage()], 422);
757| } catch (\RuntimeException $e) {
758| $this->ssmaLogger->error('[SSMA] Direito de Recusa schema/runtime: ' . $e->getMessage());
759|
760| return $this->json(['success' => false, 'message' => $e->getMessage()], 503);
Request #81
deepseek-v4-flash
P:83.25K C:166 CR:80.64K CW:0
2466ms
Reasoning
OK. Now, in buildActionPlanPanelViewData, the panel filter options are also used to create SSR variables. Need to find where presentDashboard builds the template variables `panel_filters`, `ov_filters`, `panel_table`, `panel_default_view`, etc. Let me find presentDashboard in presenter.
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["src/Service/Ssma/ActionPlan/SsmaActionPlanPanelPresenter.php"], "search_text": "function presentDashboard|panel_filters|ov_filters|panel_default_view|ap_painel_team_options"}
Result
No matches found
Request #82
deepseek-v4-flash
P:83.44K C:113 CR:83.33K CW:0
1958ms
Reasoning
presentDashboard maybe defined elsewhere (perhaps in the base class or another presenter). Let me search across the codebase for "function presentDashboard" and "panel_default_view".
Tool Calls (2)
code_search
Show Details
Arguments
{"search_text": "presentDashboard"}
Result
File: src/Controller/SsmaController.php Match lines: 2 559| return $this->actionPlanPanelPresenter->presentDashboard( 598| return $this->actionPlanPanelPresenter->presentDashboard( File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelPresenter.php Match lines: 1 25| public function presentDashboard(
code_search
Show Details
Arguments
{"search_text": "panel_default_view"}
Result
File: templates/ssma/action_plan/tabs/_tab_painel.html.twig
Match lines: 6
36|{% set panel_default_view = panel.default_view|default('pendencias') %}
72| <div class="filters-container tab-filters ml-auto align-items-center ssma-ap-panel-filters-row d-none{% if panel_default_view == 'pendencias' %} d-lg-flex{% endif %}" id="ap-painel-filters-pendencias">
183| <div class="filters-container tab-filters ml-auto align-items-center ssma-ap-panel-filters-row d-none{% if panel_default_view == 'visao_geral' %} d-lg-flex{% endif %}" id="ap-painel-filters-overview">
302| class="ssma-ap-panel-view-pill{% if view.id == panel_default_view %} is-active{% endif %}"
305| aria-selected="{{ view.id == panel_default_view ? 'true' : 'false' }}">
311| <div data-ap-panel-view="pendencias"{% if panel_default_view != 'pendencias' %} class="d-none"{% endif %}>
Request #83
deepseek-v4-flash
P:83.9K C:95 CR:83.46K CW:0
1548ms
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 150, "file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelPresenter.php", "start_line": 1}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelPresenter.php (Total lines: 357)
IS_TRUNCATED: false
LINE_RANGE: 1-150
1|<?php
2|
3|declare(strict_types=1);
4|
5|namespace App\Service\Ssma\ActionPlan;
6|
7|/**
8| * Adapta o payload do SsmaActionPlanPanelService para o formato consumido pelos templates e pelo JS.
9| */
10|final class SsmaActionPlanPanelPresenter
11|{
12| private const AXIS_LABELS = [
13| 'daily' => 'Diário',
14| 'weekly' => 'Semanal',
15| 'monthly' => 'Mensal',
16| ];
17|
18| /**
19| * @param array<string, mixed> $pendenciasPayload
20| * @param array<string, mixed> $overviewPayload
21| * @param array<string, mixed> $filterOptions
22| *
23| * @return array<string, mixed>
24| */
25| public function presentDashboard(
26| array $pendenciasPayload,
27| array $overviewPayload,
28| array $filterOptions,
29| string $defaultPeriod = 'next_month',
30| string $defaultOverviewPeriod = 'last_3_months',
31| ): array {
32| $pendenciasPanel = $this->presentPendenciasPanelData($pendenciasPayload['panel_data'] ?? []);
33|
34| return array_merge($pendenciasPanel, [
35| 'filters' => $this->presentFilters($filterOptions),
36| 'view_sections' => [
37| ['id' => 'pendencias', 'label' => 'Pendências'],
38| ['id' => 'visao_geral', 'label' => 'Visão Geral'],
39| ['id' => 'comparativo', 'label' => 'Comparativo entre unidades'],
40| ],
41| 'default_view' => 'pendencias',
42| 'active_period' => $defaultPeriod,
43| 'active_overview_period' => $defaultOverviewPeriod,
44| 'available_axes' => $pendenciasPanel['available_axes'],
45| 'active_axis' => $pendenciasPanel['active_axis'],
46| 'overview' => $this->presentOverview(
47| $overviewPayload['panel_data']['overview'] ?? [],
48| $filterOptions
49| ),
50| ]);
51| }
52|
53| /**
54| * @param array<string, mixed> $apiPayload
55| * @param array<string, mixed> $filterOptions
56| *
57| * @return array<string, mixed>
58| */
59| public function presentFilterResponse(array $apiPayload, array $filterOptions): array
60| {
61| $view = (string) ($apiPayload['view'] ?? 'pendencias');
62|
63| if ($view === 'visao_geral') {
64| return [
65| 'view' => $view,
66| 'panel' => [
67| 'overview' => $this->presentOverview(
68| $apiPayload['panel_data']['overview'] ?? [],
69| $filterOptions
70| ),
71| ],
72| 'available_axes' => $apiPayload['available_axes'] ?? [],
73| 'active_axis' => $apiPayload['active_axis'] ?? '',
74| ];
75| }
76|
77| if ($view === 'comparativo') {
78| return [
79| 'view' => $view,
80| 'panel' => [
81| 'comparativo' => $apiPayload['panel_data'] ?? [],
82| ],
83| ];
84| }
85|
86| $panel = $this->presentPendenciasPanelData($apiPayload['panel_data'] ?? []);
87|
88| return [
89| 'view' => $view,
90| 'panel' => $panel,
91| 'available_axes' => $panel['available_axes'],
92| 'active_axis' => $panel['active_axis'],
93| ];
94| }
95|
96| /**
97| * @param array<string, mixed> $filterOptions
98| *
99| * @return array<string, mixed>
100| */
101| private function presentFilters(array $filterOptions): array
102| {
103| return [
104| 'period' => $filterOptions['period'] ?? [],
105| 'team' => $filterOptions['team'] ?? [],
106| 'bond' => $filterOptions['bond'] ?? [],
107| 'unit' => $filterOptions['unit'] ?? [],
108| ];
109| }
110|
111| /**
112| * @param array<string, mixed> $raw
113| *
114| * @return array<string, mixed>
115| */
116| private function presentPendenciasPanelData(array $raw): array
117| {
118| $kpisRaw = $raw['kpis'] ?? [];
119| $openCount = (int) ($kpisRaw['open_actions'] ?? 0);
120| $trends = $kpisRaw['trend'] ?? [];
121| $recommendation = (string) ($kpisRaw['recommendation'] ?? '');
122| $operationalSummary = $raw['operational_summary'] ?? ['rows' => [], 'total' => ['label' => 'Total de pendências', 'value' => '0', 'percent' => 100]];
123| $availableAxes = $raw['available_axes'] ?? ['weekly'];
124| $activeAxis = (string) ($raw['active_axis'] ?? $availableAxes[0] ?? 'weekly');
125| $deadlineChart = $raw['deadline_chart'] ?? ['labels' => [], 'execucao' => [], 'validacao' => []];
126| $actions = $raw['actions'] ?? [];
127|
128| return [
129| 'kpis' => [
130| [
131| 'id' => 'created_in_period',
132| 'title' => 'Ações criadas no período',
133| 'value' => $this->formatNumber((int) ($kpisRaw['created_in_period'] ?? $openCount)),
134| 'trend' => $trends['created'] ?? ['direction' => 'neutral', 'label' => ''],
135| 'footer' => [],
136| ],
137| [
138| 'id' => 'completed',
139| 'title' => 'Concluídas',
140| 'value' => $this->formatNumber((int) ($kpisRaw['completed'] ?? 0)),
141| 'trend' => $trends['completed'] ?? ['direction' => 'neutral', 'label' => ''],
142| 'footer' => [],
143| ],
144| [
145| 'id' => 'awaiting_validation',
146| 'title' => 'Aguardando validação',
147| 'value' => $this->formatNumber((int) ($kpisRaw['aguardando_validacao'] ?? 0)),
148| 'trend' => $trends['awaiting'] ?? ['direction' => 'neutral', 'label' => ''],
149| 'footer' => [],
150| ],
Request #84
deepseek-v4-flash
P:85.75K C:282 CR:83.97K CW:0
3117ms
Reasoning
Interesting: `presentFilters` only includes period, team, bond, unit — NOT 'origin'. And `presentPendenciasPanelData` uses raw['actions'] where service returns 'normalizedActions'? Let's see where presentPendenciasPanelData receives `$raw = $apiPayload['panel_data']`, i.e., from buildPendenciasData which returns keys 'kpis', 'table', 'origin_icons'... Wait buildPendenciasData return includes 'table' with rows (from normalizedActions). But the presenter reads `$raw['actions']` for table? Actually service's buildPendenciasData returns a structure. Let me look at the tail of buildPendenciasData (lines 760-850) to see the keys used: 'table' => ['rows' => $normalizedActions ...], 'origin_icons', 'actions'? Let me read.
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 900, "file_path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php", "start_line": 760}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php (Total lines: 1648)
IS_TRUNCATED: false
LINE_RANGE: 760-900
760| ['label' => 'Execução', 'value' => (string) $kpiFooters['overdue_exec']],
761| ['label' => 'Validação', 'value' => (string) $kpiFooters['overdue_val']],
762| ],
763| 'awaiting_validation' => [
764| ['label' => 'Em dia', 'value' => (string) $kpiFooters['await_on_time']],
765| ['label' => 'Vencidas', 'value' => (string) $kpiFooters['await_overdue']],
766| ],
767| ],
768| ],
769| 'actions' => $normalizedActions,
770| 'deadline_chart' => [
771| 'labels' => array_column(array_values($bucketData), 'label'),
772| 'execucao' => array_column(array_values($bucketData), 'execucao'),
773| 'validacao' => array_column(array_values($bucketData), 'validacao'),
774| ],
775| 'responsible_chart' => $this->buildResponsibleChart($filtered, $membersById),
776| 'origin_chart' => $this->presentSeededOriginChart($originCount),
777| 'operational_summary' => $this->buildOperationalSummary($filtered, $today),
778| 'origin_icons' => $this->originIconsMap(),
779| ];
780| }
781|
782| /**
783| * @param list<array<string, mixed>> $filtered
784| * @param list<array<string, mixed>> $prevFiltered
785| * @param list<array<string, mixed>> $allActions
786| * @param array<string, mixed> $actionTypeMeta
787| * @param array<int, array{id: int, name: string}> $membersById
788| *
789| * @return array<string, mixed>
790| */
791| private function buildOverviewData(
792| array $filtered,
793| array $prevFiltered,
794| array $allActions,
795| array $actionTypeMeta,
796| array $membersById,
797| ?string $fromStr,
798| ?string $toStr,
799| string $axis,
800| \DateTimeImmutable $today,
801| int $page,
802| int $perPage
803| ): array {
804| $periodLabel = $fromStr
805| ? (new \DateTimeImmutable($fromStr))->format('d/m/Y') . ' - ' . (new \DateTimeImmutable($toStr))->format('d/m/Y')
806| : 'Todo o período';
807|
808| $finalized = count(array_filter($filtered, static fn (array $a): bool => (bool) ($a['solved'] ?? false)));
809| $prevFinalized = count(array_filter($prevFiltered, static fn (array $a): bool => (bool) ($a['solved'] ?? false)));
810| $overdue = count(array_filter($filtered, function (array $a) use ($today): bool {
811| if ($a['solved'] ?? false) {
812| return false;
813| }
814| $deadline = $a['deadline'] ?? null;
815|
816| return $deadline !== null && $deadline < $today->format('Y-m-d');
817| }));
818| $prevOverdue = count(array_filter($prevFiltered, function (array $a) use ($today): bool {
819| if ($a['solved'] ?? false) {
820| return false;
821| }
822| $deadline = $a['deadline'] ?? null;
823|
824| return $deadline !== null && $deadline < $today->format('Y-m-d');
825| }));
826|
827| $avgFulfillment = $this->averageFulfillmentDays($filtered);
828| $avgValidation = $this->averageValidationDays($filtered);
829|
830| $allDetails = $this->buildOverviewActionDetails($filtered, $membersById);
831| $total = count($allDetails);
832| $lastPage = max(1, (int) ceil($total / max(1, $perPage)));
833| $page = max(1, min($page, $lastPage));
834| $offset = ($page - 1) * $perPage;
835| $pageRows = array_slice($allDetails, $offset, $perPage);
836|
837| return [
838| 'filters' => [
839| 'period_label' => $periodLabel,
840| ],
841| 'indicators' => [
842| [
843| 'id' => 'actions_in_plan',
844| 'title' => 'Ações no plano',
845| 'value' => $this->formatNumber(count($filtered)),
846| 'footer' => 'Total de ações',
847| 'icon' => 'fas fa-clipboard-list',
848| 'icon_tone' => 'teal',
849| ],
850| [
851| 'id' => 'finalized_in_period',
852| 'title' => 'Finalizadas no período',
853| 'value' => $this->formatNumber($finalized),
854| 'footer' => 'vs. período anterior',
855| 'icon' => 'fas fa-check',
856| 'icon_tone' => 'green',
857| 'trend' => $this->buildTrend($finalized, $prevFinalized),
858| ],
859| [
860| 'id' => 'overdue_in_period',
861| 'title' => 'Vencidas no período',
862| 'value' => $this->formatNumber($overdue),
863| 'footer' => 'vs. período anterior',
864| 'icon' => 'fas fa-clock',
865| 'icon_tone' => 'danger',
866| 'trend' => $this->buildTrend($overdue, $prevOverdue, true),
867| ],
868| [
869| 'id' => 'avg_fulfillment_time',
870| 'title' => 'Tempo médio até cumprimento',
871| 'value' => $this->formatDecimal($avgFulfillment),
872| 'unit' => 'dias',
873| 'icon' => 'fas fa-clock',
874| 'icon_tone' => 'warning',
875| ],
876| [
877| 'id' => 'avg_validation_time',
878| 'title' => 'Tempo médio de validação',
879| 'value' => $this->formatDecimal($avgValidation),
880| 'unit' => 'dias',
881| 'icon' => 'fa-regular fa-shield-check',
882| 'icon_tone' => 'blue',
883| ],
884| ],
885| 'action_evolution' => $this->buildOverviewEvolution($filtered, $axis, $today),
886| 'average_time_by_origin' => $this->buildAverageTimeByOrigin($filtered),
887| 'average_execution_by_person' => $this->buildAverageTimeByPerson($filtered, $membersById),
888| 'action_details' => $pageRows,
889| 'semantic_analysis' => $this->buildSemanticAnalysis($filtered, $avgFulfillment),
890| 'adriana_insights' => $this->buildAdrianaInsights($finalized, $prevFinalized, $overdue, $avgFulfillment),
891| 'pagination' => [
892| 'per_page' => $perPage,
893| 'total' => $total,
894| 'current_page' => $page,
895| 'last_page' => $lastPage,
896| ],
897| ];
898| }
899|
900| /**
Request #85
deepseek-v4-flash
P:87.92K C:1.72K CR:86.02K CW:0
14035ms
Reasoning
Now I need to reconcile: the presenter `presentPendenciasPanelData` uses raw['actions'] to make table rows; that produces keys for the SSR table: 'titulo', 'origem', 'gerencia', 'prioridade', 'responsavel', 'prazo', 'pendencia', 'acoes'. Presenter maps action fields to these. Let me read presentPendenciasPanelData further (lines 150-188) — we saw at 176-181 'table' => ['rows' => $actions...] where $actions = $raw['actions']? Actually line 126 `$actions = $raw['actions'] ?? [];` and line 176 table rows $actions. Wait but the SSR template loops `panel_table.rows` and uses `row.responsible`, `row.origin` (via panel_origin_icons[row.origin]), `row.management` etc. So the action rows already have these fields (from service normalizedActions). So the SSR rows in the Twig are the SAME as the JSON rows. In the Twig loop each row has executors/validators too, but they're just not used. Right.
The template `_tab_painel.html.twig` SSR uses row fields to build cells, and we saw it builds only `responsavel` from `row.responsible`. It does NOT build separate executor and validator cells. Yet headers now have both "Quem executa" and "Quem valida". So this confirms the misalignment on initial SSR render. But wait — is the JS `updatePendenciasTable` invoked at initial load replacing it? In onPainelTabVisible, when panelData has charts labels, it does NOT call triggerPanelFilter. So initial SSR table stays. But maybe DataTable reinitialized and the JS updatePendenciasTable is never called, so SSR table remains the initial render.
Hmm, but then the SSR table cells: `_table_body_rows` iterates row keys in order (titulo, origem, gerencia, prioridade, responsavel, prazo, pendencia, acoes). 8 cells; DataTables may adapt to 9 columns by adding an empty cell? Actually DataTables sets column count based on <thead>. With 8 cells and 9 columns, DataTables produces an error warning on initialization for each row and marks the row invalid? DataTables logs warning "Requested unknown parameter '8' for row 0" or 'DataTables warning: table id=... - Requested unknown parameter ...'. In some configurations, the row may be dropped entirely or render blank. So this initial table could appear empty or with misaligned columns. That's an issue worth reporting.
But wait, actually there is a subtlety: The SSR table uses `_table_card.html.twig` with `_dynamic_table.html.twig`, and MetahumanDataTables auto-init would treat it. Since rows mismatch columns (8 vs 9), DataTables will error. This is a serious UX regression visible on first load of the Painel tab.
OK this is a solid issue in the _tab_painel.html.twig (review file). We should comment on the header lines added in the diff.
However — is that server-side code (rows) part of the diff? No, only headers + filters were changed. But the added headers are what break the existing SSR rows. The comment can anchor on the added header lines (the diff lines). That's allowed since it's new code.
Let me now confirm that the JS updatePendenciasTable actually isn't used on initial paint — check updatePendenciasTable invocation callers: line 994 inside applyPendenciasDom, which is invoked from applyFilterResponse (line 524). applyFilterResponse is invoked from runPanelFilterRequest (after a fetch) — and initially, only if triggerPanelFilter. So initial SSR: updatePendenciasTable not called unless they call triggerPanelFilter. In onPainelTabVisible, triggerPanelFilter is only called when panelData lacks charts, or chart labels empty. Given charts usually have labels? The SSR always returns the initial chart data with possibly empty labels (no data). If labels empty, triggerPanelFilter is called → the SSR table replaced with JS rows. If labels exist (data exists), the SSR table stays with the misaligned columns. So misalignment visible when there is data. That's the typical case.
Good — issue confirmed.
Now let me also double check what 'row.responsible' vs executors represent in SSR: presentPendenciasPanelData maps rows = raw['actions'] which include 'responsible', 'executors', 'validators'. But presentPendenciasPanelData table rows might only copy specific fields? It uses $actions = $raw['actions'] directly and returns ['table' => ['rows' => $actions...]]. Good, executors & validators exist in rows.
Now find more issues.
### CSS/template: new columns inside table could overflow, not critical.
### The 'origin' filter select: SSR page initial filter options panel_filters.origin: where panel_filters set? In the controller's index render, `action_plan_panel_data` from presentDashboard includes 'filters' only period, team, bond, unit (presentFilters). No 'origin'. But the template uses `panel_filters.origin|default([...])` with fallback list. So the fallback list is used, fine.
But the JS data (panelData JSON) uses the same fallback. Fine.
Wait, but there's a nuance: In template, `panel_filters` variable probably comes from `action_plan_panel_data.filters`? It has no 'origin' key, so the fallback options are always used in SSR, regardless of the service's canonical option list (same content though). Fine.
### Overview SSR default view: not relevant.
### Permission flags & template:
In `_action_plan_overflow_menu.html.twig`, `ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false))`. Need to check the template passes `ssmaCanMutateActionPlan` variable in the included context where overflow menu is used. If not passed, default to ssmaCanManageOccurrences. But where's ssmaCanMutateActionPlan set? In SsmaController index action's SQL at line ~13265 where `'ssmaCanMutateActionPlan' => $ssmaCanMutateActionPlan`. Those are passed to templates that render this overflow menu. Need to ensure every caller of the overflow menu passes ssmaCanMutateActionPlan, or the fallback to old behavior means supervisor can still mutate (only visuals). That's fine for SSR maybe, but since it's the same controller providing context, likely ok.
But wait: the confirmed finding #2 is exactly about the duplicated/contradictory flags on the screen vs backend for Gestor de Equipe/Área. So don't repeat.
Now, look at `canMutateSsmaActionPlan()` blocking supervisor tags but allowing member with can_create? Let's read canManageSsmaOccurrences to see who it returns true for. If it returns true for members whose tag has can_create on ssma-occurrences product, then member comum with can_create can create actions... Actually comment says "Membro comum (sem tag de supervisão) não pode". But canManageSsmaOccurrences may return true for those with can_create... We need to verify. isSsmaViewer false for can_create? If isSsmaViewer returns true only when tag lacks can_create... Not sure. Let's read isSsmaViewer & canManageSsmaOccurrences definitions.
Let me search.
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "private function isSsmaViewer|private function canManageSsmaOccurrences|private function canAccessSsmaSupervisorSurface"}
Result
No matches found
Request #86
deepseek-v4-flash
P:89.66K C:155 CR:89.6K CW:0
1927ms
Reasoning
The functions might be defined in a trait/base class. Let me search the whole repo (not limited to the controller) for these function definitions.
Tool Calls (3)
code_search
Show Details
Arguments
{"search_text": "function isSsmaViewer"}
Result
File: src/Controller/SsmaController.php Match lines: 1 10090| private function isSsmaViewer(): bool File: tests/Unit/Product/Ssma/ssma_permissions_policy_standalone.php Match lines: 1 204|function isSsmaViewerRole(array $p): bool
code_search
Show Details
Arguments
{"search_text": "function canManageSsmaOccurrences"}
Result
File: src/Controller/SsmaController.php Match lines: 1 11339| private function canManageSsmaOccurrences(): bool File: tests/Unit/Product/Ssma/ssma_permissions_policy_standalone.php Match lines: 1 239|function canManageSsmaOccurrencesFromRequest(array $p, string $routeForAttrs): bool
code_search
Show Details
Arguments
{"search_text": "function canAccessSsmaSupervisorSurface"}
Result
File: src/Controller/SsmaController.php Match lines: 1 11457| private function canAccessSsmaSupervisorSurface(): bool File: tests/Unit/Product/Ssma/ssma_permissions_policy_standalone.php Match lines: 1 249|function canAccessSsmaSupervisorSurface(array $p, string $routeForAttrs): bool
Request #87
deepseek-v4-flash
P:90.08K C:162 CR:89.73K CW:0
2588ms
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 10120, "file_path": "src/Controller/SsmaController.php", "start_line": 10060}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 10060-10120
10060| if (!$this->canMutateExistingInspection($inspection, $company, $user)) {
10061| return new JsonResponse(['success' => false, 'message' => 'Sem permissão para finalizar esta inspeção.'], 403);
10062| }
10063|
10064| if ($inspection->getStatus() === 'finalizada') {
10065| return new JsonResponse(['success' => true, 'message' => 'Inspeção já está finalizada.']);
10066| }
10067|
10068| try {
10069| $inspection->setStatus('finalizada');
10070| $this->entityManager->flush();
10071| } catch (\Throwable $e) {
10072| return new JsonResponse(['success' => false, 'message' => 'Erro ao finalizar inspeção.'], 500);
10073| }
10074|
10075| $payload = [
10076| 'success' => true,
10077| 'message' => 'Inspeção finalizada com sucesso.',
10078| ];
10079| try {
10080| $membersById = $this->buildMembersById($inspection->getCompany());
10081| $payload['inspection'] = $this->serializeInspection($inspection, $membersById);
10082| $payload['inspection']['can_mutate'] = $this->canMutateExistingInspection($inspection, $company, $user);
10083| } catch (\Throwable $e) {
10084| // Persistiu; o front recarrega se o payload de UI falhar.
10085| }
10086|
10087| return new JsonResponse($payload);
10088| }
10089|
10090| private function isSsmaViewer(): bool
10091| {
10092| $tag = null;
10093| $user = $this->getUser();
10094| $member = null;
10095| if ($user instanceof User) {
10096| $company = $this->getSsmaCompany() ?? $user->getCompany();
10097| $member = $company instanceof Company ? $this->getCurrentCompanyMember($company, $user) : null;
10098| if ($this->memberIsSsmaGestorAdministrador($member)) {
10099| return false;
10100| }
10101| if ($member) {
10102| $tag = $this->resolveSsmaProductPermissionTagForMember($member);
10103| }
10104| }
10105|
10106| // Supervisor global via Symfony role
10107| if ($this->isGranted('ROLE_MANAGER_VIEWER')
10108| && !$this->isGranted('ROLE_MANAGER')
10109| && !$this->isGranted('ROLE_MANAGER_GESTOR')
10110| && !$this->isGranted('ROLE_SUPER_ADMIN')
10111| ) {
10112| return true;
10113| }
10114|
10115| // Supervisor via tag SSMA de produto (can_view=true, sem permissões de escrita).
10116| // Cobre tags como "Supervisor" ou qualquer tag com can_view=1 e can_create/edit/delete=0,
10117| // atribuídas diretamente ao produto SSMA sem alterar a role global do usuário.
10118| //
10119| // IMPORTANTE: verificar a PermissionTag real da DB (não só os request attributes).
10120| // setSsmaTechnicalOccurrenceAttributes() define can_view=true nos attributes para stakeholders/técnicos
file_read
Show Details
Arguments
{"end_line": 11495, "file_path": "src/Controller/SsmaController.php", "start_line": 11330}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 11330-11495
11330| private function notifyOccurrenceRegistrantOnReject(
11331| SsmaEvent $event,
11332| Company $company,
11333| User $sender,
11334| string $note
11335| ): void {
11336| $this->ssmaNotificationService->notifyOccurrenceRegistrantOnReject($event, $sender, $note);
11337| }
11338|
11339| private function canManageSsmaOccurrences(): bool
11340| {
11341| $user = $this->getUser();
11342| $company = $this->getSsmaCompany() ?? ($user instanceof User ? $user->getCompany() : null);
11343| if ($user instanceof User && $company instanceof Company
11344| && $this->shouldStripSsmaManagementUiForUser($company, $user)) {
11345| return false;
11346| }
11347|
11348| if (
11349| $this->isGranted('ROLE_SUPER_ADMIN')
11350| || $this->isGranted('ROLE_MANAGER')
11351| || $this->isGranted('ROLE_MANAGER_GESTOR')
11352| || $this->isGranted('ROLE_TENANT')
11353| ) {
11354| return true;
11355| }
11356|
11357| $member = null;
11358| if ($user instanceof User) {
11359| $company = $this->getSsmaCompany() ?? $user->getCompany();
11360| if ($company instanceof Company) {
11361| $member = $this->getCurrentCompanyMember($company, $user);
11362| }
11363| }
11364| if ($this->memberIsSsmaGestorAdministrador($member)) {
11365| return true;
11366| }
11367|
11368| $tag = $this->ssmaCurrentMemberPermissionTag();
11369|
11370| $request = $this->requestStack->getCurrentRequest();
11371| if ($request && (
11372| (bool) $request->attributes->get('can_create', false)
11373| || (bool) $request->attributes->get('can_edit', false)
11374| || (bool) $request->attributes->get('can_delete', false)
11375| )) {
11376| return true;
11377| }
11378|
11379| if (!$tag) {
11380| return false;
11381| }
11382|
11383| return (bool) ($tag->getCanCreate() ?? false)
11384| || (bool) ($tag->getCanEdit() ?? false)
11385| || (bool) ($tag->getCanDelete() ?? false);
11386| }
11387|
11388| /**
11389| * Edição no detalhe (UI + API legada createOccurrence edit + updateEvent).
11390| * Tenant/super admin e admin de aprofundamento (Gestor Administrador) editam tudo.
11391| */
11392| private function canEditSsmaOccurrenceDetail(): bool
11393| {
11394| $user = $this->getUser();
11395| $company = $user instanceof User ? $user->getCompany() : null;
11396| if ($user instanceof User && $this->isSsmaAprofundamentoAdmin($company, $user)) {
11397| return true;
11398| }
11399|
11400| return SsmaOccurrenceCreatePermissionService::canEditOccurrenceDetail(
11401| $this->isGranted('ROLE_SUPER_ADMIN'),
11402| $this->isGranted('ROLE_TENANT'),
11403| );
11404| }
11405|
11406| /**
11407| * Permissão padrão do Membro: registrar a PRÓPRIA ocorrência.
11408| *
11409| * Diferente de canManageSsmaOccurrences() (que também habilita editar/excluir/resolver),
11410| * esta capacidade libera apenas a CRIAÇÃO para o membro comum da empresa que tem acesso
11411| * à área de ocorrências. Supervisores (somente leitura) ficam de fora; gestores/admins
11412| * já são cobertos por canManageSsmaOccurrences().
11413| */
11414| private function canMemberRegisterOwnOccurrence(?Company $company, ?User $user): bool
11415| {
11416| if (!$company || !$user) {
11417| return false;
11418| }
11419|
11420| if ($this->canManageSsmaOccurrences()) {
11421| return true;
11422| }
11423|
11424| // Supervisores são somente leitura (planilha SSMA).
11425| if ($this->isSsmaViewer()) {
11426| return false;
11427| }
11428|
11429| return $this->getCurrentCompanyMember($company, $user) !== null;
11430| }
11431|
11432| private function canCreateSsmaOccurrenceType(string $typeKey): bool
11433| {
11434| /** @var \App\Entity\User|null $user */
11435| $user = $this->getUser();
11436| $company = $user?->getCompany();
11437| if (!$user || !$company) {
11438| return false;
11439| }
11440|
11441| $member = $this->getCurrentCompanyMember($company, $user);
11442|
11443| return $this->ssmaOccurrenceCreatePermissionService->canCreateOccurrenceType(
11444| $member,
11445| $user,
11446| $company,
11447| $typeKey,
11448| $this->canManageSsmaOccurrences(),
11449| );
11450| }
11451|
11452| private function canManageSsmaPermissions(): bool
11453| {
11454| return $this->isGranted('ROLE_SUPER_ADMIN') || $this->isGranted('ROLE_MANAGER');
11455| }
11456|
11457| private function canAccessSsmaSupervisorSurface(): bool
11458| {
11459| return $this->canManageSsmaOccurrences() || $this->isSsmaViewer();
11460| }
11461|
11462| /**
11463| * Criar/editar Plano de Ação: gestor/admin.
11464| * Supervisor (viewer ou tag Supervisor*) só visualiza dash/painel — Brenda áudio 6.
11465| * Gestor de Equipe/Área continua podendo mutar.
11466| */
11467| private function canMutateSsmaActionPlan(): bool
11468| {
11469| if ($this->isSsmaViewer()) {
11470| return false;
11471| }
11472|
11473| $tagName = $this->ssmaCurrentMemberPermissionTag()?->getName();
11474| if (in_array($tagName, [
11475| 'Supervisor de Equipe',
11476| 'Supervisor',
11477| SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA,
11478| ], true)) {
11479| return false;
11480| }
11481|
11482| return $this->canManageSsmaOccurrences();
11483| }
11484|
11485| /**
11486| * Abas "Painel" e "Metas" em Prevenção Ativa: apenas perfis de supervisão/gestão na empresa.
11487| * Não usar {@see canAccessSsmaSupervisorSurface()} aqui: ele inclui Membro com can_create na tag
11488| * ssma-prevention (para registrar inspeção/abordagem), e na planilha Membro não acessa Painel/Metas.
11489| */
11490| private function canAccessPreventionDashboardAndMetasTabs(): bool
11491| {
11492| return $this->isGranted('ROLE_SUPER_ADMIN')
11493| || $this->isGranted('ROLE_MANAGER')
11494| || $this->isGranted('ROLE_MANAGER_GESTOR')
11495| || $this->isSsmaViewer();
Request #88
deepseek-v4-flash
P:93.14K C:1.37K CR:90.24K CW:0
10958ms
Reasoning
Now think about the permission change carefully.
Before: `create` action allowed when `canAccessSsmaSupervisorSurface()` = canManageSsmaOccurrences() || isSsmaViewer(). So supervisors (viewers) could create (weird but by spreadsheet rule).
After: `canMutateSsmaActionPlan()`:
1. if isSsmaViewer() → false.
2. tag name in ['Supervisor de Equipe','Supervisor', TAG_SUPERVISOR_AREA] → false.
3. else → canManageSsmaOccurrences().
Now what about "Membro comum" who has can_create on ssma-occurrences tag? canManageSsmaOccurrences() returns true if member tag can_create/can_edit/can_delete. Also via request attributes can_create etc. So members with can_create can mutate. That matches comment "Membro comum não cria"? Wait, the summary says: "Escopo por perfil: membro/stakeholder vê apenas suas ações (filtro automático)" and "$ssmaCanCreateLinkedActions = $ssmaCanManageOccurrences || $this->isSsmaViewer(); // Brenda: Supervisor só visualiza... Membro comum não cria." They replaced isSsmaViewer with canMutateSsmaActionPlan which still includes canManageSsmaOccurrences. A member comum with can_create tag would still be allowed. The comment states "Membro comum não cria" — but actually a member with can_create in ssma-occurrences tag is allowed (canManageSsmaOccurrences true). That may be intended (member with can_create). The UI says ssmaCanCreateLinkedActions = canMutateSsmaActionPlan, so the "Criar ação" button in Occurrences is hidden for supervisor and shown for those with can_create. That's consistent.
Confirmed finding #2 is about the UI forcing gestor de equipe/área true flags while server method would have blocked supervisors only — actually the flagged issue is that template/screen uses a different policy than backend method in two places. Already reported. Don't repeat.
Now check whether there is any OTHER server-side call still using canManageSsmaOccurrences or canAccessSsmaSupervisorSurface for the action plan create/edit mutation path (i.e., inconsistency in the mutation policy). E.g., create/edit route handler for specific endpoint used by "abA Ações" tab (tab_plano_acoes) and occurrence_view. The diff changed some checks. But is there an `updateEvent` or `resolveAction` endpoint also still using canManageSsmaOccurrences, so supervisor can still resolve? Diff updated canCurrentUserEditSsmaAction & canCurrentUserResolveSsmaAction to use canMutate. Good.
But what about `deleteAction`? We saw only these; need to verify any other mutation endpoints of Action Plan (e.g., saveActionPlan from actions tab? update endpoint around 7900-8100; resolve endpoint; validate endpoint) all use those methods. Possibly they call `canManageSsmaOccurrences` directly. Let me search for `canManageSsmaOccurrences()` usage around action plan mutating endpoints in this controller. There are many occurrences. But this could be out of scope; time-box.
Given confirmed finding #4 mentions tests missing. Also I need to look for NEW issues not in the confirmed list.
Let me now check the JS: I want to verify `openActionViewOffcanvas` details for an issue independent of #1. For instance, `originLink.href = originUrl;` - if originUrl has scheme javascript? It comes from server hardcoded path, safe. Fine.
Let me look for issues in the pendencias table SSR mismatch (new finding). Also check the presence of `js-ssma-ap-panel-view-action` buttons within SSR; when clicked, event bound by bindTableViewButtons at init; openActionViewOffcanvas no markup → nothing (finding #1). But also in SSR the button lacks data-* attributes that openActionViewOffcanvas expects, but #1 covers.
Let me examine whether new SSR rows have extra executor/validator columns. We already know they don't. Good.
Now another possible issue: In `updatePendenciasTable` JS: after rows created with 9 cells, DataTable initialized with headers count 9. Fine.
Let's check the JS `buildPendenciasTableRowHtml` data attribute duplication: `data-action-title` uses `row.title` escaped. If title contains quotes, escapeHtml handles.
But wait, there's a subtle XSS: `escapeHtml` on data attributes, then offcanvas reads attributes via getAttribute and sets textContent. Safe.
But note in `buildPendenciasTableRowHtml`, `data-action-origin` uses `row.origin_label || row.occurrence_title`. `occurrence_title` is same label as origin_label. So not relevant.
Now consider `originUrl`: `escapeHtml(originUrl)` inside href attribute — fine.
Now potential issue with `row.id`: For buttons, `data-action-id` uses `row.id`. But the row might be undefined (e.g., tableData.rows missing id)? It's provided.
Now consider formatPeopleNames: `names.join(', ')` no escaping at this point; later `escapeHtml(executorNames)` before placing in attribute. Good.
Now check the service: `'origin_url' => $this->resolveOriginUrl($action)`. Let's verify resolveOriginUrl hardcodes route paths that may be nonexistent. Let's search routes for 'inspections' and 'abordagens' and 'ocorrencias' to see URL patterns to confirm they're real paths. Use code_search for "manager/ssma/inspections" maybe in templates.
Tool Calls (3)
code_search
Show Details
Arguments
{"search_text": "manager/ssma/inspections/"}
Result
File: config/routes_ssma.yaml
Match lines: 5
79| path: /manager/ssma/inspections/export
181| path: /manager/ssma/inspections/{id}
186| path: /manager/ssma/inspections/{id}/view
191| path: /manager/ssma/inspections/{id}
196| path: /manager/ssma/inspections/{id}/finalize
File: docs/ssma/PRODUTO_SSMA_CATALOGO_TELAS.md
Match lines: 1
659|| **URL** | `BASE/manager/ssma/inspections/{id}/view` |
File: docs/ssma/PRODUTO_SSMA_MAPA_COMPLETO.md
Match lines: 5
113|| **Inspeção** (página) | [BASE/manager/ssma/inspections/{id}/view](BASE/manager/ssma/inspections/{id}/view) | `ssma_inspection_view` | [§5.2](#52-inspeções) |
344|4. Abrir página → [BASE/manager/ssma/inspections/{id}/view](BASE/manager/ssma/inspections/{id}/view).
349|2. **Finalizar** → `POST` `/manager/ssma/inspections/{id}/finalize`.
533|3. Links para [occurrence/{id}](BASE/manager/ssma/occurrence/{id}), [abordagem view](BASE/manager/ssma/abordagens/{id}/view), [inspeção view](BASE/manager/ssma/inspections/{id}/view).
569|- [ ] [Inspeção view](BASE/manager/ssma/inspections/{id}/view) — finalizar ou relatório
File: src/Controller/Ssma/SsmaInspectionExportController.php
Match lines: 1
24| * GET /manager/ssma/inspections/export
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php
Match lines: 1
1413| return '/manager/ssma/inspections/' . $origemId . '/view';
File: src/Service/Ssma/Export/SsmaInspectionExportFilters.php
Match lines: 1
10| * Filtros aceitos por GET /manager/ssma/inspections/export.
File: src/Service/Ssma/SsmaInspectionSubmitService.php
Match lines: 1
126| ['id' => 'view_inspection', 'label' => 'Ver inspeção', 'url' => '/manager/ssma/inspections/' . $inspectionId . '/view'],
code_search
Show Details
Arguments
{"search_text": "manager/ssma/abordagens/"}
Result
File: config/routes_ssma.yaml
Match lines: 8
84| path: /manager/ssma/abordagens/export
406| path: /manager/ssma/abordagens/questionarios
411| path: /manager/ssma/abordagens/{id}
418| path: /manager/ssma/abordagens/{id}/view
430| path: /manager/ssma/abordagens/{id}
437| path: /manager/ssma/abordagens/{id}
444| path: /manager/ssma/abordagens/{id}/duplicar
451| path: /manager/ssma/abordagens/{id}/coaching
File: docs/ssma/PRODUTO_SSMA_CATALOGO_TELAS.md
Match lines: 1
786|| **URL** | `BASE/manager/ssma/abordagens/{id}/view` |
File: docs/ssma/PRODUTO_SSMA_MAPA_COMPLETO.md
Match lines: 3
115|| **Abordagem** (página) | [BASE/manager/ssma/abordagens/{id}/view](BASE/manager/ssma/abordagens/{id}/view) | `ssma_abordagem_view` | [§5.3](#53-abordagem-comportamental) |
365|7. Ver página → [BASE/manager/ssma/abordagens/{id}/view](BASE/manager/ssma/abordagens/{id}/view).
533|3. Links para [occurrence/{id}](BASE/manager/ssma/occurrence/{id}), [abordagem view](BASE/manager/ssma/abordagens/{id}/view), [inspeção view](BASE/manager/ssma/inspections/{id}/view).
File: src/Controller/Ssma/SsmaAbordagemExportController.php
Match lines: 1
24| * GET /manager/ssma/abordagens/export
File: src/Controller/SsmaController.php
Match lines: 2
24729| * POST /manager/ssma/abordagens/{id}/coaching — o coach selecionado preenche a
25342| * GET /manager/ssma/abordagens/questionarios
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php
Match lines: 1
1416| return '/manager/ssma/abordagens/' . $origemId . '/view';
File: src/Service/Ssma/Export/SsmaAbordagemExportFilters.php
Match lines: 1
10| * Filtros aceitos por GET /manager/ssma/abordagens/export.
File: src/Service/Ssma/SsmaApproachSubmitService.php
Match lines: 1
107| ['id' => 'view_approach', 'label' => 'Ver abordagem', 'url' => '/manager/ssma/abordagens/' . $id . '/view'],
code_search
Show Details
Arguments
{"search_text": "ocorrencias/.*/view", "use_perl_regexp": true}
Result
No matches found
Request #89
deepseek-v4-flash
P:95.8K C:82 CR:94.46K CW:0
1898ms
Reasoning
The inspection and abordagem paths exist. Now for occurrence route path `/manager/ssma/ocorrencias/`. Search config routes.
Tool Calls (1)
code_search
Show Details
Arguments
{"search_text": "manager/ssma/ocorrencias"}
Result
File: config/routes_ssma.yaml
Match lines: 2
7| path: /manager/ssma/ocorrencias
271| path: /manager/ssma/ocorrencias/comparativo/filter
File: cypress/e2e/navigation/adminNavigation.spec.js
Match lines: 1
185| { path: '/manager/ssma/ocorrencias', name: 'Ocorrências SSMA' },
File: cypress/e2e/navigation/superAdminNavigation.spec.js
Match lines: 1
218| { path: '/manager/ssma/ocorrencias', name: 'Ocorrências SSMA' },
File: cypress/e2e/navigation/userNavigation.spec.js
Match lines: 1
122| { path: '/manager/ssma/ocorrencias', name: 'Ocorrências SSMA' },
File: docs/engineering/adr-ssma-view-data-scope.md
Match lines: 1
4|**Contexto:** Incidentes 500/504 em `/manager/ssma/ocorrencias` e detalhe de ocorrência.
File: docs/engineering/pr/feature-ssma-automation-team-dropdown-new-production/PR_descricao_feature-ssma-automation-team-dropdown-new-production.md
Match lines: 1
88|2. `/manager/ssma/ocorrencias` → **Esperado:** lista populada.
File: docs/engineering/pr/feature-ssma-performance-roadmap-fase-a-new-production/PR_descricao_feature-ssma-performance-roadmap-fase-a-new-production.md
Match lines: 2
33|- **504** na listagem (`/manager/ssma/ocorrencias`) e no detalhe — timeout nginx
116|1. Abrir `/manager/ssma/ocorrencias` — deve abrir sem 500/504; até 50 cards; botão **“Carregar mais”** se houver mais registros.
File: docs/engineering/pr/hotfix-ssma-ambiental-material-brenda-new-production/PR_descricao_hotfix-ssma-ambiental-material-brenda-new-production.md
Match lines: 2
20|| SSMA → Ocorrências | `/manager/ssma/ocorrencias` |
156|## Ocorrências — `/manager/ssma/ocorrencias`
File: docs/engineering/pr/hotfix-ssma-ap-validacao-etapa1-new-production/PR_descricao_hotfix-ssma-ap-validacao-etapa1-new-production.md
Match lines: 1
86|3. Em `/manager/ssma/ocorrencias`: `window.SSMA_IS_PESSOA_FISICA_COMUM_USER === 'true'`.
File: docs/engineering/pr/hotfix-ssma-occ-type-perms-datatables-new-production/PR_descricao_hotfix-ssma-occ-type-perms-datatables-new-production.md
Match lines: 1
22|| SSMA → Ocorrências | `/manager/ssma/ocorrencias` — detalhe, +Aprofundamento, configurações |
File: docs/engineering/pr/hotfix-ssma-occurrence-view-500-new-production/PR_descricao_hotfix-ssma-occurrence-view-500-new-production.md
Match lines: 1
92|1. Abrir `/manager/ssma/ocorrencias` — listagem normal.
File: docs/engineering/pr/hotfix-ssma-ocorrencias-500-504-definitivo-new-production/PR_descricao_hotfix-ssma-ocorrencias-500-504-definitivo-new-production.md
Match lines: 3
21|2. **Produção** (`metahuman.solutions`) ainda estourava **504** em `/manager/ssma/ocorrencias`: a listagem do hub de Ocorrências carregava **abordagens + metas de prevenção** via `buildSsmaViewData()` completo — carga desnecessária e pesada (JSON de abordagens, cobertura, defaults de meta por membro).
63|3. Abrir `/manager/ssma/ocorrencias?tab=tab_oc_ocorrencias` → **sem 504**.
111|- Produção: 504 nginx em `/manager/ssma/ocorrencias`.
File: docs/engineering/pr/hotfix-ssma-ux-pos-merge-231-new-production/PR_descricao_hotfix-ssma-ux-pos-merge-231-new-production.md
Match lines: 1
82|## Rota principal membro: `/manager/ssma/ocorrencias` (layoutUser — ex.: Palloma)
File: docs/engineering/ssma-roadmap-performance.md
Match lines: 1
47|- [ ] `/manager/ssma/ocorrencias` e `/manager/ssma/occurrence/{id}` OK em api-ia e prod
File: docs/ontology/audits/system_data_inventory.md
Match lines: 1
22|| SSMA | `/manager/ssma/ocorrencias` | `ssma` |
File: docs/ssma/COMITE-INVESTIGACAO-IMPLEMENTACAO.md
Match lines: 1
353|| Listar | `ssma_ocorrencia_index` | `/manager/ssma/ocorrencias` | GET | `ocorrenciaIndex` |
File: docs/ssma/FILTRO-FILIAL-PAINEL.md
Match lines: 1
70|| B | Fallback / carga dedicada | `GET /manager/ssma/ocorrencias/comparativo/filter` |
File: docs/ssma/PAINEL-OCORRENCIAS-INDICADORES-PLANO.md
Match lines: 1
18|| **Ocorrências** | Aba **Painel** em `/manager/ssma/ocorrencias` | Frequências, acidentes, risco potencial, classificação, severidade, cultura de reporte, análise semântica (Adriana) |
File: docs/ssma/PRODUTO_SSMA_CATALOGO_TELAS.md
Match lines: 9
170|| **URL** | `BASE/manager/ssma/ocorrencias` |
199|| **URL** | `BASE/manager/ssma/ocorrencias?tab=tab_oc_ocorrencias` |
225|| **URL hospedeira** | `BASE/manager/ssma/ocorrencias` |
255|| **URL** | `BASE/manager/ssma/ocorrencias` (ação no card) |
280|| **URL** | `BASE/manager/ssma/ocorrencias?tab=tab_oc_painel` |
306|| **URL** | `BASE/manager/ssma/ocorrencias?tab=tab_oc_automacoes` |
386|| **URL** | `BASE/manager/ssma/ocorrencias?executive_report=1` |
433|| **URL** | `BASE/manager/ssma/ocorrencias?tab=tab_oc_config` |
458|| **URL** | `BASE/manager/ssma/ocorrencias?tab=tab_oc_permissao` |
File: docs/ssma/PRODUTO_SSMA_MAPA_COMPLETO.md
Match lines: 20
99|| **Ocorrências** (hub) | [BASE/manager/ssma/ocorrencias](BASE/manager/ssma/ocorrencias) | `ssma_ocorrencia_index` | [§3](#3-ocorrências) |
100|| Ocorrências — aba Painel | [BASE/manager/ssma/ocorrencias?tab=tab_oc_painel](BASE/manager/ssma/ocorrencias?tab=tab_oc_painel) | `ssma_ocorrencia_index` | [§3.2](#32-aba-painel) |
101|| Ocorrências — aba Automações | [BASE/manager/ssma/ocorrencias?tab=tab_oc_automacoes](BASE/manager/ssma/ocorrencias?tab=tab_oc_automacoes) | `ssma_ocorrencia_index` | [§3.3](#33-aba-automações) |
102|| Ocorrências — aba Config | [BASE/manager/ssma/ocorrencias?tab=tab_oc_config](BASE/manager/ssma/ocorrencias?tab=tab_oc_config) | `ssma_ocorrencia_index` | [§3.4](#34-aba-configurações) |
103|| Ocorrências — aba Permissões | [BASE/manager/ssma/ocorrencias?tab=tab_oc_permissao](BASE/manager/ssma/ocorrencias?tab=tab_oc_permissao) | `ssma_ocorrencia_index` | [§3.5](#35-aba-permissões) |
104|| Relatório executivo ocorrências | [BASE/manager/ssma/ocorrencias?executive_report=1](BASE/manager/ssma/ocorrencias?executive_report=1) | `ssma_ocorrencia_index` | [§3.6](#36-relatório-executivo) |
151|| `ssma-occurrences` | [Ocorrências](BASE/manager/ssma/ocorrencias) |
177|| 1 | [Ocorrências](BASE/manager/ssma/ocorrencias) | Registrar evento tipado (ROS, AP, AM, AA, QA) |
183|| 7 | [Painéis](BASE/manager/ssma/ocorrencias?tab=tab_oc_painel) | Indicadores e Adriana |
189|**Hub:** [BASE/manager/ssma/ocorrencias](BASE/manager/ssma/ocorrencias) · Template `ssma/occurrence/index.html.twig`
193|**Link:** [BASE/manager/ssma/ocorrencias](BASE/manager/ssma/ocorrencias) (aba padrão `tab_oc_ocorrencias`)
224|**Link:** [BASE/manager/ssma/ocorrencias?tab=tab_oc_painel](BASE/manager/ssma/ocorrencias?tab=tab_oc_painel)
233|4. Alterar filtro → dados via `GET` `/manager/ssma/dashboard/filter` e `/manager/ssma/ocorrencias/comparativo/filter`.
237|**Link:** [BASE/manager/ssma/ocorrencias?tab=tab_oc_automacoes](BASE/manager/ssma/ocorrencias?tab=tab_oc_automacoes)
243|**Link:** [BASE/manager/ssma/ocorrencias?tab=tab_oc_config](BASE/manager/ssma/ocorrencias?tab=tab_oc_config)
254|**Link:** [BASE/manager/ssma/ocorrencias?tab=tab_oc_permissao](BASE/manager/ssma/ocorrencias?tab=tab_oc_permissao)
260|**Link:** [BASE/manager/ssma/ocorrencias?executive_report=1](BASE/manager/ssma/ocorrencias?executive_report=1)
523|3. Links **Ver ocorrências** → [ocorrencias](BASE/manager/ssma/ocorrencias); **Controle de espaços** → [spaces-control/dashboard](BASE/spaces-control/dashboard).
565|- [ ] [Ocorrências](BASE/manager/ssma/ocorrencias) — registrar + abrir [detalhe](BASE/manager/ssma/occurrence/{id})
566|- [ ] [Painel OC](BASE/manager/ssma/ocorrencias?tab=tab_oc_painel) — filtro carrega
File: docs/ssma/SMOKE_BUGS_SSMA_001_006.md
Match lines: 4
19|**URL:** `https://temp.metahuman.solutions/manager/ssma/ocorrencias?tab=tab_oc_painel`
32|**URL:** `https://temp.metahuman.solutions/manager/ssma/ocorrencias`
57|**URL:** `https://temp.metahuman.solutions/manager/ssma/ocorrencias`
85|**URL:** `https://temp.metahuman.solutions/manager/ssma/ocorrencias?tab=tab_oc_painel`
File: docs/ssma/SMOKE_LOCAIS_HIERARQUICOS.md
Match lines: 1
64|| Passos | Abrir modal de nova ocorrência (`/manager/ssma/ocorrencias`) ou nova abordagem (`/manager/ssma/prevencao-ativa`) e olhar o campo Local. |
File: public/css/ssma/effectiveness.css
Match lines: 1
2591|/* SSMA platform alignment - mirrors /manager/ssma/ocorrencias spacing and actions. */
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php
Match lines: 3
1421| return '/manager/ssma/ocorrencias/' . $occurrenceId;
1425| return '/manager/ssma/ocorrencias/' . $origemId;
1430| return '/manager/ssma/ocorrencias?event=' . $eventId;
File: tests/Ssma/validate_comparativo_filter.php
Match lines: 1
47|$request = Request::create('/manager/ssma/ocorrencias/comparativo/filter', 'GET', [
Request #90
deepseek-v4-flash
P:99.03K C:238 CR:95.87K CW:0
2788ms
Reasoning
There is documentation route `manager/ssma/occurrence/{id}` for the detail page in map complete (docs line 533 uses occurrence/{id}). The URL path `/manager/ssma/ocorrencias/{id}` may not be a route! Let me check routes for `ocorrencias/{id}` patterns. config routes_ssma.yaml had `/manager/ssma/ocorrencias` and `/manager/ssma/ocorrencias/comparativo/filter` only; search lines 5-40 of routes_ssma.
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 60, "file_path": "config/routes_ssma.yaml", "start_line": 1}
Result
File: config/routes_ssma.yaml (Total lines: 802)
IS_TRUNCATED: false
LINE_RANGE: 1-60
1|admin_ssma_index:
2| path: /manager/ssma
3| controller: App\Controller\SsmaController::index
4| methods: [GET]
5|
6|ssma_ocorrencia_index:
7| path: /manager/ssma/ocorrencias
8| controller: App\Controller\SsmaController::ocorrenciaIndex
9| methods: [GET]
10|
11|ssma_prevencao_index:
12| path: /manager/ssma/prevencao-ativa
13| controller: App\Controller\SsmaController::prevencaoIndex
14| methods: [GET]
15|
16|ssma_plano_acao_index:
17| path: /manager/ssma/plano-acao
18| controller: App\Controller\SsmaController::planoAcaoIndex
19| methods: [GET]
20|
21|ssma_plano_acao_painel:
22| path: /manager/ssma/plano-acao/painel
23| controller: App\Controller\SsmaController::planoAcaoPainel
24| methods: [GET]
25|
26|ssma_plano_acao_panel_filter:
27| path: /manager/ssma/plano-acao/panel/filter
28| controller: App\Controller\SsmaController::planoAcaoPanelFilter
29| methods: [GET]
30|
31|ssma_direito_recusa_index:
32| path: /manager/ssma/direito-de-recusa
33| controller: App\Controller\SsmaController::direitoRecusaIndex
34| methods: [GET]
35|
36|ssma_direito_recusa_create:
37| path: /manager/ssma/direito-de-recusa
38| controller: App\Controller\SsmaController::createDireitoRecusa
39| methods: [POST]
40|
41|ssma_direito_recusa_update:
42| path: /manager/ssma/direito-de-recusa/{id}
43| controller: App\Controller\SsmaController::updateDireitoRecusa
44| methods: [POST]
45| requirements:
46| id: '\d+'
47|
48|ssma_direito_recusa_config_save:
49| path: /manager/ssma/direito-de-recusa/config
50| controller: App\Controller\SsmaController::saveDireitoRecusaConfig
51| methods: [POST]
52|
53|admin_ssma_occurrence_view:
54| path: /manager/ssma/occurrence/{id}
55| controller: App\Controller\SsmaController::viewOccurrence
56| methods: [GET]
57|
58|ssma_members_search:
59| path: /manager/ssma/members/search
60| controller: App\Controller\SsmaController::searchSsmaMembers
code_search
Show Details
Arguments
{"search_text": "ocorrencias/{"}
Result
No matches found
Request #91
deepseek-v4-flash
P:99.99K C:421 CR:99.2K CW:0
4116ms
Reasoning
Interesting! The correct occurrence detail route is `/manager/ssma/occurrence/{id}` (singular), not `/manager/ssma/ocorrencias/{id}`. Docs in the map: "Ver ocorrências" link points to `/manager/ssma/ocorrencias`, but the detailed page route is `admin_ssma_occurrence_view` with path `/manager/ssma/occurrence/{id}`. Also there's `/manager/ssma/ocorrencias?event=` filter? Let's check if the list page supports `event` param; maybe.
So `resolveOriginUrl()` in the service returns:
- `/manager/ssma/ocorrencias/' . $occurrenceId` (plural with id) — that likely isn't a real route and would 404 (no route).
- `/manager/ssma/ocorrencias/' . $origemId` same.
- `/manager/ssma/ocorrencias?event=' . $eventId` maybe valid? Search for routes and templates for '?event=' param handling on ocorrencias list. Search "get('event'". Let's check how ocorrenciaIndex uses query param 'event'. Actually searching might confirm.
The point: hardcoded URL for occurrence detail is wrong path — should be `/manager/ssma/occurrence/{id}`. Let me verify the occurrence detail URL used elsewhere in the codebase (e.g., links "Ir para ocorrência" from action plan tables in the occurrence screens). Search for "occurrence/" links built in controllers/templates.
Tool Calls (2)
code_search
Show Details
Arguments
{"search_text": "ssma/occurrence/"}
Result
Note: The results have been truncated. Only showing first 100 results.
File: .opencodereview/rule.json
Match lines: 5
86| "path": "templates/ssma/occurrence/partials/_modal_event.html.twig",
91| "path": "templates/ssma/occurrence/partials/_ev_injured_person_box.html.twig",
96| "path": "templates/ssma/occurrence/partials/_modal_event.html.twig",
106| "path": "templates/ssma/occurrence/occurrence_view.html.twig",
111| "path": "templates/ssma/occurrence/occurrence_view.html.twig",
File: .opencodereview/rules/ssma/occurrence-approve.md
Match lines: 2
3|Modal **Validar ocorrência** (`/manager/ssma/occurrence/{id}?kind=event`): Aprovar e Reprovar não podem esperar SMTP, PDF do flash report nem automações. A decisão persiste na hora; e-mail/IA/PDF rodam depois da resposta HTTP.
7|- `templates/ssma/occurrence/occurrence_view.html.twig` — modal `#ssmaOccurrenceApproveModal` e `sendDecision`
File: .opencodereview/rules/ssma/occurrence-descaracter-suspeita-card.md
Match lines: 2
6|- `templates/ssma/occurrence/partials/_modal_event.html.twig` — `evSyncDescaracterStageUi`, `evCreateInjuredPersonCard`, `evRenderInjuredPersonBoxes`, CSS `.ev-inj-descaracter*`
7|- `templates/ssma/occurrence/partials/_ev_injured_person_box.html.twig` — bloco `.ev-inj-descaracter` / `.ev-inj-suspect-chk`
File: .opencodereview/rules/ssma/occurrence-ros-aprofundamento-readonly.md
Match lines: 2
6|- `templates/ssma/occurrence/occurrence_view.html.twig` — clique em `+ Aprofundamento` / `.js-occ-view-aprofundamento-btn`; envia `_can_edit_aprofundamento` a partir de `can_aprofundamento.can_edit`
7|- `templates/ssma/occurrence/partials/_modal_event.html.twig` — `EvModal.openAprofundamento`, `evAprofundamentoCanEditFromServer`, `evCanEditAprofundamento`, `evSetAprofundamentoReadonly`
File: ANALISE_CONFLITOS_MERGE.md
Match lines: 4
14|### 🔴 **Maior Impacto:** `templates/ssma/occurrence/tabs/_tab_occurrences.html.twig`
24|#### 1.1. `templates/ssma/occurrence/tabs/_tab_occurrences.html.twig`
131|- `templates/ssma/occurrence/tabs/_tab_occurrences.html.twig`
350|🔴 **`templates/ssma/occurrence/tabs/_tab_occurrences.html.twig`**
File: CONFLITOS_REAIS_DYNAMIC_COLOR_ICONS.md
Match lines: 7
19|### 1️⃣ `templates/ssma/occurrence/occurrence_view.html.twig` (Linha ~449)
77|### Passo 1: Editar `templates/ssma/occurrence/occurrence_view.html.twig`
110|git add templates/ssma/occurrence/occurrence_view.html.twig
130|### 📄 `templates/ssma/occurrence/tabs/_tab_occurrences.html.twig`
152|- `templates/ssma/occurrence/partials/_modal_event.html.twig` ✅
153|- `templates/ssma/occurrence/partials/_modal_occurrence.html.twig` ✅
227|git add templates/ssma/occurrence/occurrence_view.html.twig
File: GUIA_MERGE_TAB_OCCURRENCES.md
Match lines: 4
3|**Arquivo:** `templates/ssma/occurrence/tabs/_tab_occurrences.html.twig`
14|git show HEAD:templates/ssma/occurrence/tabs/_tab_occurrences.html.twig > current_version.twig
17|git show origin/dynamic_color_icons:templates/ssma/occurrence/tabs/_tab_occurrences.html.twig > dynamic_version.twig
22|git show <HASH>:templates/ssma/occurrence/tabs/_tab_occurrences.html.twig > base_version.twig
File: RESUMO_MAURICIO_MARCOS.md
Match lines: 1
30|**`templates/ssma/occurrence/tabs/_tab_occurrences.html.twig`**
File: config/routes_ssma.yaml
Match lines: 6
54| path: /manager/ssma/occurrence/{id}
89| path: /manager/ssma/occurrence/{id}/report
96| path: /manager/ssma/occurrence/{id}/flash-report/context
103| path: /manager/ssma/occurrence/{id}/flash-report/submit
110| path: /manager/ssma/occurrence/{id}/approve
117| path: /manager/ssma/occurrence/flash-report/approvers
File: docs/SSMA-REGRAS-POS-MERGE.md
Match lines: 1
535|| Ocorrências UI | `templates/ssma/occurrence/index.html.twig` |
File: docs/engineering/pr/PLANO-ISSUES-FELIPE-25-08-2026.md
Match lines: 1
207|| img2 | Classificar evento → Tipo de ocorrência fica vazio quando resultado é ROS | `templates/ssma/occurrence/partials/_modal_classify.html.twig` | Detecta `createMode='event'` + resultado ROS → mostra mensagem e direciona ao botão `+ROS` |
File: docs/engineering/pr/feature-ssma-automation-team-dropdown-new-production/PR_descricao_feature-ssma-automation-team-dropdown-new-production.md
Match lines: 1
47|| `templates/ssma/occurrence/tabs/_tab_automations.html.twig` | `fam_automation_routes: 'manager/ssma'` |
File: docs/engineering/pr/feature-ssma-performance-roadmap-fase-a-new-production/PR_descricao_feature-ssma-performance-roadmap-fase-a-new-production.md
Match lines: 1
32|- **500** no detalhe (`/manager/ssma/occurrence/{id}`) — variável indefinida
File: docs/engineering/pr/homolog/PR_arquivos_homolog.txt
Match lines: 4
70|M templates/ssma/occurrence/index.html.twig
71|M templates/ssma/occurrence/partials/_modal_event.html.twig
72|M templates/ssma/occurrence/partials/_tab_occurrence_type_permissions.html.twig
73|M templates/ssma/occurrence/tabs/_tab_occurrences.html.twig
File: docs/engineering/pr/homolog/PR_impacto_homolog.txt
Match lines: 1
70| templates/ssma/occurrence/index.html.twig | 15 +
File: docs/engineering/pr/hotfix-ssma-ambiental-material-brenda-new-production/PR_descricao_hotfix-ssma-ambiental-material-brenda-new-production.md
Match lines: 2
63|| `templates/ssma/occurrence/partials/_ev_marcos_icon_select_macro.html.twig` | Macro local select com ícone (padrão Marcos; AA migrou para select nativo) |
112|- `templates/ssma/occurrence/partials/_ev_ros_barrier.html.twig` → `_ev_shared_barrier.html.twig`
File: docs/engineering/pr/hotfix-ssma-ap-validacao-etapa1-new-production/PR_arquivos_hotfix-ssma-ap-validacao-etapa1-new-production.txt
Match lines: 11
219|M templates/ssma/occurrence/deep_dive_group.html.twig
220|M templates/ssma/occurrence/index.html.twig
221|M templates/ssma/occurrence/occurrence_view.html.twig
222|M templates/ssma/occurrence/partials/_ev_injured_person_box.html.twig
223|M templates/ssma/occurrence/partials/_ev_ros_barrier.html.twig
224|M templates/ssma/occurrence/partials/_event_injury_map_card.html.twig
225|M templates/ssma/occurrence/partials/_modal_event.html.twig
226|M templates/ssma/occurrence/partials/_modal_occurrence.html.twig
227|M templates/ssma/occurrence/partials/_tab_occurrence_type_permissions.html.twig
228|M templates/ssma/occurrence/tabs/_tab_config.html.twig
229|M templates/ssma/occurrence/tabs/_tab_occurrences.html.twig
File: docs/engineering/pr/hotfix-ssma-ap-validacao-etapa1-new-production/PR_impacto_hotfix-ssma-ap-validacao-etapa1-new-production.txt
Match lines: 4
219| .../ssma/occurrence/deep_dive_group.html.twig | 104 +-
220| templates/ssma/occurrence/index.html.twig | 20 +-
221| .../ssma/occurrence/occurrence_view.html.twig | 300 +-
228| .../ssma/occurrence/tabs/_tab_config.html.twig | 75 +-
File: docs/engineering/pr/hotfix-ssma-form-cleanup/PR_descricao_hotfix-ssma-form-cleanup.md
Match lines: 1
51|| `templates/ssma/occurrence/partials/_modal_classify.html.twig` | Se classificação resulta em ROS e `createMode === 'event'`, fecha modal e orienta usar `+ ROS` (toast ou alert) |
File: docs/engineering/pr/hotfix-ssma-occ-type-perms-datatables-new-production/PR_arquivos_hotfix-ssma-occ-type-perms-datatables-new-production.txt
Match lines: 3
6|M templates/ssma/occurrence/occurrence_view.html.twig
7|M templates/ssma/occurrence/partials/_modal_event.html.twig
8|M templates/ssma/occurrence/partials/_tab_occurrence_type_permissions.html.twig
File: docs/engineering/pr/hotfix-ssma-occ-type-perms-datatables-new-production/PR_descricao_hotfix-ssma-occ-type-perms-datatables-new-production.md
Match lines: 3
92|| `templates/ssma/occurrence/occurrence_view.html.twig` | Botão **+Aprofundamento** para especialistas |
93|| `templates/ssma/occurrence/partials/_modal_event.html.twig` | `EvModal.openAprofundamento`, botões rascunho/finalizar, payload `aprofundamento_only` |
100|| `templates/ssma/occurrence/partials/_tab_occurrence_type_permissions.html.twig` | Loading via **overlay CSS** (sem `<tr colspan>` no tbody); ajustes de responsividade mobile; texto de badge para membro sem registro na plataforma |
File: docs/engineering/pr/hotfix-ssma-occ-type-perms-datatables-new-production/PR_impacto_hotfix-ssma-occ-type-perms-datatables-new-production.txt
Match lines: 1
6| .../ssma/occurrence/occurrence_view.html.twig | 50 ++-
File: docs/engineering/pr/hotfix-ssma-occurrence-view-500-new-production/PR_descricao_hotfix-ssma-occurrence-view-500-new-production.md
Match lines: 6
16|**Módulo:** SSMA — Ocorrências (`/manager/ssma/occurrence/{id}`).
20|- `GET /manager/ssma/occurrence/15`
21|- `GET /manager/ssma/occurrence/15?kind=event`
82| - Ex.: `/manager/ssma/occurrence/15`
84| - `/manager/ssma/occurrence/15?kind=event`
150|- Log de produção: `Unhandled exception 500` em `GET /manager/ssma/occurrence/15` (`SsmaController.php:16619`).
File: docs/engineering/pr/hotfix-ssma-ocorrencias-500-504-definitivo-new-production/PR_descricao_hotfix-ssma-ocorrencias-500-504-definitivo-new-production.md
Match lines: 3
20|1. **api-ia** continuava no código do #235: a branch do #238 **não tinha pipeline de deploy** para `api-ia.metahuman.solutions`. O merge em `new_production` só publica em `metahuman.solutions`. Resultado: logs em api-ia ainda apontavam `SsmaController.php:16619` com **500** em `GET /manager/ssma/occurrence/12`.
54|3. Detalhe `/manager/ssma/occurrence/{id}` continua em escopo leve.
62|2. Abrir `/manager/ssma/occurrence/12` e `?kind=event` → **sem 500**.
File: docs/engineering/pr/hotfix-ssma-ux-pos-merge-231-new-production/PR_arquivos_hotfix-ssma-ux-pos-merge-231-new-production.txt
Match lines: 2
7|M templates/ssma/occurrence/partials/_modal_event.html.twig
8|M templates/ssma/occurrence/partials/_modal_occurrence.html.twig
File: docs/engineering/pr/hotfix-ssma-ux-pos-merge-231-new-production/PR_descricao_hotfix-ssma-ux-pos-merge-231-new-production.md
Match lines: 2
20|3. **Visualizar ocorrência** (`/manager/ssma/occurrence/{id}`) gerava **504 Gateway Timeout** em produção por carregar `buildSsmaViewData()` inteiro.
99|1. Na listagem, clicar **Visualizar** (ex.: `/manager/ssma/occurrence/15?kind=event`).
File: docs/engineering/pr/new_staging2/PR_arquivos_new_staging2.txt
Match lines: 23
1622|M templates/ssma/occurrence/index.html.twig
1623|M templates/ssma/occurrence/occurrence_view.html.twig
1624|A templates/ssma/occurrence/ocurrence_report/index.html.twig
1625|A templates/ssma/occurrence/ocurrence_report/partials/_occurrence_report_footer.html.twig
1626|A templates/ssma/occurrence/ocurrence_report/partials/_occurrence_report_pill_grid.html.twig
1627|A templates/ssma/occurrence/ocurrence_report/partials/_occurrence_report_trend_pill.html.twig
1628|A templates/ssma/occurrence/ocurrence_report/partials/_occurrence_report_units_table.html.twig
1629|M templates/ssma/occurrence/partials/_evidence_card.html.twig
1630|M templates/ssma/occurrence/partials/_modal_classify.html.twig
1631|M templates/ssma/occurrence/partials/_modal_event.html.twig
1632|M templates/ssma/occurrence/tabs/_tab_automations.html.twig
1633|M templates/ssma/occurrence/tabs/_tab_dashboard.html.twig
1634|M templates/ssma/occurrence/tabs/_tab_occurrence_panel.html.twig
1635|M templates/ssma/occurrence/tabs/_tab_occurrences.html.twig
1636|M templates/ssma/occurrence/tabs/panel/_panel_comparativo.html.twig
1637|A templates/ssma/occurrence/tabs/panel/_panel_comparativo_filiais.html.twig
1638|A templates/ssma/occurrence/tabs/panel/_panel_comparativo_filiais_scripts.html.twig
1639|A templates/ssma/occurrence/tabs/panel/_panel_comparativo_filiais_styles.html.twig
1640|M templates/ssma/occurrence/tabs/panel/_panel_macros.html.twig
1641|M templates/ssma/occurrence/tabs/panel/_panel_risco_potencial.html.twig
1642|M templates/ssma/occurrence/tabs/panel/_panel_scripts.html.twig
1643|M templates/ssma/occurrence/tabs/panel/_panel_semantic_adriana.html.twig
1644|M templates/ssma/occurrence/tabs/panel/_panel_visao_geral.html.twig
File: docs/engineering/pr/new_staging2/PR_impacto_new_staging2.txt
Match lines: 3
1622| templates/ssma/occurrence/index.html.twig | 21 +-
1623| .../ssma/occurrence/occurrence_view.html.twig | 178 +-
1633| .../ssma/occurrence/tabs/_tab_dashboard.html.twig | 1129 +++-
File: docs/engineering/ssma-roadmap-performance.md
Match lines: 1
47|- [ ] `/manager/ssma/ocorrencias` e `/manager/ssma/occurrence/{id}` OK em api-ia e prod
File: docs/generate_merge_conflicts_index_pdf.py
Match lines: 2
36| ("templates/ssma/occurrence/tabs/_tab_config.html.twig", "INCOMING", "CSS inline categoria"),
37| ("templates/ssma/occurrence/tabs/panel/_panel_semantic_adriana.html.twig", "INCOMING", "Regex post feed cultural no painel"),
File: docs/logs/engineering/frontend_console_inventory.md
Match lines: 3
794|| templates/ssma/occurrence/partials/_modal_event.html.twig | templates | nao | 2 | 0 | 2 | 0 | 0 | 0 | 0 |
795|| templates/ssma/occurrence/tabs/_tab_occurrences.html.twig | templates | nao | 2 | 0 | 2 | 0 | 0 | 0 | 0 |
975|| templates/ssma/occurrence/partials/_modal_occurrence.html.twig | templates | nao | 1 | 0 | 1 | 0 | 0 | 0 | 0 |
File: docs/pr-hotfix-ssma-ap-parte-medica-new-production.md
Match lines: 1
25|| Alterado | `templates/ssma/occurrence/partials/_modal_event.html.twig` |
File: docs/ssma/COMITE-INVESTIGACAO-IMPLEMENTACAO.md
Match lines: 5
354|| Ver detalhe | `admin_ssma_occurrence_view` | `/manager/ssma/occurrence/{id}` | GET | `viewOccurrence` |
355|| Relatório | `admin_ssma_occurrence_report` | `/manager/ssma/occurrence/{id}/report` | GET | `occurrenceReport` |
662|| Template detalhe | `templates/ssma/occurrence/occurrence_view.html.twig` |
1574|| `templates/ssma/occurrence/occurrence_view.html.twig` | Detalhe ocorrência/evento; já inclui blocos comitê UC3 |
2160|Entidades (`SsmaOccurrence`, `SsmaEvent`, `SsmaCauseTreeState`, `SsmaAction`), `SsmaController`, serviços SSMA e comitê, `config/routes_ssma.yaml`, `config/routes_ai_committee.yaml`, templates `ssma/occurrence/`, `ssma/cause_tree/`, `ai_committee/partials/_ssma_*`, `public/js/ssma/tree_view.js`, migrations SSMA.
File: docs/ssma/CORRECOES-FECHAMENTO-FIGMA-PENDENTES.md
Match lines: 2
38|**Onde:** `templates/ssma/occurrence/partials/_modal_event.html.twig` (`ev_datetime`, `evDefaultDatetimeToday`).
48|**Onde:** `templates/ssma/occurrence/deep_dive_group.html.twig` (tag fixa “Profissionais de Saúde” = `permissionTagView`).
File: docs/ssma/FILTRO-FILIAL-PAINEL.md
Match lines: 4
20|| Front (Ocorrências) | `templates/ssma/occurrence/tabs/_tab_occurrence_panel.html.twig` → `#oc_painel_filter_filial` |
140|| UI + AJAX ocorrências | `templates/ssma/occurrence/tabs/_tab_occurrence_panel.html.twig` |
141|| Gráficos / Adriana | `templates/ssma/occurrence/tabs/panel/_panel_scripts.html.twig` |
142|| Comparativo front | `templates/ssma/occurrence/tabs/panel/_panel_comparativo_filiais_scripts.html.twig` |
File: docs/ssma/PAINEL-OCORRENCIAS-INDICADORES-PLANO.md
Match lines: 8
35|| **Template** | `templates/ssma/occurrence/tabs/_tab_occurrence_panel.html.twig` → `_tab_dashboard.html.twig` |
288|- `templates/ssma/occurrence/tabs/_tab_dashboard.html.twig` — Seção B + CSS `ssma-freq-*` + JS `ssmaFreq*`
305|- `templates/ssma/occurrence/tabs/_tab_dashboard.html.twig` — Seção C + CSS `ssma-acc-*` + JS `ssmaAcc*`
322|- `templates/ssma/occurrence/tabs/_tab_dashboard.html.twig` — Seção D + CSS `ssma-lead-*`, `ssma-kpi13-*`, `ssma-cta-*` + JS `ssmaLead*`
337|- `templates/ssma/occurrence/tabs/_tab_dashboard.html.twig` — card KPI 10 + JS `ssmaLeadBuildKpi10`
594|| `templates/ssma/occurrence/tabs/_tab_dashboard.html.twig` | Layout principal — reescrita por seções |
595|| `templates/ssma/occurrence/tabs/_tab_occurrence_panel.html.twig` | Filtros + shell |
596|| `templates/ssma/occurrence/index.html.twig` | Tab Painel (sem mudança estrutural) |
File: docs/ssma/PENDENCIAS-SSMA.md
Match lines: 1
65|- `templates/ssma/occurrence/tabs/panel/_panel_semantic_adriana.html.twig`
File: docs/ssma/PRODUTO_SSMA_CATALOGO_TELAS.md
Match lines: 3
332|| **URL** | `BASE/manager/ssma/occurrence/{id}` |
360|| **URL** | `BASE/manager/ssma/occurrence/{id}` (âncoras/seções na mesma página) |
410|| **URL** | `BASE/manager/ssma/occurrence/{id}/report` |
File: docs/ssma/PRODUTO_SSMA_MAPA_COMPLETO.md
Match lines: 10
105|| **Detalhe ocorrência** | [BASE/manager/ssma/occurrence/{id}](BASE/manager/ssma/occurrence/{id}) | `admin_ssma_occurrence_view` | [§3.7](#37-detalhe-da-ocorrência) |
106|| Relatório ocorrência | [BASE/manager/ssma/occurrence/{id}/report](BASE/manager/ssma/occurrence/{id}/report) | `admin_ssma_occurrence_report` | [§3.7](#37-detalhe-da-ocorrência) |
178|| 2 | [Detalhe /{id}](BASE/manager/ssma/occurrence/{id}) | Evidências, status, aprofundamento, vínculos |
189|**Hub:** [BASE/manager/ssma/ocorrencias](BASE/manager/ssma/ocorrencias) · Template `ssma/occurrence/index.html.twig`
202|6. Card aparece na lista → **Ver** abre [detalhe](BASE/manager/ssma/occurrence/{id}).
207|2. URL: [BASE/manager/ssma/occurrence/{id}](BASE/manager/ssma/occurrence/{id}).
266|**Link:** [BASE/manager/ssma/occurrence/{id}](BASE/manager/ssma/occurrence/{id})
277|8. **Relatório** — [BASE/manager/ssma/occurrence/{id}/report](BASE/manager/ssma/occurrence/{id}/report).
533|3. Links para [occurrence/{id}](BASE/manager/ssma/occurrence/{id}), [abordagem view](BASE/manager/ssma/abordagens/{id}/view), [inspeção view](BASE/manager/ssma/inspections/{id}/view).
565|- [ ] [Ocorrências](BASE/manager/ssma/ocorrencias) — registrar + abrir [detalhe](BASE/manager/ssma/occurrence/{id})
File: docs/ssma/SMOKE_BUGS_SSMA_001_006.md
Match lines: 1
63|| Salvar e abrir detalhe `/manager/ssma/occurrence/{id}` | Dados SST/lesão visíveis |
File: docs/ssma/SSMA-AUTOMACOES-OCORRENCIAS.md
Match lines: 2
83|Link da ocorrência no e-mail: `https://{empresa}/manager/ssma/occurrence/{id}`
246|| Template aba automações | `templates/ssma/occurrence/tabs/_tab_automations.html.twig` |
File: src/Controller/SsmaController.php
Match lines: 8
382| return $this->render('ssma/occurrence/ocurrence_report/index.html.twig', array_merge($viewData, [
388| return $this->render('ssma/occurrence/index.html.twig', $viewData);
3524| return $this->render('ssma/occurrence/occurrence_view.html.twig', array_merge($viewData, [
3709| * Rota: admin_ssma_occurrence_report — /manager/ssma/occurrence/{id}/report
4079| * GET /manager/ssma/occurrence/{id}/flash-report/context?kind=event
25071| return $this->render('ssma/occurrence/deep_dive_group.html.twig', array_merge($viewData, [
25213| return $this->render('ssma/occurrence/deep_dive_group.html.twig', array_merge($viewData, [
26633| * GET|POST /manager/ssma/occurrence/flash-report/approvers
File: src/EventListener/GlobalPermissionListener.php
Match lines: 1
945| // SSMA/Governança: URLs como /manager/ssma/occurrence/{id} ou
File: src/Service/Adriana/Command/SsmaCommandService.php
Match lines: 1
2079| $actions[] = ['id' => 'view_occurrence', 'label' => 'Ver ocorrência', 'url' => '/manager/ssma/occurrence/' . $occId];
File: src/Service/Ssma/SsmaAutomationService.php
Match lines: 3
179| 'link' => 'https://exemplo.metahuman.solutions/manager/ssma/occurrence/1234',
180| 'report_link' => 'https://exemplo.metahuman.solutions/manager/ssma/occurrence/1234/report',
3005| return 'https://' . $host . '/manager/ssma/occurrence/' . $occurrenceId;
File: src/Service/Ssma/SsmaFlashReportService.php
Match lines: 1
828| $contextUrl = sprintf('/manager/ssma/occurrence/%d?kind=event', (int) $event->getId());
File: templates/governance/authorization/tabs/_tab_authorizations_monitoring.html.twig
Match lines: 1
576| templates/ssma/occurrence/tabs/panel/_panel_scripts.html.twig). ── */
File: templates/governance/cases/partials/_cases_dashboard_panel.html.twig
Match lines: 1
2|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as ssmaPanel %}
File: templates/governance/cases/partials/_cases_grc_kpi_row.html.twig
Match lines: 1
1|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as ssmaPanel %}
File: templates/governance/cases/partials/_cases_kpi_row.html.twig
Match lines: 1
5|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as ssmaPanel %}
File: templates/governance/cases/partials/_cases_resolved_kpi_row.html.twig
Match lines: 1
5|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as ssmaPanel %}
File: templates/ssma/action_plan/action_plan_report/index.html.twig
Match lines: 2
270|{% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_footer.html.twig' with { render_markup: false } %}
712|{% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_footer.html.twig' %}
File: templates/ssma/action_plan/tabs/_tab_painel.html.twig
Match lines: 1
41|{% include 'ssma/occurrence/tabs/panel/_panel_semantic_adriana_styles.html.twig' %}
File: templates/ssma/occurrence/index.html.twig
Match lines: 6
70| {% include 'ssma/occurrence/tabs/_tab_occurrences.html.twig' %}
75| {% include 'ssma/occurrence/tabs/_tab_dashboard.html.twig' %}
81| {% include 'ssma/occurrence/tabs/_tab_automations.html.twig' with {
90| {% include 'ssma/occurrence/tabs/_tab_config.html.twig' with {
113| {% include 'ssma/occurrence/partials/_modal_classify.html.twig' %}
114| {% include 'ssma/occurrence/partials/_modal_event.html.twig' with {
File: templates/ssma/occurrence/occurrence_view.html.twig
Match lines: 5
980| {% include 'ssma/occurrence/partials/_involved_people_display.html.twig' with {
1042| {% include 'ssma/occurrence/partials/_event_injury_map_card.html.twig' with {
1223| {% include 'ssma/occurrence/partials/_evidence_card.html.twig' with {
1333| {% include 'ssma/occurrence/partials/_modal_event.html.twig' with {
1347| {% include 'ssma/occurrence/partials/_modal_occurrence.html.twig' %}
File: templates/ssma/occurrence/ocurrence_report/index.html.twig
Match lines: 10
687|{% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_footer.html.twig' with { render_markup: false } %}
756| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_trend_pill.html.twig' with {
787| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_trend_pill.html.twig' with {
814| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_trend_pill.html.twig' with {
874| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_pill_grid.html.twig' with {
893| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_pill_grid.html.twig' with {
998| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_units_table.html.twig' with {
1031| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_pill_grid.html.twig' with {
1050| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_pill_grid.html.twig' with {
1083| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_footer.html.twig' %}
File: templates/ssma/occurrence/partials/_ev_injured_person_box.html.twig
Match lines: 2
162| {% include 'ssma/occurrence/partials/_ev_consequence_options.html.twig' %}
176| {% include 'ssma/occurrence/partials/_ev_consequence_options.html.twig' %}
File: templates/ssma/occurrence/partials/_modal_event.html.twig
Match lines: 10
443| {% include 'ssma/occurrence/partials/_ev_shared_barrier.html.twig' with {
454| {% include 'ssma/occurrence/partials/_ev_consequence_options.html.twig' %}
514| {% include 'ssma/occurrence/partials/_ev_shared_barrier.html.twig' with {
525| {% include 'ssma/occurrence/partials/_ev_consequence_options.html.twig' %}
568| {% include 'ssma/occurrence/partials/_ev_consequence_options.html.twig' %}
594| {% include 'ssma/occurrence/partials/_ev_consequence_options.html.twig' %}
617| {% include 'ssma/occurrence/partials/_ev_shared_barrier.html.twig' with {
663| {% include 'ssma/occurrence/partials/_ev_injured_person_box.html.twig' with {
873| {% include 'ssma/occurrence/partials/_ev_shared_barrier.html.twig' with {
889| {% include 'ssma/occurrence/partials/_ev_shared_barrier.html.twig' with {
File: templates/ssma/occurrence/tabs/_tab_config.html.twig
Match lines: 1
315| {% include 'ssma/occurrence/partials/_tab_occurrence_type_permissions.html.twig' %}
File: templates/ssma/occurrence/tabs/_tab_dashboard.html.twig
Match lines: 6
1061|{% include 'ssma/occurrence/tabs/panel/_panel_semantic_adriana_styles.html.twig' %}
1077| {% include 'ssma/occurrence/tabs/panel/_panel_visao_geral.html.twig' %}
1081| {% include 'ssma/occurrence/tabs/panel/_panel_risco_potencial.html.twig' %}
1086| {% include 'ssma/occurrence/tabs/panel/_panel_comparativo.html.twig' %}
1093| {% include 'ssma/occurrence/tabs/panel/_panel_semantic_adriana.html.twig' with { context: 'occurrence' } %}
1234|{% include 'ssma/occurrence/tabs/panel/_panel_scripts.html.twig' %}
File: templates/ssma/occurrence/tabs/_tab_occurrence_panel.html.twig
Match lines: 1
210| {% include 'ssma/occurrence/tabs/_tab_dashboard.html.twig' with {
File: templates/ssma/occurrence/tabs/_tab_occurrences.html.twig
Match lines: 3
581| {% include 'ssma/occurrence/partials/_involved_people_display.html.twig' with {
903|{% include 'ssma/occurrence/partials/_modal_occurrence.html.twig' %}
3033| if (href.indexOf('/manager/ssma/occurrence/') === -1 && href.indexOf('/occurrence/') === -1) {
File: templates/ssma/occurrence/tabs/panel/_panel_comparativo.html.twig
Match lines: 3
2| {% include 'ssma/occurrence/tabs/panel/_panel_comparativo_filiais.html.twig' %}
5|{% include 'ssma/occurrence/tabs/panel/_panel_comparativo_filiais_styles.html.twig' %}
6|{% include 'ssma/occurrence/tabs/panel/_panel_comparativo_filiais_scripts.html.twig' %}
File: templates/ssma/occurrence/tabs/panel/_panel_comparativo_filiais.html.twig
Match lines: 1
1|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as panel %}
File: templates/ssma/occurrence/tabs/panel/_panel_risco_potencial.html.twig
Match lines: 1
1|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as figma %}
File: templates/ssma/occurrence/tabs/panel/_panel_scripts.html.twig
Match lines: 1
1699| window.location.href = '/manager/ssma/occurrence/' + (id || uuid);
File: templates/ssma/occurrence/tabs/panel/_panel_visao_geral.html.twig
Match lines: 1
1|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as figma %}
File: templates/ssma/prevention/prevention_report/index.html.twig
Match lines: 2
262|{% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_footer.html.twig' with { render_markup: false } %}
865|{% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_footer.html.twig' %}
File: templates/ssma/prevention/tabs/_tab_prevention_panel.html.twig
Match lines: 4
13|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as figma %}
157|{% include 'ssma/occurrence/tabs/panel/_panel_semantic_adriana_styles.html.twig' %}
792| {% include 'ssma/occurrence/tabs/panel/_panel_semantic_adriana.html.twig' with {
1000| {{ include('ssma/occurrence/tabs/panel/_panel_semantic_adriana.html.twig', {
File: templates/ssma/refusal/tabs/_tab_panel.html.twig
Match lines: 2
1|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as figma %}
2|{% include 'ssma/occurrence/tabs/panel/_panel_semantic_adriana_styles.html.twig' %}
File: tests/Ssma/SsmaPermissionsRegressionTest.php
Match lines: 1
61| $this->occurrenceView = $root . '/templates/ssma/occurrence/occurrence_view.html.twig';
File: tests/Ssma/ssma_performance_fase_d_standalone.php
Match lines: 3
13|$panelScripts = file_get_contents($root . '/templates/ssma/occurrence/tabs/panel/_panel_scripts.html.twig');
14|$occList = file_get_contents($root . '/templates/ssma/occurrence/tabs/_tab_occurrences.html.twig');
15|$occView = file_get_contents($root . '/templates/ssma/occurrence/occurrence_view.html.twig');
File: tests/Ssma/ssma_performance_fase_e_standalone.php
Match lines: 1
13|$occList = file_get_contents($root . '/templates/ssma/occurrence/tabs/_tab_occurrences.html.twig');
File: tests/Ssma/test_email_flow.php
Match lines: 2
66| 'link' => 'https://empresa.metahuman.solutions/manager/ssma/occurrence/42',
67| 'report_link' => 'https://empresa.metahuman.solutions/manager/ssma/occurrence/42/report',
File: tests/Ssma/test_email_send_mailtrap.php
Match lines: 2
149| 'link' => 'https://empresa.metahuman.solutions/manager/ssma/occurrence/42',
150| 'report_link' => 'https://empresa.metahuman.solutions/manager/ssma/occurrence/42/report',
File: tests/Ssma/test_send_email_ssma.php
Match lines: 1
61| 'link' => 'https://metahuman.solutions/manager/ssma/occurrence/99',
File: tests/Ssma/validate_comparativo_filter.php
Match lines: 2
88|$twigOcc = file_get_contents($projectDir . '/templates/ssma/occurrence/tabs/_tab_dashboard.html.twig') ?: '';
89|$twigComp = file_get_contents($projectDir . '/templates/ssma/occurrence/tabs/panel/_panel_comparativo_filiais.html.twig') ?: '';
File: tests/Ssma/verify_all_panels.php
Match lines: 1
185|$riscoPotTemplate = file_get_contents('templates/ssma/occurrence/tabs/panel/_panel_risco_potencial.html.twig');
File: tests/Unit/Product/Effectiveness/EffectivenessFrontendContractFixesTest.php
Match lines: 3
193| 'source_url' => '/manager/ssma/occurrence/88',
194| 'module_url' => '/manager/ssma/occurrence/88',
210| self::assertSame('/manager/ssma/occurrence/88', $drawer['module_url']);
File: tests/Unit/Product/Ssma/SsmaBodyMapEntryRegressionTest.php
Match lines: 2
46| $modal = $this->read('templates/ssma/occurrence/partials/_modal_event.html.twig');
56| $view = $this->read('templates/ssma/occurrence/occurrence_view.html.twig');
File: tests/Unit/Product/Ssma/SsmaCauseTreeCommitteeCardUiTest.php
Match lines: 2
54| $occurrenceView = $this->read('templates/ssma/occurrence/occurrence_view.html.twig');
55| $occurrenceList = $this->read('templates/ssma/occurrence/tabs/_tab_occurrences.html.twig');
File: tests/Unit/Product/Ssma/SsmaInvestigationCommitteeUiRegressionTest.php
Match lines: 6
23| $view = $this->read('templates/ssma/occurrence/occurrence_view.html.twig');
56| $view = $this->read('templates/ssma/occurrence/occurrence_view.html.twig');
67| $view = $this->read('templates/ssma/occurrence/occurrence_view.html.twig');
155| $view = $this->read('templates/ssma/occurrence/occurrence_view.html.twig');
165| $view = $this->read('templates/ssma/occurrence/occurrence_view.html.twig');
246| $view = $this->read('templates/ssma/occurrence/occurrence_view.html.twig');
File: tests/Unit/Product/Ssma/assert_branch_ui_fixes.php
Match lines: 9
40|$modal = $root . '/templates/ssma/occurrence/partials/_modal_event.html.twig';
42|$barrier = $root . '/templates/ssma/occurrence/partials/_ev_shared_barrier.html.twig';
43|$injured = $root . '/templates/ssma/occurrence/partials/_ev_injured_person_box.html.twig';
44|$consOpts = $root . '/templates/ssma/occurrence/partials/_ev_consequence_options.html.twig';
105|!is_file($root . '/templates/ssma/occurrence/partials/_ev_ros_barrier.html.twig')
141|$occView = $root . '/templates/ssma/occurrence/occurrence_view.html.twig';
201|$modalEvent = $root . '/templates/ssma/occurrence/partials/_modal_event.html.twig';
287|$occView = $root . '/templates/ssma/occurrence/occurrence_view.html.twig';
335|$tabConfig = $root . '/templates/ssma/occurrence/tabs/_tab_config.html.twig';
File: tests/Unit/Product/Ssma/assert_flash_report_flow.php
Match lines: 2
37|$occView = $root . '/templates/ssma/occurrence/occurrence_view.html.twig';
140|$modalEvent = $root . '/templates/ssma/occurrence/partials/_modal_event.html.twig';
code_search
Show Details
Arguments
{"search_text": "ocorrencias?event"}
Result
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php Match lines: 1 1430| return '/manager/ssma/ocorrencias?event=' . $eventId;
Request #92
deepseek-v4-flash
P:111.01K C:325 CR:100.35K CW:0
3622ms
Reasoning
Very important: The occurrence detail route is `/manager/ssma/occurrence/{id}` (singular), NOT `/manager/ssma/ocorrencias/{id}`. So `resolveOriginUrl()` returns wrong URLs for occurrence_id and origem_id branches: `/manager/ssma/ocorrencias/{id}` → would hit route list? No route matches `ocorrencias/{id}`; would produce a 404 "No route found" (or fallback). So the "Ir para origem" link for actions of type occurrence-based (accident_personal/material/near_miss/ros) would be broken. This is a real bug in new code within the service diff.
Wait, is there a route `/manager/ssma/ocorrencias/{id}`? The routes_ssma only lists path `/manager/ssma/ocorrencias` (list) and `/manager/ssma/ocorrencias/comparativo/filter`. Also maybe a trailing wildcard? Let's search for the string `ocorrencias` in routes_ssma.yaml to ensure no parametrized path like `ocorrencias/{id}`.
Search only the yaml.
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["config/routes_ssma.yaml"], "search_text": "ocorrencias"}
Result
File: config/routes_ssma.yaml Match lines: 2 7| path: /manager/ssma/ocorrencias 271| path: /manager/ssma/ocorrencias/comparativo/filter
Request #93
deepseek-v4-flash
P:111.4K C:468 CR:111.23K CW:0
4337ms
Reasoning
Confirmed: no route for `/manager/ssma/ocorrencias/{id}`. Only list at `/manager/ssma/ocorrencias` (exact) and `/manager/ssma/ocorrencias/comparativo/filter`. So the "Ir para origem" links generated for occurrence origins (accident_personal, accident_material, near_miss, ros, accident) and occurrence_id are invalid — navigating there yields 404.
But hold on: could there be an `ocorrencias/{id}` fallback route defined with annotation/attributes in a controller rather than the yaml? Routes can be defined via annotations. Search for `#[Route('/manager/ssma/ocorrencias` or `@Route`... But given the docs and route listing, the pattern used throughout codebase is `/manager/ssma/occurrence/{id}`. The occurrence index itself is a hub listing; clicking an occurrence on the listing goes to `/manager/ssma/occurrence/{id}` via JS (template _tab_occurrences line 1699 uses `/manager/ssma/occurrence/`).
So yes, `/manager/ssma/ocorrencias/{id}` is wrong. Even if it existed, listing a single occurrence ID is not a valid detail screen. So the correct bug: the generated URL should be `/manager/ssma/occurrence/{id}` for occurrence-based origins.
Additionally, the third branch with eventId returns `/manager/ssma/ocorrencias?event=` + eventId. Does the list accept `event` param? Let's check `ocorrenciaIndex` query param handling. If 'event' param filters list to specific event, then navigating to list with event filter might be OK. But uncertain. Let's look for reading `->query->get('event'` in the controller around ocorrenciaIndex. Quick search within controller for `'event'` request query. Search "query->get('event'".
Tool Calls (1)
code_search
Show Details
Arguments
{"search_text": "query->get('event'"}
Result
No matches found
Request #94
deepseek-v4-flash
P:111.88K C:779 CR:111.74K CW:0
8110ms
Reasoning
Search for `'event'` param handling near ocorrenciaIndex. Let me instead search for "kind" param because occurrence list might use ?kind=event. And confirm no event param.
Regardless, the main branch bug is `/manager/ssma/ocorrencias/{id}` invalid route. Even if that route somehow resolved, no controller would handle it. So "Ir para origem" for those items would 404.
Wait — maybe I should double check: could there be a catch-all route that maps /manager/ssma/ocorrencias/{id} to the hub index with {id} unused? No catch-all route observed; Symfony default 404. Good.
Let me now also verify where `ocorrencias` hub handles query param to open a specific event, e.g., `?view=...`? Not important.
So issue #2: resolveOriginUrl generates invalid occurrence links (ocorrencias/{id}); correct route is occurrence/{id}.
Actually wait — Let me double-check `occurrence_id` semantics vs `origem_id`. Both ids are occurrence ids? In SQL `a.origem_id` — origem for actions may be inspection_id/abordagem_id/occurrence_id depending on origem. Since action.origem_id likely references an origin entity's id (SsmaEvent or SsmaOccurrence?). But for accident types, is origem_id an occurrence/event id? We can't be 100% sure, but the fallback for origem_key accident → url `ocorrencias/{origemId}` means the author considered origem_id as the occurrence id. But wrong URL prefix singular/plural route issue remains valid for occurrence_id >= 0 case (explicit field occurrence_id). So the comment should target the occurrence_id branch (or the accident branch), where it produces `/manager/ssma/ocorrencias/{id}` without a route → the offcanvas origin link leads to 404.
Let me double-check the documented correct route is singular "occurrence". Yes, `admin_ssma_occurrence_view: path: /manager/ssma/occurrence/{id}`.
Now, the event-based link: `/manager/ssma/ocorrencias?event=5` — no event param consumed anywhere (search empty). So that link is also suspect, but the occurrence_id branch is clearly broken and reachable for many actions (all actions that have occurrence_id set, which is the common case of actions created from an occurrence). Good.
Now check also for the JS: origin button link target opens in same tab? It's `<a href>`; fine.
Let me also double-check: is there maybe an existing method in the codebase that generates the URL for actions origin links correctly, e.g., in the action_plan tabs (Actions tab) that previously had a "ver origem" that already existed and might use the correct occurrence route? Search the action plan templates or the same service for other origin URL building. Actually the diff for overview action details (buildOverviewActionDetails) might have `occurrence_title`. Not needed.
Let me confirm the earlier statement about invalid route by verifying there is no route prefix/fallback for `/manager/ssma/ocorrencias/{id}` in other route files (annotations). Search across `src/Controller` for 'ocorrencias'.
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/", "src/Controller/Ssma/"], "search_text": "ocorrencias"}
Result
File: src/Controller/CommunicationCenterController.php
Match lines: 6
3327| 'ocorrencias_gestao_tempo' => '/time-management',
3328| 'ocorrencias_controle_espaco' => '/spaces-control/incidents',
3374| 'ocorrencias_gestao_tempo',
3375| 'ocorrencias_controle_espaco',
3962| case 'ocorrencias_gestao_tempo':
3974| case 'ocorrencias_controle_espaco':
File: src/Controller/EsocialEventsController.php
Match lines: 8
107| $ocorrencias = $response ? $response->getOcorrencias() : ($batch ? $batch->getOcorrencias() : []);
153| 'ocorrencias' => $ocorrencias,
292| 'ocorrencias' => $batch->getOcorrencias(),
301| 'ocorrencias' => $response->getOcorrencias(),
304| 'ocorrencias' => $response ? $response->getOcorrencias() : ($batch ? $batch->getOcorrencias() : []),
341| $ocorrencias = $response ? $response->getOcorrencias() : ($batch ? $batch->getOcorrencias() : []);
342| $hasOcorrencias = is_array($ocorrencias) ? count($ocorrencias) > 0 : !empty($ocorrencias);
344| if (!$response && !$batchResponse && !$hasOcorrencias && (!$batch || (!$batch->getCdResposta() && !$batch->getDescResposta()))) {
File: src/Controller/SsmaController.php
Match lines: 4
870| 'ocorrencias',
895| 'ocorrencias',
18066| 'ocorrencias' => $total,
18070| 'variacao_ocorrencias' => $total - $prevTotal,
Request #95
deepseek-v4-flash
P:113.14K C:3.65K CR:112.64K CW:0
29504ms
Reasoning
Confirmed. No route `/manager/ssma/ocorrencias/{id}`. The occurrence detail link is wrong in the service's resolveOriginUrl.
Now, let's note the bug precisely in the code comment anchored on the service lines:
```php
if ($occurrenceId > 0) {
return '/manager/ssma/ocorrencias/' . $occurrenceId;
}
```
Also the origemId branch (accident types) with `/manager/ssma/ocorrencias/` . $origemId, plus eventId branch `ocorrencias?event=`. The primary bug: wrong plural path, should be `/manager/ssma/occurrence/{id}` (singular) as defined by route admin_ssma_occurrence_view.
Now let me consider another potential problem: the origin URLs are hardcoded strings in the service instead of using route generation (`$this->router->generate(...)`). That's maintainability, but given the path bug is concrete, we can recommend route generation to avoid drift. The bug report should focus on the wrong path.
Now, I need to verify the default origin icons etc. Let me examine potential issue in the JS `origin_icons` for refusal: The JS buildOriginIconHtml uses `originIcons[originKey]`. The icons map includes refusal, so fine.
Now let's double check whether service also 'origin_icons' passed to JS via panel origin_icons key `origin_icons` at presentPendencias? In JS applyPendenciasDom uses `panel.origin_icons || {}`. Presenter's presentPendenciasPanelData includes 'origin_icons' => raw['origin_icons'] etc. OK.
Now also: buildFilterPayload for pendencias does not receive origin filter options if user sets mine but filters origin also passed. Fine.
Another thing to verify: In the overview SSR (index page), the overview filters (ov_filters.origin) etc. come from presenter presentOverview → 'origin' options from 'overview_origins', which has the new option list (removing refusal — covered finding #5).
Now potential bug candidate: The pendencias table origin filter uses `resolveOriginKey` comparing normalized key to value in select. What about the actions whose origin key is 'other' or 'refusal'? For those, selecting e.g. 'Todas' default shows everything. Good.
Now let's evaluate the JS: when mine filter is active and user picks origin that yields zero rows: empty table shows "Nenhuma ação corresponde aos filtros." fine.
Now let's double check the mine filter bug from another angle: If a "Gestor" (whose memberScope is null) but user has a CompanyMember record, mineId>0, then mine=1 → scope [mineId]. Good. If user is manager without member record, mineId=0 → payload previously built without member scope, so "Minhas ações" returns all actions — contradicting rule and also info leak? Not a security leak because manager can see everything anyway. It's UX issue already flagged as #3.
Now consider whether `mine` should also force if a supervisor's team scope applies... supervisors see team actions by default; checking mine will narrow to only their own (since override replaces scope with mineId). Works.
Now consider possible bug: When `mine=1` and view is 'visao_geral', the controller applies member scope and filters by createdAt range and dimension filters. Fine.
Now, examine the controller SSR: The default overview filter id `ap_overview_filter_origin` — but in SSR 'filters.origin' fallback options in _tab_painel template use `ov_filters.origin|default([...])`. Wait at line 209, options: `ov_filters.origin|default([{'value':'', 'text':'Origem'}])`. Is `ov_filters` provided? It's the overview filters from `action_plan_panel_data.overview.filters` presumably, which include origin with the new values. Good.
But the origin select filter options in template for pendencias uses `panel_filters.origin|default([...])`, and `panel_filters` = `action_plan_panel_data.filters` (only period, team, bond, unit). So the fallback list is used (identical content to service's). Fine. But when the JS fetches a new filter response, does it re-render the custom select options? The JS doesn't update the select; but options are static and match the service lists. Fine.
Now note: 'ap_painel_filter_origem' change handler uses `window.setCustomSelectValue(this.id, this.value)` only when e.originalEvent exists. The custom select component probably triggers change with originalEvent from native select? For a custom component, originalEvent may not exist; then the custom select UI (label) might not reflect? Actually in the existing pattern for other selects (team, vinculo, unidade) the same pattern is used. So consistent.
Now let me verify `syncPendenciasFilterState` initial values are read before first filter trigger. On init, syncPendenciasFilterState may not have been invoked before initial `buildFilterParams`? In onPainelTabVisible, after bindings, they call triggerPanelFilter only if no charts. Before triggerPanelFilter, is sync called? Look at runPanelFilterRequest→buildFilterParams uses panelState fields that may be default. Let's check where syncPendenciasFilterState is called before trigger. There are calls on events; but initial panelState defaults set at top of file: panelState has team '', vinculo '', origin '', mine false, axis 'weekly'? etc. Not a bug.
Now, let me look at top panelState definition (lines around 20-60) to ensure `mine` default false and confirm usage of `origin`. Already saw `mine: false` added.
Let me look for openActionViewOffcanvas being bound only on rows of pendencias table (bindTableViewButtons). Also bound on table? bindTableViewButtons attaches on `.js-ssma-ap-panel-view-action`. Wait — there are other `.js-ssma-ap-panel-view-action` buttons elsewhere (e.g., SSR action cell button without data attrs, and in "aba Ações" existing table). With openActionViewOffcanvas expecting data attrs, those without attrs produce defaults (origin '—', desc 'Sem descrição', id '') and still try to open offcanvas (which doesn't exist → nothing). Already covered #1.
But consider: bindTableViewButtons also used in "aba Ações" table where previously "// implementar" nothing happened; now clicking the button triggers openActionViewOffcanvas → no-op. Same as before? Before it did nothing. So behavior: nothing. Not a regression but part of #1.
Now, focus on possibly new issues:
A. SSR table column mismatch (new).
B. Wrong occurrence URL (new).
Let's also verify the JS row uses new columns headers names "Quem executa"/"Quem valida" with correct order in SSR. Covered.
Now, let me examine another subtle service bug: `resolveOriginUrl` for inspection uses origem_id; for approach uses origem_id. But what about actions with origem='occurrence' or origem 'abertura de ROS'? The SQL loads `origem_id` and `occurrence_id`. For near_miss: if occurrence_id > 0 → url ocorrencias/{occurrenceId} — wrong URL (covered). For ros: occurrence? Actually ROS is an event (ssma_event) separate from occurrence, event_id may be set. If eventId>0 and occurrenceId=0, URL /ocorrencias?event=...
Now check: Does `ssma_ocorrencia_index` read an `event` query param? Let's search controller for `->get('event'` broadly; search returned no matches with that specific pattern. Maybe it uses `$request->query->get('event')`? Our search text "query->get('event'" returned nothing. Let's try a more generic search in SsmaController: "get('event'" etc. Might be too broad. Let me search for "tab_oc_ocorrencias" handling query param event. Actually maybe the intended URL was `/manager/ssma/ocorrencias?kind=event&id=`? Not sure. But the event link branch is less common. I'll fold the mention into the occurrence URL bug: two branches produce invalid URLs and should be generated via route.
Now let's check the `buildOverviewActionDetails` for origin_type field to see if overview action details rows use origin_type = originKey; JS updateOverviewTable uses originIcons[row.origin_type]. Origin icons map includes new keys so overview table rows show icons for near_miss etc. Good.
Wait, there is an existing bug candidate: In overview rows (buildOverviewTableRowHtml), originMeta = originIcons[row.origin_type]; if origin_type was 'accident' old? Now service normalizes to new keys. OK.
Now for the 'Visão Geral' charts in JS: any code that uses origin keys old names? Not in this diff.
Let's check the 'pending_by_origin' chart (pendencias origin chart) data: buildPendenciasData origin_chart = presentSeededOriginChart(originCount). If originCount key includes 'other', 'refusal', those are appended at the end (after the seeds) because seed loop's second branch adds unknown keys with count>0. So chart includes 'other', 'refusal' items. But presentOriginChart is fine.
Wait, in `presentSeededOriginChart` seed loop ordering: The appended unknown keys are appended in the order they appear in originCount (i.e., after all seed keys), fine.
Now, potential regression: the earlier version seed included 'refusal' with count 0 always (so chart always displayed Direito de Recusa category even with 0). Now 'refusal' appears only if count>0; if zero, category disappears from the chart. That's fine visually. Not critical.
OK so now let me check for issue candidates in `_action_plan_overflow_menu.html.twig`. The change:
```
{% set can_edit_action = ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false)) or action_item.can_edit|default(false) %}
{% set can_resolve_action = action_item.can_resolve|default(false) or (ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false)) and not action_item.solved and action_item.validation_status != 'pending_validation') %}
```
Wait — the semantics changed subtly: Previously, can_edit_action = ssmaCanManageOccurrences OR action_item.can_edit. Now, if `ssmaCanMutateActionPlan` isn't passed in the include context (e.g., other template includes this partial but only passes ssmaCanManageOccurrences), the default fallback is `ssmaCanManageOccurrences|default(false)` — preserving old behavior? But wait: `ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false))` — Twig `default` uses the argument when the variable is undefined OR null? Actually Twig default filter applies when value is undefined or evaluates falsy? In Twig, `default` is used when the variable is undefined or null? Actually `default` in Twig: `{{ var|default('x') }}` returns 'x' if var is undefined or null... But actually Twig's default handles undefined and null; for false it keeps false? Documentation: "the default filter returns the passed default value if the value is strictly undefined OR if it's null" — wait, actually Twig default returns default when the variable does not exist or is null. Hmm, Twig docs: "returns the passed default value if the value is undefined or empty". It uses the `defined` test plus empty? Let me recall: Twig's `default` uses `default()` filter which returns the default if the value is undefined OR evaluates to false? Twig docs: `{{ var|default('var is not defined') }}` when var undefined. Also `{{ ''|default('var is empty') }}` returns 'var is empty' since default also checks emptiness? Actually Twig's default: "If the value is undefined or empty, default returns the provided default." Yes, Twig default considers empty (''? or false?) — hmm. In Twig 3, the `default` filter uses the rule: value is undefined OR is null OR is an empty string? Let me recall the implementation: `Twig\Extension\CoreExtension::default` returns default if `empty($value)`. `empty()` in PHP returns true for '', '0', 0, 0.0, null, false, [] — wait, PHP empty('0') is true. Twig's default filter checks `empty($value)`. So if ssmaCanMutateActionPlan is defined and false, `false|default(...)` returns the default, i.e., ssmaCanManageOccurrences. Hmm, that would mean when template passes ssmaCanMutateActionPlan=false (supervisor) the fallback would use ssmaCanManageOccurrences (true?) — Wait but in this template's context ssmaCanManageOccurrences may not even be defined; If only ssmaCanMutateActionPlan is passed as false, then `ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false))` → since ssmaCanMutateActionPlan is defined but false (empty), Twig treats it as empty and falls back to ssmaCanManageOccurrences|default(false). If ssmaCanManageOccurrences is not defined → false. So result false, consistent.
But if both are defined: ssmaCanMutateActionPlan=false, ssmaCanManageOccurrences=true (this would occur for supervisor where canManageSsmaOccurrences? A supervisor is viewer, so canManageSsmaOccurrences would be false normally... unless a supervisor role has can_edit request attributes? Might be true on occurrence edit routes. Not reliable.)
Anyway, the pattern `|default(...)` on a boolean where empty means fallback can produce false value incorrectly when value is intentionally false but we want false. Since false is falsy, the fallback will kick in if fallback arg evaluates true. For example if ssmaCanMutateActionPlan is NOT passed but ssmaCanManageOccurrences IS passed true → can_edit true (old behavior preserved, that's the desired fallback for callers not passing the new var). But if ssmaCanMutateActionPlan IS passed as false and ssmaCanManageOccurrences is ALSO true → result can_edit true, i.e., ignoring the false. Is there a scenario where ssmaCanMutateActionPlan=false and ssmaCanManageOccurrences=true simultaneously? For supervisor with tag 'Supervisor', canManageSsmaOccurrences: checks isGranted ROLE_MANAGER_VIEWER etc... a supervisor user (viewer) would have can_edit false. Request attributes can_edit? On action plan routes maybe request attributes not set for mutability. canMutateSsmaActionPlan false due isSsmaViewer. canManageSsmaOccurrences might still return true if request attributes can_create/can_edit present (e.g., on occurrence create page attributes). In overflow menu included on action plan tables, the request is the action plan page; attributes may not include those. So probably fine.
But there is a deeper problem: In the Twig template, using `|default` fallback as boolean logic means a defined `false` is treated as absent, replacing explicit false with the (possibly true) legacy value. A cleaner approach would be `ssmaCanMutateActionPlan is defined ? ssmaCanMutateActionPlan : (ssmaCanManageOccurrences|default(false))`. This might be worth a low severity comment, but given that in this partial ssmaCanManageOccurrences likely isn't even passed to every caller... Actually is `ssmaCanManageOccurrences` even still in the template context passed to the overflow menu include? Since the overflow menu includes are done in templates that receive the controller's ssma vars. Both vars may be passed globally. If the partial is included from _action_plan_table, ssmaCanMutateActionPlan likely passed globally as controller variable. This is a genuine but low-severity maintainability/correctness nuance. But we'd need to verify callers to be confident there's a concrete consequence. Given time constraints, this is minor; maybe skip, or low.
Let's check where _action_plan_overflow_menu is included and which variables are available. Search for include of the overflow partial.
Tool Calls (1)
code_search
Show Details
Arguments
{"search_text": "_action_plan_overflow_menu"}
Result
File: templates/ssma/action_plan/partials/_action_plan_table.html.twig
Match lines: 2
145| {% include 'ssma/action_plan/partials/_action_plan_overflow_menu.html.twig' with {
333| {% include 'ssma/action_plan/partials/_action_plan_overflow_menu.html.twig' with {
Request #96
deepseek-v4-flash
P:116.88K C:182 CR:116.74K CW:0
2139ms
Tool Calls (2)
file_read
Show Details
Arguments
{"end_line": 180, "file_path": "templates/ssma/action_plan/partials/_action_plan_table.html.twig", "start_line": 110}
Result
File: templates/ssma/action_plan/partials/_action_plan_table.html.twig (Total lines: 722)
IS_TRUNCATED: false
LINE_RANGE: 110-180
110| <tbody>
111| {% for child in project_children %}
112| <tr class="ssma-ap-project-child" data-action-id="{{ child.id }}">
113| <td class="ssma-ap-child-col--title">
114| <div class="ssma-action-plan-title">{{ child.title }}</div>
115| <div style="font-size:11px;color:#6c757d;">#{{ child.id }}</div>
116| </td>
117| <td class="ssma-ap-child-col--occurrence">
118| {% if child.occurrence_type_label|default('') %}
119| <span class="ssma-shared-tag ssma-shared-tag--sm ssma-ap-occurrence-type-tag">
120| <span class="ssma-shared-tag-dot"></span>
121| {{ child.occurrence_type_label }}
122| </span>
123| {% else %}
124| <span class="text-muted">—</span>
125| {% endif %}
126| </td>
127| <td class="ssma-ap-child-col--deadline">
128| <div class="ssma-action-plan-deadline">
129| <div class="ssma-action-plan-date">{{ child.deadline_label|default('—') }}</div>
130| <div class="ssma-action-plan-deadline-tag" style="color: {{ child.deadline_bucket_color|default('#8B9199') }};">
131| {{ child.deadline_bucket_label|default('') }}
132| </div>
133| </div>
134| </td>
135| <td class="ssma-ap-child-col--taken">
136| <span class="text-muted">—</span>
137| </td>
138| <td class="ssma-ap-child-col--responsible">
139| {% include 'ssma/action_plan/partials/_action_plan_responsible_icons.html.twig' with {
140| action_item: child,
141| member_by_id: member_by_id
142| } %}
143| </td>
144| <td class="ssma-ap-child-col--actions">
145| {% include 'ssma/action_plan/partials/_action_plan_overflow_menu.html.twig' with {
146| action_item: child,
147| ssmaCanManageOccurrences: ssmaCanManageOccurrences|default(false)
148| } %}
149| </td>
150| <td class="ssma-ap-child-col--validation">
151| {% if child.validation_status is defined and child.validation_status %}
152| <span class="ssma-validation-badge{% if child.validation_status == 'rejected' %} js-ssma-open-rejected-modal{% endif %}"
153| {% if child.validation_status == 'rejected' %}role="button" tabindex="0" title="Ver justificativa da reprovação" data-action-payload='{{ child|json_encode|e('html_attr') }}'{% endif %}
154| style="background-color: {{ child.validation_status_color }}20;
155| color: {{ child.validation_status_color }};
156| border-color: {{ child.validation_status_color }}40;{% if child.validation_status == 'rejected' %} cursor: pointer;{% endif %}">
157| {% if child.validation_status == 'pending_validation' %}
158| <i class="fas fa-clock mr-1"></i>
159| {% elseif child.validation_status == 'approved' %}
160| <i class="fas fa-check-circle mr-1"></i>
161| {% elseif child.validation_status == 'rejected' %}
162| <i class="fas fa-times-circle mr-1"></i>
163| {% endif %}
164| {{ child.validation_status_label }}
165| </span>
166| {% endif %}
167| </td>
168| </tr>
169| {% endfor %}
170| </tbody>
171| </table>
172| </div>
173| </div>
174| {% endset %}
175| {% set project_deadline_cell %}
176| <div class="ssma-action-plan-deadline">
177| <div class="ssma-action-plan-date">{{ project_deadline_label }}</div>
178| <div class="ssma-action-plan-deadline-tag" style="color: {{ project_deadline_color }};">
179| {{ project_deadline_bucket }}
180| </div>
file_read
Show Details
Arguments
{"end_line": 360, "file_path": "templates/ssma/action_plan/partials/_action_plan_table.html.twig", "start_line": 300}
Result
File: templates/ssma/action_plan/partials/_action_plan_table.html.twig (Total lines: 722)
IS_TRUNCATED: false
LINE_RANGE: 300-360
300| {% set deadline_cell %}
301| <div class="ssma-action-plan-deadline">
302| <div class="ssma-action-plan-date">{{ action_item.deadline_label }}</div>
303| <div class="ssma-action-plan-deadline-tag" style="color: {{ action_item.card_status_color|default(action_item.deadline_bucket_color) }};">
304| {{ action_item.card_status_label|default(action_item.deadline_bucket_label) }}
305| </div>
306| </div>
307| {% endset %}
308|
309| {% set taken_cell %}
310| {% if action_item.has_project %}
311| <div class="ssma-action-plan-taken">
312| <div class="ssma-action-plan-taken-value">{{ action_item.actions_taken_label }}</div>
313| <div class="ssma-action-plan-taken-label">Ações Tomadas</div>
314| </div>
315| {% else %}
316| <div class="ssma-action-plan-taken-tag">
317| <span class="ssma-shared-tag ssma-shared-tag--neutral">
318| <span class="ssma-shared-tag-dot"></span>
319| Sem Projeto
320| </span>
321| </div>
322| {% endif %}
323| {% endset %}
324|
325| {% set responsible_cell %}
326| {% include 'ssma/action_plan/partials/_action_plan_responsible_icons.html.twig' with {
327| action_item: action_item,
328| member_by_id: member_by_id
329| } %}
330| {% endset %}
331|
332| {% set actions_cell %}
333| {% include 'ssma/action_plan/partials/_action_plan_overflow_menu.html.twig' with {
334| action_item: action_item,
335| ssmaCanManageOccurrences: ssmaCanManageOccurrences|default(false)
336| } %}
337| {% endset %}
338|
339| {% set occurrence_type_cell %}
340| {% if action_item.occurrence_type_label|default('') %}
341| <span class="ssma-shared-tag ssma-shared-tag--sm ssma-ap-occurrence-type-tag">
342| <span class="ssma-shared-tag-dot"></span>
343| {{ action_item.occurrence_type_label }}
344| </span>
345| {% else %}
346| <span class="text-muted">—</span>
347| {% endif %}
348| {% endset %}
349|
350| {% set action_plan_rows = action_plan_rows|merge([{
351| 'id': action_item.id,
352| '_type': action_item.type|default(''),
353| 'plano_acao': title_cell,
354| 'tipo': action_item.type_label,
355| 'tipo_ocorrencia': occurrence_type_cell,
356| 'tipo_ocorrencia_filtro': action_item.occurrence_type_label|default(''),
357| 'ocorrencia_origem': action_item.occurrence_title,
358| 'prazo': deadline_cell,
359| 'prazo_sort': action_item.deadline_sort,
360| 'status_filtro': action_item.card_status_label|default(''),
Request #97
deepseek-v4-flash
P:118.95K C:612 CR:116.99K CW:0
5424ms
Reasoning
Confirmed: the overflow menu is included with explicit context `{ action_item: ..., ssmaCanManageOccurrences: ssmaCanManageOccurrences|default(false) }`. Since the include is not `with ... only`, the partial inherits parent context as well, so `ssmaCanMutateActionPlan` (if globally defined in the template that includes _action_plan_table) would still be available. But if this table is rendered on a route where the global variable `ssmaCanMutateActionPlan` is not defined (e.g., an "Ações" page rendered from a context that predates the new var), then `ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false))` returns ssmaCanManageOccurrences (old behavior). So fallback is actually OK for old contexts. And the false-value fallback nuance only triggers if ssmaCanMutateActionPlan=false explicitly set in the same context that also passes ssmaCanManageOccurrences=true — both passed. Since the controller passes both ssmaCanMutateActionPlan and ssmaCanManageOccurrences on the same index? We saw the controller sets both in the SQL list. So on the main Plano de Ação page, ssmaCanMutateActionPlan is available and equals canMutate value. For a supervisor, ssmaCanManageOccurrences = false (viewer) so no issue. For a supervisor whose role grants ROLE_MANAGER_VIEWER... canManageSsmaOccurrences uses isGranted checks: ROLE_MANAGER_VIEWER not among the true list; a viewer with ROLE_MANAGER_VIEWER would have canManage false (since ROLE_MANAGER etc. not granted). OK.
So it's probably acceptable; I'll not flag or only low. Actually, there's a subtle mismatch here: within `_action_plan_table`, the include explicitly passes `ssmaCanManageOccurrences` but NOT `ssmaCanMutateActionPlan`. If the parent template does NOT define `ssmaCanMutateActionPlan`, the fallback preserves old behavior; if it does, then both available. To be safe, I'd flag a low-severity note: the include passes only ssmaCanManageOccurrences explicitly, so new policy variable could be missing; suggest passing ssmaCanMutateActionPlan too. But is the parent template rendering with the new variable? Which template includes _action_plan_table? Let's find usages to see if they have `ssmaCanMutateActionPlan` in context. Search includes of _action_plan_table.
Tool Calls (1)
code_search
Show Details
Arguments
{"search_text": "_action_plan_table.html.twig"}
Result
File: .opencodereview/rule.json
Match lines: 1
81| "path": "templates/ssma/action_plan/partials/_action_plan_table.html.twig",
File: .opencodereview/rules/ssma/action-plan-panel.md
Match lines: 2
12|- `templates/ssma/action_plan/partials/_action_plan_table.html.twig`
72|- **Layout Ações vs Painel (intencional):** a aba **Ações** (`_tab_action_plan.html.twig`) exibe a tabela em largura total (`col-12` em `_action_plan_table.html.twig`). Gráficos de distribuição (`ssma-action-plan-type-bar`, `ssma-action-plan-deadline-bar`) e gauges (`ssma-action-plan-project-gauge`, `ssma-action-plan-resolution-gauge`) ficam na aba **Painel** (`_tab_painel.html.twig`), alimentados por `action_plan_data` (bar_charts/gauges). Não recolocar charts na aba Ações sem alinhamento de produto. Esses 4 charts **não** passam pelos filtros AJAX do Painel (`/panel/filter`) — comportamento herdado da #685, não regressão desta PR.
File: docs/INTEGRACAO-SSMA-CC-FELIPE.md
Match lines: 2
171|| `templates/ssma/action_plan/partials/_action_plan_table.html.twig` | Badges de status (`pending_validation`, `approved`, `rejected`) e link para demanda CC quando houver `cc_demand_id`. |
223|| `templates/ssma/action_plan/partials/_action_plan_table.html.twig` | Alterado |
File: docs/SSMA-CC-CORRECOES-IMPLEMENTADAS.md
Match lines: 2
145|**`templates/ssma/action_plan/partials/_action_plan_table.html.twig`**
219|| `templates/ssma/action_plan/partials/_action_plan_table.html.twig` | Item "Ler justificativa" no dropdown |
File: templates/ssma/action_plan/tabs/_tab_action_plan.html.twig
Match lines: 1
213| {% include 'ssma/action_plan/partials/_action_plan_table.html.twig' with {
Request #98
deepseek-v4-flash
P:120.11K C:1.21K CR:119.55K CW:0
11621ms
Reasoning
Let me check where `_tab_action_plan.html.twig` is included and whether `ssmaCanMutateActionPlan` exists in its context. Search "tab_action_plan" and where included: probably in index.html.twig of action_plan. Those are outside the review group (templates/ssma/action_plan/index.html.twig). We can't comment on files outside review group, but we can use context to reason. Since ssmaCanMutateActionPlan is set in the same controller SQL (viewData). All action plan pages rendered with same viewData, so it's present. So the overflow menu fallback effectively uses the new flag. So no real bug.
However: the default expression nuance (`false` being empty triggers fallback) is a real technical issue only if both false & true conflict. skip.
Now let me check for XSS issue in `_tab_painel.html.twig` SSR button: `data-action-id="{{ row.id }}"` no escaping but id is int. `title="Visualizar"`. OK.
But SSR initial action cell button lacks data-action-* attributes (only data-action-id). If JS updatePendenciasTable not executed, bindTableViewButtons still binds to SSR buttons (on tab visible, bindTableViewButtons). Clicking them calls openActionViewOffcanvas with missing attrs → defaults → attempts to open offcanvas that doesn't exist → nothing. This is consistent with finding #1 (nothing opens). OK.
Now we should think about whether the JS `updatePendenciasTable` could produce 10 cells in SSR because the template's DataTable may already be initialized from 9 headers, and when JS destroys and recreates, fine.
Now, I want to double-check the SSR table mismatch: If there is data present, does DataTables actually init with SSR? Let's see the SSR flow: On page load, when painel tab is visible, MetahumanDataTables.whenReady will initialize the DataTable for ssma-ap-panel-table from headers+rows SSR. DataTables would see 9 columns from thead and row with 8 tds → it logs warnings: "DataTables warning: table id=ssma-ap-panel-table - Requested unknown parameter '8' for row 0..." In fact, DataTables throws an error for each row because parameter 8 undefined, and it might drop the row (rendering empty table) OR fill blank. In the end user sees either misaligned or missing data on first paint; subsequent filter actions re-render correctly. So a real bug: initial page (before any filter) shows broken table.
Actually wait — this behavior occurs only if the SSR rows have 8 keys; but maybe the SSR presenter passes table rows in an order and _table_body_rows renders them with td for each key. But do we know DataTables counts columns from thead? Yes, DataTables uses the number of columns in the first row of thead (or tfoot). It doesn't tolerate tbody row with fewer cells: it warns and treats missing cells as empty (it tries to read the cell index from the row). DataTables displays warning, but continues with data.
So the misalignment: header columns 9; each data row is a JS array of 8 cell contents? Actually DataTables reads <td> values by index: row[0] titulo → col0, etc. col8 (Ações) missing → row[8] undefined → warning "Requested unknown parameter '8' for row 0, column 8". It will set that cell to ''. So columns 0-7 get data; col 8 Ações is blank. That means the content is shifted? No, DataTables assigns each td to the corresponding column index, not to headers. So the columns are not "shifted"; the LAST header column 'Ações' would be empty, and the "Pendência" column gets 'acoes' content (since acoes is td index 7 → column 7 'Pendência'), "Prazo" column index 6 gets pendencia content, "Quem valida" (index5) gets prazo content, etc. So shift indeed. Data rows would look: Título=title, Origem=icon, Gerência=mgmt, Prioridade=priority, Quem executa=responsible avatars, Quem valida=deadline, Prazo=pending text, Pendência=action button, Ações=empty. So visibly broken.
So it's a clear SSR misalignment introduced by the added headers without updating SSR row building.
That is the primary new finding on _tab_painel.html.twig.
Let me now also check for any mismatch in 'aba Ações' table header columns? Not part of diff.
Now let me try to validate the JS row builder vs the SSR row builder also mismatch 'responsible' avatars maybe (row.responsible has avatar?) not necessary.
Let me now double-check the mine/panel filter new behavior around selecting origin while in Visão Geral SSR initial load. Skip.
Now maybe check `getSelectValue` to see it returns '' if element absent, used when syncing overview 'ap_overview_filter_origin' that may not exist if the overview filters hidden? It exists in DOM but with class d-none only for container. Anyway.
Let me check top of JS for functions: escapeHtml defined, getSelectValue defined. Search quickly.
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["public/js/ssma/action_plan_panel.js"], "search_text": "function escapeHtml|function getSelectValue"}
Result
No matches found
Request #99
deepseek-v4-flash
P:121.34K C:162 CR:121.22K CW:0
1932ms
Reasoning
Maybe these functions defined elsewhere (global) or assigned as var. Let's search without "function".
Tool Calls (2)
code_search
Show Details
Arguments
{"file_patterns": ["public/js/ssma/action_plan_panel.js"], "search_text": "escapeHtml ="}
Result
No matches found
code_search
Show Details
Arguments
{"file_patterns": ["public/js/ssma/action_plan_panel.js"], "search_text": "getSelectValue"}
Result
File: public/js/ssma/action_plan_panel.js
Match lines: 11
86| function getSelectValue(id) {
1081| panelState.team = getSelectValue('ap_painel_filter_team');
1082| panelState.vinculo = getSelectValue('ap_painel_filter_vinculo');
1084| panelState.unidade = unidadeEl ? (getSelectValue('ap_painel_filter_unidade') || 'todas') : '';
1085| panelState.origin = getSelectValue('ap_painel_filter_origem');
1088| panelState.axis = getSelectValue('ssma-ap-chart-axis-filter') || panelState.axis;
1093| panelState.team = getSelectValue('ap_overview_filter_team');
1094| panelState.management = getSelectValue('ap_overview_filter_management');
1095| panelState.origin = getSelectValue('ap_overview_filter_origin');
1097| panelState.unidade = unitEl ? (getSelectValue('ap_overview_filter_unit') || 'todas') : '';
1804| panelState.axis = getSelectValue('ssma-ap-chart-axis-filter');
Request #100
deepseek-v4-flash
P:121.8K C:1.17K CR:121.47K CW:0
10100ms
Reasoning
escapeHtml must be global from some helper file. Fine.
Now let me verify the escapeHtml global handles quotes for attribute. It's presumably shared. Not needed.
Let me now confirm candidate issue about data-action-origin in SSR (server-side) button: it only includes id; but in SSR table if JS later re-renders the tbody from the same panelData rows via updatePendenciasTable, it would add the data attributes. Since updatePendenciasTable is only triggered by filter requests, initial SSR remains with the old button. When user changes filter (any filter), applyFilterResponse→applyPendenciasDom→updatePendenciasTable rows get new attributes, and bindTableViewButtons.
Now since SSR offcanvas not existing, clicking view initially does nothing.
OK.
Now let me look at another possible bug in JS: `updatePendenciasTable` row for validators uses `buildResponsibleStackHtml(row.validators || [])`. The service returns validators = resolveResponsibleDisplay([validator_member_id]) → array with one member or empty. `row.validators || []` — if validators is empty array (falsy in JS? no, [] is truthy). buildResponsibleStackHtml returns '—' for empty. Good.
Now about the JS filter param 'mine': In buildFilterParams for pendencias, when mine checked and period etc., the request includes mine=1. But when the user unchecks and filters again, mine removed (default false). Good.
Now think about the DataTable "Responsive" — extra columns. Not relevant.
Now let's look more thoroughly at whether pendencias SSR rows order changed: The header includes 9 columns while SSR rows 8 keys; JS rows 9 cells. DataTable columns count determined by thead at first init. On a filter fetch, updatePendenciasTable destroys the old DataTable (already initialized) and clears/re-sets tbody with 9 tds, then whenReady re-inits. So post-filter consistent.
Potential nuance: When a filter change happens, MetahumanDataTables.whenReady may use previously-cached options; but it's destroyed, so it re-inits. OK.
Now, let's consider the row for the SSR view: maybe it's always replaced because a filter is always triggered at start? onPainelTabVisible calls triggerPanelFilter only if no charts labels. If there IS data, the SSR table remains. If no data (labels empty), triggerPanelFilter then updatePendenciasTable with JS rows (9 cells, empty). So with data, bug visible.
Good.
Now let me draft comments. We must provide code comments only for lines in diff (newly added). The two new findings:
1. _tab_painel.html.twig header lines (added): The SSR (server-side) table rows still mount only one "Responsável" column (8 cells) while the header now declares 9 columns (adds "Quem executa" and "Quem valida"). On first load (before any AJAX filter), columns misalign: contents of Prazo/Pendência/Ações shift left, coluna Ações fica vazia, gerando erro DataTables. Fix: update SSR row builder (lines ~472-509) to include both executors and validators stacks to match headers.
Anchor: choose the two header lines in the diff:
```
{ title: 'Quem executa', responsivePriority: 3 },
{ title: 'Quem valida', responsivePriority: 3 },
```
2. SsmaActionPlanPanelService resolveOriginUrl: 'Ir para origem' links use the plural route `/manager/ssma/ocorrencias/{id}` which has no route (detail page is `/manager/ssma/occurrence/{id}`), so navigation yields 404 for occurrence-based actions. Suggest route generation or correct path. Also the event fallback `?event=` not consumed.
Anchor: lines:
```
if ($occurrenceId > 0) {
return '/manager/ssma/ocorrencias/' . $occurrenceId;
}
```
And mention accident branch same path.
Severity: high? The offcanvas origin link broken for common case → medium/high. It's a functional bug affecting a main feature of this PR (link "Ir para origem"). I'll classify as high.
Let me also consider a third new potential issue: In `formatPeopleNames`/offcanvas executors list. Not needed.
Now, is there anything in controller worth flagging beyond confirmed? Let me check the saveActionPlan handler changed guard at line ~7951: `if ($mode !== 'edit' && !$this->canMutateSsmaActionPlan())`. Previously `!$this->canAccessSsmaSupervisorSurface()`. This method is for create/update of an action? The `$mode !== 'edit'` means only for create; for edit mode, no permission check here? Look at surrounding lines to understand the function. The edit path may be protected elsewhere via canCurrentUserEditSsmaAction. Let's read context lines ~7900-8000.
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 8040, "file_path": "src/Controller/SsmaController.php", "start_line": 7900}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 7900-8040
7900| if (!$event || $event->getCompany()->getId() !== $companyId) {
7901| return new JsonResponse(['success' => false, 'message' => 'Ocorrência não encontrada.'], 404);
7902| }
7903|
7904| if (!$this->canCompleteSsmaTechnicalType($event->getCompany(), $user, $event->getType())) {
7905| return new JsonResponse(['success' => false, 'message' => 'Você não tem autorização para finalizar esse tipo de ocorrência.'], 403);
7906| }
7907|
7908| try {
7909| $data = json_decode($request->getContent(), true) ?? [];
7910| $resolveEvidences = array_values(array_filter(array_map('trim', (array) ($data['resolve_evidences'] ?? []))));
7911| $resolveComment = trim((string) ($data['resolve_comment'] ?? ''));
7912|
7913| $details = $event->getDetails();
7914| if (!is_array($details)) {
7915| $details = [];
7916| }
7917| $existing = is_array($details['evidences'] ?? null) ? $details['evidences'] : [];
7918| $details['evidences'] = $this->ssmaSanitizeEvidenceStorageList(array_merge($existing, $resolveEvidences));
7919| if ($resolveComment !== '') {
7920| $details['resolve_comment'] = $resolveComment;
7921| }
7922|
7923| $prevStatus = $event->getStatus();
7924| $event->setDetails($details);
7925| $event->setStatus(SsmaEvent::STATUS_CONCLUIDO);
7926| if ($event->getStatus() !== $prevStatus) {
7927| $event->appendHistory('Ocorrência finalizada.', ['from' => $prevStatus, 'to' => $event->getStatus()]);
7928| }
7929|
7930| $this->entityManager->flush();
7931| $company = $event->getCompany();
7932| if ($company instanceof Company) {
7933| $this->maybeSubmitOccurrenceForValidation($event, $company, $user);
7934| }
7935|
7936| return new JsonResponse(['success' => true, 'message' => 'Ocorrência finalizada com sucesso.']);
7937| } catch (\Throwable $e) {
7938| return new JsonResponse(['success' => false, 'message' => 'Erro ao finalizar ocorrência.'], 500);
7939| }
7940| }
7941|
7942| // ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
7943| // Action CRUD
7944| // ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
7945|
7946| /**
7947| * Retorna somente o HTML do modal "Criar ação" para ser carregado via AJAX
7948| * em páginas externas ao módulo SSMA (ex.: Projetos).
7949| */
7950| public function actionModalPartial(): Response
7951| {
7952| $viewData = $this->buildSsmaViewData();
7953| return new Response($this->renderView('ssma/partials/_modal_action.html.twig', [
7954| 'occurrences' => $viewData['occurrences'] ?? [],
7955| 'allMembers' => $viewData['allMembers'] ?? [],
7956| 'action_type_config' => $viewData['action_type_config'] ?? ['types' => []],
7957| ]));
7958| }
7959|
7960| // ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
7961|
7962| public function createAction(Request $request): JsonResponse
7963| {
7964| /** @var User|null $user */
7965| $user = $this->getUser();
7966| if (!$user) {
7967| return new JsonResponse(['success' => false, 'message' => 'Não autenticado.'], 401);
7968| }
7969|
7970| $company = $this->getSsmaCompany();
7971| if (!$company) {
7972| return new JsonResponse(['success' => false, 'message' => 'Empresa não encontrada.'], 400);
7973| }
7974|
7975| $data = json_decode($request->getContent(), true) ?? [];
7976| $mode = $data['mode'] ?? 'create';
7977| $title = trim((string) ($data['title'] ?? ''));
7978| $existingProject = null;
7979|
7980| // Criar: gestor/admin. Supervisor só visualiza — Brenda áudio 6.
7981| if ($mode !== 'edit' && !$this->canMutateSsmaActionPlan()) {
7982| return new JsonResponse(['success' => false, 'message' => 'Sem permissão para criar ação SSMA.'], 403);
7983| }
7984|
7985| $teamScopeError = $this->validateSsmaActionPayloadAgainstTeamScope($data, $company, $user);
7986| if ($teamScopeError !== null) {
7987| return new JsonResponse(['success' => false, 'message' => $teamScopeError], 422);
7988| }
7989|
7990| if ($title === '') {
7991| $title = 'Sem titulo';
7992| }
7993|
7994| if ($mode !== 'edit' && !empty($data['create_project_with_plan'])
7995| && empty($data['occurrence_id']) && empty($data['event_id'])
7996| && (string) ($data['related_event_type'] ?? '') !== ActionOrigemEnum::OUTRO) {
7997| return new JsonResponse(['success' => false, 'message' => 'Evento relacionado obrigatório ao criar novo plano.'], 422);
7998| }
7999|
8000| if ($mode !== 'edit' && !empty($data['existing_project_id'])) {
8001| $existingProject = $this->entityManager->find(Project::class, (int) $data['existing_project_id']);
8002| if (!$existingProject || $existingProject->getCompany()->getId() !== $company->getId()) {
8003| return new JsonResponse(['success' => false, 'message' => 'Plano existente não encontrado.'], 404);
8004| }
8005|
8006| // Regra: no plano existente, usar ocorrência raiz como padrão quando não informada.
8007| if (empty($data['occurrence_id'])) {
8008| $rootOccurrence = $this->findProjectRootOccurrence((int) $existingProject->getId(), $company);
8009| if (!empty($rootOccurrence['id'])) {
8010| $data['occurrence_id'] = (int) $rootOccurrence['id'];
8011| }
8012| }
8013| }
8014|
8015| $this->ensureSsmaActionSchema();
8016|
8017| try {
8018| $previousResponsibleIds = [];
8019| if ($mode === 'edit' && !empty($data['id'])) {
8020| $action = $this->entityManager->find(SsmaAction::class, (int) $data['id']);
8021| if (!$action || $action->getCompany()->getId() !== $company->getId()) {
8022| return new JsonResponse(['success' => false, 'message' => 'Ação não encontrada.'], 404);
8023| }
8024| if (!$this->canCurrentUserEditSsmaAction($action, $company, $user)) {
8025| return new JsonResponse(['success' => false, 'message' => 'Sem permissão para editar ações.'], 403);
8026| }
8027| $previousResponsibleIds = array_map('intval', $action->getResponsibleIds() ?? []);
8028| $message = 'Ação atualizada com sucesso.';
8029| } else {
8030| $action = new SsmaAction();
8031| $action->setCompany($company);
8032| $message = 'Ação criada com sucesso.';
8033| }
8034|
8035| $action->setTitle($title);
8036| $action->setDescription($data['description'] ?? null);
8037| $canonicalType = $this->canonicalizeSsmaActionType((string) ($data['type'] ?? ''));
8038| $action->setType($canonicalType !== '' ? $canonicalType : null);
8039| $action->setSolved((bool) ($data['solved'] ?? false));
8040| $action->setHasProject((bool) ($data['has_project'] ?? false));
Request #101
deepseek-v4-flash
P:125.29K C:3.2K CR:122.88K CW:0
25613ms
Reasoning
This is createAction endpoint. For edit mode, permission is enforced in branch using canCurrentUserEditSsmaAction. But for mode 'edit' with missing id? It will create a new action? Look: if mode==='edit' but id empty → goes to else branch, creates a new action... wait, mode edit but no id? Actually if mode edit and id empty then the createAction proceeds to create new action without the create permission check (since the create guard skipped when mode==='edit'). That pre-existed (guard was `$mode !== 'edit'` before too). Since we're only concerned with changed behavior: previously, guard for non-edit was canAccessSsmaSupervisorSurface() (i.e., viewers allowed). Now blocked. For edit path, permission unchanged via canCurrentUserEditSsmaAction (which now uses canMutate). This is fine.
But an issue: In mode 'edit' (used for editing an existing action via a generic endpoint), the create-permission check is skipped, but editing a nonexistent/not-yet-saved action when id empty goes to else → creates new. That was pre-existing behavior, not diff.
Now — there is a subtle security nuance with canMutateSsmaActionPlan returning false for a supervisor, but edit branch canCurrentUserEditSsmaAction = canMutate also false → blocked. OK.
Alright.
Let me also check `canCurrentUserResolveSsmaAction` and other uses—diff changed `$canManage = $this->canMutateSsmaActionPlan();`. This function appears within some code returning capabilities for UI. It's consistent with backend.
Now confirmed finding #2 is about screen flag forcing for team gestor etc. Fine.
Now also check: The diff changed 'create' behavior so supervisors cannot create. But at line ~12557 SQL variable rename: `$ssmaCanCreateLinkedActions = $this->canMutateSsmaActionPlan();`. Wait, is canMutateSsmaActionPlan() called in the SQL building context? Let's look at where in index it's used: earlier createAction uses canMutate; SQL comment "ssmaCanCreateLinkedActions: botão 'Criar ação' na aba Ocorrências". If a supervisor can no longer create linked actions from occurrence, fine per Brenda.
But caution: canMutateSsmaActionPlan() depends on `$this->isSsmaViewer()` and `$this->ssmaCurrentMemberPermissionTag()`. In the context where SQL vars are computed (e.g., in buildSsmaViewData for occurrence hub), the current request attributes might matter; but canMutate relies on tag name; if the member is a "Supervisor" tag with can_create true, then isSsmaViewer would return false (since viewer means can_view true but can_create/edit/delete false). Wait — earlier comment says supervisor via tag has can_view=1 and can_create/edit/delete=0, isSsmaViewer returns true. And if the tag is named 'Supervisor' with can_create true? Then isSsmaViewer false but tagName in list ['Supervisor'] → blocked. Good.
Now check Gestor de Equipe. isSsmaViewer false; tagName 'Gestor de Equipe' not in blocked list; canManageSsmaOccurrences? tag can_create may be false; but request attributes could be can_edit true on these routes? If canManage returns false, then canMutate false, yet the template overrides `$ssmaCanMutateActionPlan = true` for team/area gestores (line 12776 area) — that's exactly finding #2 about the screen/server divergence. But the actual backend mutation routes also need to allow Team Gestor. If canMutate returns false for team gestor (backend), they get 403 while the UI shows buttons. Finding #2 already covers this inconsistency generally. Good.
Now, might there be an issue that `canMutateSsmaActionPlan()` used at controller method `canCurrentUserEditSsmaAction` and `canCurrentUserResolveSsmaAction` blocks Gestor de Equipe? canCurrentUserResolve... uses canMutate. So if team gestor can't mutate via backend but UI shows buttons (template override true), then broken—covered #2.
OK let me finalize two new comments (SSR mismatch and wrong origin URL). Also consider low-priority: The `mine` filter check also leaks to overview/comparativo views (mine param sent for all views) — but is that a real bug? Suppose user checks "Minhas ações" in Pendencias, then opens Visão Geral tab → the overview filter requests include mine=1, causing overview charts to filter to only their actions even though the checkbox is not visible on Visão Geral; confusing behavior but arguably persistent filter. Comparativo? Let's trace: comparativo branch in JS buildFilterParams doesn't include mine? mine param added after the branch, unconditionally at the end (line 417-419). Yes, all views get mine param, including comparativo. In controller, comparativo view would then be member-scoped, filtering subsidiary comparative data, and when mineId=0 (manager w/o member record) ignored. It's a plausible minor inconsistency: the "Minhas ações" state silently applies to Visão Geral and Comparativo where there's no indication. Might be worth a low/medium comment. But is panelState.mine set when switching to overview? syncOverviewFilterState does not touch mine; so mine remains whatever it was in pendencias. If user never touched the checkbox, mine=false. If they checked it then moved to overview, they'd get scoped data. It's arguably by design (filter persists). I won't flag; uncertain value.
Let me examine pendencias initial default of mine checkbox: `panelState.mine` default false, but the checkbox on SSR is not persisted across page reloads; if user selected mine, then navigated away and back (page reload), checkbox resets. Also the mine filter isn't applied server side SSR initial (that's fine, initial page shows default).
Another candidate: The overview filter (Visão Geral) sets `panelState.origin = getSelectValue('ap_overview_filter_origin')`. But that filter's value keys are now the new origin keys; the request param name is 'origin' as well. Good.
Now about the mismatch on the overview origin select SSR: template options `ov_filters.origin` default fallback only has 'Origem' placeholder without options. But presenter supplies options so fine.
One more subtle bug candidate in service `resolveOriginKey` for event 'QUASE' catches e.g., "QUASE_ACIDENTE" BEFORE checking material etc. But suppose event type 'QUASE ACIDENTE MATERIAL'? unlikely. skip.
Another: The pendencias origin filter is applied AFTER deadline filter. Actions with origem 'refusal' have key 'refusal', but filter options don't include refusal, so those never filterable — finding #5. skip.
Another subtle new bug: In `buildFilterOptions`, the option 'origin' first value: '' text 'Origem'; while template default: {value:'', text:'Origem'} - consistent. overview_origins 'Todas'.
Now about the SSR table mismatch comment severity: high (functional first paint broken) but fixed when filters change? Actually after the JS re-render triggered by any filter event, table correct. On the very first paint it is broken and stays broken unless user changes filter or toggles something. Also DataTables may error & produce console warnings. That's medium/high. I'll mark high? Given impact: main table content for the module misaligned/errors on load when there is data. It's a strong candidate to be blocking but note it's the SSR-only path. I'll mark high.
Now the origin URL: mark high.
Now let me also inspect possible issue with SSR rows: because they use 'acoes' key; header key for last column 'acoes' has class text-center; those headers with key but no matching cell -> fine.
Wait: there is a nuance: In _table_body_rows, `{% for key, cell in row %}` — row is a hash; the number of tds equals number of keys (8). Column headers 9. Also first key: since twig loops over hash including 'titulo', 'origem'... all 8 non-id keys (no 'id'). DataTables init counts columns from first header row = 9. So mismatch stands.
One more nuance to be careful: In the SSR _dynamic_table, before DataTables init, HTML rendering is fine (9 th, 8 td). The visual misalignment occurs immediately in HTML (before DataTables) as well: the td order places the action button under the "Pendência" header. Actually browsers don't align td with th automatically; they render cells left to right. So the visible misalignment occurs before DataTables too. DataTables then may add error.
So the fix should add executors & validators columns in SSR row building.
Let's also confirm that SSR rows might be replaced on page load because JS might call applyPendenciasDom on initialization via something like render from panelData? We saw switchView only renders charts. There's no applyPendenciasDom call on init (only on filter response). Wait—is there a call at bottom: In onPainelTabVisible, after bindings, if !panelData.charts triggers filter; else no call to applyPendenciasDom. But what about `renderPendenciasCharts` etc. Those only charts. So SSR table remains as shown. Yes.
Double check: line 2303 `switchView(currentView)` calls renderPendenciasCharts (charts). No table apply.
So the SSR table is exactly what's displayed at initial open. Bug stands.
Now I will also re-check the openActionViewOffcanvas fallback: it references `window.jQuery('#ssmaApActionView').modal('show')`. If the offcanvas markup doesn't exist (finding #1), the code does nothing. But there's also a possibility that the offcanvas markup was expected to be added in this PR but wasn't (finding #1). skip.
Now, let me check line 2200-ish to see if openActionViewOffcanvas is defined before bindTableViewButtons, and double-check the bug candidate: `originLink.classList.remove('d-none')` etc. no issue.
Also in openActionViewOffcanvas, they set text into element by getElementById but these elements only exist inside offcanvas. #1.
Now, let me also double-check for a subtle bug: `openActionViewOffcanvas` receives `btn`, the SSR pendencias button has only data-action-id; if SSR button clicked: title = 'Ação'; origin '—'; etc. Then setText on missing elements; then calls window.openOffcanvasssmaApActionView if defined? no.
Fine.
Let me now also evaluate template overview origin select in pendencias context: In mobile, the pendencias filter row `d-none d-lg-flex` shown only on desktop; the same filters on mobile may have a "mobile fabs" variant below? Possibly the same #ap_painel_filter_origem id is also used in mobile container? Only one occurrence with that ID (line 156-173). If mobile layout has its own set with different IDs, we haven't seen it. Not in scope.
Given the huge template may have duplicate filter ids in a mobile bottom sheet; but we saw only one. skip.
Now let me verify the exact diff line numbers for comments. For _tab_painel.html.twig, added header lines:
```
{ title: 'Quem executa', responsivePriority: 3 },
{ title: 'Quem valida', responsivePriority: 3 },
```
I'll anchor comment on these two lines.
For the service, the resolveOriginUrl lines added:
```
$occurrenceId = (int) ($action['occurrence_id'] ?? 0);
if ($occurrenceId > 0) {
return '/manager/ssma/ocorrencias/' . $occurrenceId;
}
```
Anchor there.
Should I also include the event fallback `'/manager/ssma/ocorrencias?event=' . $eventId;` and origemId branch? I'll mention them in the comment text.
Let me also decide whether to flag the SSR row mismatch as two comments (header + row)? We can only anchor on added lines. Header lines added in diff. Good.
Now, let me think about severity & category. Use category "bug" for both.
Now, might there be an issue with the SSR rows being server-rendered 8 cells even before this PR: yes, previous headers were 8 columns matching 8 cells: Título, Origem, Gerência, Prioridade, Responsável, Prazo, Pendência, Ações. Now headers = 9; cells 8 → mismatch introduced by the header change (diff). Good.
Let me also confirm the JS-rendered rows are 9 columns: yes.
Let me make sure we don't duplicate confirmed finding #1 about offcanvas markup missing. The SSR table mismatch is different from #1. Fine.
Let me also verify no other new issues in JS worth raising:
- The button `originBtn` opens the origin URL in same page; clicking it will leave panel without confirmation; also its click could bubble? It's an <a> with href, distinct from the view button inside the same div. The parent `<td>` has no click handler. OK.
- In `buildPendenciasTableRowHtml`, the origin link class `ssma-ap-panel-table-action-btn` same as view button class — CSS consistent.
- data-action-origin-url escaped, and later read as attr then set as link href — the attr escaping done by escapeHtml... Actually careful: escapeHtml used in JS: need to confirm it escapes quotes? It's a global, presumably returns & ' etc. If it only escapes <,>,& but not quotes, then attribute injection possible with values from server. But originUrl is server-generated internal path (no user content). origin_label uses raw origem text (e.g., from event_type/origem user content) — data-action-origin uses `escapeHtml(row.origin_label ...)`. If escapeHtml doesn't escape quotes, a origem text containing `"` could break out of attribute. But since read back into textContent, no HTML injection; just attribute parsing issue could allow attribute injection into the DOM string -> XSS if escapeHtml lacks quote escaping. Need to verify escapeHtml implementation. It might be from a global helper. Let me find its definition in public/js.
Search entire public/js for "function escapeHtml".
Tool Calls (1)
code_search
Show Details
Arguments
{"search_text": "function escapeHtml", "file_patterns": ["public/js/"]}
Result
File: public/js/adriana-chat.js
Match lines: 1
1551|function escapeHtml(text) {
File: public/js/adriana/deep_research_stream.js
Match lines: 1
10| function escapeHtml(value) {
File: public/js/ai_training/index.js
Match lines: 1
5456|function escapeHtmlAiChat(str) {
File: public/js/chat/utils/chat-utils.js
Match lines: 1
36| function escapeHtml(text) {
File: public/js/chat_ia/adriana_reply_format.js
Match lines: 1
234| function escapeHtml(text) {
File: public/js/chat_ia/ata.js
Match lines: 1
12|function escapeHtml(text) {
File: public/js/chat_ia/chat_form.js
Match lines: 1
4077|function escapeHtml(unsafe) {
File: public/js/chat_ia/chat_ia_modal.js
Match lines: 1
4073|function escapeHtml(unsafe) {
File: public/js/chat_ia/type/cultural_rich_text.js
Match lines: 1
2| function escapeHtml(value) {
File: public/js/chat_ia/type/nps_media_uploader.js
Match lines: 1
176| function escapeHtml(text) {
File: public/js/chat_ia/workflow_approval_modal.js
Match lines: 1
79| function escapeHtml(unsafe) {
File: public/js/chat_ia/workflow_block_renderer.js
Match lines: 1
8| function escapeHtml(unsafe) {
File: public/js/ckfinder/core/connector/php/vendor/symfony/debug/ExceptionHandler.php
Match lines: 1
466| private function escapeHtml($str)
File: public/js/create-instance-offcanvas.js
Match lines: 1
9814| function escapeHtml(text) {
File: public/js/decision_system/risk_intelligence_signals.js
Match lines: 1
2949| function escapeHtml(value) {
File: public/js/feedback_page.js
Match lines: 1
377| function escapeHtml(s) {
File: public/js/goal-adriana-create-modal.js
Match lines: 1
124| function escapeHtml(value) {
File: public/js/goal-check-in.js
Match lines: 1
190| function escapeHtml(value) {
File: public/js/goals-company-offcanvas.js
Match lines: 1
709| function escapeHtml(value) {
File: public/js/interview_ia/ia-tenant-picker.js
Match lines: 1
8| function escapeHtml(value) {
File: public/js/jquery-file-upload/test/vendor/mocha.js
Match lines: 1
12695| function escapeHTML(s) {
File: public/js/metahuman-standard/pages/organizational_structure_index.js
Match lines: 1
553| function escapeHtml(value) {
File: public/js/nps-survey-chat-functions.js
Match lines: 1
293|function escapeHtml(text) {
File: public/js/offboarding/visualizar_atividades.js
Match lines: 1
1949|function escapeHtml(value) {
File: public/js/people-analytics/modules/ai-analysis-chat.js
Match lines: 1
239| function escapeHtml(text) {
File: public/js/people-analytics/modules/attraction-retention-dashboard.js
Match lines: 1
1349| function escapeHtml(value) {
File: public/js/people-analytics/modules/cost-analysis-dashboard.js
Match lines: 1
1244| function escapeHtml(value) {
File: public/js/people-analytics/modules/diversity-inclusion-dashboard.js
Match lines: 1
682| function escapeHtml(str) {
File: public/js/people-analytics/modules/engajamento-charts.js
Match lines: 1
139| function escapeHtml(value) {
File: public/js/people-analytics/modules/produtividade-dashboard.js
Match lines: 1
163| function escapeHtml(value) {
File: public/js/people-analytics/modules/saude-organizacional-dashboard.js
Match lines: 1
498| function escapeHtml(value) {
File: public/js/position-level-manager.js
Match lines: 1
8| function escapeHtml(value) {
File: public/js/process-tab-utils.js
Match lines: 1
7|function escapeHtml(value) {
File: public/js/products/create-instance-assessment-360.js
Match lines: 1
117| function escapeHtml(text) {
File: public/js/products/create-instance-crm.js
Match lines: 1
39| function escapeHtml(text) {
File: public/js/products/create-instance-nps.js
Match lines: 1
23| function escapeHtml(text) {
File: public/js/products/create-instance-treinamentos.js
Match lines: 1
262| function escapeHtml(text) {
File: public/js/shift-scheduling/index.js
Match lines: 1
223| function escapeHtml(value) {
File: public/js/spaces_control/floor_plan/plan_edit.js
Match lines: 1
3149| function escapeHtml(text) {
File: public/js/ssma/action_plan_panel.js
Match lines: 1
78| function escapeHtml(value) {
File: public/js/ssma/effectiveness_leadership.js
Match lines: 1
95| function escapeHtml(value) {
File: public/js/ssma/tree_view.js
Match lines: 1
137| function escapeHtml(value) {
Request #102
deepseek-v4-flash
P:129.76K C:90 CR:128.38K CW:0
1783ms
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 95, "file_path": "public/js/ssma/action_plan_panel.js", "start_line": 60}
Result
File: public/js/ssma/action_plan_panel.js (Total lines: 2378)
IS_TRUNCATED: false
LINE_RANGE: 60-95
60| try {
61| return JSON.parse(el.textContent);
62| } catch (e) {
63| return null;
64| }
65| }
66|
67| function initPanelConfig() {
68| var config = parsePanelConfig();
69| if (!config) {
70| return;
71| }
72| PANEL_FILTER_URL = config.filterUrl || '';
73| panelState.period = config.defaultPeriod || panelState.period;
74| panelState.overviewPeriod = config.defaultOverviewPeriod || panelState.overviewPeriod;
75| panelState.axis = config.defaultAxis || panelState.axis;
76| }
77|
78| function escapeHtml(value) {
79| return String(value == null ? '' : value)
80| .replace(/&/g, '&')
81| .replace(/</g, '<')
82| .replace(/>/g, '>')
83| .replace(/"/g, '"');
84| }
85|
86| function getSelectValue(id) {
87| var el = document.getElementById(id);
88| return el ? String(el.value || '').trim() : '';
89| }
90|
91| function pad2(value) {
92| return String(value).padStart(2, '0');
93| }
94|
95| function toInputDate(date) {
Request #103
deepseek-v4-flash
P:130.22K C:668 CR:129.79K CW:0
6685ms
Reasoning
escapeHtml escapes double quotes too (but not single quotes). Attribute values are double-quoted, so safe for `"`. It doesn't escape `'` but used inside double quotes. Data attributes read back with getAttribute → no decoding issue. Good.
Now, let me also confirm that the origin_label may contain origem text from user input: For actions created with origem '' and event type from SsmaEvent, resolveOriginLabel returns one of fixed strings or default ($origem or 'Outro'). origem is a free text field? Possibly. escapeHtml used. Good.
Now the description fallback: In buildPendenciasTableRowHtml data-action-description = escapeHtml(row.description || ''). Wait, it passes `row.description || ''` — if description has newlines, escapeHtml fine. Later offcanvas sets textContent = description (with entities decoded automatically since set via getAttribute returns the raw string? Actually when placed inside attribute value with HTML entities, reading getAttribute returns the DECODED string? Let's think: browser parses HTML and attribute value contains e.g., " → the DOM attribute value is the decoded string `"`. So getAttribute returns `"` correctly. Then textContent assigned. Good.
Now think about whether description can be extremely large (many KB) stuffed into data attribute and re-read; performance negligible.
Now also examine service 'description' field: `'description' => (string) ($action['description'] ?? $action['title'] ?? '')`. That duplicates a large description in rows of table JSON used for table cells (only used as attribute). Slight payload increase but fine.
Now, do we have any issue with the 'origin' filter select in pendencias not being reset when the DataTable filters cleared by the "reset" icon? There may not be reset. skip.
Let me look now at other new files: none other.
Let me consider an issue in the controller `canMutateSsmaActionPlan` and `canCurrentUserEditSsmaAction` not preserving "Gestor de Equipe" ability to edit deadline as responsible. But resolved before by canEditByPolicy? canCurrentUserResolveSsmaAction uses canManage = canMutate; for responsible with no admin the canManage false but isResponsible true → maybe can resolve own? Let's read canCurrentUserResolveSsmaAction full method to see if the change of canManage from canManageSsmaOccurrences to canMutate breaks supervisors who were responsible/validator resolving. This may impact normal users (members) who are responsible for action and could resolve. Previously canManage = canManageSsmaOccurrences; for member responsible (not supervisor) canManage = false? Actually members with responsible role cannot manage. But they can resolve own actions? read code.
Tool Calls (1)
file_read
Show Details
Arguments
{"end_line": 16360, "file_path": "src/Controller/SsmaController.php", "start_line": 16100}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 16100-16360
16100| }
16101| if ($requestedDeadline === null) {
16102| $action->setDeadline(null);
16103|
16104| return;
16105| }
16106| if (!$isAdminDeadlineOverride) {
16107| $maxDeadline = (clone $oldDeadline)->modify('+7 days');
16108| if ($requestedDeadline <= $oldDeadline || $requestedDeadline > $maxDeadline) {
16109| throw new \InvalidArgumentException(
16110| 'O adiamento do prazo é permitido em até 7 dias a partir do prazo atual.'
16111| );
16112| }
16113| }
16114|
16115| $changedByName = trim(($user->getFirstName() ?? '') . ' ' . ($user->getLastName() ?? ''))
16116| ?: (string) $user->getEmail();
16117| $action->recordDeadlineChange($requestedDeadline, (int) $user->getId(), $changedByName, $isAdminDeadlineOverride);
16118| }
16119|
16120| /**
16121| * Metadados de edição de prazo para o usuário atual (responsável 1x / até 7 dias; acidente só admin).
16122| *
16123| * @return array<string, mixed>
16124| */
16125| private function isCurrentUserSsmaActionResponsible(SsmaAction $action, Company $company, ?User $user): bool
16126| {
16127| $member = $user ? $this->getCurrentCompanyMember($company, $user) : null;
16128|
16129| return $this->ssmaStakeholderActionPermissionService->canResolveAsResponsible($action, $member);
16130| }
16131|
16132| private function isCurrentUserSsmaActionValidator(SsmaAction $action, Company $company, ?User $user): bool
16133| {
16134| $member = $user ? $this->getCurrentCompanyMember($company, $user) : null;
16135|
16136| return $this->ssmaStakeholderActionPermissionService->canValidateAsDesignatedValidator($action, $member);
16137| }
16138|
16139| private function canCurrentUserEditSsmaAction(SsmaAction $action, Company $company, ?User $user): bool
16140| {
16141| return $this->canMutateSsmaActionPlan();
16142| }
16143|
16144| private function canCurrentUserResolveSsmaAction(
16145| SsmaAction $action,
16146| Company $company,
16147| ?User $user,
16148| string $operation = 'resolve'
16149| ): bool {
16150| return $this->ssmaStakeholderActionPermissionService->canUserResolveAction(
16151| $action,
16152| $company,
16153| $user,
16154| $this->canManageSsmaOccurrences(),
16155| $operation
16156| );
16157| }
16158|
16159| private function canCurrentUserValidateSsmaAction(SsmaAction $action, Company $company, ?User $user): bool
16160| {
16161| return $this->ssmaStakeholderActionPermissionService->canUserValidateAction(
16162| $action,
16163| $company,
16164| $user,
16165| $this->canManageSsmaOccurrences()
16166| );
16167| }
16168|
16169| /**
16170| * @return array<string, mixed>|null
16171| */
16172| private function tryLoadOccurrenceViewRowForActionStakeholder(
16173| int $id,
16174| ?string $kind,
16175| Company $company,
16176| User $user
16177| ): ?array {
16178| $member = $this->getCurrentCompanyMember($company, $user);
16179| $memberId = (int) ($member?->getId() ?? 0);
16180| if ($memberId <= 0) {
16181| return null;
16182| }
16183|
16184| [, $teams] = $this->loadCompanyMembersAndTeamsLite($company);
16185| $teamsById = array_column($teams, null, 'id');
16186|
16187| if ($kind === 'event') {
16188| $event = $this->entityManager->getRepository(SsmaEvent::class)->find($id);
16189| if (!$event instanceof SsmaEvent || $event->getCompany()->getId() !== $company->getId()) {
16190| return null;
16191| }
16192| $row = $this->mapSsmaEventToOccurrenceListRow($event, $teamsById);
16193| if (!$this->isOccurrenceVisibleToMember($row, $memberId, $company)) {
16194| return null;
16195| }
16196|
16197| return $row;
16198| }
16199|
16200| $occurrence = $this->entityManager->getRepository(SsmaOccurrence::class)->find($id);
16201| if (!$occurrence instanceof SsmaOccurrence || $occurrence->getCompany()->getId() !== $company->getId()) {
16202| return null;
16203| }
16204| $row = $this->mapSsmaOccurrenceEntityToListRow($occurrence, $teamsById);
16205| if (!$this->isOccurrenceVisibleToMember($row, $memberId, $company)) {
16206| return null;
16207| }
16208|
16209| return $row;
16210| }
16211|
16212| /**
16213| * Carrega a linha de detalhe se o usuário tem permissão técnica do tipo da ocorrência
16214| * ({@see resolveCurrentUserTechnicalTypes}), sem exigir vínculo como stakeholder/membro.
16215| *
16216| * @return array<string, mixed>|null
16217| */
16218| private function tryLoadOccurrenceViewRowForTechnicalType(
16219| int $id,
16220| ?string $kind,
16221| Company $company,
16222| User $user
16223| ): ?array {
16224| $technicalTypes = $this->resolveCurrentUserTechnicalTypes($company, $user);
16225| if ($technicalTypes === []) {
16226| return null;
16227| }
16228|
16229| $techTypesSet = array_flip($technicalTypes);
16230| [, $teams] = $this->loadCompanyMembersAndTeamsLite($company);
16231| $teamsById = array_column($teams, null, 'id');
16232|
16233| if ($kind === 'event') {
16234| $event = $this->entityManager->getRepository(SsmaEvent::class)->find($id);
16235| if (!$event instanceof SsmaEvent || $event->getCompany()->getId() !== $company->getId()) {
16236| return null;
16237| }
16238| $row = $this->mapSsmaEventToOccurrenceListRow($event, $teamsById);
16239| $type = (string) ($row['type_value'] ?? $event->getType() ?? '');
16240|
16241| return isset($techTypesSet[$type]) ? $row : null;
16242| }
16243|
16244| $occurrence = $this->entityManager->getRepository(SsmaOccurrence::class)->find($id);
16245| if ($occurrence instanceof SsmaOccurrence && $occurrence->getCompany()->getId() === $company->getId()) {
16246| $row = $this->mapSsmaOccurrenceEntityToListRow($occurrence, $teamsById);
16247| $type = (string) ($row['type_value'] ?? $occurrence->getType() ?? '');
16248| if (isset($techTypesSet[$type])) {
16249| return $row;
16250| }
16251| }
16252|
16253| // Links sem kind=event ainda podem apontar para SsmaEvent (ROS / Quase Acidente).
16254| $event = $this->entityManager->getRepository(SsmaEvent::class)->find($id);
16255| if (!$event instanceof SsmaEvent || $event->getCompany()->getId() !== $company->getId()) {
16256| return null;
16257| }
16258| $row = $this->mapSsmaEventToOccurrenceListRow($event, $teamsById);
16259| $type = (string) ($row['type_value'] ?? $event->getType() ?? '');
16260|
16261| return isset($techTypesSet[$type]) ? $row : null;
16262| }
16263|
16264| private function resolveActionDeadlineEditMeta(SsmaAction $action, Company $company, ?User $user): array
16265| {
16266| $isAdmin = $this->canManageSsmaConfig();
16267| $member = $user ? $this->getCurrentCompanyMember($company, $user) : null;
16268| $memberId = $member ? (int) $member->getId() : 0;
16269| $respIds = $action->getResponsibleIds() ?? [];
16270| $isResponsible = $memberId > 0 && in_array($memberId, $respIds, true);
16271| $isValidator = $this->isCurrentUserSsmaActionValidator($action, $company, $user);
16272| $canManage = $this->canMutateSsmaActionPlan();
16273| $pendingValidation = $action->getValidationStatus() === 'pending_validation';
16274| $canEditByPolicy = $action->canEditDeadline($isAdmin);
16275| $canEdit = $canEditByPolicy && ($isAdmin || $isResponsible);
16276|
16277| $deadlineMax = null;
16278| if ($canEdit && !$isAdmin && $action->getDeadline() instanceof \DateTimeInterface) {
16279| $deadlineMax = (clone $action->getDeadline())->modify('+7 days')->format('Y-m-d');
16280| }
16281|
16282| return [
16283| 'can_edit_deadline' => $canEdit,
16284| 'is_accident_occurrence_action' => $action->isAccidentOccurrenceAction(),
16285| 'deadline_edit_count' => $action->getDeadlineEditCount(),
16286| 'deadline_history' => $action->getDeadlineHistory(),
16287| 'is_admin' => $isAdmin,
16288| 'is_responsible' => $isResponsible,
16289| 'is_validator' => $isValidator,
16290| 'can_edit' => $canManage,
16291| 'can_resolve' => $this->canCurrentUserResolveSsmaAction($action, $company, $user),
16292| 'can_validate' => $this->canCurrentUserValidateSsmaAction($action, $company, $user),
16293| 'deadline_max' => $deadlineMax,
16294| ];
16295| }
16296|
16297| private function loadActions(Company $company): array
16298| {
16299| /** @var SsmaAction[] $rows */
16300| $rows = $this->entityManager->getRepository(SsmaAction::class)
16301| ->findBy(['company' => $company], ['createdAt' => 'DESC']);
16302|
16303| /** @var User|null $user */
16304| $user = $this->getUser();
16305|
16306| return $this->mapSsmaActionEntitiesToListArrays($rows, $company, $user instanceof User ? $user : null);
16307| }
16308|
16309| private function buildProjectTaskCounters(array $projectIds): array
16310| {
16311| if ($projectIds === []) {
16312| return [];
16313| }
16314|
16315| $rows = $this->entityManager->getRepository(ProjectTasks::class)
16316| ->createQueryBuilder('pt')
16317| ->select('IDENTITY(pt.project) AS project_id', 'pt.status AS status')
16318| ->where('pt.project IN (:projectIds)')
16319| ->setParameter('projectIds', $projectIds)
16320| ->getQuery()
16321| ->getArrayResult();
16322|
16323| $counters = [];
16324| foreach ($rows as $taskRow) {
16325| $projectId = (int) ($taskRow['project_id'] ?? 0);
16326| if ($projectId <= 0) {
16327| continue;
16328| }
16329|
16330| if (!isset($counters[$projectId])) {
16331| $counters[$projectId] = ['total' => 0, 'completed' => 0];
16332| }
16333|
16334| $counters[$projectId]['total']++;
16335| if ((int) ($taskRow['status'] ?? 0) === self::PROJECT_TASK_STATUS_COMPLETED) {
16336| $counters[$projectId]['completed']++;
16337| }
16338| }
16339|
16340| return $counters;
16341| }
16342|
16343| private function findProjectRootOccurrence(int $projectId, Company $company): ?array
16344| {
16345| if ($projectId <= 0) {
16346| return null;
16347| }
16348|
16349| $row = $this->entityManager->getRepository(SsmaAction::class)
16350| ->createQueryBuilder('a')
16351| ->select('IDENTITY(a.occurrence) AS occurrence_id', 'o.title AS occurrence_title')
16352| ->innerJoin('a.occurrence', 'o')
16353| ->where('a.company = :company')
16354| ->andWhere('a.projectId = :projectId')
16355| ->orderBy('a.createdAt', 'ASC')
16356| ->setMaxResults(1)
16357| ->setParameter('company', $company)
16358| ->setParameter('projectId', $projectId)
16359| ->getQuery()
16360| ->getOneOrNullResult();
Request #104
deepseek-v4-flash
P:134.35K C:3.97K CR:130.82K CW:0
30457ms
Reasoning
Wait — I need to re-read the diff carefully. In the controller diff:
```
private function canCurrentUserEditSsmaAction(SsmaAction $action, Company $company, ?User $user): bool
{
- return $this->canManageSsmaOccurrences();
+ return $this->canMutateSsmaActionPlan();
}
```
But note: this function was previously `canManageSsmaOccurrences()`, but this function signature has always just used canManage, ignoring `$action`, `$company`, `$user`. This is suspicious: `canCurrentUserEditSsmaAction` returns canManage regardless of whether the user is responsible for the action, meaning any manager could edit all actions — pre-existing behavior? Actually before, supervisors (viewers) could also edit all actions since canManage? No—supervisors can't manage. So previously only managers could edit all. Now the check blocks supervisors (viewer) further, good. But it's ignoring that "responsible can edit deadline" flows use canEditDeadline policy. Fine.
Interesting: At line 16269-16275 in `resolveActionDeadlineEditMeta`, `$canEdit = $canEditByPolicy && ($isAdmin || $isResponsible);` uses isAdmin = canManageSsmaConfig. That is unchanged? diff showed that the change at 16269 area set `$canManage = $this->canMutateSsmaActionPlan();` — was previously `canManageSsmaOccurrences`. OK.
Alright. Also there is the comment in diff of canMutate method: "Gestor de Equipe/Área continua podendo mutar." But canMutateSsmaActionPlan ends by `return $this->canManageSsmaOccurrences();`, which only returns true for gestor-admin tag members or can_create tags. Wait, Gestor de Equipe tag may not have can_create? Actually canManageSsmaOccurrences true for memberIsSsmaGestorAdministrador; for gestor de equipe? Let's check memberIsSsmaGestorAdministrador vs gestor de equipe. 'Gestor de Equipe' is a different tag. canManage for member with tag can_create true (maybe Gestor de Equipe has can_create true?). In canManageSsmaOccurrences, the fallback to tag can_create/can_edit/can_delete would return true for Gestor de Equipe if tag can_create. So canMutate returns canManage → OK for gestor de equipe if can_create true.
Confirmed finding #2 relates to this divergence.
Now, time to check for a possible regression in the `mine` filter regarding supervisor seeing team actions but not own? When mine checkbox off for supervisor with team scope, member scope = team members; fine. When mine is on for supervisor, they override scope to only own id, meaning actions whose validator is the supervisor themself also included because filterByMemberScope includes validator id. Good.
Also the mine filter for gestor/admin with no memberId = 0 returns unfiltered → finding #3.
OK, final list of comments:
1. (template) SSR table header/columns mismatch. Category bug; high.
2. (service) Wrong origin URL path (ocorrencias/{id} → occurrence/{id}). Category bug; high. Also hardcoding; but primary is path error.
Let me consider whether there are additional good findings:
3. (JS) In `updatePendenciasTable`, using `row.action_id || row.id` sub-title; action_id may be undefined for some rows? service sets action_id always. fine.
4. (JS) A minor: the mine filter sends mine param for overview & comparativo; but the mine checkbox only exists in pendencias view, meaning the 'mine' filter leaks to overview/comparativo (a user can't see that it's still active when switching tabs). Wait: switching to Visão Geral triggers syncOverviewFilterState but not reset mine, then triggerPanelFilter('visao_geral'). Because panelState.mine stays true, the overview request includes mine=1, filtering overview KPIs to user's own actions, silently. Even switching from overview back to pendencias keeps mine checkbox checked (visually) because it's in pendencias filter bar. But while viewing Visão Geral, there's no indication that "Minhas ações" is active, yet charts show filtered numbers. This is arguably a real UX bug caused by unconditional mine param in buildFilterParams. But maybe users intend persistent filter across the two sub-views (team/unit/vinculo also persist). The mine checkbox is visible only in pendencias; when on overview, the state persists invisibly. If it persisted, that's the same as team filters that are ALSO invisible on overview? Wait no: the overview filter bar contains team select too (ap_overview_filter_team). Team persists to pendencias because sync reads overview select each time. Hmm; there are separate UI controls but shared panelState, meaning filters are effectively shared between the two views even though they're separate filter sets. That looks intended-ish. For mine there's only pendencias control, so if set and you switch to overview, you'd see overview data restricted; likely surprising but not "bug" incontrovertible. I'll skip given the rules to be precise.
5. Another candidate: `origin` filter state shared between pendencias (ap_painel_filter_origem) and overview (ap_overview_filter_origin). If you select origin in pendencias then go to overview, the overview origin select is empty but request includes origin param set from syncOverviewFilterState which overwrites panelState.origin with overview select value (empty). Wait syncOverviewFilterState runs when switching to overview (line 1791-1792 syncOverviewFilterState then triggerPanelFilter). That reads `getSelectValue('ap_overview_filter_origin')` = '' (empty) and overwrites panelState.origin to ''. So overview request doesn't include origin filter. Then the overview view loads without origin. When returning to pendencias... pendencias filter state is not re-synced unless user changes something. panelState.origin now '' because overview synced it. But the pendencias select still shows the selected origin? The custom select still has value = previous selection (visual). But panelState.origin empty means subsequent pendencias requests won't include origin. So after visiting Visão Geral, the pendencias origin filter silently stops working (until reselect). Conversely team/vinculo/unidade behave differently? In overview, syncOverviewFilterState reads ap_overview_filter_team etc. and overwrites panelState.team with overview team select (likely empty). So pendencias team filter would also reset visually but select stays showing old value? Wait, the custom select UI for team in pendencias keeps its own selected visual; but panelState.team is overwritten. After returning to pendencias without triggering a filter change, no issue since no request. The next request in pendencias would be missing team. But users re-enter pendencias by clicking the pill; does clicking pendencias pill call syncPendenciasFilterState before trigger? bindViewPills: clicking pendencias pill → switchView('pendencias') → return (charts only). No sync or trigger. So if from overview you return to pendencias, table still shows previous data (no new request) — fine visually but stale. This is an existing architectural quirk pre-existing; the new origin filter adds to it. Not necessarily this PR's regression to flag.
6. Let me consider XSS/attribute injection in SSR template row values: In SSR row, title_cell prints row.title raw (autoescaping? Twig template uses `{{ row.title }}` autoescape → fine). `row.management`/location are '—' constant. OK.
7. The origin SSR option list duplicated as fallback in template; service already provides them; duplication risk low.
Let me finalize the two strong comments plus maybe one medium for the service hard-coded URLs w/ wrong singular/plural. Actually combine.
Also consider adding a third comment about the wrong event fallback link. It's minor; include within same comment? code_comment anchors to a block. I'll anchor at the occurrenceId branch and mention that same wrong path is reused for origemId branch and that event fallback param not handled by the target route. One comment sufficient.
Let me now also double-check the exact wording for the SSR mismatch fix suggestion: Update the server-side row builder to build `executors_cell` and `validators_cell` and include them in `ap_table_rows` (in order), replacing `responsavel`. Since `row.executors` and `row.validators` already exist in the payload (service adds them), a stack include could be added; that matches the JS row builder. Suggest that.
Wait—one more check: does the SSR panel_table rows actually contain `executors` and `validators`? The presenter's presentPendenciasPanelData returns table rows from raw['actions'] = normalizedActions (which include executors/validators). And in SSR template `panel_table.rows` — what is panel_table? It's likely `action_plan_panel_data.table`. Yes rows include executors/validators. So the SSR fix is feasible.
Let's confirm the SSR row's responsible_members uses row.responsible for 'Quem executa'. Yes.
Great.
Let me also evaluate whether there could be an issue that the twig SSR rows are rebuilt but DataTable row count mismatch would make MetahumanDataTables auto-init crash the entire painel page (with error) — high severity.
Let me finalize comments now with code_comment calls.
For the template comment, existing_code lines must be present in diff with matching format. The diff lines:
```
{ title: 'Quem executa', responsivePriority: 3 },
{ title: 'Quem valida', responsivePriority: 3 },
```
I'll include both lines.
For service comment:
```
$occurrenceId = (int) ($action['occurrence_id'] ?? 0);
if ($occurrenceId > 0) {
return '/manager/ssma/ocorrencias/' . $occurrenceId;
}
```
That's added code; anchor with these 3 lines.
Write content in pt-BR in the required format: (1) practical impact simple language; (2) why it matters; (3) what to do.
Comment 1 (template SSR mismatch):
"Na primeira renderização da sub-aba Pendências (antes de qualquer filtro), as colunas novas 'Quem executa'/'Quem valida' entram no cabeçalho, mas a montagem das linhas feita no próprio template continua gerando só 8 células (uma coluna 'Responsável'), contra 9 colunas do cabeçalho. O resultado é a tabela carregada do servidor com dados desalinhados: conteúdo de Prazo/Pendência/Ações desloca uma coluna, a coluna 'Ações' fica vazia e o DataTables acusa erro de parâmetro desconhecido. Como esta PR adicionou as duas colunas, é preciso atualizar também o loop de linhas (bloco `ap_table_rows`, ~linha 500) para emitir 'Quem executa' e 'Quem valida' separadamente (ex.: usar `row.executors` e `row.validators`, que o backend já devolve), alinhando com o que o JS monta em `updatePendenciasTable`."
Comment 2 (service URL):
"O link 'Ir para origem' gerado para ações com ocorrência aponta para `/manager/ssma/ocorrencias/{id}`, caminho que não existe nas rotas (o detalhe da ocorrência é `/manager/ssma/occurrence/{id}`). Ao clicar, o usuário cai em 404 em vez de abrir a origem, que é justamente o novo recurso desta PR; o mesmo prefixo errado é usado no fallback de acidente/quase acidente/ROS e a variante com `?event=` não é consumida pela listagem. Corrija para a rota canônica (idealmente via `RouterInterface::generate('admin_ssma_occurrence_view', ['id'=>...])`) e ajuste também o fallback de `event_id`."
Category bug, severity high.
Now, let me ensure not to duplicate confirmed findings. Both new.
One more possible finding about the fallback in template `_action_plan_overflow_menu` for boolean false `|default` semantics - but given risk of overreach and it's uncertain (Twig default treats only undefined/null? Actually in Twig, `default` applies when the value is undefined or null, NOT when false. Let me double-check. Twig documentation: `{{ var|default('var is not defined') }}` - returns default if var is undefined OR null? The doc example: `{{ ''|default('var is empty') }}` returns 'var is empty' — actually the docs say "If the variable does not exist or is empty (null, false, empty string, empty array...) default is used"? Let me recall exactly: Twig default filter: "The default filter returns the passed default value if the value is undefined or empty, otherwise the value of the variable: `{{ ''|default('var is empty') }}`" — So empty strings count as empty, and false? PHP empty(false) true. Actually Twig uses `twig_test_empty` which checks `false === $value || '' === $value || null === $value || ...`? The implementation is `empty($value)`. false → empty true → fallback used. So my earlier analysis stands: `false|default(x)` returns x if x not empty... Hmm wait `default` semantics: if the given value is empty, returns the DEFAULT value. So false|default(true) → true. That means in overflow menu, if ssmaCanMutateActionPlan=false is passed (supervisor) AND ssmaCanManageOccurrences=true is also in context (e.g., from parent page for a 'Gestor' role that is not supervisor, impossible for supervisor). For a supervisor, ssmaCanManageOccurrences false. So concrete divergence unlikely. Given the controller sets ssmaCanManageOccurrences = canManageSsmaOccurrences (false for supervisor) and ssmaCanMutateActionPlan false, both false → can_edit false. OK no bug.
But wait: For a user with tag 'Supervisor' but can_create capability? isSsmaViewer? For a member who is viewer ROLE_MANAGER_VIEWER? canManageSsmaOccurrences may be true because request attributes can_create? If canMutate false but canManage true and both variables present: can_edit = ssmaCanMutateActionPlan|default(ssmaCanManageOccurrences|default(false)) → since false|default(true) → true! This would mean for a supervisor on an occurrence hub page where request attributes set can_create (e.g., page for event creation), the overflow menu (rendered on action plan listing inside occurrence detail page) would show Edit because canManage true. Wait is canManageOccurrences true for a supervisor page? isSsmaViewer false in canManage? No. canManageSsmaOccurrences checks memberIsSsmaGestorAdministrador; if supervisor tag can_create=0 → false. Unless request attrs can_edit true on that route. On occurrence_view for supervisor, GlobalPermissionListener sets can_edit? If supervisor has only view, can_edit false. So both false. Fine, skip.
OK. Now produce the comments.
Let me also confirm the exact anchor text from the diff: lines with leading space from diff context. Our anchor for template header should be:
```
{ title: 'Quem executa', responsivePriority: 3 },
{ title: 'Quem valida', responsivePriority: 3 },
```
exact text. Yes.
For service anchor, exact lines from diff:
```
$occurrenceId = (int) ($action['occurrence_id'] ?? 0);
if ($occurrenceId > 0) {
return '/manager/ssma/ocorrencias/' . $occurrenceId;
}
```
These lines appear in diff as added. Yes.
Let me now write the two comments and finish. Maybe also a third, lower: origin options duplicated in template fallback vs service (maintainability) — skip to keep concise.
Let me finalize.
Vou concluir a revisão após verificar os pontos mais críticos nos arquivos.
Identifiquei dois problemas novos (não cobertos pelos achados já confirmados) e vou registrá-los:
Tool Calls (1)
code_comment
Show Details
Arguments
{"comments": [{"content": "Na primeira renderização da sub-aba Pendências (antes de qualquer filtro AJAX), as colunas novas 'Quem executa'/'Quem valida' entram no cabeçalho, mas a montagem das linhas feita no próprio template continua gerando 8 células — a antiga coluna única 'Responsável' — contra 9 colunas do cabeçalho. Na prática, a tabela carregada do servidor sai desalinhada: prazo/pendência/ações deslocam uma coluna para a esquerda, a coluna 'Ações' fica vazia e o DataTables registra erro de parâmetro desconhecido ao inicializar. Como esta PR adicionou as duas colunas, é preciso atualizar também o loop que monta `ap_table_rows` (por volta da linha 500 deste arquivo) para emitir 'Quem executa' e 'Quem valida' separadamente — usando `row.executors` e `row.validators`, que o backend já devolve — em vez do único `responsavel`, alinhando com o que o JS monta em `updatePendenciasTable`.", "existing_code": " { title: 'Quem executa', responsivePriority: 3 },\n { title: 'Quem valida', responsivePriority: 3 },", "category": "bug", "severity": "high", "path": "templates/ssma/action_plan/tabs/_tab_painel.html.twig"}]}
Result
(async)
Request #105
deepseek-v4-flash
P:26.64K C:351 CR:22.02K CW:0
3151ms
Reasoning
Now the service URL comment.
Tool Calls (1)
code_comment
Show Details
Arguments
{"comments": [{"category": "bug", "content": "O link \"Ir para origem\" gerado para ações com ocorrência aponta para `/manager/ssma/ocorrencias/{id}`, mas a rota real de detalhe da ocorrência é `/manager/ssma/occurrence/{id}` — o caminho com `ocorrencias` (plural) não existe. Ao clicar no novo botão, o usuário cai em 404 em vez de abrir a origem, que é justamente o recurso que esta PR entrega; o mesmo prefixo errado é usado no fallback para acidente/quase acidente/ROS e a variante `?event=` não é consumida pela listagem. Corrija para a rota canônica (idealmente gerando via `RouterInterface::generate(...)` para não duplicar path hardcoded) e ajuste também o fallback de `event_id`.", "existing_code": " $occurrenceId = (int) ($action['occurrence_id'] ?? 0);\n if ($occurrenceId > 0) {\n return '/manager/ssma/ocorrencias/' . $occurrenceId;\n }", "category": "bug", "severity": "high", "path": "src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php"}]}
Result
(async)
Request #106
deepseek-v4-flash
P:27K C:232 CR:26.88K CW:0
2257ms
Reasoning
Both comments placed. Let me finalize and check nothing else that's a major finding is left. Let me quickly sanity check the claim about route `occurrence/` vs `ocorrencias/` for the detail. Let me search for route patterns to avoid false positive.
Vou confirmar a rota real da ocorrência antes de encerrar, para não emitir achado falso.
Tool Calls (2)
code_search
Show Details
Arguments
{"search_text": "manager/ssma/ocorrencias", "file_patterns": ["*.php", "*.twig", "*.js"]}
Result
File: cypress/e2e/navigation/adminNavigation.spec.js
Match lines: 1
185| { path: '/manager/ssma/ocorrencias', name: 'Ocorrências SSMA' },
File: cypress/e2e/navigation/superAdminNavigation.spec.js
Match lines: 1
218| { path: '/manager/ssma/ocorrencias', name: 'Ocorrências SSMA' },
File: cypress/e2e/navigation/userNavigation.spec.js
Match lines: 1
122| { path: '/manager/ssma/ocorrencias', name: 'Ocorrências SSMA' },
File: src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php
Match lines: 3
1421| return '/manager/ssma/ocorrencias/' . $occurrenceId;
1425| return '/manager/ssma/ocorrencias/' . $origemId;
1430| return '/manager/ssma/ocorrencias?event=' . $eventId;
File: tests/Ssma/validate_comparativo_filter.php
Match lines: 1
47|$request = Request::create('/manager/ssma/ocorrencias/comparativo/filter', 'GET', [
code_search
Show Details
Arguments
{"search_text": "ssma/occurrence/", "file_patterns": ["*.php", "*.twig", "*.js"]}
Result
Note: The results have been truncated. Only showing first 100 results.
File: src/Controller/SsmaController.php
Match lines: 8
382| return $this->render('ssma/occurrence/ocurrence_report/index.html.twig', array_merge($viewData, [
388| return $this->render('ssma/occurrence/index.html.twig', $viewData);
3524| return $this->render('ssma/occurrence/occurrence_view.html.twig', array_merge($viewData, [
3709| * Rota: admin_ssma_occurrence_report — /manager/ssma/occurrence/{id}/report
4079| * GET /manager/ssma/occurrence/{id}/flash-report/context?kind=event
25071| return $this->render('ssma/occurrence/deep_dive_group.html.twig', array_merge($viewData, [
25213| return $this->render('ssma/occurrence/deep_dive_group.html.twig', array_merge($viewData, [
26633| * GET|POST /manager/ssma/occurrence/flash-report/approvers
File: src/EventListener/GlobalPermissionListener.php
Match lines: 1
945| // SSMA/Governança: URLs como /manager/ssma/occurrence/{id} ou
File: src/Service/Adriana/Command/SsmaCommandService.php
Match lines: 1
2079| $actions[] = ['id' => 'view_occurrence', 'label' => 'Ver ocorrência', 'url' => '/manager/ssma/occurrence/' . $occId];
File: src/Service/Ssma/SsmaAutomationService.php
Match lines: 3
179| 'link' => 'https://exemplo.metahuman.solutions/manager/ssma/occurrence/1234',
180| 'report_link' => 'https://exemplo.metahuman.solutions/manager/ssma/occurrence/1234/report',
3005| return 'https://' . $host . '/manager/ssma/occurrence/' . $occurrenceId;
File: src/Service/Ssma/SsmaFlashReportService.php
Match lines: 1
828| $contextUrl = sprintf('/manager/ssma/occurrence/%d?kind=event', (int) $event->getId());
File: templates/governance/authorization/tabs/_tab_authorizations_monitoring.html.twig
Match lines: 1
576| templates/ssma/occurrence/tabs/panel/_panel_scripts.html.twig). ── */
File: templates/governance/cases/partials/_cases_dashboard_panel.html.twig
Match lines: 1
2|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as ssmaPanel %}
File: templates/governance/cases/partials/_cases_grc_kpi_row.html.twig
Match lines: 1
1|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as ssmaPanel %}
File: templates/governance/cases/partials/_cases_kpi_row.html.twig
Match lines: 1
5|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as ssmaPanel %}
File: templates/governance/cases/partials/_cases_resolved_kpi_row.html.twig
Match lines: 1
5|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as ssmaPanel %}
File: templates/ssma/action_plan/action_plan_report/index.html.twig
Match lines: 2
270|{% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_footer.html.twig' with { render_markup: false } %}
712|{% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_footer.html.twig' %}
File: templates/ssma/action_plan/tabs/_tab_painel.html.twig
Match lines: 1
41|{% include 'ssma/occurrence/tabs/panel/_panel_semantic_adriana_styles.html.twig' %}
File: templates/ssma/occurrence/index.html.twig
Match lines: 6
70| {% include 'ssma/occurrence/tabs/_tab_occurrences.html.twig' %}
75| {% include 'ssma/occurrence/tabs/_tab_dashboard.html.twig' %}
81| {% include 'ssma/occurrence/tabs/_tab_automations.html.twig' with {
90| {% include 'ssma/occurrence/tabs/_tab_config.html.twig' with {
113| {% include 'ssma/occurrence/partials/_modal_classify.html.twig' %}
114| {% include 'ssma/occurrence/partials/_modal_event.html.twig' with {
File: templates/ssma/occurrence/occurrence_view.html.twig
Match lines: 5
980| {% include 'ssma/occurrence/partials/_involved_people_display.html.twig' with {
1042| {% include 'ssma/occurrence/partials/_event_injury_map_card.html.twig' with {
1223| {% include 'ssma/occurrence/partials/_evidence_card.html.twig' with {
1333| {% include 'ssma/occurrence/partials/_modal_event.html.twig' with {
1347| {% include 'ssma/occurrence/partials/_modal_occurrence.html.twig' %}
File: templates/ssma/occurrence/ocurrence_report/index.html.twig
Match lines: 10
687|{% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_footer.html.twig' with { render_markup: false } %}
756| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_trend_pill.html.twig' with {
787| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_trend_pill.html.twig' with {
814| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_trend_pill.html.twig' with {
874| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_pill_grid.html.twig' with {
893| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_pill_grid.html.twig' with {
998| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_units_table.html.twig' with {
1031| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_pill_grid.html.twig' with {
1050| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_pill_grid.html.twig' with {
1083| {% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_footer.html.twig' %}
File: templates/ssma/occurrence/partials/_ev_injured_person_box.html.twig
Match lines: 2
162| {% include 'ssma/occurrence/partials/_ev_consequence_options.html.twig' %}
176| {% include 'ssma/occurrence/partials/_ev_consequence_options.html.twig' %}
File: templates/ssma/occurrence/partials/_modal_event.html.twig
Match lines: 10
443| {% include 'ssma/occurrence/partials/_ev_shared_barrier.html.twig' with {
454| {% include 'ssma/occurrence/partials/_ev_consequence_options.html.twig' %}
514| {% include 'ssma/occurrence/partials/_ev_shared_barrier.html.twig' with {
525| {% include 'ssma/occurrence/partials/_ev_consequence_options.html.twig' %}
568| {% include 'ssma/occurrence/partials/_ev_consequence_options.html.twig' %}
594| {% include 'ssma/occurrence/partials/_ev_consequence_options.html.twig' %}
617| {% include 'ssma/occurrence/partials/_ev_shared_barrier.html.twig' with {
663| {% include 'ssma/occurrence/partials/_ev_injured_person_box.html.twig' with {
873| {% include 'ssma/occurrence/partials/_ev_shared_barrier.html.twig' with {
889| {% include 'ssma/occurrence/partials/_ev_shared_barrier.html.twig' with {
File: templates/ssma/occurrence/tabs/_tab_config.html.twig
Match lines: 1
315| {% include 'ssma/occurrence/partials/_tab_occurrence_type_permissions.html.twig' %}
File: templates/ssma/occurrence/tabs/_tab_dashboard.html.twig
Match lines: 6
1061|{% include 'ssma/occurrence/tabs/panel/_panel_semantic_adriana_styles.html.twig' %}
1077| {% include 'ssma/occurrence/tabs/panel/_panel_visao_geral.html.twig' %}
1081| {% include 'ssma/occurrence/tabs/panel/_panel_risco_potencial.html.twig' %}
1086| {% include 'ssma/occurrence/tabs/panel/_panel_comparativo.html.twig' %}
1093| {% include 'ssma/occurrence/tabs/panel/_panel_semantic_adriana.html.twig' with { context: 'occurrence' } %}
1234|{% include 'ssma/occurrence/tabs/panel/_panel_scripts.html.twig' %}
File: templates/ssma/occurrence/tabs/_tab_occurrence_panel.html.twig
Match lines: 1
210| {% include 'ssma/occurrence/tabs/_tab_dashboard.html.twig' with {
File: templates/ssma/occurrence/tabs/_tab_occurrences.html.twig
Match lines: 3
581| {% include 'ssma/occurrence/partials/_involved_people_display.html.twig' with {
903|{% include 'ssma/occurrence/partials/_modal_occurrence.html.twig' %}
3033| if (href.indexOf('/manager/ssma/occurrence/') === -1 && href.indexOf('/occurrence/') === -1) {
File: templates/ssma/occurrence/tabs/panel/_panel_comparativo.html.twig
Match lines: 3
2| {% include 'ssma/occurrence/tabs/panel/_panel_comparativo_filiais.html.twig' %}
5|{% include 'ssma/occurrence/tabs/panel/_panel_comparativo_filiais_styles.html.twig' %}
6|{% include 'ssma/occurrence/tabs/panel/_panel_comparativo_filiais_scripts.html.twig' %}
File: templates/ssma/occurrence/tabs/panel/_panel_comparativo_filiais.html.twig
Match lines: 1
1|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as panel %}
File: templates/ssma/occurrence/tabs/panel/_panel_risco_potencial.html.twig
Match lines: 1
1|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as figma %}
File: templates/ssma/occurrence/tabs/panel/_panel_scripts.html.twig
Match lines: 1
1699| window.location.href = '/manager/ssma/occurrence/' + (id || uuid);
File: templates/ssma/occurrence/tabs/panel/_panel_visao_geral.html.twig
Match lines: 1
1|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as figma %}
File: templates/ssma/prevention/prevention_report/index.html.twig
Match lines: 2
262|{% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_footer.html.twig' with { render_markup: false } %}
865|{% include 'ssma/occurrence/ocurrence_report/partials/_occurrence_report_footer.html.twig' %}
File: templates/ssma/prevention/tabs/_tab_prevention_panel.html.twig
Match lines: 4
13|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as figma %}
157|{% include 'ssma/occurrence/tabs/panel/_panel_semantic_adriana_styles.html.twig' %}
792| {% include 'ssma/occurrence/tabs/panel/_panel_semantic_adriana.html.twig' with {
1000| {{ include('ssma/occurrence/tabs/panel/_panel_semantic_adriana.html.twig', {
File: templates/ssma/refusal/tabs/_tab_panel.html.twig
Match lines: 2
1|{% import 'ssma/occurrence/tabs/panel/_panel_macros.html.twig' as figma %}
2|{% include 'ssma/occurrence/tabs/panel/_panel_semantic_adriana_styles.html.twig' %}
File: tests/Ssma/SsmaPermissionsRegressionTest.php
Match lines: 1
61| $this->occurrenceView = $root . '/templates/ssma/occurrence/occurrence_view.html.twig';
File: tests/Ssma/ssma_performance_fase_d_standalone.php
Match lines: 3
13|$panelScripts = file_get_contents($root . '/templates/ssma/occurrence/tabs/panel/_panel_scripts.html.twig');
14|$occList = file_get_contents($root . '/templates/ssma/occurrence/tabs/_tab_occurrences.html.twig');
15|$occView = file_get_contents($root . '/templates/ssma/occurrence/occurrence_view.html.twig');
File: tests/Ssma/ssma_performance_fase_e_standalone.php
Match lines: 1
13|$occList = file_get_contents($root . '/templates/ssma/occurrence/tabs/_tab_occurrences.html.twig');
File: tests/Ssma/test_email_flow.php
Match lines: 2
66| 'link' => 'https://empresa.metahuman.solutions/manager/ssma/occurrence/42',
67| 'report_link' => 'https://empresa.metahuman.solutions/manager/ssma/occurrence/42/report',
File: tests/Ssma/test_email_send_mailtrap.php
Match lines: 2
149| 'link' => 'https://empresa.metahuman.solutions/manager/ssma/occurrence/42',
150| 'report_link' => 'https://empresa.metahuman.solutions/manager/ssma/occurrence/42/report',
File: tests/Ssma/test_send_email_ssma.php
Match lines: 1
61| 'link' => 'https://metahuman.solutions/manager/ssma/occurrence/99',
File: tests/Ssma/validate_comparativo_filter.php
Match lines: 2
88|$twigOcc = file_get_contents($projectDir . '/templates/ssma/occurrence/tabs/_tab_dashboard.html.twig') ?: '';
89|$twigComp = file_get_contents($projectDir . '/templates/ssma/occurrence/tabs/panel/_panel_comparativo_filiais.html.twig') ?: '';
File: tests/Ssma/verify_all_panels.php
Match lines: 1
185|$riscoPotTemplate = file_get_contents('templates/ssma/occurrence/tabs/panel/_panel_risco_potencial.html.twig');
File: tests/Unit/Product/Effectiveness/EffectivenessFrontendContractFixesTest.php
Match lines: 3
193| 'source_url' => '/manager/ssma/occurrence/88',
194| 'module_url' => '/manager/ssma/occurrence/88',
210| self::assertSame('/manager/ssma/occurrence/88', $drawer['module_url']);
File: tests/Unit/Product/Ssma/SsmaBodyMapEntryRegressionTest.php
Match lines: 2
46| $modal = $this->read('templates/ssma/occurrence/partials/_modal_event.html.twig');
56| $view = $this->read('templates/ssma/occurrence/occurrence_view.html.twig');
File: tests/Unit/Product/Ssma/SsmaCauseTreeCommitteeCardUiTest.php
Match lines: 2
54| $occurrenceView = $this->read('templates/ssma/occurrence/occurrence_view.html.twig');
55| $occurrenceList = $this->read('templates/ssma/occurrence/tabs/_tab_occurrences.html.twig');
File: tests/Unit/Product/Ssma/SsmaInvestigationCommitteeUiRegressionTest.php
Match lines: 6
23| $view = $this->read('templates/ssma/occurrence/occurrence_view.html.twig');
56| $view = $this->read('templates/ssma/occurrence/occurrence_view.html.twig');
67| $view = $this->read('templates/ssma/occurrence/occurrence_view.html.twig');
155| $view = $this->read('templates/ssma/occurrence/occurrence_view.html.twig');
165| $view = $this->read('templates/ssma/occurrence/occurrence_view.html.twig');
246| $view = $this->read('templates/ssma/occurrence/occurrence_view.html.twig');
File: tests/Unit/Product/Ssma/assert_branch_ui_fixes.php
Match lines: 9
40|$modal = $root . '/templates/ssma/occurrence/partials/_modal_event.html.twig';
42|$barrier = $root . '/templates/ssma/occurrence/partials/_ev_shared_barrier.html.twig';
43|$injured = $root . '/templates/ssma/occurrence/partials/_ev_injured_person_box.html.twig';
44|$consOpts = $root . '/templates/ssma/occurrence/partials/_ev_consequence_options.html.twig';
105|!is_file($root . '/templates/ssma/occurrence/partials/_ev_ros_barrier.html.twig')
141|$occView = $root . '/templates/ssma/occurrence/occurrence_view.html.twig';
201|$modalEvent = $root . '/templates/ssma/occurrence/partials/_modal_event.html.twig';
287|$occView = $root . '/templates/ssma/occurrence/occurrence_view.html.twig';
335|$tabConfig = $root . '/templates/ssma/occurrence/tabs/_tab_config.html.twig';
File: tests/Unit/Product/Ssma/assert_flash_report_flow.php
Match lines: 2
37|$occView = $root . '/templates/ssma/occurrence/occurrence_view.html.twig';
140|$modalEvent = $root . '/templates/ssma/occurrence/partials/_modal_event.html.twig';
Request #107
deepseek-v4-flash
P:31.99K C:370 CR:27.14K CW:0
2801ms
Reasoning
Confirmed: `/manager/ssma/occurrence/{id}` is the canonical detail route (used by SsmaCommandService, SsmaAutomationService, flash report, etc.), while `ocorrencias` is the list endpoint `/manager/ssma/ocorrencias`. The comment is valid.
Wait, let me double check whether `/manager/ssma/ocorrencias/{id}` could be a valid detail route though. Let me search the controller for route with path "ocorrencias/{". The test references `/manager/ssma/ocorrencias/comparativo/filter` — the listing includes a comparativo sub-route under `/manager/ssma/ocorrencias`. Hmm — maybe there is a route `/manager/ssma/ocorrencias/{id}` too? Let me search routes in the controller.
Confirmo que a rota canônica de detalhe é `/manager/ssma/occurrence/{id}`. Vou verificar se existe também alguma rota `ocorrencias/{id}` registrada para evitar falso positivo.
Tool Calls (2)
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "ocorrencias/{"}
Result
No matches found
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "occurrence/{id}"}
Result
File: src/Controller/SsmaController.php
Match lines: 2
3709| * Rota: admin_ssma_occurrence_report — /manager/ssma/occurrence/{id}/report
4079| * GET /manager/ssma/occurrence/{id}/flash-report/context?kind=event
Request #108
deepseek-v4-flash
P:32.46K C:217 CR:32.26K CW:0
2220ms
Reasoning
No route `/manager/ssma/ocorrencias/{id}`. Let me double check the listing routes `admin_ssma_occurrences` etc. Let me quickly find the actual annotation route for occurrence detail view. Search for "admin_ssma_occurrence" route patterns, or for the view occurrence route with path /occurrence/.
Tool Calls (2)
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "Route\\(\"/manager/ssma/occurrence"}
Result
No matches found
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "ssma/occurrence/"}
Result
File: src/Controller/SsmaController.php
Match lines: 8
382| return $this->render('ssma/occurrence/ocurrence_report/index.html.twig', array_merge($viewData, [
388| return $this->render('ssma/occurrence/index.html.twig', $viewData);
3524| return $this->render('ssma/occurrence/occurrence_view.html.twig', array_merge($viewData, [
3709| * Rota: admin_ssma_occurrence_report — /manager/ssma/occurrence/{id}/report
4079| * GET /manager/ssma/occurrence/{id}/flash-report/context?kind=event
25071| return $this->render('ssma/occurrence/deep_dive_group.html.twig', array_merge($viewData, [
25213| return $this->render('ssma/occurrence/deep_dive_group.html.twig', array_merge($viewData, [
26633| * GET|POST /manager/ssma/occurrence/flash-report/approvers
Request #109
deepseek-v4-flash
P:32.95K C:191 CR:32.64K CW:0
2126ms
Reasoning
Let me find route definitions (attributes) that map occurrence view. Search for `admin_ssma_occurrence` route names and the URL prefix `/manager/ssma/occurrence/`. Let me look for route attribute in the controller for the occurrence view.
Tool Calls (2)
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "'occurrence_view'"}
Result
No matches found
code_search
Show Details
Arguments
{"file_patterns": ["src/Controller/SsmaController.php"], "search_text": "occurrence/{id}"}
Result
File: src/Controller/SsmaController.php
Match lines: 2
3709| * Rota: admin_ssma_occurrence_report — /manager/ssma/occurrence/{id}/report
4079| * GET /manager/ssma/occurrence/{id}/flash-report/context?kind=event
Request #110
deepseek-v4-flash
P:33.23K C:195 CR:33.02K CW:0
1812ms
Reasoning
Route attributes may be YAML-based (routes defined in config). Let me find where the route `/manager/ssma/occurrence/{id}` is defined — likely in config/routes/ssma.yaml or annotations using #[Route]. Let's search the config folder for that path pattern.
Tool Calls (2)
code_search
Show Details
Arguments
{"file_patterns": ["config/", "routes/", "*.yaml"], "search_text": "ssma/occurrence/{id}"}
Result
File: config/routes_ssma.yaml
Match lines: 5
54| path: /manager/ssma/occurrence/{id}
89| path: /manager/ssma/occurrence/{id}/report
96| path: /manager/ssma/occurrence/{id}/flash-report/context
103| path: /manager/ssma/occurrence/{id}/flash-report/submit
110| path: /manager/ssma/occurrence/{id}/approve
code_search
Show Details
Arguments
{"file_patterns": ["config/"], "search_text": "occurrence/{id}"}
Result
File: config/routes_ssma.yaml
Match lines: 5
54| path: /manager/ssma/occurrence/{id}
89| path: /manager/ssma/occurrence/{id}/report
96| path: /manager/ssma/occurrence/{id}/flash-report/context
103| path: /manager/ssma/occurrence/{id}/flash-report/submit
110| path: /manager/ssma/occurrence/{id}/approve
Request #111
deepseek-v4-flash
P:33.67K C:413 CR:33.41K CW:0
3458ms
Reasoning
Confirmed: there is no `/manager/ssma/ocorrencias/{id}` route; the actual detail path is `/manager/ssma/occurrence/{id}`. The comment about the wrong origin URL is valid.
Also, the fallback `/manager/ssma/ocorrencias?event={id}` — no such query param consumed by the listing (likely not). Not necessary to verify further; the primary is right.
Also verify route for inspections/abordagens detail paths — not critical since those aren't the main comment.
Now, let me double-check the template claim about the SSR table row builder to make sure the template `_tab_painel.html.twig` truly builds the pendencias rows SSR with single `responsavel` cell. Since `_tab_painel.html.twig` may include `_action_plan_table.html.twig` or a `_pendencias_table.html.twig` partial. The header added in this diff is inside `_tab_painel.html.twig`, so the row builder must be within the same file or a partial included. The previous review summary mentioned `_action_plan_table.html.twig` was among conflicting files. Let me read the template around line 500+ to verify the row-building code lives there.
Vou confirmar que a montagem das linhas (células) da tabela de Pendências está no próprio `_tab_painel.html.twig`, para validar o desalinhamento de colunas apontado.
Tool Calls (1)
file_read
Show Details
Arguments
{"file_path": "templates/ssma/action_plan/tabs/_tab_painel.html.twig", "start_line": 440, "end_line": 600}
Result
File: templates/ssma/action_plan/tabs/_tab_painel.html.twig (Total lines: 570)
IS_TRUNCATED: false
LINE_RANGE: 440-570
440| <div class="ssma-ap-table-title-main">{{ row.title }}</div>
441| <div class="ssma-ap-table-title-sub">{{ row.action_id }}</div>
442| </div>
443| {% endset %}
444| {% set origin_cell %}
445| <span class="ssma-ap-panel-table-origin"
446| data-toggle="tooltip"
447| title="{{ origin_meta.title|default('Origem') }}"
448| aria-label="{{ origin_meta.title|default('Origem') }}">
449| {% include 'components/ui/_icon_badge.html.twig' with {
450| icon: origin_meta.icon|default('fa-link'),
451| size: 'md',
452| variant: origin_meta.variant|default('primary'),
453| rounded: true
454| } %}
455| </span>
456| {% endset %}
457| {% set mgmt_cell %}
458| <div>
459| <div class="ssma-ap-table-title-main">{{ row.management }}</div>
460| <div class="ssma-ap-table-mgmt-sub">{{ row.location }}</div>
461| </div>
462| {% endset %}
463| {% set priority_key = row.priority_key|default('baixa')|lower %}
464| {% set priority_color = priority_colors[priority_key] is defined ? priority_colors[priority_key] : 'gray' %}
465| {% set priority_cell %}
466| {% include 'components/ui/_pill.html.twig' with {
467| label: row.priority,
468| color: priority_color,
469| size: 'sm'
470| } %}
471| {% endset %}
472| {% set responsible_members = [] %}
473| {% for person in row.responsible|default([]) %}
474| {% set responsible_members = responsible_members|merge([{
475| name: person.name|default(person.initials|default('')),
476| avatar: person.avatar|default('')
477| }]) %}
478| {% endfor %}
479| {% set responsible_cell %}
480| {% include 'components/ui/_member_avatars_stack.html.twig' with {
481| members: responsible_members,
482| max_visible: 3,
483| size: 27,
484| empty_label: '—'
485| } %}
486| {% endset %}
487| {% set deadline_cell %}
488| <span class="ssma-ap-deadline--{{ row.deadline_overdue|default(false) ? 'overdue' : 'ok' }}">{{ row.deadline }}</span>
489| {% endset %}
490| {% set action_cell %}
491| <button type="button"
492| class="ssma-ap-panel-table-action-btn js-ssma-ap-panel-view-action"
493| data-action-id="{{ row.id }}"
494| data-toggle="tooltip"
495| title="Visualizar"
496| aria-label="Visualizar ação">
497| <i class="fas fa-eye" aria-hidden="true"></i>
498| </button>
499| {% endset %}
500| {% set ap_table_rows = ap_table_rows|merge([{
501| titulo: title_cell|trim,
502| origem: origin_cell|trim,
503| gerencia: mgmt_cell|trim,
504| prioridade: priority_cell|trim,
505| responsavel: responsible_cell|trim,
506| prazo: deadline_cell|trim,
507| pendencia: row.pending,
508| acoes: action_cell|trim
509| }]) %}
510| {% endfor %}
511|
512| <div class="row mb-3">
513| <div class="col-12">
514| {% include 'components/ui/_table_card.html.twig' with {
515| title: 'Plano de ação',
516| table_id: 'ssma-ap-panel-table',
517| headers: [
518| { title: 'Título da ação', responsivePriority: 1 },
519| { title: 'Origem', key: 'origem', class: 'text-center', responsivePriority: 3 },
520| { title: 'Gerência', responsivePriority: 2 },
521| { title: 'Prioridade', responsivePriority: 2 },
522| { title: 'Quem executa', responsivePriority: 3 },
523| { title: 'Quem valida', responsivePriority: 3 },
524| { title: 'Prazo', responsivePriority: 2 },
525| { title: 'Pendência', responsivePriority: 4 },
526| { title: 'Ações', key: 'acoes', class: 'text-center', responsivePriority: 1 }
527| ],
528| rows: ap_table_rows,
529| empty_message: 'Nenhuma ação encontrada.',
530| datatable_options: {
531| ordering: false,
532| searching: false,
533| pageLength: panel_table.page_length|default(10),
534| lengthMenu: [[10, 25, 50], [10, 25, 50]],
535| lengthChange: true,
536| language: {
537| emptyTable: 'Nenhuma ação encontrada.',
538| zeroRecords: 'Nenhuma ação corresponde aos filtros.',
539| info: 'Mostrando _END_ de _TOTAL_ ações',
540| infoEmpty: 'Mostrando 0 de 0 ações',
541| lengthMenu: 'Resultados por página _MENU_',
542| paginate: { previous: '<', next: '>' }
543| }
544| }
545| } %}
546| </div>
547| </div>
548|
549| {% include 'ssma/action_plan/partials/_action_plan_semantic_adriana.html.twig' with {
550| view_mode: 'pendencias',
551| semantic: panel_semantic,
552| adriana: panel_adriana,
553| context: 'action_plan',
554| row_id: 'ssma-ap-semantic-adriana-pendencias'
555| } %}
556| </div>
557|
558| <div data-ap-panel-view="visao_geral" class="d-none">
559| {% include 'ssma/action_plan/tabs/_tab_painel_visao_geral.html.twig' %}
560| </div>
561|
562| <div data-ap-panel-view="comparativo" class="d-none">
563| <div class="ssma-ap-view-placeholder" id="ssma-ap-comparativo-root">
564| Comparativo entre unidades — carregando dados…
565| </div>
566| </div>
567|</div>
568|
569|<script src="{{ asset('js/ssma/action_plan_panel.js') }}"></script>
570|
Request #112
deepseek-v4-flash
P:35.72K C:734 CR:34.05K CW:0
6032ms
Reasoning
Confirmed. SSR rows built in `_tab_painel.html.twig` contain keys: titulo, origem, gerencia, prioridade, responsavel, prazo, pendencia, acoes (8 columns). Header now has 9 columns: Título, Origem, Gerência, Prioridade, Quem executa, Quem valida, Prazo, Pendência, Ações.
The table card keys map to headers. Wait — how does `_table_card.html.twig` map row keys to headers? It uses column key from the header; keys that are not present in the row? In the JS table component, rows map keyed objects; headers with `key` property use the row key. But here headers lack `key` for all but origem and acoes, meaning the row order in the template likely follows insertion order and the header displays row[key]. For data-tables driven display (dynamic_table), likely requires all keys aligned by header index. Let me check `_table_card`/`_dynamic_table` component to determine behavior when header has a column without key vs row keyed differently. It's likely that the component iterates headers and reads rows[header.key] — if no key, uses title as fallback key? That would produce empty cells everywhere; but the pre-existing table already worked with this scheme (headers without keys, rows keyed titulo/origem/gerencia/prioridade/responsavel/prazo/pendencia/acoes). So likely the DataTable maps each header index to row value by... hmm. If it required keys, the original 8-col table wouldn't render either unless title used as key. In the original, header "Título da ação" has no key and row has titulo → empty. So there must be a positional mapping: rows provided as array of strings; and the JS DataTable takes row values positionally. But rows here are keyed objects (not arrays). Let me quickly view `_table_card.html.twig` to understand row rendering; this matters because if DataTable uses positional arrays from keyed objects via `Object.values(row)`? Then the header count mismatch (9 vs 8) is a real desync.
Actually the key question: whether the new header columns (Quem executa/Quem valida) will match new keys or map by position. If rows contain only 'responsavel' (position 5), and headers put Quem executa at position 5 and Quem valida at position 6, positional mapping means Quem executa column will show responsible avatars, Quem valida will show prazo, prazo will show pendencia... everything shifted by one. That's exactly the bug I described. If mapping is by header key, then all non-keyed headers display empty and the pre-existing behavior would have been broken — unlikely.
Let me check the table_card component to confirm how rows map.
A montagem das linhas no template confirma 8 chaves (`titulo, origem, gerencia, prioridade, responsavel, prazo, pendencia, acoes`) contra 9 cabeçalhos. Vou ver como o componente `_table_card` mapeia linha↔cabeçalho para fechar o diagnóstico.
Tool Calls (1)
file_read
Show Details
Arguments
{"file_path": "templates/components/ui/_table_card.html.twig"}
Result
File: templates/components/ui/_table_card.html.twig (Total lines: 252)
IS_TRUNCATED: false
LINE_RANGE: 1-252
1|{#
2| Reusable table card wrapper.
3|
4| Combines a card header (title + filters) with an injected table component.
5| Ideal for contexts where filters should stay inside the card instead of the global header actions row.
6|
7| @param string title - Título exibido no header do card.
8| @param string table_id - Default table ID for the injected table component.
9| @param array headers - Default headers passed to the injected table component.
10| @param array rows - Default rows passed to the injected table component.
11| @param array filters - Lista de filtros a exibir no header do card. Cada item pode ser:
12| - { type: 'search', id: 'my-search', placeholder: 'Buscar...' }
13| - { type: 'select', id: 'mySelect', label: 'Label', column: N, options: [{value:'', text:'Todos'}, ...] }
14| @param object datatable_options - Default DataTables options (optional).
15| @param string empty_message - Empty-state message (optional).
16| @param bool with_checkbox - Enables checkbox column (optional).
17| @param array bulk_actions - Bulk actions config (optional).
18| @param string table_template - Twig template used to render the table (optional).
19| @param array table_context - Full context override for the table template (optional).
20|
21| Styles are loaded from:
22| - public/css/metahuman-standard/components/_table_card.css
23|
24| JavaScript is loaded from:
25| - public/js/metahuman-standard/components/_table_card.js
26|
27| Usage:
28| {% include 'components/ui/_table_card.html.twig' with {
29| 'title': 'Relacionamento da Campanha',
30| 'table_id': 'myTable',
31| 'headers': [{'title': 'Nome'}, {'title': 'Status'}],
32| 'rows': rows,
33| 'filters': [
34| {'type': 'search', 'id': 'my-search', 'placeholder': 'Buscar...'},
35| {'type': 'select', 'id': 'mySelect', 'label': 'Status', 'column': 1, 'options': [
36| {'value': '', 'text': 'Todos'},
37| {'value': 'ACTIVE', 'text': 'Ativo'}
38| ]}
39| ]
40| } %}
41|#}
42|
43|{% set filters = filters|default([]) %}
44|{% set empty_message = empty_message|default('Nenhum dado encontrado.') %}
45|{% set with_checkbox = with_checkbox|default(false) %}
46|{% set bulk_actions = bulk_actions|default({}) %}
47|{% set checkbox_header_label = checkbox_header_label|default('') %}
48|{% set checkbox_control = checkbox_control|default('checkbox') %}
49|{% set show_select_all = show_select_all|default(true) %}
50|{% set default_table_id = table_id|default('table-card-' ~ random()) %}
51|{% set table_template = table_template|default('components/ui/_dynamic_table.html.twig') %}
52|{% set title_html = title_html|default(null) %}
53|{% set header_actions = header_actions|default(null) %}
54|{% set default_table_context = {
55| 'table_id': default_table_id,
56| 'headers': headers|default([]),
57| 'rows': rows|default([]),
58| 'datatable_options': datatable_options|default({}),
59| 'empty_message': empty_message,
60| 'with_checkbox': with_checkbox,
61| 'bulk_actions': bulk_actions,
62| '_table_card_context': true,
63| 'checkbox_header_label': checkbox_header_label,
64| 'checkbox_control': checkbox_control,
65| 'show_select_all': show_select_all
66|} %}
67|{% set table_context = default_table_context|merge(table_context|default({})) %}
68|{% set table_card_id = table_context.table_id|default(default_table_id) %}
69|
70|<style>
71| .mhs-table-card-header {
72| display: flex;
73| align-items: center;
74| justify-content: space-between;
75| padding: 12px 16px;
76| border-bottom: 1px solid #ECEEEE;
77| gap: 12px;
78| flex-wrap: wrap;
79| }
80|
81| .mhs-table-card-title {
82| font-size: 16px;
83| font-weight: 700;
84| color: #5C5D5D;
85| white-space: nowrap;
86| }
87|
88| .mhs-table-card-right {
89| display: flex;
90| align-items: center;
91| gap: 8px;
92| flex-wrap: wrap;
93| margin-left: auto;
94| }
95|
96| .mhs-table-card-filters {
97| display: flex;
98| align-items: center;
99| gap: 8px;
100| flex-wrap: wrap;
101| }
102|
103| .mhs-table-card-filters .filter-item {
104| display: flex;
105| align-items: center;
106| }
107|
108| .mhs-table-sort-icon {
109| font-size: 10px;
110| transition: transform 0.2s;
111| }
112|
113| button[data-direction="desc"] .mhs-table-sort-icon {
114| transform: rotate(180deg);
115| }
116|
117| @media (max-width: 768px) {
118| .mhs-table-card-header {
119| flex-direction: column;
120| align-items: flex-start;
121| }
122|
123| .mhs-table-card-filters {
124| width: 100%;
125| }
126|
127| .mhs-table-card-right {
128| width: 100%;
129| margin-left: 0;
130| }
131| }
132|</style>
133|
134|<div class="app-card-surface mb-3 mhs-table-card" data-table-card-id="{{ table_card_id }}" style="overflow-x: auto;">
135|
136| {# Card header: title + filters #}
137| <div class="mhs-table-card-header">
138| {% if title_html %}
139| <span class="mhs-table-card-title">{{ title_html|raw }}</span>
140| {% elseif title is defined and title %}
141| <span class="mhs-table-card-title">{{ title }}</span>
142| {% endif %}
143|
144| {% if filters|length > 0 or header_actions %}
145| <div class="mhs-table-card-right">
146| {% if filters|length > 0 %}
147| <div class="mhs-table-card-filters">
148| {% for filter in filters %}
149| {% if filter.type == 'select' %}
150| <div class="filter-item mhs-table-card-filter"
151| data-table-card-filter="true"
152| data-filter-type="select"
153| data-filter-id="{{ filter.id }}"
154| {% if filter.column is defined %}data-filter-column="{{ filter.column }}"{% endif %}>
155| {# `only`: evita herdar `title` do card (ex.: "Tipos de ação"), que virava title="" no select e tooltip errado. #}
156| {% include 'components/ui/_custom_select.html.twig' with {
157| 'id': filter.id,
158| 'name': filter.id,
159| 'label': filter.label|default('Filtrar'),
160| 'options': filter.options|default([])
161| } only %}
162| </div>
163| {% elseif filter.type == 'search' %}
164| <div class="filter-item mhs-table-card-filter"
165| data-table-card-filter="true"
166| data-filter-type="search"
167| data-filter-id="{{ filter.id }}">
168| {% include 'components/ui/_search_expandable.html.twig' with {
169| 'id': filter.id,
170| 'placeholder': filter.placeholder|default('Buscar...')
171| } only %}
172| </div>
173| {% elseif filter.type == 'sort' %}
174| <div class="filter-item mhs-table-card-filter"
175| data-table-card-filter="true"
176| data-filter-type="sort"
177| data-filter-id="{{ filter.id }}"
178| {% if filter.column is defined %}data-filter-column="{{ filter.column }}"{% endif %}>
179| <button type="button"
180| id="{{ filter.id }}"
181| class="select-btn custom-modern-select-trigger"
182| data-column="{{ filter.column }}"
183| data-direction="asc">
184| <span>{{ filter.label|default('Ordenar') }}</span>
185| <i class="fas fa-arrow-up mhs-table-sort-icon"></i>
186| </button>
187| </div>
188| {% endif %}
189| {% endfor %}
190| </div>
191| {% endif %}
192| {% if header_actions %}
193| {{ header_actions|raw }}
194| {% endif %}
195| </div>
196| {% endif %}
197| </div>
198|
199| {% include table_template with table_context %}
200|</div>
201|
202|{# Wire up filters to DataTables #}
203|{% if filters|length > 0 %}
204|<script>
205|(function () {
206| var tableId = {{ table_card_id|json_encode|raw }};
207|
208| if (window.initCustomSelects) {
209| window.initCustomSelects();
210| }
211|
212| function onTableReady(cb) {
213| if (window.MetahumanDataTables) {
214| window.MetahumanDataTables.whenReady(tableId, cb);
215| return;
216| }
217|
218| if (typeof $ !== 'undefined' && $.fn.DataTable && $.fn.DataTable.isDataTable('#' + tableId)) {
219| cb($('#' + tableId).DataTable());
220| return;
221| }
222|
223| setTimeout(function () { onTableReady(cb); }, 100);
224| }
225|
226| onTableReady(function (dt) {
227|
228| {% for filter in filters %}
229| {% if filter.type == 'search' %}
230| $(document).on('input', '#{{ filter.id }}-input', function () {
231| dt.search($(this).val()).draw();
232| });
233| {% elseif filter.type == 'select' and filter.column is defined %}
234| if (typeof setupTableSelectFilter === 'function') {
235| setupTableSelectFilter('#{{ filter.id }}', tableId, {{ filter.column }});
236| }
237| {% elseif filter.type == 'sort' %}
238| $(document).on('click', '#{{ filter.id }}', function () {
239| var $btn = $(this);
240| var col = {{ filter.column }};
241| var dir = $btn.data('direction') === 'asc' ? 'desc' : 'asc';
242|
243| $btn.data('direction', dir).attr('data-direction', dir).addClass('active');
244| dt.order([[col, dir]]).draw();
245| });
246| {% endif %}
247| {% endfor %}
248| });
249|})();
250|</script>
251|{% endif %}
252|
Request #113
deepseek-v4-flash
P:39.18K C:108 CR:36.35K CW:0
1570ms
Reasoning
The table_card just includes `_dynamic_table.html.twig`. Rows are passed keyed objects; the dynamic table component probably renders DataTable with positional column arrays? Let me look at `_dynamic_table.html.twig` to know how rows map to columns.
Tool Calls (1)
file_read
Show Details
Arguments
{"file_path": "templates/components/ui/_dynamic_table.html.twig"}
Result
File: templates/components/ui/_dynamic_table.html.twig (Total lines: 280)
IS_TRUNCATED: false
LINE_RANGE: 1-280
1|{# templates/components/ui/_dynamic_table.html.twig #}
2|
3|{#
4| Reusable dynamic table component with DataTables.
5|
6| Styles are loaded from:
7| - public/css/metahuman-standard/components/_dynamic_table.css
8|
9| JavaScript is loaded from:
10| - public/js/metahuman-standard/components/_dynamic_table.js
11|
12| @param array headers
13| @param array rows
14| @param string title
15| @param string table_id
16| @param bool with_checkbox
17| @param array datatable_options Optional DataTables options. Use skipResponsiveEdgeDefaults: true
18| to disable the default always-visible first data column and
19| high-priority (hideable) last column.
20| @param array bulk_actions
21|#}
22|
23|{% set headers = headers|default([]) %}
24|{% set rows = rows|default([]) %}
25|{% set title = title|default('') %}
26|{% set table_id = table_id|default('dynamic-table-' ~ random()) %}
27|{% set with_checkbox = with_checkbox|default(false) %}
28|{% set datatable_options = datatable_options|default({}) %}
29|{% set empty_message = empty_message|default('Nenhum dado encontrado.') %}
30|{% set header_checkbox_disabled = header_checkbox_disabled|default(false) %}
31|{% set custom_checkbox_style = custom_checkbox_style|default(false) %}
32|{% set checkbox_config = checkbox_config|default({}) %}
33|{% set bulk_actions = bulk_actions|default({}) %}
34|{% set checkbox_name = checkbox_name|default('row_id[]') %}
35|{% set checkbox_control = checkbox_control|default('checkbox') %}
36|{% set show_select_all = show_select_all|default(true) %}
37|{% set checkbox_header_label = checkbox_header_label|default('') %}
38|
39|<style>
40| .dynamic-table-component {
41| background: #FBFCFD;
42| border: 1px solid #ECEEEE;
43| border-radius: 5px !important;
44| font-family: 'Inter', sans-serif;
45| }
46|
47| /* Ancora o overlay de processamento ao wrapper; evita "Carregando..." solto perto do rodapé/paginação */
48| .dynamic-table-component .dataTables_wrapper {
49| position: relative;
50| }
51|
52| .dynamic-table-component .dataTables_processing {
53| display: none !important;
54| }
55|
56| /* Scoped overrides: ensure member-cell layout is never broken by external CSS
57| (e.g. crm_custom.css redefines .member-info without flex-direction, making
58| names appear centred / misaligned when both files are loaded on the same page) */
59| .dynamic-table-component .member-cell {
60| display: flex;
61| align-items: center;
62| gap: 6px;
63| }
64|
65| .dynamic-table-component .member-info {
66| display: flex;
67| flex-direction: column;
68| align-items: flex-start;
69| gap: 0;
70| }
71|
72| .table-figma {
73| width: 100%;
74| border-collapse: collapse;
75| border-radius: 5px !important;
76| }
77|
78| .table-figma thead {
79| background-color: #EAEEF3 !important;
80| }
81|
82| .table-figma th {
83| padding: 10px;
84| font-weight: 700;
85| font-size: 12px;
86| color: #5C5D5D;
87| text-align: left;
88| border-bottom: 1px solid #ECEEEE;
89| background-color: #EAEEF3 !important;
90| }
91|
92| .table-figma tbody tr {
93| border-bottom: 1px solid #ECEDED;
94| background-color: #FFFFFF !important;
95| }
96|
97| .table-figma tbody tr:nth-child(even) {
98| background-color: #FAFBFC !important;
99| }
100|
101| .table-figma tbody tr:last-child {
102| border-bottom: none;
103| }
104|
105| .table-figma td {
106| padding: 15px 10px;
107| vertical-align: middle;
108| background-color: transparent !important;
109| font-size: 14px;
110| }
111|
112| /* Footer layout — inline style wins over static external CSS order-wise.
113| Using .dataTables_wrapper prefix (0-2-0) beats DataTables CDN (0-2-0 tie)
114| only when this style block is stamped later; for the container itself,
115| specificity 0-1-0 is enough since CDN doesn't target our custom class. */
116| .datatable-footer {
117| display: flex !important;
118| justify-content: space-between !important;
119| align-items: center !important;
120| flex-wrap: nowrap !important;
121| gap: 8px !important;
122| width: 100% !important;
123| padding: 20px 10px !important;
124| background-color: #FBFCFD !important;
125| border-top: 1px solid #ECEEEE !important;
126| border-radius: 0 0 5px 5px !important;
127| font-size: 12px !important;
128| font-weight: 600 !important;
129| color: #5C5D5D !important;
130| }
131|
132| /* 0-3-0 specificity — always beats DataTables CDN responsive CSS
133| which uses .dataTables_wrapper .dataTables_xxx (0-2-0) */
134| .dataTables_wrapper .datatable-footer .dataTables_info,
135| .dataTables_wrapper .datatable-footer .dt-info {
136| flex: 0 0 auto !important;
137| font-size: 12px !important;
138| font-weight: 600 !important;
139| white-space: nowrap !important;
140| display: inline-block !important;
141| }
142|
143| .dataTables_wrapper .datatable-footer .dataTables_paginate,
144| .dataTables_wrapper .datatable-footer .dt-paging {
145| flex: 1 1 auto !important;
146| text-align: center !important;
147| display: flex !important;
148| justify-content: center !important;
149| align-items: center !important;
150| gap: 5px !important;
151| min-width: 0 !important;
152| }
153|
154| .dataTables_wrapper .datatable-footer .dataTables_length,
155| .dataTables_wrapper .datatable-footer .dt-length {
156| flex: 0 0 auto !important;
157| text-align: right !important;
158| margin: 0 !important;
159| display: flex !important;
160| align-items: center !important;
161| justify-content: flex-end !important;
162| gap: 8px !important;
163| white-space: nowrap !important;
164| }
165|
166| .dataTables_wrapper .datatable-footer .dataTables_length select,
167| .dataTables_wrapper .datatable-footer .dt-length select {
168| height: 28px !important;
169| padding: 2px 6px !important;
170| border: 1px solid #ECEEEE !important;
171| border-radius: 5px !important;
172| font-size: 12px !important;
173| font-weight: 600 !important;
174| background: #FFFFFF !important;
175| color: #5C5D5D !important;
176| cursor: pointer !important;
177| outline: none !important;
178| min-width: 55px !important;
179| }
180|
181| @media (max-width: 768px) {
182| .dynamic-table-component {
183| margin-bottom: 32px !important;
184| }
185|
186| .datatable-footer {
187| flex-direction: column !important;
188| align-items: center !important;
189| gap: 12px !important;
190| }
191|
192| .dataTables_wrapper .datatable-footer .dataTables_info,
193| .dataTables_wrapper .datatable-footer .dt-info,
194| .dataTables_wrapper .datatable-footer .dataTables_paginate,
195| .dataTables_wrapper .datatable-footer .dt-paging,
196| .dataTables_wrapper .datatable-footer .dataTables_length,
197| .dataTables_wrapper .datatable-footer .dt-length {
198| justify-content: center !important;
199| text-align: center !important;
200| }
201| }
202|</style>
203|
204|{% if with_checkbox and bulk_actions is not empty %}
205|<div class="bulk-actions-row" id="bulkActionsBar_{{ table_id }}" style="display: none;">
206| <span class="bulk-count"><strong id="selectedCount_{{ table_id }}">0</strong> Candidatos Selecionados:</span>
207|
208| {% if bulk_actions.primary is defined %}
209| <button type="button"
210| class="mhs-btn-table-action border"
211| id="btnBulkPrimary_{{ table_id }}"
212| {% if bulk_actions.primary.modal is defined %}data-toggle="modal" data-target="{{ bulk_actions.primary.modal }}"{% endif %}
213| {% if bulk_actions.primary.onclick is defined %}onclick="{{ bulk_actions.primary.onclick }}"{% endif %}>
214| {{ bulk_actions.primary.label|default('Ação') }}
215| </button>
216| {% endif %}
217|
218| {% if bulk_actions.danger is defined %}
219| <button type="button"
220| class="mhs-btn-table-action mhs-btn-table-action-outline-danger border"
221| id="btnBulkDanger_{{ table_id }}"
222| {% if bulk_actions.danger.modal is defined %}data-toggle="modal" data-target="{{ bulk_actions.danger.modal }}"{% endif %}
223| {% if bulk_actions.danger.onclick is defined %}onclick="{{ bulk_actions.danger.onclick }}"{% endif %}>
224| {{ bulk_actions.danger.label|default('Cancelar') }}
225| </button>
226| {% endif %}
227|
228| {% if bulk_actions.talent is defined %}
229| <button type="button"
230| class="mhs-btn-table-action border"
231| id="btnBulkTalent_{{ table_id }}"
232| style="display: none;"
233| {% if bulk_actions.talent.modal is defined %}data-toggle="modal" data-target="{{ bulk_actions.talent.modal }}"{% endif %}
234| {% if bulk_actions.talent.onclick is defined %}onclick="{{ bulk_actions.talent.onclick }}"{% endif %}>
235| {{ bulk_actions.talent.label|default('Incluir Talento') }}
236| </button>
237| {% endif %}
238|
239| {% if bulk_actions.show_clear is not defined or bulk_actions.show_clear %}
240| <button type="button" class="mhs-btn-table-action mhs-btn-table-action-secondary border" id="btnClearSelection_{{ table_id }}">
241| Limpar Seleção
242| </button>
243| {% endif %}
244|</div>
245|{% endif %}
246|
247|<div class="dynamic-table-component"
248| data-dynamic-table="true"
249| data-table-id="{{ table_id }}"
250| data-headers="{{ headers|json_encode|e('html_attr') }}"
251| data-datatable-options="{{ datatable_options|json_encode|e('html_attr') }}"
252| data-with-checkbox="{{ with_checkbox ? 'true' : 'false' }}"
253| data-has-rows="{{ rows|length > 0 ? 'true' : 'false' }}"
254| data-empty-message="{{ empty_message|e('html_attr') }}">
255| <table id="{{ table_id }}" class="table-figma display responsive striped-table" style="width:100%">
256| <thead>
257| <tr>
258| {% if with_checkbox %}
259| <th class="all" style="width: 10px; text-align:center;">
260| <input type="checkbox" class="select-all{% if custom_checkbox_style %} custom-checkbox{% endif %}" {% if header_checkbox_disabled %}disabled{% endif %}>
261| </th>
262| {% endif %}
263| {% for header in headers %}
264| <th class="{{ header.class|default('') }}">{{ header.title|raw }}</th>
265| {% endfor %}
266| </tr>
267| </thead>
268| {% include 'components/ui/partials/_table_body_rows.html.twig' with {
269| 'headers': headers,
270| 'rows': rows,
271| 'with_checkbox': with_checkbox,
272| 'custom_checkbox_style': custom_checkbox_style,
273| 'checkbox_name': checkbox_name,
274| 'checkbox_control': checkbox_control,
275| 'table_id': table_id,
276| 'empty_message': empty_message
277| } only %}
278| </table>
279|</div>
280|
Request #114
deepseek-v4-flash
P:42.51K C:88 CR:39.17K CW:0
2091ms
Reasoning
The dynamic table uses `_table_body_rows.html.twig` to render rows. Let me read that partial to see how the row keys map.
Tool Calls (1)
file_read
Show Details
Arguments
{"file_path": "templates/components/ui/partials/_table_body_rows.html.twig"}
Result
File: templates/components/ui/partials/_table_body_rows.html.twig (Total lines: 145)
IS_TRUNCATED: false
LINE_RANGE: 1-145
1|<tbody>
2| {% for row in rows %}
3| <tr {% if row.id is defined %}id="team_{{ row.id }}"{% endif %}{% if row._rowClass is defined and row._rowClass %} class="{{ row._rowClass|e('html_attr') }}"{% endif %}{% if row.tr_attributes is defined and row.tr_attributes is iterable %}{% for attr, value in row.tr_attributes %} {{ attr }}="{{ value|e('html_attr') }}"{% endfor %}{% endif %}{% for key, val in row %}{% if key[0:1] == '_' and key not in ['_canSelect', '_checked', '_rowClass'] and val is not iterable %} data-{{ key|slice(1) }}="{{ val|e('html_attr') }}"{% endif %}{% endfor %}>
4| {% if with_checkbox %}
5| {% set checkboxDisabled = row._canSelect is defined and row._canSelect == false %}
6| {% set checkboxChecked = row._checked is defined and row._checked %}
7| {% set rowCheckboxValue = row.id is defined ? row.id : ('[id]' in checkbox_name ? '1' : loop.index) %}
8| {% set rowCheckboxId = 'rowControl_' ~ table_id|default('table') ~ '_' ~ loop.index %}
9| <td style="text-align:center;">
10| {% if checkbox_control|default('checkbox') == 'switch' %}
11| <div class="form-toggle-switch mhs-table-row-switch justify-content-center" style="gap:0;">
12| <input type="checkbox"
13| id="{{ rowCheckboxId }}"
14| class="row-checkbox{% if custom_checkbox_style %} custom-checkbox{% endif %}"
15| name="{{ checkbox_name|replace({'[id]': '[' ~ row.id ~ ']'}) }}"
16| value="{{ rowCheckboxValue }}"
17| {% if checkboxChecked %}checked{% endif %}
18| {% if checkboxDisabled %}disabled{% endif %}>
19| <label for="{{ rowCheckboxId }}" aria-label="Alternar status"></label>
20| </div>
21| {% else %}
22| <input type="checkbox"
23| class="row-checkbox{% if custom_checkbox_style %} custom-checkbox{% endif %}"
24| name="{{ checkbox_name|replace({'[id]': '[' ~ row.id ~ ']'}) }}"
25| value="{{ rowCheckboxValue }}"
26| {% if checkboxChecked %}checked{% endif %}
27| {% if checkboxDisabled %}disabled{% endif %}>
28| {% endif %}
29| </td>
30| {% endif %}
31|
32| {% for key, cell in row %}
33| {% if key != 'id' and key[0:1] != '_' and key != 'tr_attributes' %}
34| {% set tdClass = loop.first ? 'dtr-control' : '' %}
35| {% for header in headers %}
36| {% set headerKey = header.key|default(header.title) %}
37| {% if headerKey == key and header.class|default('') %}
38| {% set tdClass = tdClass ~ (tdClass ? ' ' : '') ~ header.class %}
39| {% endif %}
40| {% endfor %}
41| <td{% if tdClass %} class="{{ tdClass }}"{% endif %}>
42| {% if key == 'member' %}
43| <div class="member-cell">
44| <div class="user-avatar-container {% if cell.hasCrown|default(false) %}has-crown{% endif %}">
45| {% if cell.hasCrown|default(false) %}
46| <img src="{{ asset('images/employee-advocacy/image.png') }}" class="crown-icon" alt="Crown">
47| {% endif %}
48| {% if cell.avatar is defined and cell.avatar is not empty and cell.avatar is not null %}
49| <img src="{{ asset(cell.avatar) }}" class="user-avatar-image {% if cell.hasCrown|default(false) %}crowned{% endif %}" onerror="this.onerror=null; this.style.display='none'; this.nextElementSibling.style.display='flex';">
50| <div class="user-avatar user-avatar-fallback {% if cell.hasCrown|default(false) %}crowned{% endif %}" style="display: none; background-color: {{ cell.avatar_bg | default('#CCCCCC') }};">
51| <span>{{ cell.name | first | upper }}</span>
52| </div>
53| {% else %}
54| <div class="user-avatar {% if cell.hasCrown|default(false) %}crowned{% endif %}" style="background-color: {{ cell.avatar_bg | default('#CCCCCC') }};">
55| <span>{{ cell.name | first | upper }}</span>
56| </div>
57| {% endif %}
58| {% if cell.online_status is defined and cell.online_status %}
59| <span class="user-status-indicator"
60| style="background-color: {{ cell.online_status == 'online' ? '#1E9E04' : (cell.online_status == 'offline' ? '#E2AE02' : '#B2B2B2') }};">
61| </span>
62| {% endif %}
63| </div>
64| <div class="member-info">
65| <div class="member-name">{{ cell.name }}</div>
66| {% if cell.email is defined and cell.email %}
67| <div class="member-email">{{ cell.email }}</div>
68| {% endif %}
69| </div>
70| </div>
71| {% elseif key == 'team' %}
72| {% if cell is not empty and cell is iterable %}
73| <div class="teams-container">
74| {% for team_name in cell %}
75| {% if team_name is not empty %}
76| <span class="team-badge">{{ team_name }}</span>
77| {% endif %}
78| {% endfor %}
79| </div>
80| {% else %}
81| <span></span>
82| {% endif %}
83| {% elseif key == 'actions' or key == 'Ações' %}
84| <div class="actions-cell">
85| {% for action in cell %}
86| {% if action.type == 'button' %}
87| <a href="{{ action.url | default('#') }}" class="btn btn-sm {{ action.class | default('mhs-btn-table-action border') }}"
88| {% if action.attributes is defined and action.attributes is iterable %}
89| {% for attr, value in action.attributes %}
90| {{ attr }}="{{ value }}"
91| {% endfor %}
92| {% endif %}>
93| {% if action.icon is defined and action.icon %}
94| <i class="{{ action.icon }}"></i>
95| {% endif %}
96| {% if action.label is defined and action.label and action.icon is defined and action.icon %}
97| <span class="ml-1">{{ action.label }}</span>
98| {% elseif action.label is defined and action.label %}
99| {{ action.label }}
100| {% endif %}
101| </a>
102| {% elseif action.type == 'dropdown' %}
103| <div class="dropdown d-inline-block">
104| <button class="btn btn-sm btn-default" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
105| <i class="fas fa-ellipsis-v"></i>
106| </button>
107| <div class="dropdown-menu dropdown-menu-right">
108| {% for item in action.items %}
109| <a class="dropdown-item {{ item.class|default('') }}" href="{{ item.url | default('#') }}"
110| {% if item.attributes is defined and item.attributes is iterable %}
111| {% for attr, value in item.attributes %}
112| {{ attr }}="{{ value }}"
113| {% endfor %}
114| {% endif %}>
115| {% if item.icon is defined and item.icon %}
116| <i class="{{ item.icon }}"></i>
117| {% endif %}
118| {{ item.label }}
119| </a>
120| {% endfor %}
121| </div>
122| </div>
123| {% endif %}
124| {% endfor %}
125| </div>
126| {% else %}
127| {{ cell|raw }}
128| {% endif %}
129| </td>
130| {% endif %}
131| {% endfor %}
132| </tr>
133| {% else %}
134| <tr class="datatable-empty-message">
135| {% set totalColumns = headers|length %}
136| {% if with_checkbox %}
137| {% set totalColumns = totalColumns + 1 %}
138| {% endif %}
139| <td colspan="{{ totalColumns }}" class="text-center text-muted" style="padding: 40px 20px;">
140| {{ empty_message }}
141| </td>
142| </tr>
143| {% endfor %}
144|</tbody>
145|
Request #115
deepseek-v4-flash
P:44.73K C:1.2K CR:42.5K CW:0
10172ms
Reasoning
Now this is crucial. In `_table_body_rows.html.twig`, row cells are rendered by iterating row keys in order (`for key, cell in row`), creating one `<td>` per row key. The headers just provide `<th>` count. There's no positional alignment between headers and row cells except by CSS classes.
So the SSR table `<tbody>` will have rows with 8 `<td>`s (order: titulo, origem, gerencia, prioridade, responsavel, prazo, pendencia, acoes — based on the merge array insertion order; Twig preserves insertion order). The `<thead>` has 9 `<th>`s. DataTables will then complain: "Requested unknown parameter" is not applicable for server HTML. Actually DataTables auto-detect columns from the header; with 9 `<th>` and 8 `<td>`, cells misalign: the header shows: Título, Origem, Gerência, Prioridade, Quem executa, Quem valida, Prazo, Pendência, Ações; but data columns 0..7 map: Título←titulo, Origem←origem, Gerência←gerencia, Prioridade←prioridade, Quem executa←responsavel (avatars), Quem valida←prazo(deadline), Prazo←pendencia, Pendência←acoes(buttons), Ações←(no data). DataTables may throw error "Requested unknown parameter '9' from the data source for row" only when column definitions exceed; but with plain HTML DataTables uses column count from header; extra cells are ignored? Actually mismatch between th and td counts in the first page of the table before DataTables processes: DataTables' `cells` per column - if header > data cells, DataTables will show fewer; the "Ações" column is empty and content misaligned. Also, responsive priority classes from headers may warn. The DataTables error "Requested unknown parameter" arises in ajax mode; here data is server-side HTML, so no such error. But the misalignment is real: the "Quem valida", "Prazo", "Pendência" contents shifted left by one, and "Ações" column is empty (the eye button appears under "Pendência"). DataTables "columns" will auto-scan from thead; tbody cells count mismatch can raise "Requested unknown parameter '8' from the data source for row 0" actually? I think DataTables uses columns from thead to render each row by column index; if fewer cells than columns, it may error with "Requested unknown parameter '8'" when drawing, because it expects each row to have at least columns count? Not exactly. DataTables converts each `<tr>` into an array of cell values via its row data source type 'dom'. With fewer cells than columns, DataTables may throw "Requested unknown parameter '8' from the data source for row 0"? That happens when the columns config asks for parameter beyond data length; DataTables auto-scan uses thead columns count (9), then for each row reads cells; if the row only has 8 cells, reading index 8 triggers error in `_aData` (undefined). DataTables might indeed produce that error during initialization for server-side-rendered tables with misaligned header count. Either way it's a real layout bug.
Also note: even earlier (before this PR), header/row counts matched at 8 columns (with 'Responsável'). Wait, the original was header columns: Título, Origem, Gerência, Prioridade, Responsável, Prazo, Pendência, Ações (8), and row keys 8 (titulo..acoes). So fine before; now the header adds 2 columns but row still 8 → mismatch.
Also updatePendenciasTable rebuilds rows with keys matching new header column count? Let's verify JS updatePendenciasTable builds 9 cells; row is an array? Let me read the JS around updatePendenciasTable to see its output format and check whether DataTable is re-initialized with column definitions or rebuilds HTML. If AJAX path rebuilds the table rows in JS (creating tr with 9 tds), the header already 9 so it's fine after the first AJAX load; the bug is only on initial server-rendered page.
Let me quickly re-check: the header diff is in this twig, and the JS updatePendenciasTable (already present) — but does the JS DataTable re-init use the existing thead? The JS builds rows via jq/DataTable? Need to ensure the JS row builder writes new cells to match. Let me read JS lines around updatePendenciasTable to confirm the JS builds 9 columns and also whether it destroys the DataTable each render. This confirms our claim that the initial SSR load is the misaligned one.
Let me view JS region lines ~880-1030.
O mapeamento é por posição das `<td>` no `<tbody>` (a partial itera as chaves da linha em ordem, sem casar com cada `<th>`). Vou confirmar como o JS reconstrói as linhas para saber se o desalinhamento afeta apenas a renderização inicial SSR.
Tool Calls (1)
file_read
Show Details
Arguments
{"file_path": "public/js/ssma/action_plan_panel.js", "start_line": 890, "end_line": 1060}
Result
File: public/js/ssma/action_plan_panel.js (Total lines: 2378)
IS_TRUNCATED: false
LINE_RANGE: 890-1060
890| }).filter(Boolean);
891| return names.length ? names.join(', ') : '—';
892| }
893|
894| function buildPendenciasTableRowHtml(row, originIcons) {
895| var deadlineClass = row.deadline_overdue ? 'overdue' : 'ok';
896| var originUrl = row.origin_url || '';
897| var executorNames = formatPeopleNames(row.executors || row.responsible || []);
898| var validatorNames = formatPeopleNames(row.validators || []);
899| var originBtn = originUrl
900| ? '<a class="ssma-ap-panel-table-action-btn" href="' + escapeHtml(originUrl) + '" title="Ir para origem" aria-label="Ir para origem">'
901| + '<i class="fas fa-external-link-alt" aria-hidden="true"></i></a>'
902| : '';
903| return '<tr>'
904| + '<td><div class="ssma-ap-table-title-main">' + escapeHtml(row.title) + '</div>'
905| + '<div class="ssma-ap-table-title-sub">' + escapeHtml(row.action_id || row.id) + '</div></td>'
906| + '<td class="text-center">' + buildOriginIconHtml(row.origin, originIcons) + '</td>'
907| + '<td><div class="ssma-ap-table-title-main">' + escapeHtml(row.management) + '</div>'
908| + '<div class="ssma-ap-table-mgmt-sub">' + escapeHtml(row.location) + '</div></td>'
909| + '<td><span class="mhs-pill mhs-pill--sm mhs-pill--' + priorityPillClass(row.priority_key) + '">'
910| + '<span class="mhs-pill-label">' + escapeHtml(row.priority) + '</span></span></td>'
911| + '<td>' + buildResponsibleStackHtml(row.executors || row.responsible) + '</td>'
912| + '<td>' + buildResponsibleStackHtml(row.validators || []) + '</td>'
913| + '<td><span class="ssma-ap-deadline--' + deadlineClass + '">' + escapeHtml(row.deadline) + '</span></td>'
914| + '<td>' + escapeHtml(row.pending) + '</td>'
915| + '<td class="text-center"><div class="d-inline-flex align-items-center" style="gap:6px;">'
916| + '<button type="button" class="ssma-ap-panel-table-action-btn js-ssma-ap-panel-view-action"'
917| + ' data-action-id="' + escapeHtml(row.id) + '"'
918| + ' data-action-title="' + escapeHtml(row.title || '') + '"'
919| + ' data-action-origin="' + escapeHtml(row.origin_label || row.occurrence_title || '') + '"'
920| + ' data-action-deadline="' + escapeHtml(row.deadline || '') + '"'
921| + ' data-action-pending="' + escapeHtml(row.pending || '') + '"'
922| + ' data-action-description="' + escapeHtml(row.description || '') + '"'
923| + ' data-action-origin-url="' + escapeHtml(originUrl) + '"'
924| + ' data-action-executors="' + escapeHtml(executorNames) + '"'
925| + ' data-action-validators="' + escapeHtml(validatorNames) + '"'
926| + ' title="Visualizar" aria-label="Visualizar ação">'
927| + '<i class="fas fa-eye" aria-hidden="true"></i></button>'
928| + originBtn
929| + '</div></td></tr>';
930| }
931|
932| function updatePendenciasTable(tableData, originIcons) {
933| var table = document.getElementById('ssma-ap-panel-table');
934| if (!table) {
935| return;
936| }
937| var tbody = table.querySelector('tbody');
938| if (!tbody) {
939| return;
940| }
941| var rows = (tableData && tableData.rows) || [];
942| var $ = window.jQuery;
943| if ($ && $.fn && $.fn.DataTable && $.fn.DataTable.isDataTable('#ssma-ap-panel-table')) {
944| $('#ssma-ap-panel-table').DataTable().clear().destroy();
945| }
946| tbody.innerHTML = rows.map(function (row) {
947| return buildPendenciasTableRowHtml(row, originIcons);
948| }).join('');
949| bindTableViewButtons();
950| if (window.MetahumanDataTables && typeof window.MetahumanDataTables.whenReady === 'function') {
951| window.MetahumanDataTables.whenReady('ssma-ap-panel-table', function () {
952| if ($ && $.fn && $.fn.DataTable && !$.fn.DataTable.isDataTable('#ssma-ap-panel-table')) {
953| $('#ssma-ap-panel-table').DataTable({
954| ordering: false,
955| searching: false,
956| pageLength: (tableData && tableData.page_length) || 10,
957| lengthMenu: [[10, 25, 50], [10, 25, 50]],
958| lengthChange: true,
959| language: {
960| emptyTable: 'Nenhuma ação encontrada.',
961| zeroRecords: 'Nenhuma ação corresponde aos filtros.',
962| info: 'Mostrando _END_ de _TOTAL_ ações',
963| infoEmpty: 'Mostrando 0 de 0 ações',
964| lengthMenu: 'Resultados por página _MENU_',
965| paginate: { previous: '<', next: '>' },
966| },
967| });
968| }
969| });
970| }
971| }
972|
973| function updateAxisFilterOptions(chartData) {
974| var select = document.getElementById('ssma-ap-chart-axis-filter');
975| if (!select || !chartData || !chartData.axes) {
976| return;
977| }
978| select.innerHTML = chartData.axes.map(function (axis) {
979| var selected = axis.selected ? ' selected' : '';
980| return '<option value="' + escapeHtml(axis.value) + '"' + selected + '>' + escapeHtml(axis.label) + '</option>';
981| }).join('');
982| panelState.axis = chartData.default_axis || panelState.axis;
983| }
984|
985| function applyPendenciasDom(panel) {
986| if (!panel) {
987| return;
988| }
989| updateKpiRow(panel.kpis || []);
990| updateRecommendationBlock(panel.recommendation || {});
991| updateOperationalSummary(panel.operational_summary || {});
992| updateSemanticAdriana(panel.semantic || {}, panel.adriana || {});
993| updateAxisFilterOptions((panel.charts || {}).critical_pending_by_deadline || {});
994| updatePendenciasTable(panel.table || {}, panel.origin_icons || {});
995| }
996|
997| function buildOverviewTableRowHtml(row, originIcons) {
998| var originMeta = (originIcons && originIcons[row.origin_type]) || {};
999| return '<tr>'
1000| + '<td>' + escapeHtml(row.code) + '</td>'
1001| + '<td>' + escapeHtml(row.action) + '</td>'
1002| + '<td><span class="action-plan-overview__origin-cell" title="' + escapeHtml(originMeta.title || row.origin) + '">'
1003| + '<span class="icon-badge icon-badge-sm icon-badge--' + escapeHtml(originMeta.variant || 'primary') + ' icon-badge--rounded">'
1004| + '<i class="fas ' + escapeHtml(originMeta.icon || 'fa-link') + '" aria-hidden="true"></i></span></span></td>'
1005| + '<td>' + escapeHtml(row.created_at) + '</td>'
1006| + '<td>' + escapeHtml(row.completed_at) + '</td>'
1007| + '<td class="text-center"><span class="action-plan-overview__time action-plan-overview__time--'
1008| + escapeHtml(row.fulfillment_time_class || 'ok') + '">' + escapeHtml(row.fulfillment_time) + ' dias</span></td>'
1009| + '<td class="text-center"><span class="action-plan-overview__time action-plan-overview__time--ok">'
1010| + escapeHtml(row.validation_time) + ' dias</span></td>'
1011| + '<td>' + escapeHtml(row.responsible) + '</td></tr>';
1012| }
1013|
1014| function updateOverviewTable(overview) {
1015| var table = document.getElementById('ssma-ap-overview-table');
1016| if (!table || !overview) {
1017| return;
1018| }
1019| var tbody = table.querySelector('tbody');
1020| if (!tbody) {
1021| return;
1022| }
1023| var originIcons = (panelData && panelData.origin_icons) || {};
1024| tbody.innerHTML = (overview.action_details || []).map(function (row) {
1025| return buildOverviewTableRowHtml(row, originIcons);
1026| }).join('');
1027| }
1028|
1029| function applyOverviewDom(overview) {
1030| if (!overview) {
1031| return;
1032| }
1033| var periodLabel = document.getElementById('ap_overview_period_label');
1034| if (periodLabel && overview.filters && overview.filters.period_label) {
1035| periodLabel.textContent = overview.filters.period_label;
1036| }
1037| var indicators = overview.indicators || [];
1038| updateOverviewKpiRow(indicators);
1039|
1040| var pagination = overview.pagination || {};
1041| var container = document.getElementById('ssma-ap-overview-pagination');
1042| if (container) {
1043| container.setAttribute('data-per-page', String(pagination.per_page || 10));
1044| container.setAttribute('data-total', String(pagination.total || 0));
1045| container.setAttribute('data-current-page', String(pagination.current_page || 1));
1046| container.setAttribute('data-last-page', String(pagination.last_page || 1));
1047| panelState.overviewPerPage = Number(pagination.per_page || panelState.overviewPerPage || 10);
1048| var perPageSelect = document.getElementById('ssma-ap-overview-per-page');
1049| if (perPageSelect) {
1050| perPageSelect.value = String(panelState.overviewPerPage);
1051| }
1052| updateOverviewPagination(Number(pagination.current_page || 1));
1053| }
1054| updateOverviewTable(overview);
1055| updateOverviewSemanticAdriana(overview.semantic_analysis || {}, overview.adriana_insights || {});
1056| }
1057|
1058| function renderComparativoView(data) {
1059| var root = document.getElementById('ssma-ap-comparativo-root');
1060| if (!root) {
Request #116
deepseek-v4-flash
P:48.66K C:989 CR:45.82K CW:0
8797ms
Reasoning
Confirmed. On the initial SSR page the table header is 9 columns while the SSR rows are built with 8 `<td>`s in this twig file. After the first AJAX filter request, updatePendenciasTable rebuilds rows via JS with 9 cells (matching). So the bug: initial page load shows misaligned columns and empty "Ações" column; also the first DataTables init sees a mismatch between `<th>` (9) and the `<td>` count (8) per row, which DataTables auto-config may translate into the "Requested unknown parameter" or misalignment. This is a real regression from this PR's own header change without updating SSR rows. My comment stands.
Additionally, on the SSR first load the eye-button exists (in action_cell at position 8 = under Pendência), and data-action attributes missing (no data-action-* attributes in SSR — only data-action-id). So even the first-load eye button would fail to show anything via openActionViewOffcanvas except id — finding #1 confirmed earlier (offcanvas markup missing).
I've validated two new comments. Both are solid:
1. SSR rows/cells mismatch (template) — high/bug.
2. Wrong origin URL path for occurrence detail — high/bug.
Given the review rules, I should be careful not to over-report. But there could be one more subtle thing: In `resolveOriginUrl`, for inspection/approach path check is placed before occurrence link. Actually there's an interesting data flow: inspection/approach actions may also carry occurrence_id; they return the specific detail. OK.
Another one worth a quick second thought: the event_id fallback route `/manager/ssma/ocorrencias?event=` uses wrong base too (list route exists at `/manager/ssma/ocorrencias`), but does the listing page consume `?event=` to deep-link a specific event? Let me not flag; the primary occurrence bug covers it and I referenced it.
Now let me also scan the mine filter backend: after the `if ($request->query->getBoolean('mine'))` block, if $mineId>0 the payload is rebuilt with scope filter [$mineId=>true]. But notice: the payload was already built once (before) for the non-mine case. Building again just overwrites. Fine, although wasteful duplicate call only when mine. Not a real bug. But subtle issue: for the "mine" filter, they pass scope filter [$mineId => true], which sets scope filter to only member = me. But is that consistent with a supervisor who should see team scope normally but with mine on sees just mine? Yes intended.
Wait, but there's an important detail: for gestor/admin (member with can_create... whatever), scopeFilter is normally null → sees all. With mine, restricts to mine. Good.
Actually, is there a subtle case where `mine` on for a supervisor but $member null → mineId 0 → returns unfiltered (whole team scope) instead of blocking. Finding #3 covered member=null case.
Now consider: Should mine filter also include actions where the current user is the origin/creator? Business said "retorna apenas ações em que o usuário logado é executor ou validador" — resolvePendenciasDeadline/member scope: scope filter [$mineId=>true] — but does filterByMemberScope treat key 0 as supervisor team? Need to check how buildFilterPayload uses the memberScope. Let me check the service memberScope logic quickly to confirm that passing [$mineId=>true] restricts to executor/validator membership and matches backend representation. But not strictly necessary.
Let me instead check one subtle thing about `mine`: is `filterByMemberScope` semantics that supervisor team scope? Earlier I speculated. Let me quickly grep for filterByMemberScope.
Confirmado: no load inicial SSR as linhas têm 8 `<td>` e o cabeçalho passou a 9 `<th>` (a partial itera as chaves da linha, sem casar com o cabeçalho), enquanto o JS reconstrói com 9 células — o desalinhamento é real só na primeira renderização. Vou dar uma última passada no serviço sobre o escopo do filtro "mine" antes de encerrar.
Tool Calls (1)
code_search
Show Details
Arguments
{"file_patterns": ["src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php"], "search_text": "function filterByMemberScope|memberScope|member_ids"}
Result
No matches found
Request #117
deepseek-v4-flash
P:49.66K C:179 CR:49.54K CW:0
1879ms
Reasoning
Let me look for how member scope param is consumed in this service — maybe it's buildFilterPayload's $memberScope param that goes to some query in a repository or filter method. Let me search for '$memberScope' in the service.
Tool Calls (2)
code_search
Show Details
Arguments
{"file_patterns": ["src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php"], "search_text": "memberScope|member_scope|scopeMember"}
Result
No matches found
file_read_diff
Show Details
Arguments
{"path_array": ["src/Controller/SsmaController.php"]}
Result
==== FILE: src/Controller/SsmaController.php ====
diff --git a/src/Controller/SsmaController.php b/src/Controller/SsmaController.php
--- a/src/Controller/SsmaController.php
+++ b/src/Controller/SsmaController.php
@@ -519,6 +519,32 @@ class SsmaController extends AbstractController
trim((string) $request->query->get('origin', '')),
);
+ if ($request->query->getBoolean('mine')) {
+ $user = $this->getUser();
+ $member = ($user instanceof User) ? $this->getCurrentCompanyMember($company, $user) : null;
+ $mineId = (int) ($member?->getId() ?? 0);
+ if ($mineId > 0) {
+ $payload = $this->ssmaActionPlanPanelService->buildFilterPayload(
+ $scopeCompanies,
+ $dataCompany,
+ $view,
+ $period,
+ $axis,
+ $team,
+ $vinculo,
+ $this->getActionTypeMetadata(),
+ [$mineId => true],
+ $page,
+ $perPage,
+ trim((string) $request->query->get('management', '')),
+ trim((string) $request->query->get('area', '')),
+ trim((string) $request->query->get('exec_responsible', '')),
+ trim((string) $request->query->get('val_responsible', '')),
+ trim((string) $request->query->get('origin', '')),
+ );
+ }
+ }
+
$filterOptions = $this->ssmaActionPlanPanelService->buildFilterOptions($dataCompany);
$presented = $this->actionPlanPanelPresenter->presentFilterResponse($payload, $filterOptions);
@@ -7951,7 +7977,8 @@ class SsmaController extends AbstractController
$title = trim((string) ($data['title'] ?? ''));
$existingProject = null;
- if ($mode !== 'edit' && !$this->canAccessSsmaSupervisorSurface()) {
+ // Criar: gestor/admin. Supervisor só visualiza — Brenda áudio 6.
+ if ($mode !== 'edit' && !$this->canMutateSsmaActionPlan()) {
return new JsonResponse(['success' => false, 'message' => 'Sem permissão para criar ação SSMA.'], 403);
}
@@ -11432,6 +11459,29 @@ class SsmaController extends AbstractController
return $this->canManageSsmaOccurrences() || $this->isSsmaViewer();
}
+ /**
+ * Criar/editar Plano de Ação: gestor/admin.
+ * Supervisor (viewer ou tag Supervisor*) só visualiza dash/painel — Brenda áudio 6.
+ * Gestor de Equipe/Área continua podendo mutar.
+ */
+ private function canMutateSsmaActionPlan(): bool
+ {
+ if ($this->isSsmaViewer()) {
+ return false;
+ }
+
+ $tagName = $this->ssmaCurrentMemberPermissionTag()?->getName();
+ if (in_array($tagName, [
+ 'Supervisor de Equipe',
+ 'Supervisor',
+ SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA,
+ ], true)) {
+ return false;
+ }
+
+ return $this->canManageSsmaOccurrences();
+ }
+
/**
* Abas "Painel" e "Metas" em Prevenção Ativa: apenas perfis de supervisão/gestão na empresa.
* Não usar {@see canAccessSsmaSupervisorSurface()} aqui: ele inclui Membro com can_create na tag
@@ -12557,9 +12607,10 @@ SQL;
$ssmaCanManageConfig = $this->canManageSsmaConfig();
$ssmaCanManagePermissions = $this->canManageSsmaPermissions();
// ssmaCanCreateLinkedActions: botão "Criar ação" na aba Ocorrências e occurrence_view.
- // Supervisores (viewers) podem criar Plano de Ação (planilha: só Plano de Ação).
- // Membro comum (sem tag de supervisão) não pode.
- $ssmaCanCreateLinkedActions = $ssmaCanManageOccurrences || $this->isSsmaViewer();
+ // Brenda: Supervisor só visualiza (dash/painel). Criar/editar fica com gestor/admin
+ // e Gestor de Equipe (override abaixo). Membro comum não cria.
+ $ssmaCanCreateLinkedActions = $this->canMutateSsmaActionPlan();
+ $ssmaCanMutateActionPlan = $ssmaCanCreateLinkedActions;
// ssmaCanCreateCauseTree: Supervisor ?? SOMENTE LEITURA na Árvore de Causas (planilha).
// NÃO incluir isSsmaViewer() aqui. Usa produto ssma-cause-tree (não can_create de ssma-occurrences).
$ssmaCanCreateCauseTree = $this->canCreateSsmaCauseTree();
@@ -12725,6 +12776,7 @@ SQL;
// Árvore de causas: {@see canCreateSsmaCauseTree()} já cobre Gestor de Equipe.
if ($ssmaIsTagTeamGestor || $ssmaIsTagAreaGestor) {
$ssmaCanCreateLinkedActions = true;
+ $ssmaCanMutateActionPlan = true;
}
// Tabela de metas por pessoa (aba Metas): edição global só para gestão; membro com can_create não gere metas alheias.
@@ -13213,6 +13265,7 @@ SQL;
'ssmaCanManageConfig' => $ssmaCanManageConfig,
'ssmaCanManagePermissions' => $ssmaCanManagePermissions,
'ssmaCanCreateLinkedActions' => $ssmaCanCreateLinkedActions,
+ 'ssmaCanMutateActionPlan' => $ssmaCanMutateActionPlan,
'ssmaPreventionCanCreateLinkedActions' => $ssmaPreventionCanCreateLinkedActions,
'ssmaCanEditPreventionContent' => $ssmaCanEditPreventionContent,
'ssmaCanEditPreventionMetasTable' => $ssmaCanEditPreventionMetasTable,
@@ -16085,7 +16138,7 @@ SQL;
private function canCurrentUserEditSsmaAction(SsmaAction $action, Company $company, ?User $user): bool
{
- return $this->canManageSsmaOccurrences();
+ return $this->canMutateSsmaActionPlan();
}
private function canCurrentUserResolveSsmaAction(
@@ -16216,7 +16269,7 @@ SQL;
$respIds = $action->getResponsibleIds() ?? [];
$isResponsible = $memberId > 0 && in_array($memberId, $respIds, true);
$isValidator = $this->isCurrentUserSsmaActionValidator($action, $company, $user);
- $canManage = $this->canManageSsmaOccurrences();
+ $canManage = $this->canMutateSsmaActionPlan();
$pendingValidation = $action->getValidationStatus() === 'pending_validation';
$canEditByPolicy = $action->canEditDeadline($isAdmin);
$canEdit = $canEditByPolicy && ($isAdmin || $isResponsible);
Request #118
deepseek-v4-flash
P:51.58K C:396 CR:49.79K CW:0
3815ms
Reasoning
The comment about a potential divergence in resolve endpoints: canCurrentUserResolveSsmaAction (below line 16144, not changed in this diff) still calls canManageSsmaOccurrences, while edit now uses canMutate. Let me verify what the diff did NOT change there. The hunk at @@ -16216,7 +16269,7 @@ is for a method that includes `$canManage = $this->canMutateSsmaActionPlan();`. This is probably `resolveActionDeadlineEditMeta` or similar.
But `canCurrentUserResolveSsmaAction` at 16144-16157 previously — is it in the diff? No, not part of diff hunks. So unchanged code still calls canManageSsmaOccurrences with operation param. For a supervisor (viewer), canManageSsmaOccurrences = false. So resolve is blocked anyway. For 'Gestor de Equipe' member with a tag? canManageSsmaOccurrences may be false if tag doesn't have can_create/can_edit/can_delete... So there may be a mismatch where a Gestor de Equipe canMutate (UI flags override true) but backend resolve still uses canManage = false → denied, while edit allowed via canMutate. But there's canCurrentUserResolveSsmaAction which is used where? It's one of the resolve endpoints: pending validation resolve by validator? Let's read the actual method near 16144.
Tool Calls (1)
file_read
Show Details
Arguments
{"file_path": "src/Controller/SsmaController.php", "start_line": 16080, "end_line": 16290}
Result
File: src/Controller/SsmaController.php (Total lines: 28437)
IS_TRUNCATED: false
LINE_RANGE: 16080-16290
16080| if ($action->getId() === null || $oldDeadline === null) {
16081| $action->setDeadline($requestedDeadline);
16082|
16083| return;
16084| }
16085|
16086| $deadlineEditMeta = $this->resolveActionDeadlineEditMeta($action, $company, $user);
16087| $isAdminDeadlineOverride = $deadlineEditMeta['is_admin'];
16088|
16089| if (!$isAdminDeadlineOverride && !$deadlineEditMeta['is_responsible']) {
16090| throw new \InvalidArgumentException(
16091| 'Apenas o responsável pela execução ou um administrador pode alterar o prazo desta ação.'
16092| );
16093| }
16094| if (!$action->canEditDeadline($isAdminDeadlineOverride)) {
16095| throw new \InvalidArgumentException(
16096| $action->isAccidentOccurrenceAction()
16097| ? 'Ações de ocorrências do tipo acidente só podem ter o prazo alterado por um administrador.'
16098| : 'O prazo desta ação já foi alterado uma vez pelo responsável e não pode ser modificado novamente.'
16099| );
16100| }
16101| if ($requestedDeadline === null) {
16102| $action->setDeadline(null);
16103|
16104| return;
16105| }
16106| if (!$isAdminDeadlineOverride) {
16107| $maxDeadline = (clone $oldDeadline)->modify('+7 days');
16108| if ($requestedDeadline <= $oldDeadline || $requestedDeadline > $maxDeadline) {
16109| throw new \InvalidArgumentException(
16110| 'O adiamento do prazo é permitido em até 7 dias a partir do prazo atual.'
16111| );
16112| }
16113| }
16114|
16115| $changedByName = trim(($user->getFirstName() ?? '') . ' ' . ($user->getLastName() ?? ''))
16116| ?: (string) $user->getEmail();
16117| $action->recordDeadlineChange($requestedDeadline, (int) $user->getId(), $changedByName, $isAdminDeadlineOverride);
16118| }
16119|
16120| /**
16121| * Metadados de edição de prazo para o usuário atual (responsável 1x / até 7 dias; acidente só admin).
16122| *
16123| * @return array<string, mixed>
16124| */
16125| private function isCurrentUserSsmaActionResponsible(SsmaAction $action, Company $company, ?User $user): bool
16126| {
16127| $member = $user ? $this->getCurrentCompanyMember($company, $user) : null;
16128|
16129| return $this->ssmaStakeholderActionPermissionService->canResolveAsResponsible($action, $member);
16130| }
16131|
16132| private function isCurrentUserSsmaActionValidator(SsmaAction $action, Company $company, ?User $user): bool
16133| {
16134| $member = $user ? $this->getCurrentCompanyMember($company, $user) : null;
16135|
16136| return $this->ssmaStakeholderActionPermissionService->canValidateAsDesignatedValidator($action, $member);
16137| }
16138|
16139| private function canCurrentUserEditSsmaAction(SsmaAction $action, Company $company, ?User $user): bool
16140| {
16141| return $this->canMutateSsmaActionPlan();
16142| }
16143|
16144| private function canCurrentUserResolveSsmaAction(
16145| SsmaAction $action,
16146| Company $company,
16147| ?User $user,
16148| string $operation = 'resolve'
16149| ): bool {
16150| return $this->ssmaStakeholderActionPermissionService->canUserResolveAction(
16151| $action,
16152| $company,
16153| $user,
16154| $this->canManageSsmaOccurrences(),
16155| $operation
16156| );
16157| }
16158|
16159| private function canCurrentUserValidateSsmaAction(SsmaAction $action, Company $company, ?User $user): bool
16160| {
16161| return $this->ssmaStakeholderActionPermissionService->canUserValidateAction(
16162| $action,
16163| $company,
16164| $user,
16165| $this->canManageSsmaOccurrences()
16166| );
16167| }
16168|
16169| /**
16170| * @return array<string, mixed>|null
16171| */
16172| private function tryLoadOccurrenceViewRowForActionStakeholder(
16173| int $id,
16174| ?string $kind,
16175| Company $company,
16176| User $user
16177| ): ?array {
16178| $member = $this->getCurrentCompanyMember($company, $user);
16179| $memberId = (int) ($member?->getId() ?? 0);
16180| if ($memberId <= 0) {
16181| return null;
16182| }
16183|
16184| [, $teams] = $this->loadCompanyMembersAndTeamsLite($company);
16185| $teamsById = array_column($teams, null, 'id');
16186|
16187| if ($kind === 'event') {
16188| $event = $this->entityManager->getRepository(SsmaEvent::class)->find($id);
16189| if (!$event instanceof SsmaEvent || $event->getCompany()->getId() !== $company->getId()) {
16190| return null;
16191| }
16192| $row = $this->mapSsmaEventToOccurrenceListRow($event, $teamsById);
16193| if (!$this->isOccurrenceVisibleToMember($row, $memberId, $company)) {
16194| return null;
16195| }
16196|
16197| return $row;
16198| }
16199|
16200| $occurrence = $this->entityManager->getRepository(SsmaOccurrence::class)->find($id);
16201| if (!$occurrence instanceof SsmaOccurrence || $occurrence->getCompany()->getId() !== $company->getId()) {
16202| return null;
16203| }
16204| $row = $this->mapSsmaOccurrenceEntityToListRow($occurrence, $teamsById);
16205| if (!$this->isOccurrenceVisibleToMember($row, $memberId, $company)) {
16206| return null;
16207| }
16208|
16209| return $row;
16210| }
16211|
16212| /**
16213| * Carrega a linha de detalhe se o usuário tem permissão técnica do tipo da ocorrência
16214| * ({@see resolveCurrentUserTechnicalTypes}), sem exigir vínculo como stakeholder/membro.
16215| *
16216| * @return array<string, mixed>|null
16217| */
16218| private function tryLoadOccurrenceViewRowForTechnicalType(
16219| int $id,
16220| ?string $kind,
16221| Company $company,
16222| User $user
16223| ): ?array {
16224| $technicalTypes = $this->resolveCurrentUserTechnicalTypes($company, $user);
16225| if ($technicalTypes === []) {
16226| return null;
16227| }
16228|
16229| $techTypesSet = array_flip($technicalTypes);
16230| [, $teams] = $this->loadCompanyMembersAndTeamsLite($company);
16231| $teamsById = array_column($teams, null, 'id');
16232|
16233| if ($kind === 'event') {
16234| $event = $this->entityManager->getRepository(SsmaEvent::class)->find($id);
16235| if (!$event instanceof SsmaEvent || $event->getCompany()->getId() !== $company->getId()) {
16236| return null;
16237| }
16238| $row = $this->mapSsmaEventToOccurrenceListRow($event, $teamsById);
16239| $type = (string) ($row['type_value'] ?? $event->getType() ?? '');
16240|
16241| return isset($techTypesSet[$type]) ? $row : null;
16242| }
16243|
16244| $occurrence = $this->entityManager->getRepository(SsmaOccurrence::class)->find($id);
16245| if ($occurrence instanceof SsmaOccurrence && $occurrence->getCompany()->getId() === $company->getId()) {
16246| $row = $this->mapSsmaOccurrenceEntityToListRow($occurrence, $teamsById);
16247| $type = (string) ($row['type_value'] ?? $occurrence->getType() ?? '');
16248| if (isset($techTypesSet[$type])) {
16249| return $row;
16250| }
16251| }
16252|
16253| // Links sem kind=event ainda podem apontar para SsmaEvent (ROS / Quase Acidente).
16254| $event = $this->entityManager->getRepository(SsmaEvent::class)->find($id);
16255| if (!$event instanceof SsmaEvent || $event->getCompany()->getId() !== $company->getId()) {
16256| return null;
16257| }
16258| $row = $this->mapSsmaEventToOccurrenceListRow($event, $teamsById);
16259| $type = (string) ($row['type_value'] ?? $event->getType() ?? '');
16260|
16261| return isset($techTypesSet[$type]) ? $row : null;
16262| }
16263|
16264| private function resolveActionDeadlineEditMeta(SsmaAction $action, Company $company, ?User $user): array
16265| {
16266| $isAdmin = $this->canManageSsmaConfig();
16267| $member = $user ? $this->getCurrentCompanyMember($company, $user) : null;
16268| $memberId = $member ? (int) $member->getId() : 0;
16269| $respIds = $action->getResponsibleIds() ?? [];
16270| $isResponsible = $memberId > 0 && in_array($memberId, $respIds, true);
16271| $isValidator = $this->isCurrentUserSsmaActionValidator($action, $company, $user);
16272| $canManage = $this->canMutateSsmaActionPlan();
16273| $pendingValidation = $action->getValidationStatus() === 'pending_validation';
16274| $canEditByPolicy = $action->canEditDeadline($isAdmin);
16275| $canEdit = $canEditByPolicy && ($isAdmin || $isResponsible);
16276|
16277| $deadlineMax = null;
16278| if ($canEdit && !$isAdmin && $action->getDeadline() instanceof \DateTimeInterface) {
16279| $deadlineMax = (clone $action->getDeadline())->modify('+7 days')->format('Y-m-d');
16280| }
16281|
16282| return [
16283| 'can_edit_deadline' => $canEdit,
16284| 'is_accident_occurrence_action' => $action->isAccidentOccurrenceAction(),
16285| 'deadline_edit_count' => $action->getDeadlineEditCount(),
16286| 'deadline_history' => $action->getDeadlineHistory(),
16287| 'is_admin' => $isAdmin,
16288| 'is_responsible' => $isResponsible,
16289| 'is_validator' => $isValidator,
16290| 'can_edit' => $canManage,
Request #119
deepseek-v4-flash
P:54.89K C:2.88K CR:51.97K CW:0
23822ms
Reasoning
So `canCurrentUserResolveSsmaAction` and `canCurrentUserValidateSsmaAction` still call `canManageSsmaOccurrences()` — not changed. Whether that's inconsistent with canMutate for Gestor de Equipe/Área tags is arguably covered by confirmed finding #2 (dual sources with different criteria). Given confirmed finding #2 already captures the duplication/inconsistency issue in the controller context, adding a new comment about resolve/validate using canManage would be largely duplicative — but it's actually a distinct, concrete point: the policy change for supervisor-blocking was applied to edit (canCurrentUserEditSsmaAction), create (mode create gate), deadline-edit meta, but NOT to the resolve/validate endpoints. Is that a bug? Business: "Supervisor somente visualiza" — resolve action would be an edit-like mutation that supervisor shouldn't do. Before this PR, canAccessSsmaSupervisorSurface included viewers with can_create tag — supervisors could resolve actions as manager? canManageSsmaOccurrences false for supervisors → they were already blocked on resolve even before the PR. So there's no regression for the supervisor-blocking goal; the remaining scenario is Gestor de Equipe: canManageSsmaOccurrences may be false if tag lacks can_create... but Gestor de Equipe tag in this project often has can_create on ssma-occurrence product (that's how they can create linked actions pre-PR per old comment "Gestor de Equipe" override). So canManageOccurrences true for them anyway → resolve/validate allowed. Therefore no mismatch in practice.
So the resolve/validate paths staying on canManage are not creating a *new* regression. This is precisely what confirmed finding #2 flagged generally (inconsistency between the canMutate helper vs. other checks). Skip.
Let me reconsider anything else overlooked:
- On SSR initial table, the row button lacks data-action-title etc., so openActionViewOffcanvas would show '—' for everything if markup existed (but markup doesn't exist — confirmed finding #1). No need to add.
- `formatPeopleNames` and JS changes look fine.
- Service: `executors` and `validators` resolution uses resolveResponsibleDisplay each action — potential performance but same as before (single array walk in memory). Not an issue.
- `resolveOriginKey`: check for personal before material: event string for accident types may contain 'ACIDENTE PESSOAL' etc. If event 'ACIDENTE COM MATERIAL' - contains PESSOAL? no. Material handled. If 'ACIDENTE' generic w/o qualifier returns accident_personal (default). The seed chart no longer shows 'accident' key; resolveOriginKey never returns 'accident' now except possibly from normalize for origem 'ocorr'? Actually match returns 'accident' in none of the branches now except... no, they renamed to accident_personal. But `origin_icons` seed still has key 'accident' (present map includes 'accident'), plus seed origin chart uses no 'accident'. The panel presenter passes originCounts keys resolved to new keys. Legacy action origem values may map via normalize to 'accident'?? The match returns accident_personal for 'acidente'. In the resolveOriginKey there's a branch checking normalized === INSPECAO etc. but what if normalize returns 'accident'? Let me check ActionOrigemEnum::normalize output tokens. Might return 'acidente' normalized for origem strings; match maps to accident_personal. OK. So 'accident' only remains in the icons map for legacy chart labels maybe from DB old aggregation? Not an issue.
- Overview origins options list removed 'Direito de Recusa' and 'Ocorrência', and 'acidente' replaced by accident_personal etc. Also chart seeding removed refusal; originCount still may include 'refusal' key for legacy actions; `if (isset($seed[$key]))` silently skips legacy refusal keys → chart count for recusa disappears entirely. That's confirmed finding #5 already covers refusal missing from options/chart.
- presentSeededOriginChart seeds now 6 keys; old 'refusal' & 'accident' & 'occurrence' counts vanish from chart. Also 'ocorr' origin type maps? default 'other' for origem 'ocorrência'? Wait resolveOriginKey for origem occurrences: normalize 'ocorrência'? Previously map had 'ocorr'→accident. Now normalize may match INSPECAO/...? Let me see ActionOrigemEnum::normalize handles occurrence? The old code's final match included `str_contains($value,'ocorr') => 'accident'`; that path is only reached if origin normalized string contains 'ocorr'. Hmm normalized output probably is canonical label from origem enum; If a origem literally contains 'ocorrência' then normalize returns something? Whatever, legacy 'occurrence'-sourced actions get 'accident_personal' (previously accident). But the seed chart no longer has 'accident' key but now includes accident_personal so counts preserved.
- In the service diff at line ~710: building 'executors' from responsible_ids and 'validators' from validator_member_id. Then buildResponsibleStackHtml used for each. But in the table SSR old template had single "Responsável" = responsible (executors). Now header wants "Quem executa" + "Quem valida"; SSR row builder not updated (comment #1).
- origin_url in JS inserted via `escapeHtml(originUrl)` into href attribute of anchor — URL from server (internal path) fine; the href uses escapeHtml so quotes escaped.
- Potential XSS in template SSR via `row.priority`/`row.management` unescaped? Twig autoescapes by default, but within `{% set %}` and `{{ row.priority }}` in cell — but these cells are output with `|raw` in `_table_body_rows` (line 127: `{{ cell|raw }}`). Wait! The cells are set via `{% set priority_cell %}` containing `{{ row.priority }}` — that's already escaped to HTML entities at set time? In Twig, `{% set x %} {{ value }} {% endset %}` — the content is not rendered/escaped until output? Actually capture blocks store the rendered output, including escaping, at capture time? Twig applies escaping when the `{{ }}` inside the block is rendered, which happens at capture time, so escaping is already applied. So when output later with `|raw`, the content is safe because escaping already happened at capture. Yes capture renders the inner `{{ }}` with escaping at the time the block is executed. Safe. Good.
But the twig headers used `header.title|raw` — static strings, fine.
Now back to row keys: rows output only 8 keys → misalignment.
Another important spot: The JS `buildPendenciasTableRowHtml` builds row `<tr>` with 9 `<td>`. That aligns after AJAX refresh. And DataTables re-created with default column count from thead (9). Since tbody now has 9 cells each, good. But what about DataTable column-count mapping header-key? Datatable does not read keyed data here (tbody innerHTML) — it's a DOM table. Fine.
Wait — the initial DataTable is initialized on page load by the SSR markup itself (MetahumanDataTables auto-init reading data-headers/rows). The initial tbody row has 8 cells but headers 9. DataTables auto-detect: For DOM-source tables, DataTables will populate row data from the cells; the column count = max(thead count)? Actually DataTables builds columns from `thead` th count. Each row's cells count fewer. In rendering, it will render column i by reading aData[i]. If a row only has 8 cells, columns.length=9; when drawing the last column, aData[8] is undefined → renders empty or throws "Requested unknown parameter '8' from the data source for row 0"? The precise DataTables behavior: when data is a DOM array, the array has 8 entries; requesting 9th column yields `undefined`; DataTables does render empty for missing? Typically it throws the "Requested unknown parameter" error when column.data function retrieves undefined? Actually DataTables doesn't automatically throw for arrays shorter than columns; the `columns` auto-detection sets column.data index 0..8, retrieving `row[8]` which is undefined; DataTables might render blank and not throw since the error triggers only for object access where property missing? For array data source, accessing an undefined index returns undefined and is rendered as blank. There is known behavior where header/body count mismatch leads to misalignment not an error. Either way, the visual misalignment is the concrete problem: the action (eye) appears under the wrong header, and extra empty "Ações" column at right.
So my comment is correct; I'd word to avoid over-claiming the DataTables error precisely. Already did: "conteúdo ... desloca, a coluna 'Ações' fica vazia". Good.
One more possible thing: Since header has 9 columns with 'responsivePriority' but the twig default ordering false etc. This doesn't matter.
Let me double check that initial DataTable auto-init reads tbody rows — yes `_table_body_rows` includes them and MetahumanDataTables initializes from DOM. After filter, JS updatePendenciasTable destroys DataTable and rebuilds.
But note: initial SSR load triggers AJAX automatically on page open (since panel default loads pendencias via AJAX)? Possibly the view initially renders with server rows and then the panel JS fetches fresh. Even if initial fetch replaces the DOM immediately, if user's very first paint runs before AJAX completes, DataTables init may have already occurred on misaligned SSR rows (auto-init on DOM ready). It could produce the misalignment flash or even initialize fine since AJAX replace destroys and recreates. But if SSR row count mismatch causes DataTables error at auto-init, it may break the table until re-init via whenReady. Medium-high bug remains valid to report.
Now — one more consideration about `updatePendenciasTable` destroying/rebuilding DataTable each time; it's the pre-existing approach. Not in scope.
I have 2 new comments already placed. Plus previously confirmed 5 findings stand. I think we can finish.
Let me be sure about the second comment severity/path — placement anchored in service. Good.
Final: call task_done.
A revisão está completa. Resumo do que foi analisado nesta passada:
**Novos achados registrados (não cobertos pelos confirmados):**
1. **`templates/ssma/action_plan/tabs/_tab_painel.html.twig` (bug, alto):** o cabeçalho da tabela SSR de Pendências ganhou 9 colunas ("Quem executa"/"Quem valida"), mas o loop que monta `ap_table_rows` (linhas ~472–509) continua gerando 8 células com a chave única `responsavel`. Como a partial `_table_body_rows` itera as chaves da linha por posição (sem casar com o `<th>` correspondente), o primeiro carregamento sai desalinhado — o avatar de responsável cai em "Quem executa", prazo/pendência/ações deslocam uma coluna e a coluna "Ações" fica vazia. Só após a primeira atualização AJAX (que reconstrói via JS com 9 células) a tabela fica correta. Confirmei a lógica em `_table_body_rows.html.twig` (linha 32–131).
2. **`src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php` (bug, alto):** o link "Ir para origem" usa `/manager/ssma/ocorrencias/{id}`, mas a rota de detalhe registrada em `config/routes_ssma.yaml` é `/manager/ssma/occurrence/{id}` — o plural `ocorrencias` é a listagem. Todo o restante do código (SsmaCommandService, SsmaAutomationService, flash report) usa o singular `occurrence`. Clique no novo botão cai em 404.
**Validações feitas que não viraram achado:** verifiquei que `canCurrentUserResolveSsmaAction`/`canCurrentUserValidateSsmaAction` continuam em `canManageSsmaOccurrences()` — mas isso é a duplicidade já capturada pelo achado confirmado nº 2 (fontes duplas de permissão); para supervisor/viewer o acesso já era bloqueado antes, então não há regressão nova isolada para reportar aqui.
Os demais pontos críticos (offcanvas sem markup, duplicidade de política de permissão, filtro `mine` ignorado quando usuário sem vínculo de membro, ausência de testes na política, e origem "Direito de Recusa" órfã nos filtros/gráfico) já estavam registrados como achados confirmados e não foram repetidos.
Tool Calls (1)
task_done
Show Details
Arguments
{"state": "DONE"}
memory_compression_task
Request #1
deepseek-v4-flash
P:292K C:3.66K CR:384 CW:0
39196ms
Reasoning
Let me analyze what I need to do. The user asked me to summarize a code review conversation in Portuguese (pt-BR) according to the structured format. But this conversation is actually between an assistant and a code review assistant tool — wait no, looking at it, the conversation is between a code review assistant (the assistant messages with reasoning) and tool call results. There are no explicit code review plan messages from a user beyond the initial context included within the assistant's reasoning.
Actually, looking at the content, the "assistant" messages contain reasoning about investigating issues from a "review plan", and the tool calls return file contents. There are no user messages at all. The reasoning in message 0 includes a review plan with 7+ items. I need to compress this into a summary in the specified format with headings in Portuguese.
Key observations from the conversation:
1. **Issue 1**: Permission rule duplicated for `canMutateSsmaActionPlan()` vs `$ssmaCanMutateActionPlan` flags. Investigation reveals:
- `canMutateSsmaActionPlan()` (SsmaController.php:11467) checks isSsmaViewer → false, tag names Supervisor de Equipe/Supervisor/TAG_SUPERVISOR_AREA → false, else returns `canManageSsmaOccurrences()`.
- Template flags at SsmaController.php:12612-12613 set `$ssmaCanCreateLinkedActions = $this->canMutateSsmaActionPlan(); $ssmaCanMutateActionPlan = $ssmaCanCreateLinkedActions;`
- At 12777-12780, forced override: if `$ssmaIsTagTeamGestor || $ssmaIsTagAreaGestor` then `$ssmaCanCreateLinkedActions = true; $ssmaCanMutateActionPlan = true;`
- Server endpoints: createAction at 7981 uses canMutateSsmaActionPlan, also 16141 and 16272.
- Conclusion: divergence exists between server-side policy (canMutateSsmaActionPlan — no Gestor de Equipe/Área name exception) and UI forced flags. Line 20076 shows related method (`canManageAllPreventionContentForCurrentUser`) explicitly adds Gestor de Equipe/Área tag names on top of canManageSsmaOccurrences, suggesting those tags aren't necessarily captured by canManageSsmaOccurrences. This is a genuine inconsistency — potential 403 for Users who see UI buttons.
2. **Issue 2**: `mine` filter when member not resolved returns full payload:
- Controller planoAcaoPanelFilter at 522-546: if `mine` true, resolves member; if `$mineId = 0` (member null), the payload remains with the initial member scope from resolveActionPlanPanelMemberScope($company), which returns null for managers/admins (no restriction). So a manager/admin with no member record checking "Minhas ações" sees everything (full list), contrary to intent. Confirmed issue (medium).
3. **Issue 3**: "Minhas ações" filter matching only responsible_ids not validator_member_id:
- Investigation of `filterByMemberScope` (SsmaActionPlanPanelService.php:367-386): Actually DOES check both validator_member_id and responsible_ids. So issue 3 is NOT a bug — resolved as non-issue. Tool conclusion.
4. **Issue 4**: Refusal classification regression — no evidence collected yet; NOT investigated in the visible conversation. Pending.
5. **Issue 5**: Missing tests — noted but not investigated in detail. Pending.
6. **Issue 6**: `mine` param added outside Pendencias branch:
- In buildFilterPayload, member scope filtering happens before branch to comparativo/visao_geral/pendencias (lines 58-60), so `mine` applies also to other views (minhas ações) — likely acceptable or at least flags were intended for Pendencias; valid partially. Not fully resolved but evidence gathered. Actually, the review note says "mine parametro added outside branch de pendências" — tool check shows filterByMemberScope applied before all views, so mine affects visao_geral etc too. This is now confirmed but whether it's an issue depends on product semantics. Still pending judgment.
7. **Issue 7**: Offcanvas data attributes, escapeHtml, existing wrapper:
- action_plan_panel.js lines 2234-2243 reference DOM ids `ssma-ap-action-view-title`, `ssma-ap-action-view-id`, `ssma-ap-action-view-origin`, `ssma-ap-action-view-executors`, `ssma-ap-action-view-validators`, `ssma-ap-action-view-deadline`, `ssma-ap-action-view-pending`, `ssma-ap-action-view-description`, `ssma-ap-action-view-origin-link`.
- Search for these DOM ids in templates: NO matches found in templates (search returned nothing for these selectors).
- `window.openOffcanvasssmaApActionView` referenced at action_plan_panel.js:2253-2254, but no template defines it — however, templates/ssma/action_plan/tabs/_tab_action_plan.html.twig:1638 uses different name `openOffcanvasSsmaActionPlanViewOffcanvas`, and the generic framework registers openers via data attributes (see metahuman-standard _modal_offcanvas.js generating `window["openOffcanvas"+fnSuffix]`).
- escapeHtml function exists in action_plan_panel.js:78 and is used for safe output — good, no issue there.
- Confirmed risk: presentation layer of off-canvas details may be broken/not rendering because the referenced DOM IDs don't exist in the Twig templates, OR existing wrappers in _tab_action_plan.html.twig' registered dynamic opener differs from the JS function name. Need further check (pending) but key conclusion captured.
8. Tool conclusions:
- get_function_info(SsmaController.php) — canManageSsmaOccurrences at 11339 and canMutateSsmaActionPlan at 11467; flags computed at 12550-12790 area.
- Search "Gestor de Equipe" tag names — found constants SsmaAreaLimitationScope TAG_SUPERVISOR_AREA/TAG_GESTOR_AREA.
- `resolveActionPlanPanelMemberScope` at 611 returns null for users with canManageSsmaOccurrences; restricting for supervisors/team gestors; otherwise own memberId.
- SsmaActionPlanPanelService filterByMemberScope: matches both validator and responsible members (so "Minhas ações" is correct in that regard).
- Searches confirm missing DOM ids for ssma-ap-action-view-* in templates.
Now to structure the summary in Portuguese:
### Problemas de Código Identificados
- [HIGH] src/Controller/SsmaController.php — ... — duplicated/mismatched permission rule: server uses canMutateSsmaActionPlan without Gestor exception, UI flags force true for Gestor de Equipe/Área; risk of 403 in UI.
Let me phrase: [ALTA] `SsmaController.php` — política de permissão duplicada/diverge entre `canMutateSsmaActionPlan()` e as flags `ssmaCanMutateActionPlan`/`ssmaCanCreateLinkedActions`; o tratamento de Gestor de Equipe/Área existe apenas na view e o backend pode retornar 403.
- [MÉDIA] SsmaController.php planoAcaoPanelFilter (linha 522-546) — quando `mine=1` e o usuário não possui membro (getId=0), o filtro é silenciosamente ignorado e o payload completo é retornado; deveria retornar lista vazia.
- [MÉDIA] JS/Template off-canvas — public/js/ssma/action_plan_panel.js referencia ids `ssma-ap-action-view-*` que não existem templates; fallback para abrir offcanvas incompatível com `openOffcanvasSsmaActionPlanViewOffcanvas` — possível quebra na renderização do detalhe.
- maybe mention the XSS? Descobrimos que escapeHtml existe e é usado... no issue.
- The issue 6 mine outside pendencias? I need to decide severity to list on confirmed issues — it's confirmed technically but not yet resolution; I'll leave it as pending not as confirmed issue.
- Missing tests — pending.
### Conclusões das Chamadas de Ferramenta
- get_function_info/canManageSsmaOccurrences: confirmed logic; canManageSsmaOccurrences depends on can_create/can_edit dos tags + request attributes; canMutateSsmaActionPlan calls it after blocking viewer/supervisors tags.
- pesquisa por tags (Gestor/Supervisor/Área): revealed that canManageAllPreventionContentForCurrentUser (20076) adds Gestor explicitly by tag name, reinforcing the mismatch.
- get_function_info(filterByMemberScope): confirms the "minhas ações" filter matches both `validator_member_id` and `responsible_ids` — not a bug.
- get_function_info(resolveActionPlanPanelMemberScope): managers/admins (canManageSsmaOccurrences true) return null — causing issue when member resolution fails for mine.
- search for DOM ids / off-canvas wrappers: ids missing; only existing template uses different opener name.
### Tarefas Concluídas
- Checked server policy vs flags — done (finding documented).
- Evaluated mine member scope filter and described behavior with null member.
- Checked whether mine matches validator/responsible — confirmed both.
- Verified escapeHtml exists and used correctly.
- Checked DOM ids in templates — done (missing).
### Tarefas Pendentes
- Falta concluir a classificação de recusa (item 4) - not investigated.
- Falta confirmar tratamento de testes ausentes (item 5) e se há testes adicionados no PR.
- Avaliar o impacto do `mine` fora de pendências em visão geral/comparativo (item 6) com a semântica de produto/UX.
- Confirmar a existência do wrapper off-canvas que registra o abridor correto (`_modal_offcanvas.js` fnSuffix/data attributes) e mapear ids reais na Twig para a visão da ação.
### Foco Atual
Investigando a divergência entre a política de permissão do servidor e as flags de UI do Plano de Ação — e a cobertura da funcionalidade "Minhas ações"/off-canvas.
I need to use Portuguese — nominal format.
Need to respect rule 1: do not include specific code details, only file path + issue type. Detailed descriptions should be concise but the examples show they include code-ish hints (UserService.go:45). I'll keep line refs and short descriptions.
Make sure heading names match the output structure but in pt-BR:
### Problemas de Código Identificados
### Conclusões das Chamadas de Ferramenta
### Tarefas Concluídas
### Tarefas Pendentes
### Foco Atual
Keep it concise, avoid redundant.
### Problemas de Código Identificados
- [ALTA] `src/Controller/SsmaController.php` (11467, 12612-12613, 12777-12780) — regra de permissão duplicada e divergente: backend usa `canMutateSsmaActionPlan()` (que delega a `canManageSsmaOccurrences()` e não reconhece Gestor de Equipe/Área pelo nome da tag), enquanto a view força as flags `ssmaCanCreateLinkedActions`/`ssmaCanMutateActionPlan` para Gestor de Equipe/Área; consequência: o usuário pode ver os botões na UI e receber 403 no endpoint `createAction` (métodos em 16141 e 16272 também dependem só da versão do servidor), criando risco real de divergência de autorização.
- [MÉDIA] `src/Controller/SsmaController.php` (522-546) — filtro "Minhas ações": quando `mine=1` e o usuário logado não possui membro vinculado na empresa (`$mineId = 0`), o filtro é silenciosamente ignorado e o payload completo é retornado; o comportamento esperado seria lista vazia ou mensagem de erro.
- [MÉDIA] `public/js/ssma/action_plan_panel.js` (2234-2243, 2253-2254) — renderização do off-canvas de detalhe: o JS referencia ids `ssma-ap-action-view-*` e o abridor `openOffcanvasssmaApActionView`, mas nenhum template contém esses ids; o template existente (`_tab_action_plan.html.twig` 1638) registra o abridor com outro nome (`openOffcanvasSsmaActionPlanViewOffcanvas`), apontando possível quebra ou componente incompatível na exibição dos dados da ação.
### Conclusões das Chamadas de Ferramenta
- get_function_info(SsmaController.php, canMutateSsmaActionPlan/canManageSsmaOccurrences): confirmada a lógica — supervisores/viewers são bloqueados no método do servidor, mas Gestor de Equipe/Área só passam se `canManageSsmaOccurrences()` retornar true via `can_create/edit/delete` da tag; a UI, porém, recebe override explícito para Gestor de Equipe/Área.
- search_file("tag Gestor/Supervisor"): `canManageAllPreventionContentForCurrentUser` (linha 20076) adiciona Gestor de Equipe/Área explicitamente pelo nome da tag depois de `canManageSsmaOccurrences()`, reforçando evidência de que essas tags não são reconhecidas apenas por `canManageSsmaOccurrences()`.
- get_function_info(SsmaActionPlanPanelService.filterByMemberScope): confirmado que o filtro por membro considera tanto `validator_member_id` quanto `responsible_ids` — o escopo da questão 3 do plano não é um bug.
- get_function_info(resolveActionPlanPanelMemberScope): para quem passa por `canManageSsmaOccurrences()` o escopo é `null` (sem restrição); quando o usuário não é membro/gestor comum o filtro cai para `[memberId => true]` — comportamento que sustenta o problema do `mine` não aplicado quando o membro é nulo.
- search_file("ssma-ap-action-view-*", templates): nenhum resultado em Twig para os elementos esperados pelo JS; a infraestrutura genérica de abridores (`_modal_offcanvas.js` + data-attributes) registra funções `window["openOffcanvas"+fnSuffix]`, mas há incompatibilidade de nomenclatura com o registrado na página.
- get_function_info(escapeHtml): a função existe em `action_plan_panel.js` e é aplicada antes da injeção de conteúdo — nenhum problema de escape encontrado.
### Tarefas Concluídas
- Compatibilidade entre `canMutateSsmaActionPlan()` e as flags de UI foi verificada e a divergência documentada.
- O comportamento do filtro "Minhas ações" com membro não resolvido foi analisado e o problema confirmado.
- A cobertura de `validator_member_id`/`responsible_ids` no filtro "Minhas ações" foi analisada e descartada como bug.
- A existência do `escapeHtml` e sua utilização foram verificadas.
- A busca pelos elementos DOM do off-canvas nos templates foi concluída (não encontrados).
### Tarefas Pendentes
- Verificar a regressão da classificação de recusa citada no plano de revisão, ainda não investigada.
- Avaliar a necessidade e a presença de testes para as mudanças deste PR.
- Confirmar impacto/aceitação da aplicação do `mine` fora do filtro de pendências (visão geral/comparativo), dada a filtragem por membro ocorrer antes da ramificação de views.
- Mapear, no form do plano de ação, os ids/abridor de off-canvas reais e decidir se o `action_plan_panel.js` deve ser ajustado ao wrapper existente ou se o template precisa ser criado/atualizado.
### Foco Atual
Investigando a divergência entre a política de permissão do servidor e as flags de UI no Plano de Ação (Gestor de Equipe/Área) e a completude dos elementos visuais/infraestrutura off-canvas para a visualização de ações.
Request #2
deepseek-v4-flash
P:296.84K C:5.3K CR:384 CW:0
52994ms
Reasoning
The conversation is a long chain of searches and reads, and I need to summarize it. Given the complexity, I should identify the core matters:
- The controller section with `mine` filter in action plan panel (lines 503–545).
- `presentSeededOriginChart` behavior: refusal still included when count>0 since the foreach appends non-seed keys with count>0.
- `resolveOrigemKey` categories.
- `resolveActionPlanPanelMemberScope` behavior with Gestor de Equipe.
- The UI/backend permission divergence in `canMutateSsmaActionPlan` for Gestor de Equipe/Área remains a high suspicion / confirmed? The reasoning indicates it's a divergence worth flagging, but has not been formally posted yet.
- There's also the `mine` filter edge case: if member can't be resolved, it silently returns first payload instead of empty list.
- Refusal regression: not actually losing actions in chart; however dropdowns `origin`/`overview_origins` no longer include 'refusal' while actions can still be classified as 'refusal' — makes refusal unselectable in new filters. In overview, `overview_origins` removed 'refusal' option that existed before, so users can no longer filter by Direito de Recusa in Visão Geral, and the new 'origin' dropdown for pendências also lacks refusal.
- Need to verify templates for off-canvas id mismatch (it appears in the search now: results include `templates/ssma/action_plan/_tab_action_plan.html.twig` with `openOffcanvasSsmaActionPlanViewOffcanvas` and only one such code; there's also `addOpenOffcanvasLsmaAction...`? Actually need to find the specific mismatches). The summary earlier claimed off-canvas ids/abridor mismatch in action plan form. The search result shows there's a function name `openOffcanvasSsmaActionPlanViewOffcanvas` in `_tab_action_plan.html.twig` (line 1638), while the JS `action_plan_panel.js` calls `window.openOffcanvasssmaApActionView()` (lowercase `ssmaApActionView`) and then falls back to `#ssmaApActionView-offcanvas-wrapper` or `#ssmaApActionViewOffcanvas` / modal `#ssmaApActionView`. So there appear to be at least two naming patterns: openOffcanvasSsmaActionPlanViewOffcanvas (used by tab template) vs window.openOffcanvasssmaApActionView (used by JS). Slight mismatch possible.
- Need to determine which offcanvas wrapper/id is opened by the generic registration and by the view function.
There is also the earlier problem in `applyMine` where request is executed twice (buildFilterPayload called twice) which is inefficient but not necessarily a bug. Should I flag? In the controller the "mine" filter is applied outside the main function and it overrides the member-scope passed; if mineId=0 it keeps the first payload. Also, the mine branch only handles pendencias view? It builds filter payload which for `view` may be overview — the `mine` param applies in all views? Possibly only pendencias has "mine" checkbox in UI. The `buildFilterPayload` takes `view` and when `view=visao_geral` it returns overview data with filters, but passing `[$mineId => true]` means all actions are filtered by member scope before overview computations, which might count KPI differently than intended (maybe not a bug but mine filter semantics apply to pendências only in UI).
Now, as a continuation summary, I need to output the five sections in Portuguese (pt-BR). The instructions ask to compress this conversation - but the conversation provided is likely the "review progress" that should be summarized as if continuing. I am the assistant? Actually in this task, I should produce the summary based on the conversation log. The user wants:
- Struct summary capable of continuing from current state.
- Headings:
- ### Identified Code Issues
- ### Tool Call Conclusions
- ### Completed Tasks
- ### Pending Tasks
- ### Current Focus
- Rules: pt-BR output; do not include specific code details, only paths and issue types; avoid repetition; omit sections without content; complete sentences for tasks; concise current_focus (1 sentence).
So, I'll compile.
Important highlights:
1. Confirmed issue (HIGH/MEDIUM/etc) candidates with severity decisions:
- Permission divergence (backend `canMutateSsmaActionPlan()` vs UI override for Gestor de Equipe/Área) — HIGH (authorization) path `src/Controller/SsmaController.php`.
- `mine` filter quando member is null fails open and uses unfiltered payload — MEDIUM (security/privacy / functional).
- Refusal regression — after investigation, chart preservation still exists but filters dropdowns no longer include refusal, making the overview filter unselectable; classify as MEDIUM/LOW. Also the old overview dropdown had a "refusal" option ("Direito de Recusa") and now it's removed — user cannot filter by refusal anymore.
- Need "offcanvas id mismatch" - from previous summary already confirmed? Here part of it: There is a finding: in the action plan panel file, open of view runs when `window.openOffcanvasssmaApActionView` exists. In the template for the action plan tab we see `openOffcanvasSsmaActionPlanViewOffcanvas`, which means there is a mismatch or at least duplication between naming conventions. Let me check the evidence: The search results at the end show:
- `templates/ssma/action_plan/tabs/_tab_action_plan.html.twig` line 1638: `openOffcanvasSsmaActionPlanViewOffcanvas` used (presumably registered elsewhere).
- `public/js/ssma/action_plan_panel.js` line 2253: checks `window.openOffcanvasssmaApActionView`. So for the view pane, if the offcanvas with the view is registered as `openOffcanvasSsmaActionPlanViewOffcanvas`, then that function isn't the one being called by the panel's helper - instead it relies on `openOffcanvasssmaApActionView`; then fallback selects `#ssmaApActionView-offcanvas-wrapper` or `#ssmaApActionViewOffcanvas` etc. Let me quickly confirm whether the template registers function `openOffcanvasSsmaActionPlanViewOffcanvas` by finding its pattern. The search results line 1638 only show invocation, not registration. Need to check template content further? In our log, the search only returns matching lines. It doesn't show the function definition. There is definitely a mismatch with what was previously confirmed (line 2253 uses window.openOffcanvasssmaApActionView; external invokes openOffcanvasSsmaActionPlanViewOffcanvas). If no one registers `openOffcanvas...ssmaApActionView` (the name containing "ssmaApActionView"), the fallback would try `#ssmaApActionView-offcanvas-wrapper`, which might exist. So there must be a template where an off-canvas wrapper with id `ssmaApActionView-offcanvas-wrapper` exists, and the registered op calls `openOffcanvasSsmaActionPlanViewOffcanvas`. The mismatch: both paths may exist to open the same wrapper but through slightly different registered functions. Actually the invocation in the tab at 1638 might be where existing legacy links open view; the js at 2253-2263 tries to call `openOffcanvasssmaApActionView()` and fallback to the wrapper. So if wrapper exists, both eventually open it. There might nevertheless be leftover old id `#ssmaApActionView` that doesn't exist. Not enough to state exact bug—but the previous summary already had "off-canvas ids/abridor mismatch in action plan form". This would count as identified issue if confirmed before. Since the review is currently at planning/execution, we can summarize as still-validated from evidence so far. We can confidently mention mismatch as MEDIUM/LOW.
- Double invocation of buildFilterPayload when mine=1 and mineId>0 — efficiency issue, duplicate DB load/performance, plus non-atomic? It's a MEDIUM/LOW. The two calls are needed because memberScope changes, but first call wasted. Flag: duplicated execution of service method with identical params except memberScope.
- Origin chart total `total` uses seeded; Good.
Severity decisions:
- HIGH: Authorization gap/divergence (front allows, backend denies or vice versa) — because canCreate called on mutations.
- MEDIUM: mine filter fail-open when member cannot be resolved (returns scope instead of empty list); origin filter missing refusal option.
- MEDIUM/LOW: off-canvas id/opener inconsistency; duplicate buildFilterPayload call.
Need "Tool Call Conclusions": Summarize:
- code_search into SsmaActionPlanPanelService (no result due regex literal issue; search rerun with regex) found resolveOriginKey/Label/Url and presentSeededOriginChart; conclusion: refusal/other keys with count>0 are appended dynamically; seeding only controls order and default items, so actions of refusal are not discarded; but buildFilterOptions no longer lists 'refusal' in origin/overview_origins.
- read controller lines 500-560: mine filter applied atop initial scope; when mineId=0 no restriction; twice payload when mineId >0.
- read controller lines 11339-11483: canMutateSsmaActionPlan does not include Gestor de Equipe/Área as allowed nor keep them consistent with UI flags; isSsmaViewer semantic documented.
- read controller lines 611-638: resolveActionPlanPanelMemberScope shows Gestor de Equipe users are handled via team IDs; reinforces that canManageSsmaOccurrences() may not cover them; potential discrepancy.
- read controller lines 12775-12789: UI forces ssmaCanMutateActionPlan/ssmaCanCreateLinkedActions true for Gestor de Equipe/Área tags (name-based), diverging from backend `canMutateSsmaActionPlan()` — confirms main suspect.
- read SsmaAreaLimitationScope constants: TAG_SUPERVISOR_AREA = 'Supervisor de Área'; TAG_GESTOR_AREA='Gestor de Área'.
- read service lines 617-780 and 1441-1466: pendencias origin and chart; chart seeds six categories and appends leftover categories with >0 count; total computed after merge; no count lost.
- read service lines 1300-1466: resolveOriginKey/Url + chart. Confirms `recusa/refusal` mapping handled; `resolveOriginUrl` unused fallback to event_id returns '...?event=...' (query list, not direct). Minor.
- code_search broad across project found multiple offcanvas opener patterns; in relevant SSMA action plan panel: `action_plan_panel.js` relies on `window.openOffcanvasssmaApActionView` while the template uses `openOffcanvasSsmaActionPlanViewOffcanvas`, suggesting inconsistent names; fallbacks mitigate.
Completed tasks (based on what review has done):
- Confirmed seed origin chart does not discard actions of origin refusal.
- Confirmed mine filter does not ignore validators (member scope covers validator+responsible); earlier plan item false alarm closed.
- Confirmed permission inconsistency between UI and backend for Gestor de Equipe/Área.
- Need to list "already completed" items from summary/earlier review (e.g., preliminary plan, first pass findings) but only in the current conversation context: We know there were previous review summary facts. Since asked to summarize current conversation and pending tasks to continue, include items from previous summary that remain relevant. Provide detailed findings.
Pending tasks:
- Compose formal review comments (code_comment) for each confirmed issue.
- Check action plan offcanvas registration/definition to verify exact inconsistency and produce a precise comment + line.
- Check tests of new permission changes in this diff (pending from previous summary).
- Possibly check if `overview_origins` dropdown is actually rendered/used for visão geral, and whether `origin` new dropdown is applied in view pendencias.
- Verify whether permission divergence is indeed backend-blocking for Gestor de Equipe/Área with tags that might have can_create/can_edit; maybe check DB state? Not possible; but in code review can state risk needs author to centralize permission function.
Current focus: We are currently corroborating and documenting the suspected authorization divergence and the refusal filter removal in the SSMA action plan panel with file/line evidence to turn the findings into final review comments.
Need answer in pt-BR with headings. Keep moderately concise but detailed enough. No code snippets.
Format:
### Problemas de código identificados
- [ALTA] `src/Controller/SsmaController.php` — Inconsistência de autorização: flag `$ssmaCanMutateActionPlan/$ssmaCanCreateLinkedActions` é forçada a true para tags Gestor de Equipe/Área (...), enquanto `canMutateSsmaActionPlan()` não cobre essas tags por nome e depende de `canManageSsmaOccurrences()`. Resultado: botões/registros liberados na UI sem garantia de permissão no backend (risco de 403 ou de bypass dependendo da configuração da tag).
- [MÉDIA] `src/Controller/SsmaController.php` — Filtro “mine” faz fail-open quando `$member` não é resolvido (`mineId=0`): mantém o payload completo do escopo anterior em vez de retornar conjunto vazio.
- [MÉDIA] `src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php` — Remoção da opção `refusal` em `overview_origins` (e ausência no novo seletor `origin`) faz com que ações classificadas como “Direito de Recusa” não possam ser filtradas, apesar de `resolveOriginKey()` continuar mapeando `recusa/refusal`.
- [MÉDIA] `src/Controller/SsmaController.php` — `buildFilterPayload()` é chamado duas vezes quando `mine=1` com resolução de membro válida; primeira chamada descartada (custo/perf);
- [BAIXA] `templates/ssma/action_plan/tabs/_tab_action_plan.html.twig` + `public/js/ssma/action_plan_panel.js` — nomenclatura de abertura do off-canvas divergente (`openOffcanvasSsmaActionPlanViewOffcanvas` vs `openOffcanvasssmaApActionView`) ... maybe unconfirmed.
Hmm, let's classify better:
- The off-canvas mismatch was in previous "I found off-canvas ids/abridor mismatch". I should include under identified issues with path and type, severity MEDIUM (UX). But #5 is not yet fully confirmed by this session? The log immediately after shows the search results. We can state as tool conclusion but not put full certainty; include if it was already confirmed earlier (comprised in previous summary). Given instructions say "identified code issues" list confirmed issues. I'll include but say "nomenclaturas divergentes" and "potencial".
- Also present issue that "mine filter" double call — is worth including as LOW-MEDIUM.
Severities:
- Authorization divergence — HIGH
- Mine fail-open — MEDIUM
- Refusal filter missing — MEDIUM
- Duplicate buildFilterPayload call — LOW (performance)
- Offcanvas mismatched opener functions — MEDIUM, but maybe previously resolved; in the current summary I can include as "pendura para confirmar" instead of identified. Better not put uncertain in identified list. Write under Pending as verify/compose.
Include exact severities labels [ALTA]/[MÉDIA]/[BAIXA].
Wait, the previous summary (not fully known) already likely produced final notes:
Also from message 30 reasoning: "Now the important observation: isSsmaViewer()... confirms tag with can_view true and create false is viewer; resolveActionPlanPanelMemberScope at line 618 explicitly returns null for canManageSsmaOccurrences; Gestor de Equipe in team scope branch; reinforces not covered by canManage... divergence".
Another completed item from this conversation: Tag names confirmed: Supervisor de Área / Gestor de Área; therefore canMutateSsmaActionPlan's exclusion names confirm 'Supervisor de Área' excluded but 'Gestor de Área' not.
Pending:
1. Emitir comentários formais (code_comment) com os achados confirmados.
2. Confirmar (ler template) qual função/open-canvas é registrada para a view do plano de ação e identificar o mismatch preciso de id/nome antes de comentar.
3. Verificar se a opção `refusal` em `overview_origins` é efetivamente utilizada no template Visão Geral (to know if regression is user-visible) — worth doing before final comment.
4. Verificar testes novos do PR cobrindo alterações de permissões/campo mine e cobertura das mudanças de origem.
5. (Optional) Avaliar se o filtro mine aparece apenas no view pendências; se não, considerar semântica nos overview.
Current focus: "Revisão do painel de Plano de Ação SSMA: estamos consolidando evidências para apontar a inconsistência de autorização entre UI e backend para Gestor de Equipe/Área e a regressão do filtro de origem 'refusal', a fim de finalizar os comentários de revisão."
The output language must be pt-BR.
Tool Call Conclusions:
- Leitura do controller (linhas ~500-560): confirma that "mine" overrides only if mineId > 0; else returns unrestricted; mine branch discards first payload when valid.
- Leitura do service (linhas 617-780 e 1441-1466): graph seed retains lack of dropping of refusal; no regression in chart counts.
- Leitura do controller (11335-11490 e 12750-12790): UI override vs backend funções.
- Leitura do SsmaAreaLimitationScope: constants.
- code_search global: offcanvas patterns.
Need maybe only include 3-4 bullets.
Overall response likely around 600-900 words. Let me write in Portuguese pt-BR with bullets.
### Problemas de código identificados
- [ALTA] `src/Controller/SsmaController.php:11467` — Inconsistência de autorização: a UI força `ssmaCanMutateActionPlan`/`ssmaCanCreateLinkedActions = true` para usuários com tag `Gestor de Equipe`/`Gestor de Área`, mas o backend `canMutateSsmaActionPlan()` não trata essas tags por nome e depende de `canManageSsmaOccurrences()`. Isso gera divergência autoritativa entre front-end e backend (botões liberados sem garantia de permissão na rota de mutação, com risco de 403 em ações legítimas).
- [MÉDIA] `src/Controller/SsmaController.php:522` — Filtro “mine” com falha aberta: se o usuário logado não possui `CompanyMembers` resolvido (`mineId=0`), o sistema retorna o payload do escopo inicial (sem restrição/escopo total) em vez de retornar lista vazia.
- [MÉDIA] `src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php:214` — Remoção da opção `refusal` em `overview_origins` e ausência no novo seletor `origin`: `resolveOriginKey()` ainda classifica ações como `refusal` (recusa/direito de recusa), então essas ações não conseguem mais ser filtradas pela UI.
- [BAIXA] `src/Controller/SsmaController.php:503` — `buildFilterPayload()` é executada duas vezes quando `mine=true` e o membro é resolvido; a primeira chamada é descartada, gerando custo/período duplicado de carga de dados.
- [MÉDIA] `public/js/ssma/action_plan_panel.js:2253` + `templates/ssma/action_plan/tabs/_tab_action_plan.html.twig:1638` — Nomenclaturas divergentes para abrir o off-canvas de visualização de ação (`openOffcanvasssmaApActionView` usada no JS, enquanto o template chama `openOffcanvasSsmaActionPlanViewOffcanvas`), sugerindo possíveis caminhos/resíduos inconsistentes de abertura.
### Conclusões de chamadas de ferramenta
- Leitura do service `SsmaActionPlanPanelService.php` (buildPendenciasData/presentSeededOriginChart): confirmado que o gráfico semear seis categorias padrão, mas **não descarta** categorias extras com contagem maior que zero; portanto ações `refusal` continuam aparecendo no gráfico. O problema real é apenas no filtro/opções de seleção.
- Leitura do controller `SsmaController.php` (canManageSsmaOccurrences, canMutateSsmaActionPlan, flags de UI): confirmada a disparidade entre o método utilizado nas rotas de mutação e os overrides baseados em nome de tag aplicados apenas na renderização.
- Leitura de `SsmaAreaLimitationScope.php`: confirmadas as constantes `Supervisor de Área` e `Gestor de Área`; `canMutateSsmaActionPlan()` exclui explicitamente apenas supervisores, não os gestores de área/equipe.
- Leitura do controller (linhas ~500–560): confirmado que o “mine” é tratado como override do escopo-membro, que ignora a restrição do usuário quando `mineId=0` e que, quando válido, calcula o payload duas vezes.
- Busca global por padrões `openOffcanvas`: encontradas divergências nos nomes de função registrados/callbacks para o painel de Plano de Ação SSMA, reforçando o possível resíduo no fluxo de abertura do off-canvas.
### Tarefas concluídas
- Confirmado que o filtro por membro `filterByMemberScope()` cobre `validator_member_id` e `responsible_ids`, portanto não há bug de filtro “minhas ações” ignorando validação.
- Confirmado que o gráfico de origem não regride na contagem de ações da categoria `refusal`; a regressão é restrita às opções de filtro (`origin`/`overview_origins`).
- Confirmada a divergência de autorização UI vs backend para Gestor de Equipe/Área no Plano de Ação.
- Confirmado o comportamento fail-open do filtro “mine” quando o CompanyMembers não é localizado.
### Tarefas pendentes
- Emitir comentários formais (`code_comment`) para cada problema confirmado, com localizações precisas e sugestões de correção.
- Ler o template/registro do off-canvas de visualização do plano de ação para validar exatamente qual função/id é registrado e especificar o ajuste correto no comentário.
- Conferir se a View Visão Geral realmente consome `overview_origins` na template; caso consuma, documentar a perda do filtro “Direito de Recusa” como regressão de UX.
- Verificar se existem testes novos na PR cobrindo as alterações de permissões/mutação do Plano de Ação e o novo filtro `mine`.
- Valer-se da oportunidade de avaliar se o filtro `mine` deve aplicar escopo de validador/executor quando aplicado à Visão Geral ou se restringir apenas à aba Pendências.
### Foco atual
Consolidar evidências e finalizar os comentários de revisão sobre a inconsistência de autorização UI/backend para Gestores de Equipe/Área — e a perda de filtro de origem “refusal” — no fluxo do Plano de Ação SSMA (`SsmaController.php` / `SsmaActionPlanPanelService.php`).
Request #3
deepseek-v4-flash
P:109.86K C:536 CR:384 CW:0
9043ms
Reasoning
This is crucial: `canCurrentUserResolveSsmaAction` still calls `$this->canManageSsmaOccurrences()` rather than `$this->canMutateSsmaActionPlan()`! Wait — my earlier assumption from diff review was that canCurrentUserResolveSsmaAction was changed to use canMutate. Looking at actual code at 16144-16157:
```php
private function canCurrentUserResolveSsmaAction(...): bool
{
return $this->ssmaStakeholderActionPermissionService->canUserResolveAction(
$action,
$company,
$user,
$this->canManageSsmaOccurrences(),
$operation
);
}
```
And `canCurrentUserEditSsmaAction` at 16139-16142 returns `$this->canMutateSsmaActionPlan();`.
Hmm. That means the "resolve" endpoint / permissions still allow a supervisor to resolve if canManageSsmaOccurrences true? But for viewer, canManageSsmaOccurrences false (since viewer has no create/edit/delete). So functionally blocked anyway. But what about Gestor de Equipe (tag) that canManage via request attributes? Actually canManageSsmaOccurrences might return true in edit routes only; on resolve route request, likely no can_edit attr. So Gestor Equipe may still not be able to resolve if canManage false. But UI flags force true? Finding #2 covers.
Wait — diff snippet earlier supposedly showed canCurrentUserResolveSsmaAction uses canMutate. Let me recheck the diff text in the conversation: The data provided in the prompt was plain and doesn't include actually review diffs. It listed already-confirmed findings. It said: "#4 ... permission policy change without tests; #2 ... ssmaCanMutateActionPlan duplicated logic issue (screen flags forced for team/area gestor)." No explicit diff code for canCurrentUserResolve.
Let me search in code for `canMutateSsmaActionPlan()` occurrences to list where it's used; and compare with canManageSsmaOccurrences uses in resolve/validate/edit methods. If some action mutation flows still use canManage, this could be a new inconsistency beyond #2? #2 says about duplicate issue in screen flags forced for team/area gestor; plus "canMutate ... logic issue" maybe the entire policy inconsistency is known. Let me read carefully.
Let me find all occurrences of canMutateSsmaActionPlan.
</reasoning>
</message>
review_filter_task
Request #1
deepseek-v4-flash
P:11.88K C:3.79K CR:2.05K CW:0
24797ms
Reasoning
Let me analyze each comment carefully.
The task: remove only comments the diff proves factually wrong. Ground A: comment targets code not in subject file's diff. Ground B: a specific diff line literally contradicts the central claim.
Let me look at each comment.
**c-0**: path `public/js/ssma/action_plan_panel.js`. Content: The "Visualizar" button added in the Pendências table doesn't open anything: the function fills ids `ssma-ap-action-view-*` and tries to open `#ssmaApActionView`/`ssmaApActionView-offcanvas-wrapper`, but no template (including `_tab_painel.html.twig`, which contains the button) defines that markup nor registers the opener `openOffcanvasssmaApActionView`. Result: clicking the eye icon doesn't display the action data — the main delivery of the PR stays inoperative.
Wait — this comment is about markup in templates, but filed against the JS file. Hmm, the central claim: the button doesn't open anything because the offcanvas markup doesn't exist in templates. The JS diff shows `openActionViewOffcanvas(btn)` added and the button click handler now calls it. The comment claims no template defines `ssma-ap-action-view-*` markup or the opener.
Is this comment about code in its subject file (the JS diff)? The JS diff does add `openActionViewOffcanvas` function which references those ids. The comment is filed against the JS file but discusses template markup. Ground A: comment targets code not in its subject file's diff. Actually the comment's central claim is about template files not containing the markup. But the subject file is the JS. Hmm.
But wait — this is a behavioral claim: "clicking the eye icon doesn't display the action data". This is a runtime behavior claim about code the Agent could see (templates). We can't verify templates from the diff provided. The comment reasons about behavior across files not fully visible. According to instructions: "The comment reasons about runtime behavior, business semantics, or code in files you cannot see. The Agent had access you do not." So approve.
Also is it a protected subject? Behavioral change? Possibly not exactly. But regardless, we can't prove it wrong from the diff. The JS diff shows the function exists and is wired. We can't confirm templates lack markup. Approve.
**c-1**: path `src/Controller/SsmaController.php`. Content: Gestores de Equipe/Área may see create/edit/resolve buttons that the server will deny (or the opposite), because the same permission rule now lives in two points with different criteria. Here the screen forces flags for "Gestor de Equipe"/"Gestor de Área" tags unconditionally, while the method used in endpoints (`canMutateSsmaActionPlan()`) only frees those tags indirectly — if the tag has can_create/edit/delete of ssma-occurrences or management role. Since permission tags are configurable per company, a company configuring Gestor de Equipe with only read access would see buttons and get 403.
Wait, the comment says the code forces flags for "Gestor de Equipe"/"Gestor de Área" unconditionally. Let me check: the diff at line 12776 shows:
```php
if ($ssmaIsTagTeamGestor || $ssmaIsTagAreaGestor) {
$ssmaCanCreateLinkedActions = true;
$ssmaCanMutateActionPlan = true;
}
```
But wait, in canMutateSsmaActionPlan(), the tags checked are 'Supervisor de Equipe', 'Supervisor', SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA — not 'Gestor de Equipe'/'Gestor de Área'. Hmm, the comment claims canMutateSsmaActionPlan only frees Gestor de Equipe tags "indirectly". Actually let me look more carefully.
Actually the comment asserts a discrepancy between two code points. This is about permission behavior — behavioral/consistency analysis. It involves reasoning about the actual semantics of tags, configurable per company, templates not shown. We cannot verify from the diff. The code in the diff doesn't show what `$ssmaIsTagTeamGestor` is, nor the tag config, nor templates. This comment reasons about runtime behavior/business semantics in code we cannot see. Approve.
Also subject could be protected (behavioral change / permission). The comment about behavioral changes in permissions — protected subject. Approve.
**c-2**: path `src/Controller/SsmaController.php`. Content: When "Minhas ações" is checked and the logged user has no member link in the company (mineId = 0), the filter is silently ignored: the payload built before the `if` — which for managers/admins is without member restriction — is returned intact. So a manager without CompanyMembers checking "Minhas ações" receives the full company list instead of empty list or error, breaking the filter promise. Also when the member exists the payload is built twice (lines 503 and 527), doubling load.
Let me look at the diff. In SsmaController.php around line 519:
```php
+ if ($request->query->getBoolean('mine')) {
+ $user = $this->getUser();
+ $member = ($user instanceof User) ? $this->getCurrentCompanyMember($company, $user) : null;
+ $mineId = (int) ($member?->getId() ?? 0);
+ if ($mineId > 0) {
+ $payload = $this->ssmaActionPlanPanelService->buildFilterPayload(
...
+ );
+ }
+ }
```
So the code: if mine checked and member exists, rebuild payload with member restriction. If member doesn't exist (mineId=0), nothing happens — payload remains as built before (unrestricted). The comment claims that when mineId = 0, the payload built before is returned intact (full list for managers). That matches the diff logic — yes, there's an earlier payload built before this block (presumably). The comment also says payload built twice when member exists — yes, an earlier build at line ~503 and another within if at ~527.
Is this factually wrong? The diff shows the `if ($mineId > 0)` block — which means when mineId is 0, nothing happens. Whether this "breaks the filter promise" is a value judgment / behavioral reasoning. The factual claims: (1) when mineId=0 the filter is ignored and prior payload returned — consistent with the diff code as shown. We can't see the earlier build though; but the diff shows context where `$payload` is used after. Actually wait, the earlier code (before diff) built payload at lines 503. We see in the diff the surrounding context that a payload was already built (line ~503 in original). Actually we see `$payload = $this->ssmaActionPlanPanelService->buildFilterPayload(...)` before the `if` block in the pre-existing code at lines 519 region (the diff hunk header shows @@ -519,6 +519,32 @@ and the added block is at the end of a method where payload was already built). Yes the diff shows the pre-existing payload build right above (the context lines include `trim((string) $request->query->get('origin', '')),` and `);` before the `if`). So the claim "payload is built twice" matches.
This is a behavioral/logic analysis. Is it protected? The comment describes a behavior: when mine filter is active and no member, the response returns unrestricted scope. This is arguably a behavioral/security concern about the filter semantics. It's the sort of runtime behavior reasoning. It may be correct or not. But the question: does the diff prove it wrong? No. Approve.
Also this might be a protected subject (behavioral change) — the filter's behavior. Approve regardless.
**c-3**: path `src/Controller/SsmaController.php`. Content: Permission policy changed without automated test covering scenarios. Add integration test. This is a test-coverage recommendation — not factually verifiable from diff. Not a factual claim about the diff per se. Approve (can't prove wrong).
**c-4**: path `src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php`. Content: Actions of origin "Direito de Recusa" (recusa/refusal) still classified as `refusal` by `resolveOriginKey()`, but the origin filter options — the new one and the Visão Geral one — no longer include this category, which existed before in the Visão Geral selector. So old data of this type can't be isolated by filter, only appears in "Todas", without migration or justification. Keep the option (and graph seed) while the domain value exists, or document discontinuation and handle old records explicitly.
Let me check the facts. In the service file diff:
Filter options:
```php
'overview_origins' => [
['value' => '', 'text' => 'Todas'],
['value' => 'accident_personal', 'text' => 'Acidente pessoal'],
...
['value' => 'inspection', 'text' => 'Inspeção'],
['value' => 'approach', 'text' => 'Abordagem'],
],
'origin' => [
['value' => '', 'text' => 'Origem'],
...
],
```
Wait, 'overview_origins' before: included 'ros', 'refusal' (Direito de Recusa). The new overview_origins: no 'refusal'. Indeed the old list had `['value' => 'refusal', 'text' => 'Direito de Recusa']` and 'ros' — but new removes both 'refusal' and keeps ros? Let me re-read the diff:
```
'overview_origins' => [
- ['value' => '', 'text' => 'Origem'],
- ['value' => 'accident', 'text' => 'Acidente'],
+ ['value' => '', 'text' => 'Todas'],
+ ['value' => 'accident_personal', 'text' => 'Acidente pessoal'],
+ ['value' => 'accident_material', 'text' => 'Acidente material'],
+ ['value' => 'near_miss', 'text' => 'Quase acidente'],
+ ['value' => 'ros', 'text' => 'ROS'],
['value' => 'inspection', 'text' => 'Inspeção'],
['value' => 'approach', 'text' => 'Abordagem'],
+ ],
+ 'origin' => [
+ ['value' => '', 'text' => 'Origem'],
+ ['value' => 'accident_personal', 'text' => 'Acidente pessoal'],
+ ['value' => 'accident_material', 'text' => 'Acidente material'],
+ ['value' => 'near_miss', 'text' => 'Quase acidente'],
['value' => 'ros', 'text' => 'ROS'],
- ['value' => 'refusal', 'text' => 'Direito de Recusa'],
+ ['value' => 'inspection', 'text' => 'Inspeção'],
+ ['value' => 'approach', 'text' => 'Abordagem'],
],
```
Hmm, wait. The diff is a bit confusing. Let me reconstruct. The original probably had only 'overview_origins' with entries: Origem, accident Acidente, inspection, approach, ros, refusal Direito de Recusa. Hmm the diff shows the removal of `['value' => 'refusal', 'text' => 'Direito de Recusa']`. So yes, 'refusal' option removed.
The new 'origin' options don't include refusal either.
And resolveOriginKey still maps recusa/refusal → 'refusal' (in resolveOrigemFromValue, line "str_contains($value, 'recusa') || str_contains($value, 'refusal') => 'refusal'"). And resolveOriginLabel still has 'refusal' => 'Direito de Recusa'. And resolveOriginIcon metadata still has 'refusal' => [...]. But the seed for chart removed 'refusal' (old seed had 'refusal' => ['label' => 'Direito de Recusa', 'count' => 0], new seed dropped it).
So the comment's claims: refusal still classified as refusal (true per diff), filter options no longer include refusal (true per diff), seed of graph no longer includes refusal (true). Before it existed in Visão Geral selector (true per diff, removed). So comment is factually consistent with the diff.
The comment's recommendation — keep option or document — is a value judgment. The factual claims hold. So approve.
Hmm, wait: is any of this a protected subject? Not exactly. Is the comment factually wrong anywhere? It says "antes existia no seletor da Visão Geral" — before it existed in the overview selector. The diff shows removal of refusal from overview_origins. Correct. It says refusal data can no longer be isolated by filter — plausible. Nothing contradicts.
So all comments approved? Let me double check c-0 more carefully for Ground A or B.
c-0 filed against `public/js/ssma/action_plan_panel.js`. The central claim: the added button doesn't open anything because no template defines the offcanvas markup or the opener. The subject file diff contains the `openActionViewOffcanvas` function and the click handler wiring. The comment claims that the function references elements `ssma-ap-action-view-*`, `#ssmaApActionView`, `ssmaApActionView-offcanvas-wrapper`, and the opener `openOffcanvasssmaApActionView`, none of which are defined in templates. We cannot see the templates that would define the markup — but the file `_tab_painel.html.twig` in the group does not show offcanvas markup. However, Ground A says the comment targets code absent from its subject file's diff. The comment targets the JS code (in subject file) — it is present. The claim is about whether markup exists elsewhere. Since we cannot prove no other template defines it, we can't prove the comment wrong. Also, there could be other template files the Agent saw that define the offcanvas. Indeed, the offcanvas markup might exist in the same template but is in a section of the file not in the diff. The diff only shows part of `_tab_painel.html.twig`. The Agent had full file access. So we can't verify, hence approve.
Also c-0 concerns runtime behavior (button does nothing) — behavior reasoning. Approve.
Actually, wait — there's a subtlety about c-0. Ground A: "it discusses the body of a function, on a file that only declares or references it". Not this case. The function is fully added in the JS diff. So Ground A doesn't apply.
Could Ground B apply? Is there a diff line literally contradicting "no template defines that markup"? We can't check templates because offcanvas may exist in parts not in the diff. `_tab_painel.html.twig` diff doesn't show `ssma-ap-action-view` markup, but absence in the diff isn't proof of absence in the file. Ground A applies only against subject file. Approve.
So final decision: approve all comments.
Let me reconsider whether any comment should be removed on Ground B.
c-1 claims the screen forces flags for "Gestor de Equipe"/"Gestor de Área" tags unconditionally, while canMutateSsmaActionPlan only frees these tags indirectly. Hmm. Actually looking at the code, is there a diff line that contradicts this? Let's look at canMutateSsmaActionPlan in the diff:
```php
private function canMutateSsmaActionPlan(): bool
{
if ($this->isSsmaViewer()) {
return false;
}
$tagName = $this->ssmaCurrentMemberPermissionTag()?->getName();
if (in_array($tagName, [
'Supervisor de Equipe',
'Supervisor',
SsmaAreaLimitationScope::TAG_SUPERVISOR_AREA,
], true)) {
return false;
}
return $this->canManageSsmaOccurrences();
}
```
So canMutateSsmaActionPlan returns canManageSsmaOccurrences() unless viewer or supervisor tag. And in the template, `$ssmaCanMutateActionPlan` forced true for tag gestor de equipe/área. The comment says these two points use different criteria. Indeed there's a difference in the code as shown. But whether it leads to users seeing buttons then 403 depends on actual tag configs — reasoning about configurable tags, can't verify. But that is a value/logic analysis, not factually contradicted by the diff. So approve.
Actually, hmm, let me reconsider whether the comment is factually accurate as to the code. But the question is only whether the diff proves it wrong — no. Approve.
Now let me reconsider whether c-0, c-2 etc might be protected subjects that force approval regardless. c-0: behavior of button not opening — behavioral claim. c-2: behavior of filter. c-1: permission/behavioral. c-3: testing. c-4: domain/behavior. All protected or unverifiable.
Approve all.
Tool Calls (1)
approve_all_comments
Show Details
Arguments
{}
Request #2
deepseek-v4-flash
P:11.15K C:1.54K CR:4.61K CW:0
12013ms
Reasoning
Let me analyze the two review comments.
Comment c-0: Filed against src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php. Claims that the "Ir para origem" link for actions with occurrence points to `/manager/ssma/ocorrencias/{id}` but the real route for occurrence detail is `/manager/ssma/occurrence/{id}`. Claims the path with `ocorrencias` (plural) doesn't exist.
The diff shows in the service file:
```php
$occurrenceId = (int) ($action['occurrence_id'] ?? 0);
if ($occurrenceId > 0) {
return '/manager/ssma/ocorrencias/' . $occurrenceId;
}
```
So the code does generate `/manager/ssma/ocorrencias/{id}`. Whether that route exists or not is a claim about routing in other files that I cannot verify. Is this a protected subject? This is about a route/path that doesn't exist — behavioral (404). Hmm. Actually the comment claims the route doesn't exist and would give 404. This is about a behavioral problem... it's a factual claim about routing which I cannot verify from the diff. It's not clearly in a protected category. Actually "behavioral change" protected category is about old code producing something new code no longer does. This is not exactly that.
The comment targets code in the diff. Ground A doesn't apply since the code exists in the diff. Ground B: is there a diff line that literally contradicts the claim? The claim says the path `/manager/ssma/ocorrencias/{id}` is wrong. The diff shows this path is generated. But whether the route exists is external to the diff — I can't verify. The Agent may have seen routing files. So approve.
Actually, wait — do the diffs show any route? Let me search. In the group files, routes aren't defined. We can't verify the route doesn't exist. So approve c-0.
Comment c-1: Filed against templates/ssma/action_plan/tabs/_tab_painel.html.twig. Claims that on first render of Pendências sub-tab, the new columns 'Quem executa'/'Quem valida' are in the header, but the template still generates 8 cells — the old single 'Responsável' column — against 9 header columns, causing misalignment. Says there's a loop building `ap_table_rows` around line 500 in this file that needs updating to emit 'Quem executa' and 'Quem valida' separately using `row.executors` and `row.validators`.
Now let me look at the diff of _tab_painel.html.twig. The diff only shows changes to header titles (adding two new columns) plus filter items. The diff doesn't show any row-building loop or `ap_table_rows`. So the comment claims there is a loop building rows around line 500 in this file that generates 8 cells. But the diff for this file only shows the header change.
Hmm. But is the row-building code present in the file (just not in the diff)? The comment's subject file's diff — Ground A says the comment targets code that is not in its subject file's diff. The comment describes a loop that mounts `ap_table_rows` around line 500 in this file, which is absent from the diff. We can only see the diff, not the whole file. Wait — Ground A says "The symbol, statement, or construct the comment describes appears nowhere in the `<file>` whose path the comment names." But here the question is whether the code exists in the file. We can only see the diff. The comment says the loop is "por volta da linha 500 deste arquivo" (around line 500 of this file). The diff shows changes around lines 153 and 495-528. Actually the diff hunk at line 495-519+ shows header titles around line 519-528. So there could be a row loop at line ~500 in the file that isn't shown in the diff (it's context not changed).
Hmm, but the task says: "These review comments come from an Agent that could invoke tools to read the full codebase. You can see only the diffs of the files it reviewed together. Anything you cannot see, the Agent may well have seen."
So I can't verify whether the template has a row-building loop that still generates 8 cells. The diff doesn't show it. So Ground A cannot be established — I cannot prove the row loop is absent from the file, since I can only see the diff. The row-building code might well exist in the unchanged portion of the file.
Wait, but let's think carefully. The template diff shows the columns header. The claim: on server-side first render, the template generates rows with 8 cells. The diff of this file does not contain the row generation code, but it may be in the file unchanged. Given the diff context shows the table header columns are being added, and DataTables columns are defined... Actually there's also a DataTables JS config somewhere. The template file contains the table. Row rendering in the server-rendered template likely happens server-side elsewhere or within the same file.
Actually, the claim is that the template builds rows in the same file around line 500. The diff only shows the header around line 519. Since we can only see a diff, and not the whole file, we cannot confirm nor deny the existence of a row-building loop.
Let me consider: is this claim contradicted by the diff? Ground B requires a specific diff line that literally contradicts the central claim. Is there any diff line in the group that shows the server-side rows already emit 'Quem executa' and 'Quem valida' separately? The JS diff in action_plan_panel.js adds cells for executors and validators in updatePendenciasTable (client-side rendering). But that's the AJAX-updated table, not the first server render. The template file `_tab_painel.html.twig` diff shows no row code change. So no contradiction visible.
So comment c-1 cannot be proven wrong from the diff. Approve.
Let me double check the protected subjects for c-0. The subject is about a route producing 404 — behavioral. The "behavioral or compatibility change" protected category: "a message, field, status, or default that the old code produced and the new code no longer does; an altered error path; a counter whose update moved to a different point in the lifecycle." This comment is about a new link pointing to a non-existent route causing 404. That's arguably about an error path / behavior of the new feature. Not quite the old-vs-new change. But regardless, we cannot prove it wrong — the route existence is unknowable from diff.
So both comments: approve all.
Let me be careful with c-0: Is there a route file in the group? No. The controller file SsmaController.php has routes like '/manager/ssma/...' but no route definitions visible. So cannot verify.
Both approve.
I'll call approve_all_comments.
Tool Calls (1)
approve_all_comments
Show Details
Arguments
{}
Review Comments (7 findings)
public/js/ssma/action_plan_panel.js 1 comments
src/Controller/SsmaController.php 3 comments
src/Service/Ssma/ActionPlan/SsmaActionPlanPanelService.php 2 comments
templates/ssma/action_plan/tabs/_tab_painel.html.twig 1 comments
No comments match this filter.