Feat: Adiciona filtros PF/PJ, dropdown de clientes e visualização em grupo (accordion)
This commit is contained in:
parent
2c05ac8311
commit
14128cce99
|
|
@ -1,401 +1,441 @@
|
||||||
<!-- Toast (Sucesso Login) -->
|
<div class="toast-container position-fixed top-0 end-0 p-3" style="z-index: 10000;">
|
||||||
<div class="toast-container position-fixed top-0 end-0 p-3" style="z-index: 2000;">
|
<div #successToast class="toast text-bg-success border-0 shadow" role="alert" aria-live="assertive" aria-atomic="true">
|
||||||
<div
|
<div class="toast-header border-bottom-0">
|
||||||
#successToast
|
<strong class="me-auto text-primary">LineGestão</strong>
|
||||||
class="toast text-bg-success"
|
|
||||||
role="alert"
|
|
||||||
aria-live="assertive"
|
|
||||||
aria-atomic="true"
|
|
||||||
>
|
|
||||||
<div class="toast-header">
|
|
||||||
<strong class="me-auto">LineGestão</strong>
|
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Fechar"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Fechar"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="toast-body">
|
<div class="toast-body bg-white rounded-bottom text-dark">
|
||||||
{{ toastMessage }}
|
{{ toastMessage }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section class="geral-page">
|
<section class="geral-page" (click)="closeClientDropdown()">
|
||||||
|
|
||||||
<!-- background "home-like" -->
|
|
||||||
<span class="page-blob blob-1" aria-hidden="true"></span>
|
<span class="page-blob blob-1" aria-hidden="true"></span>
|
||||||
<span class="page-blob blob-2" aria-hidden="true"></span>
|
<span class="page-blob blob-2" aria-hidden="true"></span>
|
||||||
<span class="page-blob blob-3" aria-hidden="true"></span>
|
<span class="page-blob blob-3" aria-hidden="true"></span>
|
||||||
<span class="page-blob blob-4" aria-hidden="true"></span>
|
<span class="page-blob blob-4" aria-hidden="true"></span>
|
||||||
|
|
||||||
<div class="container-geral">
|
<div class="container-geral">
|
||||||
|
|
||||||
<div class="geral-card" data-animate>
|
<div class="geral-card" data-animate>
|
||||||
|
|
||||||
<!-- HEADER -->
|
|
||||||
<div class="geral-header">
|
<div class="geral-header">
|
||||||
<div class="header-row-top">
|
<div class="header-row-top">
|
||||||
|
<div class="header-spacer d-none d-md-block"></div>
|
||||||
<div class="header-title" data-animate>
|
<div class="header-title" data-animate>
|
||||||
<div class="title-badge">
|
<div class="title-badge"><i class="bi bi-grid-1x2"></i> Gestão centralizada</div>
|
||||||
<i class="bi bi-grid-1x2"></i>
|
|
||||||
Gestão centralizada
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h5 class="title mb-0">Geral</h5>
|
<h5 class="title mb-0">Geral</h5>
|
||||||
<small class="subtitle">Tabela de linhas e dados de telefonia</small>
|
<small class="subtitle">Tabela de linhas e dados de telefonia</small>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="header-actions d-flex gap-2 justify-content-center justify-content-md-end" data-animate>
|
||||||
<div class="header-actions d-flex gap-2" data-animate>
|
<button type="button" class="btn btn-glass btn-sm" (click)="onImportExcel()" [disabled]="loading">
|
||||||
<button
|
<i class="bi bi-file-earmark-excel me-1"></i> Importar
|
||||||
type="button"
|
|
||||||
class="btn btn-outline-primary btn-sm btn-glass"
|
|
||||||
(click)="onImportExcel()"
|
|
||||||
title="Importar dados de planilha"
|
|
||||||
[disabled]="loading"
|
|
||||||
>
|
|
||||||
<i class="bi bi-file-earmark-excel me-1"></i>
|
|
||||||
Importar Excel
|
|
||||||
</button>
|
</button>
|
||||||
|
<input #excelInput type="file" class="d-none" accept=".xlsx" (change)="onExcelSelected($event)" />
|
||||||
<!-- input escondido para upload -->
|
<button type="button" class="btn btn-brand btn-sm" (click)="onCadastrarLinha()" [disabled]="loading">
|
||||||
<input
|
<i class="bi bi-plus-circle me-1"></i> Nova Linha
|
||||||
#excelInput
|
|
||||||
type="file"
|
|
||||||
class="d-none"
|
|
||||||
accept=".xlsx"
|
|
||||||
(change)="onExcelSelected($event)"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary btn-sm btn-brand"
|
|
||||||
(click)="onCadastrarLinha()"
|
|
||||||
title="Cadastrar uma nova linha"
|
|
||||||
[disabled]="loading"
|
|
||||||
>
|
|
||||||
<i class="bi bi-plus-circle me-1"></i>
|
|
||||||
Cadastrar Linha
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- CONTROLES -->
|
<div class="filters-row mt-4" data-animate>
|
||||||
<div class="controls mt-3" data-animate>
|
|
||||||
|
|
||||||
<div class="input-group input-group-sm search-group">
|
<div class="filter-tabs">
|
||||||
<span class="input-group-text" title="Buscar">
|
<button type="button" class="filter-tab" [class.active]="filterSkil === 'ALL'" (click)="setFilter('ALL')" [disabled]="loading">
|
||||||
<i class="bi bi-search"></i>
|
Todos
|
||||||
</span>
|
</button>
|
||||||
|
<button type="button" class="filter-tab" [class.active]="filterSkil === 'PF'" (click)="setFilter('PF')" [disabled]="loading">
|
||||||
<input
|
<i class="bi bi-person me-1"></i> Pessoa Física
|
||||||
class="form-control"
|
</button>
|
||||||
placeholder="Pesquisar..."
|
<button type="button" class="filter-tab" [class.active]="filterSkil === 'PJ'" (click)="setFilter('PJ')" [disabled]="loading">
|
||||||
[(ngModel)]="searchTerm"
|
<i class="bi bi-building me-1"></i> Pessoa Jurídica
|
||||||
(ngModelChange)="onSearch()"
|
|
||||||
[disabled]="loading"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<button
|
|
||||||
class="btn btn-outline-secondary btn-clear"
|
|
||||||
type="button"
|
|
||||||
(click)="clearSearch()"
|
|
||||||
*ngIf="searchTerm"
|
|
||||||
title="Limpar busca"
|
|
||||||
[disabled]="loading"
|
|
||||||
>
|
|
||||||
<i class="bi bi-x-lg"></i>
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-size">
|
<div class="client-filter-wrap" (click)="$event.stopPropagation()">
|
||||||
<span class="text-muted small">Itens por página</span>
|
<button
|
||||||
<select
|
type="button"
|
||||||
class="form-select form-select-sm w-auto select-glass"
|
class="btn-client-filter"
|
||||||
[(ngModel)]="pageSize"
|
[class.active]="selectedClient"
|
||||||
(change)="onPageSizeChange()"
|
(click)="toggleClientMenu()"
|
||||||
[disabled]="loading"
|
[disabled]="loading"
|
||||||
>
|
>
|
||||||
|
<i class="bi bi-people-fill me-2" *ngIf="!selectedClient"></i>
|
||||||
|
<span class="text-truncate" style="max-width: 150px;">
|
||||||
|
{{ selectedClient ? selectedClient : 'Clientes' }}
|
||||||
|
</span>
|
||||||
|
<i class="bi bi-chevron-down ms-2 small"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div class="client-dropdown" *ngIf="showClientMenu">
|
||||||
|
<div class="dropdown-header-search">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="form-control form-control-sm"
|
||||||
|
placeholder="Buscar na lista..."
|
||||||
|
[(ngModel)]="clientSearchTerm"
|
||||||
|
autofocus
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="dropdown-list">
|
||||||
|
<div
|
||||||
|
class="dropdown-item-custom"
|
||||||
|
[class.selected]="!selectedClient"
|
||||||
|
(click)="selectClient(null)"
|
||||||
|
>
|
||||||
|
<i class="bi bi-grid me-2"></i> Todos os Clientes
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ng-container *ngFor="let client of filteredClientsList">
|
||||||
|
<div
|
||||||
|
class="dropdown-item-custom"
|
||||||
|
[class.selected]="client === selectedClient"
|
||||||
|
(click)="selectClient(client)"
|
||||||
|
>
|
||||||
|
{{ client }}
|
||||||
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<div class="p-3 text-center text-muted small" *ngIf="filteredClientsList.length === 0">
|
||||||
|
Nenhum cliente encontrado.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="controls mt-3" data-animate *ngIf="!isGroupMode">
|
||||||
|
<div class="input-group input-group-sm search-group">
|
||||||
|
<span class="input-group-text"><i class="bi bi-search"></i></span>
|
||||||
|
<input class="form-control" placeholder="Pesquisar..." [(ngModel)]="searchTerm" (ngModelChange)="onSearch()" [disabled]="loading" />
|
||||||
|
<button class="btn btn-outline-secondary btn-clear" type="button" (click)="clearSearch()" *ngIf="searchTerm">
|
||||||
|
<i class="bi bi-x-lg"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="page-size">
|
||||||
|
<span class="text-muted small fw-bold">Itens por página</span>
|
||||||
|
<select class="form-select form-select-sm select-glass" [(ngModel)]="pageSize" (change)="onPageSizeChange()" [disabled]="loading">
|
||||||
<option [ngValue]="10">10</option>
|
<option [ngValue]="10">10</option>
|
||||||
<option [ngValue]="20">20</option>
|
<option [ngValue]="20">20</option>
|
||||||
<option [ngValue]="50">50</option>
|
<option [ngValue]="50">50</option>
|
||||||
<option [ngValue]="100">100</option>
|
<option [ngValue]="100">100</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- TABELA -->
|
|
||||||
<div class="geral-body">
|
<div class="geral-body">
|
||||||
<div class="table-wrap">
|
|
||||||
<div class="table-responsive">
|
|
||||||
|
|
||||||
<table class="table table-hover align-middle mb-0 table-geral">
|
<div class="groups-container" *ngIf="isGroupMode; else tableView">
|
||||||
|
|
||||||
|
<div class="text-center p-5" *ngIf="loading">
|
||||||
|
<span class="spinner-border text-brand"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="group-list" *ngIf="!loading">
|
||||||
|
<div *ngFor="let group of clientGroups" class="client-group-card" [class.expanded]="expandedGroup === group.cliente">
|
||||||
|
|
||||||
|
<div class="group-header" (click)="toggleGroup(group.cliente)">
|
||||||
|
<div class="group-info">
|
||||||
|
<h6 class="mb-0 fw-bold text-dark">{{ group.cliente }}</h6>
|
||||||
|
<div class="group-badges">
|
||||||
|
<span class="badge-pill total">{{ group.totalLinhas }} Linhas</span>
|
||||||
|
<span class="badge-pill active" *ngIf="group.ativos > 0">{{ group.ativos }} Ativas</span>
|
||||||
|
<span class="badge-pill blocked" *ngIf="group.bloqueados > 0">{{ group.bloqueados }} Bloq.</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="group-toggle-icon">
|
||||||
|
<i class="bi bi-chevron-down"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="group-body" *ngIf="expandedGroup === group.cliente">
|
||||||
|
<div class="table-wrap inner-table-wrap">
|
||||||
|
<div *ngIf="loadingLines" class="p-4 text-center text-muted"><span class="spinner-border spinner-border-sm me-2"></span> Carregando linhas...</div>
|
||||||
|
|
||||||
|
<table class="table table-modern align-middle text-center mb-0" *ngIf="!loadingLines">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ITEM</th><th>LINHA</th><th>USUÁRIO</th><th>STATUS</th><th>VENCIMENTO</th><th>AÇÕES</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let r of groupLines" class="table-row-item">
|
||||||
|
<td class="text-muted fw-bold">{{ r.item }}</td>
|
||||||
|
<td class="fw-black text-blue">{{ r.linha }}</td>
|
||||||
|
<td class="text-dark">{{ r.usuario || '-' }}</td>
|
||||||
|
<td><span class="status-pill" [ngClass]="statusClass(r.status)">{{ statusLabel(r.status) }}</span></td>
|
||||||
|
<td class="text-muted small fw-bold">{{ r.contrato }}</td>
|
||||||
|
<td>
|
||||||
|
<div class="action-group justify-content-center">
|
||||||
|
<button type="button" class="btn-icon" (click)="onDetalhes(r)" title="Detalhes"><i class="bi bi-eye"></i></button>
|
||||||
|
<button type="button" class="btn-icon success" (click)="onFinanceiro(r)" title="Financeiro"><i class="bi bi-cash-coin"></i></button>
|
||||||
|
<button type="button" class="btn-icon primary" (click)="onEditar(r)" title="Editar"><i class="bi bi-pencil-square"></i></button>
|
||||||
|
<button type="button" class="btn-icon danger" (click)="onRemover(r, true)" title="Remover"><i class="bi bi-trash"></i></button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr *ngIf="groupLines.length === 0">
|
||||||
|
<td colspan="6" class="p-3 text-muted">Nenhuma linha encontrada neste grupo.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ng-template #tableView>
|
||||||
|
<div class="table-wrap">
|
||||||
|
<table class="table table-modern align-middle text-center">
|
||||||
|
<colgroup>
|
||||||
|
<col style="width: 80px;">
|
||||||
|
<col style="width: 140px;">
|
||||||
|
<col style="width: 280px;">
|
||||||
|
<col style="width: 160px;">
|
||||||
|
<col style="width: 130px;">
|
||||||
|
<col style="width: 130px;">
|
||||||
|
<col style="width: 160px;">
|
||||||
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="sortable" (click)="setSort('item')">
|
<th class="sortable text-center" (click)="setSort('item')">
|
||||||
ITÉM
|
<div class="th-content justify-content-center">
|
||||||
<span class="sort-caret">
|
ITEM <span class="sort-caret" [class.active]="sortKey==='item'">{{ sortKey==='item' && sortDir==='desc' ? '▼' : '▲' }}</span>
|
||||||
{{ sortKey==='item' ? (sortDir==='asc' ? '▲' : '▼') : '' }}
|
</div>
|
||||||
</span>
|
|
||||||
</th>
|
</th>
|
||||||
|
<th class="sortable text-center" (click)="setSort('linha')">
|
||||||
<th class="sortable" (click)="setSort('conta')">
|
<div class="th-content justify-content-center">
|
||||||
CONTA
|
LINHA <span class="sort-caret" [class.active]="sortKey==='linha'">{{ sortKey==='linha' && sortDir==='desc' ? '▼' : '▲' }}</span>
|
||||||
<span class="sort-caret">
|
</div>
|
||||||
{{ sortKey==='conta' ? (sortDir==='asc' ? '▲' : '▼') : '' }}
|
|
||||||
</span>
|
|
||||||
</th>
|
</th>
|
||||||
|
<th class="sortable text-center" (click)="setSort('cliente')">
|
||||||
<th class="sortable" (click)="setSort('linha')">
|
<div class="th-content justify-content-center">
|
||||||
LINHA
|
CLIENTE <span class="sort-caret" [class.active]="sortKey==='cliente'">{{ sortKey==='cliente' && sortDir==='desc' ? '▼' : '▲' }}</span>
|
||||||
<span class="sort-caret">
|
</div>
|
||||||
{{ sortKey==='linha' ? (sortDir==='asc' ? '▲' : '▼') : '' }}
|
|
||||||
</span>
|
|
||||||
</th>
|
</th>
|
||||||
|
<th class="sortable text-center" (click)="setSort('status')">
|
||||||
<th class="sortable" (click)="setSort('chip')">
|
<div class="th-content justify-content-center">
|
||||||
CHIP
|
STATUS <span class="sort-caret" [class.active]="sortKey==='status'">{{ sortKey==='status' && sortDir==='desc' ? '▼' : '▲' }}</span>
|
||||||
<span class="sort-caret">
|
</div>
|
||||||
{{ sortKey==='chip' ? (sortDir==='asc' ? '▲' : '▼') : '' }}
|
|
||||||
</span>
|
|
||||||
</th>
|
</th>
|
||||||
|
<th class="sortable text-center" (click)="setSort('skil')">
|
||||||
<th class="sortable" (click)="setSort('cliente')">
|
<div class="th-content justify-content-center">
|
||||||
CLIENTE
|
SKIL <span class="sort-caret" [class.active]="sortKey==='skil'">{{ sortKey==='skil' && sortDir==='desc' ? '▼' : '▲' }}</span>
|
||||||
<span class="sort-caret">
|
</div>
|
||||||
{{ sortKey==='cliente' ? (sortDir==='asc' ? '▲' : '▼') : '' }}
|
|
||||||
</span>
|
|
||||||
</th>
|
</th>
|
||||||
|
<th class="sortable text-center" (click)="setSort('contrato')">
|
||||||
<th class="sortable" (click)="setSort('usuario')">
|
<div class="th-content justify-content-center">
|
||||||
USUÁRIO
|
VENCIMENTO <span class="sort-caret" [class.active]="sortKey==='contrato'">{{ sortKey==='contrato' && sortDir==='desc' ? '▼' : '▲' }}</span>
|
||||||
<span class="sort-caret">
|
</div>
|
||||||
{{ sortKey==='usuario' ? (sortDir==='asc' ? '▲' : '▼') : '' }}
|
|
||||||
</span>
|
|
||||||
</th>
|
</th>
|
||||||
|
<th class="text-center">AÇÕES</th>
|
||||||
<th class="sortable" (click)="setSort('plano')">
|
|
||||||
PLANO CONTRATO
|
|
||||||
<span class="sort-caret">
|
|
||||||
{{ sortKey==='plano' ? (sortDir==='asc' ? '▲' : '▼') : '' }}
|
|
||||||
</span>
|
|
||||||
</th>
|
|
||||||
|
|
||||||
<th class="sortable" (click)="setSort('contrato')">
|
|
||||||
VENC. DA CONTA
|
|
||||||
<span class="sort-caret">
|
|
||||||
{{ sortKey==='contrato' ? (sortDir==='asc' ? '▲' : '▼') : '' }}
|
|
||||||
</span>
|
|
||||||
</th>
|
|
||||||
|
|
||||||
<th class="text-end">AÇÕES</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngIf="loading">
|
<tr *ngIf="loading">
|
||||||
<td colspan="9" class="text-center py-5 text-muted empty-state">
|
<td colspan="7" class="text-center py-5 empty-state"><span class="spinner-border spinner-border-sm me-2 text-brand"></span> Carregando...</td>
|
||||||
<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>
|
</tr>
|
||||||
Carregando registros...
|
<tr *ngFor="let r of pagedRows; trackBy: trackById" class="table-row-item">
|
||||||
|
<td class="text-center text-muted fw-bold">{{ r.item }}</td>
|
||||||
|
<td class="text-center fw-black text-blue">{{ r.linha }}</td>
|
||||||
|
<td class="text-center fw-bold text-dark td-clip" [title]="r.cliente">{{ r.cliente }}</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<span class="status-pill" [ngClass]="statusClass(r.status)" [title]="r.status || ''">{{ statusLabel(r.status) }}</span>
|
||||||
|
</td>
|
||||||
|
<td class="text-center fw-bold text-muted small">{{ r.skil }}</td>
|
||||||
|
<td class="text-center fw-bold text-muted small">{{ r.contrato }}</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<div class="action-group justify-content-center">
|
||||||
|
<button type="button" class="btn-icon" (click)="onDetalhes(r)" title="Detalhes"><i class="bi bi-eye"></i></button>
|
||||||
|
<button type="button" class="btn-icon success" (click)="onFinanceiro(r)" title="Financeiro"><i class="bi bi-cash-coin"></i></button>
|
||||||
|
<button type="button" class="btn-icon primary" (click)="onEditar(r)" title="Editar"><i class="bi bi-pencil-square"></i></button>
|
||||||
|
<button type="button" class="btn-icon danger" (click)="onRemover(r)" title="Remover"><i class="bi bi-trash"></i></button>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr *ngFor="let r of pagedRows; trackBy: trackById" data-row>
|
|
||||||
<td class="text-muted">{{ r.item }}</td>
|
|
||||||
<td>{{ r.conta }}</td>
|
|
||||||
<td class="fw-semibold td-highlight">{{ r.linha }}</td>
|
|
||||||
<td>{{ r.chip }}</td>
|
|
||||||
<td>{{ r.cliente }}</td>
|
|
||||||
<td>{{ r.usuario }}</td>
|
|
||||||
<td>{{ r.plano }}</td>
|
|
||||||
<td>{{ r.contrato }}</td>
|
|
||||||
|
|
||||||
<td class="text-end actions">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-sm btn-outline-secondary btn-icon"
|
|
||||||
(click)="onDetalhes(r)"
|
|
||||||
title="Detalhes"
|
|
||||||
[disabled]="loading"
|
|
||||||
>
|
|
||||||
<i class="bi bi-eye"></i>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-sm btn-outline-success btn-icon ms-1"
|
|
||||||
(click)="onFinanceiro(r)"
|
|
||||||
title="Financeiro"
|
|
||||||
[disabled]="loading"
|
|
||||||
>
|
|
||||||
<i class="bi bi-cash-coin"></i>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-sm btn-outline-danger btn-icon ms-1"
|
|
||||||
(click)="onRemover(r)"
|
|
||||||
title="Remover"
|
|
||||||
[disabled]="loading"
|
|
||||||
>
|
|
||||||
<i class="bi bi-trash"></i>
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr *ngIf="!loading && pagedRows.length === 0">
|
<tr *ngIf="!loading && pagedRows.length === 0">
|
||||||
<td colspan="9" class="text-center py-5 text-muted empty-state">
|
<td colspan="7" class="text-center py-5 empty-state">Nenhum registro encontrado.</td>
|
||||||
<i class="bi bi-inbox me-2"></i>
|
|
||||||
Nenhum registro encontrado.
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</ng-template>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- FOOTER / PAGINAÇÃO -->
|
<div class="geral-footer" *ngIf="!isGroupMode">
|
||||||
<div class="geral-footer">
|
<div class="small text-muted fw-bold">Mostrando {{ pageStart }}–{{ pageEnd }} de {{ filteredCount }}</div>
|
||||||
<div class="small text-muted">
|
<nav>
|
||||||
Mostrando {{ pageStart }}–{{ pageEnd }} de {{ filteredCount }} registros
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<nav aria-label="Paginação">
|
|
||||||
<ul class="pagination pagination-sm mb-0 pagination-modern">
|
<ul class="pagination pagination-sm mb-0 pagination-modern">
|
||||||
<li class="page-item" [class.disabled]="page === 1 || loading">
|
<li class="page-item" [class.disabled]="page === 1 || loading"><button class="page-link" (click)="goToPage(page - 1)">Anterior</button></li>
|
||||||
<button class="page-link" (click)="goToPage(page - 1)">
|
<li class="page-item" *ngFor="let p of pageNumbers" [class.active]="p === page"><button class="page-link" (click)="goToPage(p)">{{ p }}</button></li>
|
||||||
<i class="bi bi-chevron-left"></i>
|
<li class="page-item" [class.disabled]="page === totalPages || loading"><button class="page-link" (click)="goToPage(page + 1)">Próxima</button></li>
|
||||||
Anterior
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="page-item" *ngFor="let p of pageNumbers" [class.active]="p === page" [class.disabled]="loading">
|
|
||||||
<button class="page-link" (click)="goToPage(p)">{{ p }}</button>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="page-item" [class.disabled]="page === totalPages || loading">
|
|
||||||
<button class="page-link" (click)="goToPage(page + 1)">
|
|
||||||
Próxima
|
|
||||||
<i class="bi bi-chevron-right"></i>
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- ===================== -->
|
|
||||||
<!-- MODAL DETALHES -->
|
|
||||||
<!-- ===================== -->
|
|
||||||
<div class="modal-backdrop-custom" *ngIf="detailOpen" (click)="closeDetail()"></div>
|
<div class="modal-backdrop-custom" *ngIf="detailOpen" (click)="closeDetail()"></div>
|
||||||
<div class="modal-custom" *ngIf="detailOpen">
|
<div class="modal-custom" *ngIf="detailOpen">
|
||||||
<div class="modal-card" (click)="$event.stopPropagation()">
|
<div class="modal-card modal-responsive" (click)="$event.stopPropagation()">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<div class="modal-title">
|
<div class="modal-title">
|
||||||
<i class="bi bi-info-circle me-2"></i>
|
<span class="icon-bg primary-soft"><i class="bi bi-sim"></i></span>
|
||||||
Detalhes da Linha
|
Detalhes da Linha
|
||||||
</div>
|
</div>
|
||||||
|
<button type="button" class="btn btn-sm btn-icon" (click)="closeDetail()"><i class="bi bi-x-lg"></i></button>
|
||||||
<button type="button" class="btn btn-sm btn-outline-secondary btn-icon" (click)="closeDetail()">
|
|
||||||
<i class="bi bi-x-lg"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-body" *ngIf="detailData; else detailLoading">
|
<div class="modal-body modern-body bg-light-gray" *ngIf="detailData; else detailLoading">
|
||||||
<div class="detail-grid">
|
<div class="details-dashboard">
|
||||||
<div><span class="k">ITÉM</span><span class="v">{{ detailData.item }}</span></div>
|
<div class="dashboard-column">
|
||||||
<div><span class="k">CONTA</span><span class="v">{{ detailData.conta }}</span></div>
|
<div class="detail-box">
|
||||||
<div><span class="k">LINHA</span><span class="v">{{ detailData.linha }}</span></div>
|
<div class="box-header"><i class="bi bi-person-badge me-2"></i> Identificação</div>
|
||||||
<div><span class="k">CHIP</span><span class="v">{{ detailData.chip }}</span></div>
|
<div class="box-body compact">
|
||||||
|
<div class="row-item"><span class="lbl">LINHA</span><span class="val text-blue fs-5">{{ detailData.linha || '-' }}</span></div>
|
||||||
<div><span class="k">CLIENTE</span><span class="v">{{ detailData.cliente }}</span></div>
|
<div class="row-item"><span class="lbl">CLIENTE</span><span class="val text-end text-truncate" style="max-width: 250px;" [title]="detailData.cliente">{{ detailData.cliente || '-' }}</span></div>
|
||||||
<div><span class="k">USUÁRIO</span><span class="v">{{ detailData.usuario }}</span></div>
|
<div class="row-item"><span class="lbl">USUÁRIO</span><span class="val">{{ detailData.usuario || '-' }}</span></div>
|
||||||
<div class="span-2"><span class="k">PLANO CONTRATO</span><span class="v">{{ detailData.planoContrato }}</span></div>
|
<div class="divider small"></div>
|
||||||
|
<div class="row-grid-2">
|
||||||
<div><span class="k">STATUS</span><span class="v">{{ detailData.status }}</span></div>
|
<div class="mini-item"><span class="lbl">ITEM</span><span class="val">{{ detailData.item }}</span></div>
|
||||||
<div><span class="k">DATA DO BLOQUEIO</span><span class="v">{{ detailData.dataBloqueio }}</span></div>
|
<div class="mini-item text-end"><span class="lbl">CHIP</span><span class="val">{{ detailData.chip || '-' }}</span></div>
|
||||||
|
</div>
|
||||||
<div><span class="k">SKIL</span><span class="v">{{ detailData.skil }}</span></div>
|
</div>
|
||||||
<div><span class="k">MODALIDADE</span><span class="v">{{ detailData.modalidade }}</span></div>
|
</div>
|
||||||
|
<div class="detail-box mt-3">
|
||||||
<div><span class="k">CEDENTE</span><span class="v">{{ detailData.cedente }}</span></div>
|
<div class="box-header"><i class="bi bi-file-earmark-text me-2"></i> Contrato & Plano</div>
|
||||||
<div><span class="k">SOLICITANTE</span><span class="v">{{ detailData.solicitante }}</span></div>
|
<div class="box-body compact">
|
||||||
|
<div class="row-item"><span class="lbl">PLANO CONTRATO</span><span class="val fw-bold">{{ detailData.planoContrato || '-' }}</span></div>
|
||||||
<div><span class="k">DATA ENTREGA OPERA.</span><span class="v">{{ detailData.dataEntregaOpera }}</span></div>
|
<div class="row-item"><span class="lbl">CONTA</span><span class="val">{{ detailData.conta || '-' }}</span></div>
|
||||||
<div><span class="k">DATA ENTREGA CLIENTE</span><span class="v">{{ detailData.dataEntregaCliente }}</span></div>
|
<div class="row-item"><span class="lbl">VENC. DA CONTA</span><span class="val">{{ detailData.vencConta || '-' }}</span></div>
|
||||||
|
</div>
|
||||||
<div><span class="k">VENC. DA CONTA</span><span class="v">{{ detailData.vencConta }}</span></div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="dashboard-column">
|
||||||
|
<div class="detail-box">
|
||||||
|
<div class="box-header"><i class="bi bi-activity me-2"></i> Status & Logística</div>
|
||||||
|
<div class="box-body compact">
|
||||||
|
<div class="row-item align-items-center"><span class="lbl">STATUS</span><span class="status-pill static" [ngClass]="statusClass(detailData.status)">{{ statusLabel(detailData.status) }}</span></div>
|
||||||
|
<div class="row-item"><span class="lbl">DATA DO BLOQUEIO</span><span class="val">{{ formatDateBr(detailData.dataBloqueio) }}</span></div>
|
||||||
|
<div class="row-item"><span class="lbl">MODALIDADE</span><span class="val">{{ detailData.modalidade || '-' }}</span></div>
|
||||||
|
<div class="divider small"></div>
|
||||||
|
<div class="row-item"><span class="lbl">DATA ENTREGA OPERA.</span><span class="val">{{ formatDateBr(detailData.dataEntregaOpera) }}</span></div>
|
||||||
|
<div class="row-item"><span class="lbl">DATA ENTREGA CLIENTE</span><span class="val">{{ formatDateBr(detailData.dataEntregaCliente) }}</span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="detail-box mt-3">
|
||||||
|
<div class="box-header"><i class="bi bi-sliders me-2"></i> Dados de Gestão</div>
|
||||||
|
<div class="box-body compact">
|
||||||
|
<div class="row-item"><span class="lbl">SKIL</span><span class="val">{{ detailData.skil || '-' }}</span></div>
|
||||||
|
<div class="row-item"><span class="lbl">CEDENTE</span><span class="val">{{ detailData.cedente || '-' }}</span></div>
|
||||||
|
<div class="row-item"><span class="lbl">SOLICITANTE</span><span class="val">{{ detailData.solicitante || '-' }}</span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<ng-template #detailLoading><div class="p-5 text-center text-muted">Carregando detalhes...</div></ng-template>
|
||||||
<ng-template #detailLoading>
|
|
||||||
<div class="modal-body text-muted text-center py-4">
|
|
||||||
<span class="spinner-border spinner-border-sm me-2"></span>
|
|
||||||
Carregando detalhes...
|
|
||||||
</div>
|
|
||||||
</ng-template>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- ===================== -->
|
|
||||||
<!-- MODAL FINANCEIRO -->
|
|
||||||
<!-- ===================== -->
|
|
||||||
<div class="modal-backdrop-custom" *ngIf="financeOpen" (click)="closeFinance()"></div>
|
<div class="modal-backdrop-custom" *ngIf="financeOpen" (click)="closeFinance()"></div>
|
||||||
<div class="modal-custom" *ngIf="financeOpen">
|
<div class="modal-custom" *ngIf="financeOpen">
|
||||||
<div class="modal-card" (click)="$event.stopPropagation()">
|
<div class="modal-card modal-lg" (click)="$event.stopPropagation()">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<div class="modal-title">
|
<div class="modal-title"><span class="icon-bg success"><i class="bi bi-wallet2"></i></span> Financeiro</div>
|
||||||
<i class="bi bi-cash-coin me-2"></i>
|
<button type="button" class="btn btn-sm btn-icon" (click)="closeFinance()"><i class="bi bi-x-lg"></i></button>
|
||||||
Financeiro
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="button" class="btn btn-sm btn-outline-secondary btn-icon" (click)="closeFinance()">
|
|
||||||
<i class="bi bi-x-lg"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-body modern-body bg-light-gray" *ngIf="financeData; else financeLoading">
|
||||||
<div class="modal-body" *ngIf="financeData; else financeLoading">
|
<div class="finance-dashboard">
|
||||||
|
<div class="finance-card vivo-card">
|
||||||
<div class="finance-box vivo">
|
<div class="card-header-f"><i class="bi bi-telephone-fill me-2"></i> Vivo</div>
|
||||||
<div class="box-title">Vivo</div>
|
<div class="card-body-f">
|
||||||
<div class="box-grid">
|
<div class="row-item"><span>Franquia</span> <strong>{{ formatFranquia(financeData.franquiaVivo) }}</strong></div>
|
||||||
<div><span class="k">FRAQUIA</span><span class="v">{{ financeData.franquiaVivo }}</span></div>
|
<div class="row-item"><span>Valor Plano</span> <strong>{{ formatMoney(financeData.valorPlanoVivo) }}</strong></div>
|
||||||
<div><span class="k">VALOR DO PLANO R$</span><span class="v">{{ financeData.valorPlanoVivo }}</span></div>
|
<div class="row-item"><span>Gestão Voz/Dados</span> <strong>{{ formatMoney(financeData.gestaoVozDados) }}</strong></div>
|
||||||
<div><span class="k">GESTÃO VOZ E DADOS R$</span><span class="v">{{ financeData.gestaoVozDados }}</span></div>
|
<div class="row-item"><span>Skeelo</span> <strong>{{ formatMoney(financeData.skeelo) }}</strong></div>
|
||||||
<div><span class="k">SKEELO</span><span class="v">{{ financeData.skeelo }}</span></div>
|
<div class="row-item"><span>Vivo News+</span> <strong>{{ formatMoney(financeData.vivoNewsPlus) }}</strong></div>
|
||||||
<div><span class="k">VIVO NEWS PLUS</span><span class="v">{{ financeData.vivoNewsPlus }}</span></div>
|
<div class="row-item"><span>Travel Mundo</span> <strong>{{ formatMoney(financeData.vivoTravelMundo) }}</strong></div>
|
||||||
<div><span class="k">VIVO TRAVEL MUNDO</span><span class="v">{{ financeData.vivoTravelMundo }}</span></div>
|
<div class="row-item"><span>Gestão Disp.</span> <strong>{{ formatMoney(financeData.vivoGestaoDispositivo) }}</strong></div>
|
||||||
<div><span class="k">VIVO GESTÃO DISPOSITIVO</span><span class="v">{{ financeData.vivoGestaoDispositivo }}</span></div>
|
<div class="divider"></div>
|
||||||
<div><span class="k">VALOR CONTRATO VIVO</span><span class="v">{{ financeData.valorContratoVivo }}</span></div>
|
<div class="row-item total"><span>Total Vivo</span> <strong>{{ formatMoney(financeData.valorContratoVivo) }}</strong></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="finance-card line-card">
|
||||||
|
<div class="card-header-f"><i class="bi bi-hdd-network-fill me-2"></i> Line Móvel</div>
|
||||||
|
<div class="card-body-f">
|
||||||
|
<div class="row-item"><span>Franquia Line</span> <strong>{{ formatFranquia(financeData.franquiaLine) }}</strong></div>
|
||||||
|
<div class="row-item"><span>Franquia Gestão</span> <strong>{{ formatFranquia(financeData.franquiaGestao) }}</strong></div>
|
||||||
|
<div class="row-item"><span>Locação Ap.</span> <strong>{{ formatMoney(financeData.locacaoAp) }}</strong></div>
|
||||||
|
<div class="divider"></div>
|
||||||
|
<div class="row-item total"><span>Total Line</span> <strong>{{ formatMoney(financeData.valorContratoLine) }}</strong></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="finance-summary mt-3">
|
||||||
<div class="finance-box line">
|
<div class="summary-item"><span class="lbl">Desconto</span><span class="val text-success">{{ formatMoney(financeData.desconto) }}</span></div>
|
||||||
<div class="box-title">Line Móvel</div>
|
<div class="vertical-line"></div>
|
||||||
<div class="box-grid">
|
<div class="summary-item"><span class="lbl">Lucro Estimado</span><span class="val text-brand">{{ formatMoney(financeData.lucro) }}</span></div>
|
||||||
<div><span class="k">FRANQUIA LINE</span><span class="v">{{ financeData.franquiaLine }}</span></div>
|
|
||||||
<div><span class="k">FRANQUIA GESTÃO</span><span class="v">{{ financeData.franquiaGestao }}</span></div>
|
|
||||||
<div><span class="k">LOCAÇÃO AP.</span><span class="v">{{ financeData.locacaoAp }}</span></div>
|
|
||||||
<div><span class="k">VALOR CONTRATO LINE</span><span class="v">{{ financeData.valorContratoLine }}</span></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="finance-footer">
|
|
||||||
<div><span class="k">DESCONTO</span><span class="v">{{ financeData.desconto }}</span></div>
|
|
||||||
<div><span class="k">LUCRO</span><span class="v">{{ financeData.lucro }}</span></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<ng-template #financeLoading><div class="p-5 text-center text-muted">Carregando financeiro...</div></ng-template>
|
||||||
<ng-template #financeLoading>
|
</div>
|
||||||
<div class="modal-body text-muted text-center py-4">
|
</div>
|
||||||
<span class="spinner-border spinner-border-sm me-2"></span>
|
|
||||||
Carregando financeiro...
|
<div class="modal-backdrop-custom" *ngIf="editOpen" (click)="closeEdit()"></div>
|
||||||
</div>
|
<div class="modal-custom" *ngIf="editOpen">
|
||||||
</ng-template>
|
<div class="modal-card modal-edit" (click)="$event.stopPropagation()">
|
||||||
|
<div class="modal-header">
|
||||||
|
<div class="modal-title"><span class="icon-bg primary-soft"><i class="bi bi-pencil-square"></i></span> Editar Linha</div>
|
||||||
|
<div class="d-flex align-items-center gap-2">
|
||||||
|
<button type="button" class="btn btn-glass btn-sm" (click)="closeEdit()" [disabled]="editSaving"><i class="bi bi-x-lg me-1"></i> Cancelar</button>
|
||||||
|
<button type="button" class="btn btn-brand btn-sm" (click)="saveEdit()" [disabled]="!editModel || editSaving">
|
||||||
|
<span *ngIf="!editSaving"><i class="bi bi-check2-circle me-1"></i> Salvar</span>
|
||||||
|
<span *ngIf="editSaving"><span class="spinner-border spinner-border-sm me-2"></span> Salvando...</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body modern-body bg-light-gray">
|
||||||
|
<ng-container *ngIf="editModel; else editLoadingTpl">
|
||||||
|
<div class="edit-sections">
|
||||||
|
<details open class="edit-section">
|
||||||
|
<summary><i class="bi bi-person-badge me-2"></i>Identificação</summary>
|
||||||
|
<div class="edit-grid">
|
||||||
|
<div class="form-field"><label>Item</label><input class="form-control form-control-sm" type="number" [(ngModel)]="editModel.item" name="edit_item" /></div>
|
||||||
|
<div class="form-field"><label>Conta</label><input class="form-control form-control-sm" [(ngModel)]="editModel.conta" name="edit_conta" /></div>
|
||||||
|
<div class="form-field"><label>Linha</label><input class="form-control form-control-sm" [(ngModel)]="editModel.linha" name="edit_linha" /></div>
|
||||||
|
<div class="form-field"><label>Chip</label><input class="form-control form-control-sm" [(ngModel)]="editModel.chip" name="edit_chip" /></div>
|
||||||
|
<div class="form-field"><label>Cliente</label><input class="form-control form-control-sm" [(ngModel)]="editModel.cliente" name="edit_cliente" /></div>
|
||||||
|
<div class="form-field"><label>Usuário</label><input class="form-control form-control-sm" [(ngModel)]="editModel.usuario" name="edit_usuario" /></div>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
<details open class="edit-section"><summary><i class="bi bi-file-earmark-text me-2"></i>Contrato & Plano</summary>
|
||||||
|
<div class="edit-grid">
|
||||||
|
<div class="form-field span-2"><label>Plano Contrato</label><input class="form-control form-control-sm" [(ngModel)]="editModel.planoContrato" name="edit_planoContrato" /></div>
|
||||||
|
<div class="form-field"><label>Venc. da Conta</label><input class="form-control form-control-sm" [(ngModel)]="editModel.vencConta" name="edit_vencConta" /></div>
|
||||||
|
<div class="form-field"><label>Modalidade</label><input class="form-control form-control-sm" [(ngModel)]="editModel.modalidade" name="edit_modalidade" /></div>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
<details open class="edit-section"><summary><i class="bi bi-activity me-2"></i>Status & Logística</summary>
|
||||||
|
<div class="edit-grid">
|
||||||
|
<div class="form-field"><label>Status</label><input class="form-control form-control-sm" [(ngModel)]="editModel.status" name="edit_status" /></div>
|
||||||
|
<div class="form-field"><label>Data do Bloqueio</label><input class="form-control form-control-sm" type="date" [(ngModel)]="editModel.dataBloqueio" name="edit_dataBloqueio" /></div>
|
||||||
|
<div class="form-field"><label>Data Entrega Operadora</label><input class="form-control form-control-sm" type="date" [(ngModel)]="editModel.dataEntregaOpera" name="edit_dataEntregaOpera" /></div>
|
||||||
|
<div class="form-field"><label>Data Entrega Cliente</label><input class="form-control form-control-sm" type="date" [(ngModel)]="editModel.dataEntregaCliente" name="edit_dataEntregaCliente" /></div>
|
||||||
|
<div class="form-field"><label>Skil</label><input class="form-control form-control-sm" [(ngModel)]="editModel.skil" name="edit_skil" /></div>
|
||||||
|
<div class="form-field"><label>Cedente</label><input class="form-control form-control-sm" [(ngModel)]="editModel.cedente" name="edit_cedente" /></div>
|
||||||
|
<div class="form-field"><label>Solicitante</label><input class="form-control form-control-sm" [(ngModel)]="editModel.solicitante" name="edit_solicitante" /></div>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
<ng-template #editLoadingTpl><div class="p-5 text-center text-muted"><span class="spinner-border spinner-border-sm me-2"></span> Carregando...</div></ng-template>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1,32 +1,44 @@
|
||||||
:host {
|
:host {
|
||||||
|
/* ================= PALETA DE CORES ================= */
|
||||||
--brand: #E33DCF;
|
--brand: #E33DCF;
|
||||||
--blue: #030FAA;
|
--blue: #030FAA;
|
||||||
|
|
||||||
--text: #111214;
|
--text: #111214;
|
||||||
--muted: rgba(17, 18, 20, 0.70);
|
--muted: rgba(17, 18, 20, 0.65);
|
||||||
|
|
||||||
|
/* Cores Específicas (Financeiro) */
|
||||||
|
--bg-vivo: #fbf5fc;
|
||||||
|
--text-vivo: #8a2be2;
|
||||||
|
--bg-line: #f5f6ff;
|
||||||
|
--text-line: #030FAA;
|
||||||
|
|
||||||
|
/* Dimensões & Bordas */
|
||||||
--radius-xl: 22px;
|
--radius-xl: 22px;
|
||||||
--radius-lg: 16px;
|
--radius-lg: 16px;
|
||||||
|
--radius-md: 12px;
|
||||||
|
|
||||||
display: block;
|
display: block;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
color: var(--text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ========================================= */
|
||||||
|
/* 1. LAYOUT DA PÁGINA & BACKGROUND */
|
||||||
|
/* ========================================= */
|
||||||
.geral-page {
|
.geral-page {
|
||||||
min-height: calc(100vh - 69.2px);
|
min-height: 100vh;
|
||||||
padding: 24px 12px 90px;
|
padding: 24px 12px 90px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
|
/* Fundo com Gradientes Suaves */
|
||||||
background:
|
background:
|
||||||
radial-gradient(900px 420px at 20% 10%, rgba(227, 61, 207, 0.14), transparent 60%),
|
radial-gradient(900px 420px at 20% 10%, rgba(227, 61, 207, 0.14), transparent 60%),
|
||||||
radial-gradient(820px 380px at 80% 30%, rgba(227, 61, 207, 0.08), transparent 60%),
|
radial-gradient(820px 380px at 80% 30%, rgba(227, 61, 207, 0.08), transparent 60%),
|
||||||
linear-gradient(180deg, #ffffff 0%, #f5f5f7 70%);
|
linear-gradient(180deg, #ffffff 0%, #f5f5f7 70%);
|
||||||
|
|
||||||
|
/* Overlay sutil de ruído/textura (opcional) */
|
||||||
&::after {
|
&::after {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
@ -36,15 +48,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* blobs fixos */
|
/* Blobs Flutuantes (Animação de Fundo) */
|
||||||
.page-blob {
|
.page-blob {
|
||||||
position: fixed;
|
position: fixed; pointer-events: none; border-radius: 999px; filter: blur(34px); opacity: 0.55; z-index: 0;
|
||||||
pointer-events: none;
|
|
||||||
border-radius: 999px;
|
|
||||||
filter: blur(34px);
|
|
||||||
opacity: 0.55;
|
|
||||||
z-index: 0;
|
|
||||||
|
|
||||||
background: radial-gradient(circle at 30% 30%, rgba(227,61,207,0.55), rgba(227,61,207,0.06));
|
background: radial-gradient(circle at 30% 30%, rgba(227,61,207,0.55), rgba(227,61,207,0.06));
|
||||||
animation: floaty 10s ease-in-out infinite;
|
animation: floaty 10s ease-in-out infinite;
|
||||||
|
|
||||||
|
|
@ -52,8 +58,12 @@
|
||||||
&.blob-2 { width: 520px; height: 520px; top: -220px; right: -240px; animation-duration: 12s; }
|
&.blob-2 { width: 520px; height: 520px; top: -220px; right: -240px; animation-duration: 12s; }
|
||||||
&.blob-3 { width: 360px; height: 360px; bottom: -180px; left: 25%; animation-duration: 14s; }
|
&.blob-3 { width: 360px; height: 360px; bottom: -180px; left: 25%; animation-duration: 14s; }
|
||||||
&.blob-4 { width: 520px; height: 520px; bottom: -260px; right: -260px; animation-duration: 16s; opacity: .45; }
|
&.blob-4 { width: 520px; height: 520px; bottom: -260px; right: -260px; animation-duration: 16s; opacity: .45; }
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 992px) { opacity: 0.35; }
|
@keyframes floaty {
|
||||||
|
0% { transform: translate(0, 0) scale(1); }
|
||||||
|
50% { transform: translate(18px, 10px) scale(1.03); }
|
||||||
|
100% { transform: translate(0, 0) scale(1); }
|
||||||
}
|
}
|
||||||
|
|
||||||
.container-geral {
|
.container-geral {
|
||||||
|
|
@ -63,450 +73,427 @@
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CARD GLASS */
|
/* Card Principal (Efeito de Vidro) */
|
||||||
.geral-card {
|
.geral-card {
|
||||||
border-radius: var(--radius-xl);
|
border-radius: var(--radius-xl);
|
||||||
overflow: hidden;
|
overflow: hidden; /* Importante para conter tabelas */
|
||||||
|
|
||||||
background: rgba(255, 255, 255, 0.82);
|
background: rgba(255, 255, 255, 0.82);
|
||||||
border: 1px solid rgba(227, 61, 207, 0.16);
|
border: 1px solid rgba(227, 61, 207, 0.16);
|
||||||
backdrop-filter: blur(12px);
|
backdrop-filter: blur(12px);
|
||||||
box-shadow: 0 22px 46px rgba(17, 18, 20, 0.10);
|
box-shadow: 0 22px 46px rgba(17, 18, 20, 0.10);
|
||||||
|
|
||||||
/* borda interna */
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
max-height: 85vh; /* Limita altura total do card na tela */
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
content: '';
|
content: ''; position: absolute; inset: 1px; border-radius: calc(var(--radius-xl) - 1px);
|
||||||
position: absolute;
|
pointer-events: none; border: 1px solid rgba(255, 255, 255, 0.65); opacity: 0.75;
|
||||||
inset: 1px;
|
|
||||||
border-radius: calc(var(--radius-xl) - 1px);
|
|
||||||
pointer-events: none;
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.65);
|
|
||||||
opacity: 0.75;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* HEADER */
|
/* ========================================= */
|
||||||
|
/* 2. HEADER & AÇÕES */
|
||||||
|
/* ========================================= */
|
||||||
.geral-header {
|
.geral-header {
|
||||||
padding: 16px 16px 14px 16px;
|
padding: 16px 24px;
|
||||||
border-bottom: 1px solid rgba(17, 18, 20, 0.06);
|
border-bottom: 1px solid rgba(17, 18, 20, 0.06);
|
||||||
background: linear-gradient(180deg, rgba(227,61,207,0.08), rgba(255,255,255,0.10));
|
background: linear-gradient(180deg, rgba(227,61,207,0.06), rgba(255,255,255,0.2));
|
||||||
|
flex-shrink: 0; /* Header não encolhe */
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-row-top {
|
.header-row-top {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr auto;
|
grid-template-columns: 1fr auto 1fr;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
gap: 16px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-title {
|
.header-title {
|
||||||
display: flex;
|
display: flex; flex-direction: column; align-items: center; text-align: center;
|
||||||
flex-direction: column;
|
|
||||||
align-items: flex-start;
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-badge {
|
.title-badge {
|
||||||
display: inline-flex;
|
display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px;
|
||||||
align-items: center;
|
border-radius: 999px; background: rgba(255, 255, 255, 0.78);
|
||||||
gap: 10px;
|
border: 1px solid rgba(227, 61, 207, 0.22); backdrop-filter: blur(10px);
|
||||||
|
color: var(--text); font-size: 13px; font-weight: 800;
|
||||||
padding: 8px 12px;
|
|
||||||
border-radius: 999px;
|
|
||||||
|
|
||||||
background: rgba(255, 255, 255, 0.78);
|
|
||||||
border: 1px solid rgba(227, 61, 207, 0.22);
|
|
||||||
backdrop-filter: blur(10px);
|
|
||||||
|
|
||||||
color: var(--text);
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 800;
|
|
||||||
|
|
||||||
i { color: var(--brand); }
|
i { color: var(--brand); }
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title { font-size: 26px; font-weight: 950; letter-spacing: -0.3px; color: var(--text); margin-top: 10px; margin-bottom: 0; }
|
||||||
font-size: 26px;
|
.subtitle { color: rgba(17, 18, 20, 0.65); font-weight: 700; }
|
||||||
font-weight: 950;
|
|
||||||
letter-spacing: -0.3px;
|
|
||||||
color: var(--text);
|
|
||||||
margin-top: 10px;
|
|
||||||
|
|
||||||
@media (max-width: 768px) { font-size: 24px; }
|
/* Botões de Ação Principais */
|
||||||
}
|
|
||||||
|
|
||||||
.subtitle {
|
|
||||||
color: rgba(17, 18, 20, 0.65);
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-actions {
|
|
||||||
justify-content: flex-end;
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* BOTÕES */
|
|
||||||
.btn-brand {
|
.btn-brand {
|
||||||
background-color: var(--brand);
|
background-color: var(--brand); border-color: var(--brand); color: #fff;
|
||||||
border-color: var(--brand);
|
font-weight: 900; border-radius: 12px; transition: transform 0.2s, box-shadow 0.2s;
|
||||||
font-weight: 900;
|
&:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(227, 61, 207, 0.25); filter: brightness(1.05); }
|
||||||
border-radius: 12px;
|
&:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
|
||||||
|
|
||||||
transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 14px 24px rgba(227, 61, 207, 0.22);
|
|
||||||
filter: brightness(0.97);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-glass {
|
.btn-glass {
|
||||||
border-radius: 12px;
|
border-radius: 12px; font-weight: 900; background: rgba(255, 255, 255, 0.6);
|
||||||
font-weight: 900;
|
border: 1px solid rgba(3, 15, 170, 0.25); color: var(--blue);
|
||||||
|
&:hover { transform: translateY(-2px); border-color: var(--brand); background: #fff; }
|
||||||
background: rgba(255, 255, 255, 0.72);
|
|
||||||
border: 1px solid rgba(3, 15, 170, 0.25);
|
|
||||||
color: var(--blue);
|
|
||||||
|
|
||||||
transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 14px 24px rgba(17, 18, 20, 0.10);
|
|
||||||
border-color: rgba(227, 61, 207, 0.30);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CONTROLES */
|
/* ========================================= */
|
||||||
.controls {
|
/* 3. FILTROS (TABS E DROPDOWN) */
|
||||||
|
/* ========================================= */
|
||||||
|
.filters-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 12px;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
gap: 12px;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Busca */
|
/* Tabs (Todos / PF / PJ) */
|
||||||
.search-group {
|
.filter-tabs {
|
||||||
max-width: 340px;
|
display: flex; gap: 4px; padding: 4px;
|
||||||
border-radius: 14px;
|
background: rgba(255, 255, 255, 0.6);
|
||||||
overflow: hidden;
|
border: 1px solid rgba(17, 18, 20, 0.08);
|
||||||
|
|
||||||
.input-group-text {
|
|
||||||
background: rgba(255, 255, 255, 0.78);
|
|
||||||
border: 1px solid rgba(17, 18, 20, 0.10);
|
|
||||||
color: var(--brand);
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-control {
|
|
||||||
border: 1px solid rgba(17, 18, 20, 0.10);
|
|
||||||
background: rgba(255, 255, 255, 0.78);
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-control:focus {
|
|
||||||
border-color: rgba(227, 61, 207, 0.35);
|
|
||||||
box-shadow: 0 0 0 0.2rem rgba(227, 61, 207, 0.12);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-clear {
|
|
||||||
border: 1px solid rgba(17, 18, 20, 0.10);
|
|
||||||
background: rgba(255, 255, 255, 0.78);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* select */
|
|
||||||
.select-glass {
|
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
background: rgba(255, 255, 255, 0.78);
|
backdrop-filter: blur(8px);
|
||||||
border: 1px solid rgba(17, 18, 20, 0.10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* BODY */
|
.filter-tab {
|
||||||
|
border: none; background: transparent; padding: 8px 16px; border-radius: 8px;
|
||||||
|
font-size: 0.85rem; font-weight: 700; color: var(--muted);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
display: flex; align-items: center; gap: 6px;
|
||||||
|
|
||||||
|
&:hover { color: var(--text); background: rgba(255, 255, 255, 0.5); }
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background: #fff; color: var(--brand);
|
||||||
|
box-shadow: 0 2px 8px rgba(227, 61, 207, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dropdown de Clientes */
|
||||||
|
.client-filter-wrap {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-client-filter {
|
||||||
|
display: flex; align-items: center; gap: 8px;
|
||||||
|
padding: 8px 16px; border-radius: 12px;
|
||||||
|
border: 1px solid rgba(17, 18, 20, 0.08);
|
||||||
|
background: rgba(255, 255, 255, 0.6);
|
||||||
|
color: var(--muted); font-weight: 700; font-size: 0.85rem;
|
||||||
|
backdrop-filter: blur(8px); transition: all 0.2s;
|
||||||
|
|
||||||
|
&:hover { background: #fff; border-color: var(--blue); color: var(--blue); }
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background: var(--blue); color: #fff; border-color: var(--blue);
|
||||||
|
i { color: #fff; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.client-dropdown {
|
||||||
|
position: absolute; top: calc(100% + 8px); right: 0;
|
||||||
|
width: 280px; max-height: 350px;
|
||||||
|
background: #fff; border-radius: 12px;
|
||||||
|
box-shadow: 0 10px 30px rgba(0,0,0,0.15);
|
||||||
|
border: 1px solid rgba(17,18,20,0.08);
|
||||||
|
z-index: 50;
|
||||||
|
display: flex; flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
animation: fadeIn 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeIn {
|
||||||
|
from { opacity:0; transform:translateY(-10px); }
|
||||||
|
to { opacity:1; transform:translateY(0); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-header-search {
|
||||||
|
padding: 8px; border-bottom: 1px solid rgba(0,0,0,0.05); background: #f9fafb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-list {
|
||||||
|
overflow-y: auto; max-height: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-item-custom {
|
||||||
|
padding: 10px 16px; font-size: 0.85rem; color: var(--text);
|
||||||
|
cursor: pointer; border-bottom: 1px solid rgba(0,0,0,0.03);
|
||||||
|
transition: background 0.1s;
|
||||||
|
|
||||||
|
&:hover { background: rgba(227,61,207,0.05); color: var(--brand); font-weight: 600; }
|
||||||
|
&.selected { background: rgba(3,15,170,0.08); color: var(--blue); font-weight: 700; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Inputs de Busca e Paginação */
|
||||||
|
.controls {
|
||||||
|
display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-group {
|
||||||
|
max-width: 340px; border-radius: 14px; overflow: hidden;
|
||||||
|
.input-group-text { background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(17, 18, 20, 0.1); color: var(--brand); }
|
||||||
|
.form-control { border: 1px solid rgba(17, 18, 20, 0.1); background: rgba(255, 255, 255, 0.6); &:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(227,61,207,0.1); } }
|
||||||
|
.btn-clear { background: rgba(255,255,255,0.6); border: 1px solid rgba(17,18,20,0.1); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-glass {
|
||||||
|
border-radius: 12px; background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(17, 18, 20, 0.1); width: auto; cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ========================================= */
|
||||||
|
/* 4. ÁREA DE CONTEÚDO (BODY) */
|
||||||
|
/* ========================================= */
|
||||||
.geral-body {
|
.geral-body {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
background: transparent;
|
||||||
|
flex: 1; /* Ocupa espaço restante do card */
|
||||||
|
overflow: hidden; /* Scroll interno na tabela/grupos */
|
||||||
|
display: flex; flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wrapper com altura e scroll */
|
/* ========================================= */
|
||||||
.table-wrap {
|
/* 5. MODO GRUPO (ACCORDION) */
|
||||||
max-height: 58vh;
|
/* ========================================= */
|
||||||
overflow: auto;
|
.groups-container {
|
||||||
|
padding: 16px;
|
||||||
|
overflow-y: auto;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TABELA MODERNA */
|
.group-list {
|
||||||
.table-geral {
|
display: flex; flex-direction: column; gap: 12px;
|
||||||
font-size: 0.875rem;
|
}
|
||||||
|
|
||||||
th, td {
|
.client-group-card {
|
||||||
white-space: nowrap;
|
background: #fff;
|
||||||
padding: 10px 12px;
|
border-radius: 16px;
|
||||||
color: var(--text);
|
border: 1px solid rgba(17,18,20,0.08);
|
||||||
font-weight: 700;
|
overflow: hidden;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: var(--brand);
|
||||||
|
box-shadow: 0 4px 12px rgba(227,61,207,0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.expanded {
|
||||||
|
border-color: var(--brand);
|
||||||
|
box-shadow: 0 8px 24px rgba(227,61,207,0.12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.group-header {
|
||||||
|
padding: 16px 24px;
|
||||||
|
display: flex; justify-content: space-between; align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
background: linear-gradient(180deg, #fff, #fdfdfd);
|
||||||
|
|
||||||
|
&:hover .group-toggle-icon { color: var(--brand); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.group-info {
|
||||||
|
display: flex; flex-direction: column; gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.group-badges {
|
||||||
|
display: flex; gap: 8px; flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-pill {
|
||||||
|
font-size: 0.7rem; padding: 4px 10px; border-radius: 99px; font-weight: 800; text-transform: uppercase;
|
||||||
|
&.total { background: rgba(3,15,170,0.1); color: var(--blue); }
|
||||||
|
&.active { background: rgba(25,135,84,0.1); color: #198754; }
|
||||||
|
&.blocked { background: rgba(220,53,69,0.1); color: #dc3545; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.group-toggle-icon {
|
||||||
|
font-size: 1.2rem; color: var(--muted); transition: transform 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.client-group-card.expanded .group-toggle-icon {
|
||||||
|
transform: rotate(180deg); color: var(--brand);
|
||||||
|
}
|
||||||
|
|
||||||
|
.group-body {
|
||||||
|
border-top: 1px solid rgba(17,18,20,0.06);
|
||||||
|
background: #fbfbfc;
|
||||||
|
animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes slideDown {
|
||||||
|
from { opacity: 0; transform: translateY(-10px); }
|
||||||
|
to { opacity: 1; transform: translateY(0); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.inner-table-wrap {
|
||||||
|
max-height: 450px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ========================================= */
|
||||||
|
/* 6. MODO TABELA (CENTRALIZADA) */
|
||||||
|
/* ========================================= */
|
||||||
|
.table-wrap {
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: auto;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-modern {
|
||||||
|
width: 100%; min-width: 1000px; border-collapse: separate; border-spacing: 0;
|
||||||
|
|
||||||
thead th {
|
thead th {
|
||||||
position: sticky;
|
position: sticky; top: 0; z-index: 10;
|
||||||
top: 0;
|
background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(8px);
|
||||||
z-index: 2;
|
|
||||||
|
|
||||||
background: rgba(255, 255, 255, 0.92);
|
|
||||||
backdrop-filter: blur(10px);
|
|
||||||
|
|
||||||
border-bottom: 2px solid rgba(227, 61, 207, 0.15);
|
border-bottom: 2px solid rgba(227, 61, 207, 0.15);
|
||||||
|
padding: 12px;
|
||||||
|
color: rgba(17, 18, 20, 0.7); font-size: 0.8rem; font-weight: 950; letter-spacing: 0.05em; text-transform: uppercase;
|
||||||
|
white-space: nowrap; cursor: pointer; transition: color 0.2s;
|
||||||
|
|
||||||
color: rgba(17, 18, 20, 0.75);
|
/* Centralização Forçada */
|
||||||
font-weight: 950;
|
text-align: center !important;
|
||||||
letter-spacing: 0.06em;
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
|
|
||||||
th.sortable {
|
|
||||||
cursor: pointer;
|
|
||||||
user-select: none;
|
|
||||||
transition: color 180ms ease;
|
|
||||||
|
|
||||||
&:hover { color: var(--brand); }
|
&:hover { color: var(--brand); }
|
||||||
}
|
}
|
||||||
|
|
||||||
.sort-caret {
|
|
||||||
font-size: 11px;
|
|
||||||
margin-left: 6px;
|
|
||||||
opacity: 0.75;
|
|
||||||
color: rgba(17, 18, 20, 0.60);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* destaque da linha */
|
|
||||||
.td-highlight {
|
|
||||||
color: var(--blue);
|
|
||||||
font-weight: 950;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* linhas mais “clean” */
|
|
||||||
tbody tr {
|
tbody tr {
|
||||||
border-top: 1px solid rgba(17, 18, 20, 0.06);
|
transition: background-color 0.2s;
|
||||||
transition: background-color 180ms ease, transform 180ms ease;
|
border-bottom: 1px solid rgba(17,18,20,0.05);
|
||||||
|
&:hover { background-color: rgba(227, 61, 207, 0.05); }
|
||||||
|
td { border-bottom: 1px solid rgba(17,18,20,0.04); }
|
||||||
}
|
}
|
||||||
|
|
||||||
tbody tr:hover {
|
td {
|
||||||
background-color: rgba(227, 61, 207, 0.06);
|
padding: 12px; vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
||||||
}
|
font-size: 0.875rem; color: var(--text);
|
||||||
|
|
||||||
td.actions {
|
/* Centralização Forçada */
|
||||||
min-width: 160px;
|
text-align: center !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* botões ícone */
|
.th-content { display: flex; align-items: center; justify-content: center; gap: 4px; }
|
||||||
|
|
||||||
|
.sort-caret { display: inline-block; width: 14px; text-align: center; opacity: 0.3; &.active { opacity: 1; color: var(--brand); } }
|
||||||
|
.text-brand { color: var(--brand) !important; }
|
||||||
|
.text-blue { color: var(--blue) !important; }
|
||||||
|
.fw-black { font-weight: 950; }
|
||||||
|
.td-clip { overflow: hidden; text-overflow: ellipsis; max-width: 250px; }
|
||||||
|
.empty-state { background: rgba(255,255,255,0.4); }
|
||||||
|
|
||||||
|
/* Ações */
|
||||||
|
.action-group { display: flex; justify-content: center; gap: 6px; }
|
||||||
.btn-icon {
|
.btn-icon {
|
||||||
padding: 6px 10px;
|
width: 32px; height: 32px; border: none; background: transparent; border-radius: 8px;
|
||||||
border-radius: 12px;
|
display: flex; align-items: center; justify-content: center; color: rgba(17,18,20,0.5); transition: all 0.2s;
|
||||||
transition: transform 150ms ease, box-shadow 150ms ease;
|
&:hover { background: rgba(17,18,20,0.05); color: var(--text); transform: translateY(-1px); }
|
||||||
|
&.success:hover { color: #198754; background: rgba(25,135,84,0.1); }
|
||||||
&:hover {
|
&.primary:hover { color: var(--blue); background: rgba(3,15,170,0.1); }
|
||||||
transform: translateY(-1px);
|
&.danger:hover { color: #dc3545; background: rgba(220,53,69,0.1); }
|
||||||
box-shadow: 0 12px 22px rgba(17, 18, 20, 0.10);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty-state {
|
/* Footer */
|
||||||
background: rgba(255, 255, 255, 0.35);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FOOTER */
|
|
||||||
.geral-footer {
|
.geral-footer {
|
||||||
padding: 14px 16px;
|
padding: 14px 24px; border-top: 1px solid rgba(17, 18, 20, 0.06);
|
||||||
border-top: 1px solid rgba(17, 18, 20, 0.06);
|
display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; flex-shrink: 0;
|
||||||
|
@media (max-width: 768px) { justify-content: center; text-align: center; }
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
justify-content: center;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Paginação moderna */
|
|
||||||
.pagination-modern .page-link {
|
.pagination-modern .page-link {
|
||||||
color: var(--blue);
|
color: var(--blue); font-weight: 900; border-radius: 10px; border: 1px solid rgba(17,18,20,0.1);
|
||||||
font-weight: 900;
|
background: rgba(255,255,255,0.6); margin: 0 2px;
|
||||||
border-radius: 12px;
|
&:hover { transform: translateY(-1px); border-color: var(--brand); color: var(--brand); }
|
||||||
border: 1px solid rgba(17, 18, 20, 0.10);
|
}
|
||||||
background: rgba(255, 255, 255, 0.78);
|
.pagination-modern .page-item.active .page-link { background-color: var(--blue); border-color: var(--blue); color: #fff; }
|
||||||
transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease, color 150ms ease;
|
|
||||||
|
|
||||||
i { font-size: 12px; }
|
/* ========================================= */
|
||||||
|
/* 7. MODAIS (Geral) */
|
||||||
|
/* ========================================= */
|
||||||
|
.modal-backdrop-custom { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 9990; backdrop-filter: blur(4px); }
|
||||||
|
.modal-custom { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 9995; padding: 16px; }
|
||||||
|
|
||||||
|
.modal-card {
|
||||||
|
background: #ffffff; border: 1px solid rgba(255,255,255,0.8); border-radius: 20px;
|
||||||
|
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); overflow: hidden; display: flex; flex-direction: column;
|
||||||
|
animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
|
||||||
|
|
||||||
|
/* Tamanho Padrão */
|
||||||
|
width: min(850px, 100%);
|
||||||
|
max-height: 90vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination-modern .page-link:hover {
|
@keyframes modalPop { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
|
||||||
transform: translateY(-1px);
|
|
||||||
border-color: rgba(227, 61, 207, 0.28);
|
.modal-header {
|
||||||
color: var(--brand);
|
padding: 16px 24px; border-bottom: 1px solid rgba(0,0,0,0.06); background: #fff; display: flex; justify-content: space-between; align-items: center;
|
||||||
box-shadow: 0 12px 22px rgba(17, 18, 20, 0.08);
|
.modal-title { font-size: 1.1rem; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 12px; }
|
||||||
|
.icon-bg { width: 32px; height: 32px; border-radius: 10px; background: rgba(3, 15, 170, 0.1); color: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 16px; &.success { background: rgba(25, 135, 84, 0.1); color: #198754; } &.primary-soft { background: rgba(3, 15, 170, 0.1); color: var(--blue); } }
|
||||||
|
.btn-icon { color: var(--muted); background: transparent; font-size: 1.2rem; &:hover { color: var(--brand); transform: rotate(90deg); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination-modern .page-item.active .page-link {
|
.modal-body { padding: 24px; overflow-y: auto; &.bg-light-gray { background-color: #f8f9fa; } }
|
||||||
background-color: rgba(3, 15, 170, 0.92);
|
|
||||||
border-color: rgba(3, 15, 170, 0.92);
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* =============================== */
|
/* ========================================= */
|
||||||
/* ✅ ANIMAÇÕES SSR-SAFE */
|
/* 8. MODAL DETALHES (Responsivo Inteligente) */
|
||||||
/* =============================== */
|
/* ========================================= */
|
||||||
[data-animate] { opacity: 1; transform: none; }
|
|
||||||
|
|
||||||
.js-animate [data-animate] {
|
/* Regra apenas para telas GRANDES (>1440px) */
|
||||||
opacity: 0;
|
@media (min-width: 1441px) {
|
||||||
transform: translateY(14px);
|
.modal-card.modal-responsive {
|
||||||
transition: opacity 600ms ease, transform 600ms ease;
|
width: min(1200px, 95%);
|
||||||
will-change: opacity, transform;
|
height: 85vh;
|
||||||
}
|
max-height: none;
|
||||||
|
|
||||||
.js-animate [data-animate].is-visible {
|
|
||||||
opacity: 1;
|
|
||||||
transform: translateY(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-reduced-motion: reduce) {
|
|
||||||
.page-blob { animation: none; }
|
|
||||||
.js-animate [data-animate] { transition: none; transform: none; opacity: 1; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* animações */
|
|
||||||
@keyframes floaty {
|
|
||||||
0% { transform: translate(0, 0) scale(1); }
|
|
||||||
50% { transform: translate(18px, 10px) scale(1.03); }
|
|
||||||
100% { transform: translate(0, 0) scale(1); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* =============================== */
|
|
||||||
/* ✅ MODAIS (Detalhes / Financeiro) */
|
|
||||||
/* =============================== */
|
|
||||||
|
|
||||||
.modal-backdrop-custom{
|
|
||||||
position: fixed;
|
|
||||||
inset: 0;
|
|
||||||
background: rgba(0,0,0,.35);
|
|
||||||
z-index: 2500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-custom{
|
|
||||||
position: fixed;
|
|
||||||
inset: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
z-index: 2501;
|
|
||||||
padding: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-card{
|
|
||||||
width: min(980px, 100%);
|
|
||||||
background: rgba(255, 255, 255, 0.92);
|
|
||||||
border: 1px solid rgba(227, 61, 207, 0.16);
|
|
||||||
backdrop-filter: blur(12px);
|
|
||||||
border-radius: 18px;
|
|
||||||
box-shadow: 0 22px 46px rgba(17, 18, 20, 0.18);
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-header{
|
|
||||||
padding: 12px 14px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
background: linear-gradient(180deg, rgba(227,61,207,0.08), rgba(255,255,255,0.10));
|
|
||||||
border-bottom: 1px solid rgba(17, 18, 20, 0.06);
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-title{
|
|
||||||
font-weight: 950;
|
|
||||||
color: var(--text);
|
|
||||||
letter-spacing: -0.2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-body{
|
|
||||||
padding: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-grid{
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(2, 1fr);
|
|
||||||
gap: 10px 14px;
|
|
||||||
|
|
||||||
.k { display:block; font-size: 12px; color: rgba(17, 18, 20, 0.65); font-weight: 800; }
|
|
||||||
.v { display:block; font-size: 14px; color: var(--text); font-weight: 950; }
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-grid .span-2{
|
|
||||||
grid-column: 1 / -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.finance-box{
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 12px;
|
|
||||||
border: 1px solid rgba(17, 18, 20, 0.08);
|
|
||||||
background: rgba(255,255,255,0.78);
|
|
||||||
margin-bottom: 12px;
|
|
||||||
|
|
||||||
.box-title{
|
|
||||||
font-weight: 950;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.box-grid{
|
.detail-box .box-header { padding: 8px 16px; }
|
||||||
display: grid;
|
.detail-box .box-body.compact { padding: 10px 14px; }
|
||||||
grid-template-columns: repeat(2, 1fr);
|
.box-body.compact .row-item { margin-bottom: 4px; font-size: 0.85rem; }
|
||||||
gap: 10px 14px;
|
.details-dashboard { gap: 16px; }
|
||||||
|
}
|
||||||
|
|
||||||
.k { display:block; font-size: 12px; opacity: .8; font-weight: 800; }
|
.details-dashboard { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; @media(max-width: 700px) { grid-template-columns: 1fr; } }
|
||||||
.v { display:block; font-weight: 950; }
|
.detail-box { background: #fff; border-radius: 12px; border: 1px solid rgba(0,0,0,0.06); overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,0.02); height: 100%; .box-header { padding: 10px 16px; font-weight: 800; font-size: 0.85rem; background: #fdfdfd; border-bottom: 1px solid rgba(0,0,0,0.04); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; i { color: var(--blue); } } .box-body { padding: 16px; } .box-body.compact { padding: 12px 14px; } }
|
||||||
}
|
.row-item { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 0.9rem; color: var(--muted); .lbl { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.3px; } .val { color: var(--text); font-weight: 700; text-align: right; } }
|
||||||
}
|
.box-body.compact .row-item { margin-bottom: 6px; }
|
||||||
|
.row-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
|
||||||
.finance-box.vivo{
|
.mini-item { display: flex; flex-direction: column; .lbl { font-size: 0.7rem; color: var(--muted); font-weight: 800; text-transform: uppercase; } .val { font-size: 0.9rem; color: var(--text); font-weight: 700; } }
|
||||||
border-color: rgba(227, 61, 207, 0.25);
|
.divider { height: 1px; background: rgba(0,0,0,0.06); margin: 12px 0; }
|
||||||
.box-title, .v { color: var(--brand); }
|
.divider.small { margin: 8px 0; }
|
||||||
}
|
|
||||||
|
/* ========================================= */
|
||||||
.finance-box.line{
|
/* 9. MODAL FINANCEIRO */
|
||||||
border-color: rgba(3, 15, 170, 0.20);
|
/* ========================================= */
|
||||||
.box-title, .v { color: var(--blue); }
|
.finance-dashboard { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; @media(max-width: 700px) { grid-template-columns: 1fr; } }
|
||||||
}
|
.finance-card { background: #fff; border-radius: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid rgba(0,0,0,0.04); overflow: hidden; &.vivo-card { border-top: 4px solid var(--brand); .card-header-f { color: var(--brand); background: var(--bg-vivo); } } &.line-card { border-top: 4px solid var(--blue); .card-header-f { color: var(--blue); background: var(--bg-line); } } }
|
||||||
|
.card-header-f { padding: 12px 16px; font-weight: 800; font-size: 0.95rem; display: flex; align-items: center; }
|
||||||
.finance-footer{
|
.card-body-f { padding: 16px; .row-item { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 0.85rem; color: var(--muted); strong { color: var(--text); font-weight: 700; } &.total { font-size: 1rem; color: var(--text); margin-top: 8px; margin-bottom: 0; strong { color: var(--text); font-weight: 900; } } } .divider { height: 1px; background: rgba(0,0,0,0.06); margin: 12px 0; } }
|
||||||
display: flex;
|
.finance-summary { background: #fff; border-radius: 16px; padding: 16px 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.03); display: flex; align-items: center; justify-content: space-around; .summary-item { display: flex; flex-direction: column; align-items: center; .lbl { font-size: 0.75rem; text-transform: uppercase; font-weight: 800; color: var(--muted); } .val { font-size: 1.25rem; font-weight: 900; } } .vertical-line { width: 1px; height: 40px; background: rgba(0,0,0,0.08); } }
|
||||||
justify-content: flex-end;
|
.text-success { color: #198754 !important; }
|
||||||
gap: 16px;
|
|
||||||
padding-top: 4px;
|
/* ========================================= */
|
||||||
|
/* 10. MODAL EDITAR */
|
||||||
.k { display:block; font-size: 12px; color: rgba(17, 18, 20, 0.65); font-weight: 800; }
|
/* ========================================= */
|
||||||
.v { display:block; font-weight: 950; color: var(--text); }
|
.modal-card.modal-edit { width: min(1100px, 100%); }
|
||||||
}
|
.edit-sections { display: grid; gap: 12px; }
|
||||||
|
.edit-section {
|
||||||
@media (max-width: 720px){
|
background: #fff; border: 1px solid rgba(0,0,0,0.06); border-radius: 16px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.03);
|
||||||
.detail-grid,
|
summary {
|
||||||
.finance-box .box-grid{
|
cursor: pointer; user-select: none; padding: 12px 16px; font-weight: 950; color: rgba(17,18,20,0.75); display: flex; align-items: center; background: linear-gradient(180deg, rgba(227,61,207,0.06), rgba(255,255,255,0.6)); border-bottom: 1px solid rgba(0,0,0,0.06);
|
||||||
grid-template-columns: 1fr;
|
i { color: var(--blue); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.edit-grid { padding: 14px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; @media (max-width: 700px) { grid-template-columns: 1fr; } }
|
||||||
|
.form-field { display: flex; flex-direction: column; gap: 6px; label { font-size: 0.75rem; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; color: rgba(17,18,20,0.65); } }
|
||||||
|
.form-field.span-2 { grid-column: span 2; @media (max-width: 700px) { grid-column: span 1; } }
|
||||||
|
.edit-section .form-control { border-radius: 12px; border: 1px solid rgba(17,18,20,0.12); background: rgba(255,255,255,0.85); &:focus { border-color: rgba(227,61,207,0.5); box-shadow: 0 0 0 2px rgba(227,61,207,0.12); } }
|
||||||
|
|
@ -1,73 +1,38 @@
|
||||||
import { Component, ElementRef, ViewChild, Inject, PLATFORM_ID, AfterViewInit } from '@angular/core';
|
import { Component, ElementRef, ViewChild, Inject, PLATFORM_ID, AfterViewInit, ChangeDetectorRef } from '@angular/core';
|
||||||
import { isPlatformBrowser, CommonModule } from '@angular/common';
|
import { isPlatformBrowser, CommonModule } from '@angular/common';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { HttpClient, HttpClientModule, HttpParams } from '@angular/common/http';
|
import { HttpClient, HttpClientModule, HttpParams, HttpErrorResponse } from '@angular/common/http';
|
||||||
|
|
||||||
type SortDir = 'asc' | 'desc';
|
type SortDir = 'asc' | 'desc';
|
||||||
|
|
||||||
|
// ✅ CORREÇÃO: Adicionado 'usuario' aqui
|
||||||
type LineRow = {
|
type LineRow = {
|
||||||
id: string; // GUID
|
id: string;
|
||||||
item: string;
|
item: string;
|
||||||
conta: string;
|
|
||||||
linha: string;
|
linha: string;
|
||||||
chip: string;
|
|
||||||
cliente: string;
|
cliente: string;
|
||||||
usuario: string;
|
usuario: string; // <--- NOVO CAMPO
|
||||||
plano: string; // PLANO CONTRATO
|
status: string;
|
||||||
contrato: string; // VENC. DA CONTA
|
skil: string;
|
||||||
};
|
contrato: string;
|
||||||
|
|
||||||
// ✅ seu backend está retornando camelCase (confirmado no Network)
|
|
||||||
type ApiPagedResult<T> = {
|
|
||||||
page: number;
|
|
||||||
pageSize: number;
|
|
||||||
total: number;
|
|
||||||
items: T[];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type ApiPagedResult<T> = { page: number; pageSize: number; total: number; items: T[]; };
|
||||||
|
// ✅ CORREÇÃO: Adicionado 'usuario' no DTO de listagem também, caso não tivesse
|
||||||
type ApiLineList = {
|
type ApiLineList = {
|
||||||
id: string;
|
id: string;
|
||||||
item: number;
|
item: number;
|
||||||
conta: string | null;
|
|
||||||
linha: string | null;
|
linha: string | null;
|
||||||
chip: string | null;
|
|
||||||
cliente: string | null;
|
cliente: string | null;
|
||||||
usuario: string | null;
|
usuario: string | null; // <--- NOVO CAMPO
|
||||||
planoContrato: string | null;
|
|
||||||
vencConta: string | null;
|
vencConta: string | null;
|
||||||
|
|
||||||
// se vier no list também (como no seu Response)
|
|
||||||
status?: string | null;
|
status?: string | null;
|
||||||
skil?: string | null;
|
skil?: string | null;
|
||||||
modalidade?: string | null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type ApiLineDetail = ApiLineList & {
|
type ApiLineDetail = { /* ... campos detalhe (mantenha os mesmos) ... */ id: string; item: number; conta?: string | null; linha?: string | null; chip?: string | null; cliente?: string | null; usuario?: string | null; planoContrato?: string | null; status?: string | null; skil?: string | null; modalidade?: string | null; dataBloqueio?: string | null; cedente?: string | null; solicitante?: string | null; dataEntregaOpera?: string | null; dataEntregaCliente?: string | null; vencConta?: string | null; franquiaVivo?: number | null; valorPlanoVivo?: number | null; gestaoVozDados?: number | null; skeelo?: number | null; vivoNewsPlus?: number | null; vivoTravelMundo?: number | null; vivoGestaoDispositivo?: number | null; valorContratoVivo?: number | null; franquiaLine?: number | null; franquiaGestao?: number | null; locacaoAp?: number | null; valorContratoLine?: number | null; desconto?: number | null; lucro?: number | null; };
|
||||||
dataBloqueio?: string | null;
|
type UpdateMobileLineRequest = Omit<ApiLineDetail, 'id'>;
|
||||||
cedente?: string | null;
|
type ClientGroupDto = { cliente: string; totalLinhas: number; ativos: number; bloqueados: number; };
|
||||||
solicitante?: string | null;
|
|
||||||
dataEntregaOpera?: string | null;
|
|
||||||
dataEntregaCliente?: string | null;
|
|
||||||
|
|
||||||
// Vivo
|
|
||||||
franquiaVivo?: number | null;
|
|
||||||
valorPlanoVivo?: number | null;
|
|
||||||
gestaoVozDados?: number | null;
|
|
||||||
skeelo?: number | null;
|
|
||||||
vivoNewsPlus?: number | null;
|
|
||||||
vivoTravelMundo?: number | null;
|
|
||||||
vivoGestaoDispositivo?: number | null;
|
|
||||||
valorContratoVivo?: number | null;
|
|
||||||
|
|
||||||
// Line
|
|
||||||
franquiaLine?: number | null;
|
|
||||||
franquiaGestao?: number | null;
|
|
||||||
locacaoAp?: number | null;
|
|
||||||
valorContratoLine?: number | null;
|
|
||||||
|
|
||||||
desconto?: number | null;
|
|
||||||
lucro?: number | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
|
|
@ -77,316 +42,294 @@ type ApiLineDetail = ApiLineList & {
|
||||||
})
|
})
|
||||||
export class Geral implements AfterViewInit {
|
export class Geral implements AfterViewInit {
|
||||||
toastMessage = '';
|
toastMessage = '';
|
||||||
@ViewChild('successToast') successToast!: ElementRef;
|
@ViewChild('successToast', { static: false }) successToast!: ElementRef;
|
||||||
@ViewChild('excelInput') excelInput!: ElementRef<HTMLInputElement>;
|
@ViewChild('excelInput') excelInput!: ElementRef<HTMLInputElement>;
|
||||||
|
|
||||||
constructor(
|
constructor(@Inject(PLATFORM_ID) private platformId: object, private http: HttpClient, private cdr: ChangeDetectorRef) {}
|
||||||
@Inject(PLATFORM_ID) private platformId: object,
|
|
||||||
private http: HttpClient
|
|
||||||
) {}
|
|
||||||
|
|
||||||
// ========= API =========
|
|
||||||
private readonly apiBase = 'https://localhost:7205/api/lines';
|
private readonly apiBase = 'https://localhost:7205/api/lines';
|
||||||
|
|
||||||
loading = false;
|
loading = false;
|
||||||
|
|
||||||
// ========= TABELA (agora vem da API) =========
|
|
||||||
rows: LineRow[] = [];
|
rows: LineRow[] = [];
|
||||||
|
clientGroups: ClientGroupDto[] = [];
|
||||||
|
groupLines: LineRow[] = [];
|
||||||
|
|
||||||
|
expandedGroup: string | null = null;
|
||||||
|
loadingLines = false;
|
||||||
|
|
||||||
searchTerm = '';
|
searchTerm = '';
|
||||||
|
filterSkil: 'ALL' | 'PF' | 'PJ' = 'ALL';
|
||||||
|
clientsList: string[] = [];
|
||||||
|
selectedClient: string | null = null;
|
||||||
|
showClientMenu = false;
|
||||||
|
clientSearchTerm = '';
|
||||||
|
|
||||||
sortKey: keyof LineRow = 'item';
|
sortKey: keyof LineRow = 'item';
|
||||||
sortDir: SortDir = 'asc';
|
sortDir: SortDir = 'asc';
|
||||||
|
|
||||||
page = 1;
|
page = 1;
|
||||||
pageSize = 10;
|
pageSize = 10;
|
||||||
|
total = 0;
|
||||||
|
|
||||||
total = 0; // total do banco
|
detailOpen = false; financeOpen = false; editOpen = false; editSaving = false;
|
||||||
|
detailData: any = null; financeData: any = null; editModel: any = null;
|
||||||
// modais
|
private editingId: string | null = null;
|
||||||
detailOpen = false;
|
|
||||||
financeOpen = false;
|
|
||||||
detailData: ApiLineDetail | null = null;
|
|
||||||
financeData: ApiLineDetail | null = null;
|
|
||||||
|
|
||||||
private searchTimer: any = null;
|
private searchTimer: any = null;
|
||||||
|
|
||||||
|
get isGroupMode(): boolean {
|
||||||
|
return this.filterSkil === 'ALL' && !this.selectedClient && !this.searchTerm;
|
||||||
|
}
|
||||||
|
|
||||||
async ngAfterViewInit() {
|
async ngAfterViewInit() {
|
||||||
if (!isPlatformBrowser(this.platformId)) return;
|
if (!isPlatformBrowser(this.platformId)) return;
|
||||||
|
|
||||||
this.initAnimations();
|
this.initAnimations();
|
||||||
this.loadFromApi();
|
this.refreshData();
|
||||||
|
this.loadClients();
|
||||||
|
|
||||||
const msg = (history.state && history.state.toastMessage) ? String(history.state.toastMessage) : '';
|
const state = history.state;
|
||||||
if (!msg) return;
|
if (state && state.toastMessage) {
|
||||||
|
const msg = String(state.toastMessage);
|
||||||
this.toastMessage = msg;
|
const newState = { ...state }; delete newState.toastMessage;
|
||||||
await this.showToast(msg);
|
history.replaceState(newState, '', location.href);
|
||||||
|
setTimeout(() => this.showToast(msg), 500);
|
||||||
const newState = { ...history.state };
|
}
|
||||||
delete newState.toastMessage;
|
|
||||||
history.replaceState(newState, '', location.href);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private initAnimations() {
|
private initAnimations() {
|
||||||
document.documentElement.classList.add('js-animate');
|
document.documentElement.classList.add('js-animate');
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const items = Array.from(document.querySelectorAll<HTMLElement>('[data-animate]'));
|
const items = document.querySelectorAll<HTMLElement>('[data-animate]');
|
||||||
if (!items.length) return;
|
items.forEach(el => el.classList.add('is-visible'));
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
const reduceMotion =
|
refreshData() {
|
||||||
window.matchMedia &&
|
if (this.isGroupMode) {
|
||||||
window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
this.loadGroups();
|
||||||
|
} else {
|
||||||
|
this.loadFromApi();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (reduceMotion || !('IntersectionObserver' in window)) {
|
private loadGroups() {
|
||||||
items.forEach(i => i.classList.add('is-visible'));
|
this.loading = true;
|
||||||
return;
|
this.http.get<ClientGroupDto[]>(`${this.apiBase}/groups`).subscribe({
|
||||||
|
next: (data) => {
|
||||||
|
this.clientGroups = data || [];
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
this.loading = false;
|
||||||
|
this.showToast('Erro ao carregar grupos.');
|
||||||
}
|
}
|
||||||
|
});
|
||||||
const io = new IntersectionObserver((entries) => {
|
|
||||||
for (const entry of entries) {
|
|
||||||
if (entry.isIntersecting) {
|
|
||||||
(entry.target as HTMLElement).classList.add('is-visible');
|
|
||||||
io.unobserve(entry.target);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, { threshold: 0.12 });
|
|
||||||
|
|
||||||
items.forEach(el => io.observe(el));
|
|
||||||
}, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async showToast(message: string) {
|
toggleGroup(clientName: string) {
|
||||||
this.toastMessage = message;
|
if (this.expandedGroup === clientName) {
|
||||||
|
this.expandedGroup = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.expandedGroup = clientName;
|
||||||
|
this.groupLines = [];
|
||||||
|
this.loadingLines = true;
|
||||||
|
|
||||||
// ✅ segurança (caso algum dia seja chamado fora do browser)
|
const params = new HttpParams()
|
||||||
if (!isPlatformBrowser(this.platformId)) return;
|
.set('client', clientName)
|
||||||
|
.set('page', '1')
|
||||||
|
.set('pageSize', '500')
|
||||||
|
.set('sortBy', 'item')
|
||||||
|
.set('sortDir', 'asc');
|
||||||
|
|
||||||
const bs = await import('bootstrap');
|
this.http.get<ApiPagedResult<ApiLineList>>(this.apiBase, { params }).subscribe({
|
||||||
const toast = new bs.Toast(this.successToast.nativeElement, { autohide: true, delay: 1500 });
|
next: (res) => {
|
||||||
toast.show();
|
// ✅ CORREÇÃO: Mapeando 'usuario' corretamente aqui
|
||||||
}
|
this.groupLines = (res.items ?? []).map(x => ({
|
||||||
|
id: x.id,
|
||||||
// ========= API LOAD =========
|
item: String(x.item ?? ''),
|
||||||
private mapSortKeyToApi(sortKey: keyof LineRow): string {
|
linha: x.linha ?? '',
|
||||||
const map: Record<string, string> = {
|
cliente: x.cliente ?? '',
|
||||||
item: 'item',
|
usuario: x.usuario ?? '', // <--- Mapeado
|
||||||
conta: 'conta',
|
status: x.status ?? '',
|
||||||
linha: 'linha',
|
skil: x.skil ?? '',
|
||||||
chip: 'chip',
|
contrato: x.vencConta ?? ''
|
||||||
cliente: 'cliente',
|
}));
|
||||||
usuario: 'usuario',
|
this.loadingLines = false;
|
||||||
plano: 'planoContrato',
|
},
|
||||||
contrato: 'vencConta',
|
error: () => {
|
||||||
};
|
this.loadingLines = false;
|
||||||
return map[String(sortKey)] ?? 'item';
|
this.showToast('Erro ao carregar linhas do grupo.');
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private loadFromApi() {
|
private loadFromApi() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
let params = new HttpParams()
|
||||||
const params = new HttpParams()
|
|
||||||
.set('page', String(this.page))
|
.set('page', String(this.page))
|
||||||
.set('pageSize', String(this.pageSize))
|
.set('pageSize', String(this.pageSize))
|
||||||
.set('search', (this.searchTerm ?? '').trim())
|
.set('search', (this.searchTerm ?? '').trim())
|
||||||
.set('sortBy', this.mapSortKeyToApi(this.sortKey))
|
.set('sortBy', this.mapSortKeyToApi(this.sortKey))
|
||||||
.set('sortDir', this.sortDir);
|
.set('sortDir', this.sortDir);
|
||||||
|
|
||||||
|
if (this.filterSkil === 'PF') params = params.set('skil', 'PESSOA FÍSICA');
|
||||||
|
else if (this.filterSkil === 'PJ') params = params.set('skil', 'PESSOA JURÍDICA');
|
||||||
|
|
||||||
|
if (this.selectedClient) params = params.set('client', this.selectedClient);
|
||||||
|
|
||||||
this.http.get<ApiPagedResult<ApiLineList>>(this.apiBase, { params }).subscribe({
|
this.http.get<ApiPagedResult<ApiLineList>>(this.apiBase, { params }).subscribe({
|
||||||
next: (res) => {
|
next: (res) => {
|
||||||
// ✅ camelCase (igual seu Response)
|
|
||||||
this.total = res.total ?? 0;
|
this.total = res.total ?? 0;
|
||||||
|
// ✅ CORREÇÃO: Mapeando 'usuario' corretamente aqui também
|
||||||
this.rows = (res.items ?? []).map((x) => ({
|
this.rows = (res.items ?? []).map(x => ({
|
||||||
id: x.id,
|
id: x.id,
|
||||||
item: String(x.item ?? ''),
|
item: String(x.item ?? ''),
|
||||||
conta: x.conta ?? '',
|
|
||||||
linha: x.linha ?? '',
|
linha: x.linha ?? '',
|
||||||
chip: x.chip ?? '',
|
|
||||||
cliente: x.cliente ?? '',
|
cliente: x.cliente ?? '',
|
||||||
usuario: x.usuario ?? '',
|
usuario: x.usuario ?? '', // <--- Mapeado
|
||||||
plano: x.planoContrato ?? '',
|
status: x.status ?? '',
|
||||||
contrato: x.vencConta ?? '',
|
skil: x.skil ?? '',
|
||||||
|
contrato: x.vencConta ?? ''
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
error: async () => {
|
error: async () => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
await this.showToast('Erro ao carregar dados da API.');
|
await this.showToast('Erro ao carregar dados.');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========= BUSCA / ORDENAÇÃO / PAGINAÇÃO =========
|
setFilter(type: 'ALL' | 'PF' | 'PJ') {
|
||||||
|
if (this.filterSkil === type) return;
|
||||||
|
this.filterSkil = type;
|
||||||
|
this.page = 1;
|
||||||
|
this.refreshData();
|
||||||
|
}
|
||||||
|
|
||||||
onSearch() {
|
onSearch() {
|
||||||
if (this.searchTimer) clearTimeout(this.searchTimer);
|
if (this.searchTimer) clearTimeout(this.searchTimer);
|
||||||
|
|
||||||
this.searchTimer = setTimeout(() => {
|
this.searchTimer = setTimeout(() => {
|
||||||
this.page = 1;
|
this.page = 1;
|
||||||
this.loadFromApi();
|
this.refreshData();
|
||||||
}, 250);
|
}, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSearch() {
|
clearSearch() {
|
||||||
this.searchTerm = '';
|
this.searchTerm = '';
|
||||||
this.page = 1;
|
this.page = 1;
|
||||||
this.loadFromApi();
|
this.refreshData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadClients() { this.http.get<string[]>(`${this.apiBase}/clients`).subscribe({ next: (data) => this.clientsList = data || [] }); }
|
||||||
|
toggleClientMenu() { this.showClientMenu = !this.showClientMenu; this.clientSearchTerm = ''; }
|
||||||
|
closeClientDropdown() { this.showClientMenu = false; }
|
||||||
|
selectClient(client: string | null) {
|
||||||
|
this.selectedClient = client;
|
||||||
|
this.showClientMenu = false;
|
||||||
|
this.page = 1;
|
||||||
|
this.refreshData();
|
||||||
|
}
|
||||||
|
get filteredClientsList(): string[] {
|
||||||
|
if (!this.clientSearchTerm) return this.clientsList;
|
||||||
|
const s = this.clientSearchTerm.toLowerCase();
|
||||||
|
return this.clientsList.filter(c => c.toLowerCase().includes(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
setSort(key: keyof LineRow) {
|
setSort(key: keyof LineRow) {
|
||||||
if (this.sortKey === key) {
|
if (this.sortKey === key) this.sortDir = this.sortDir === 'asc' ? 'desc' : 'asc';
|
||||||
this.sortDir = this.sortDir === 'asc' ? 'desc' : 'asc';
|
else { this.sortKey = key; this.sortDir = 'asc'; }
|
||||||
} else {
|
this.page = 1; this.loadFromApi();
|
||||||
this.sortKey = key;
|
|
||||||
this.sortDir = 'asc';
|
|
||||||
}
|
|
||||||
|
|
||||||
this.page = 1;
|
|
||||||
this.loadFromApi();
|
|
||||||
}
|
}
|
||||||
|
onPageSizeChange() { this.page = 1; this.loadFromApi(); }
|
||||||
onPageSizeChange() {
|
goToPage(p: number) { this.page = Math.max(1, Math.min(this.totalPages, p)); this.loadFromApi(); }
|
||||||
this.page = 1;
|
|
||||||
this.loadFromApi();
|
|
||||||
}
|
|
||||||
|
|
||||||
goToPage(p: number) {
|
|
||||||
const target = Math.max(1, Math.min(this.totalPages, p));
|
|
||||||
this.page = target;
|
|
||||||
this.loadFromApi();
|
|
||||||
}
|
|
||||||
|
|
||||||
trackById(_: number, row: LineRow) { return row.id; }
|
trackById(_: number, row: LineRow) { return row.id; }
|
||||||
|
get pagedRows() { return this.rows; }
|
||||||
|
get totalPages() { return Math.ceil((this.total || 0) / this.pageSize) || 1; }
|
||||||
|
get filteredCount() { return this.total || 0; }
|
||||||
|
get pageStart() { return this.filteredCount === 0 ? 0 : (this.page - 1) * this.pageSize + 1; }
|
||||||
|
get pageEnd() { return this.filteredCount === 0 ? 0 : Math.min((this.page - 1) * this.pageSize + this.rows.length, this.filteredCount); }
|
||||||
|
get pageNumbers() { const total = this.totalPages; const current = this.page; const max = 5; let start = Math.max(1, current - 2); let end = Math.min(total, start + (max - 1)); start = Math.max(1, end - (max - 1)); const pages = []; for (let i = start; i <= end; i++) pages.push(i); return pages; }
|
||||||
|
|
||||||
get pagedRows(): LineRow[] {
|
private getById(id: string, cb: (d: any) => void) { this.http.get(`${this.apiBase}/${id}`).subscribe({ next: cb }); }
|
||||||
return this.rows;
|
onDetalhes(r: LineRow) { this.detailOpen = true; this.detailData = null; this.getById(r.id, d => this.detailData = d); }
|
||||||
|
onFinanceiro(r: LineRow) { this.financeOpen = true; this.financeData = null; this.getById(r.id, d => this.financeData = d); }
|
||||||
|
closeDetail() { this.detailOpen = false; this.detailData = null; }
|
||||||
|
closeFinance() { this.financeOpen = false; this.financeData = null; }
|
||||||
|
|
||||||
|
async onEditar(r: LineRow) {
|
||||||
|
this.editOpen = true; this.editSaving = false; this.editModel = null; this.editingId = r.id;
|
||||||
|
this.http.get<ApiLineDetail>(`${this.apiBase}/${r.id}`).subscribe({ next: (d) => this.editModel = this.toEditModel(d) });
|
||||||
|
}
|
||||||
|
closeEdit() { this.editOpen = false; this.editSaving = false; this.editModel = null; this.editingId = null; }
|
||||||
|
|
||||||
|
async saveEdit() {
|
||||||
|
if (!this.editingId || !this.editModel) return;
|
||||||
|
this.editSaving = true;
|
||||||
|
|
||||||
|
const payload: UpdateMobileLineRequest = {
|
||||||
|
item: this.toInt(this.editModel.item),
|
||||||
|
conta: (this.editModel.conta ?? '').toString(),
|
||||||
|
linha: (this.editModel.linha ?? '').toString(),
|
||||||
|
chip: (this.editModel.chip ?? '').toString(),
|
||||||
|
cliente: (this.editModel.cliente ?? '').toString(),
|
||||||
|
usuario: (this.editModel.usuario ?? '').toString(),
|
||||||
|
planoContrato: (this.editModel.planoContrato ?? '').toString(),
|
||||||
|
status: (this.editModel.status ?? '').toString(),
|
||||||
|
skil: (this.editModel.skil ?? '').toString(),
|
||||||
|
modalidade: (this.editModel.modalidade ?? '').toString(),
|
||||||
|
dataBloqueio: this.dateInputToIso(this.editModel.dataBloqueio),
|
||||||
|
cedente: (this.editModel.cedente ?? '').toString(),
|
||||||
|
solicitante: (this.editModel.solicitante ?? '').toString(),
|
||||||
|
dataEntregaOpera: this.dateInputToIso(this.editModel.dataEntregaOpera),
|
||||||
|
dataEntregaCliente: this.dateInputToIso(this.editModel.dataEntregaCliente),
|
||||||
|
vencConta: (this.editModel.vencConta ?? '').toString(),
|
||||||
|
franquiaVivo: this.toNullableNumber(this.editModel.franquiaVivo),
|
||||||
|
valorPlanoVivo: this.toNullableNumber(this.editModel.valorPlanoVivo),
|
||||||
|
gestaoVozDados: this.toNullableNumber(this.editModel.gestaoVozDados),
|
||||||
|
skeelo: this.toNullableNumber(this.editModel.skeelo),
|
||||||
|
vivoNewsPlus: this.toNullableNumber(this.editModel.vivoNewsPlus),
|
||||||
|
vivoTravelMundo: this.toNullableNumber(this.editModel.vivoTravelMundo),
|
||||||
|
vivoGestaoDispositivo: this.toNullableNumber(this.editModel.vivoGestaoDispositivo),
|
||||||
|
valorContratoVivo: this.toNullableNumber(this.editModel.valorContratoVivo),
|
||||||
|
franquiaLine: this.toNullableNumber(this.editModel.franquiaLine),
|
||||||
|
franquiaGestao: this.toNullableNumber(this.editModel.franquiaGestao),
|
||||||
|
locacaoAp: this.toNullableNumber(this.editModel.locacaoAp),
|
||||||
|
valorContratoLine: this.toNullableNumber(this.editModel.valorContratoLine),
|
||||||
|
desconto: this.toNullableNumber(this.editModel.desconto),
|
||||||
|
lucro: this.toNullableNumber(this.editModel.lucro),
|
||||||
|
};
|
||||||
|
|
||||||
|
this.http.put(`${this.apiBase}/${this.editingId}`, payload).subscribe({
|
||||||
|
next: async () => { this.editSaving = false; this.closeEdit(); await this.showToast('Registro atualizado!'); if(this.isGroupMode && this.expandedGroup) { this.toggleGroup(this.expandedGroup); } else { this.refreshData(); } },
|
||||||
|
error: async () => { this.editSaving = false; await this.showToast('Erro ao salvar.'); }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get totalPages(): number {
|
async onRemover(r: LineRow, fromGroup = false) {
|
||||||
const total = Math.ceil((this.total || 0) / this.pageSize);
|
if (!confirm(`Remover linha ${r.linha}?`)) return;
|
||||||
return total > 0 ? total : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
get filteredCount(): number {
|
|
||||||
return this.total || 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
get pageStart(): number {
|
|
||||||
if (this.filteredCount === 0) return 0;
|
|
||||||
return (this.page - 1) * this.pageSize + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
get pageEnd(): number {
|
|
||||||
if (this.filteredCount === 0) return 0;
|
|
||||||
return Math.min((this.page - 1) * this.pageSize + this.rows.length, this.filteredCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
get pageNumbers(): number[] {
|
|
||||||
const total = this.totalPages;
|
|
||||||
const current = this.page;
|
|
||||||
|
|
||||||
const max = 5;
|
|
||||||
let start = Math.max(1, current - 2);
|
|
||||||
let end = Math.min(total, start + (max - 1));
|
|
||||||
start = Math.max(1, end - (max - 1));
|
|
||||||
|
|
||||||
const pages: number[] = [];
|
|
||||||
for (let i = start; i <= end; i++) pages.push(i);
|
|
||||||
return pages;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========= IMPORTAR EXCEL =========
|
|
||||||
async onImportExcel() {
|
|
||||||
if (!this.excelInput?.nativeElement) return;
|
|
||||||
this.excelInput.nativeElement.value = '';
|
|
||||||
this.excelInput.nativeElement.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
onExcelSelected(ev: Event) {
|
|
||||||
const input = ev.target as HTMLInputElement;
|
|
||||||
const file = input.files?.[0];
|
|
||||||
if (!file) return;
|
|
||||||
|
|
||||||
const form = new FormData();
|
|
||||||
|
|
||||||
// ✅ mantém 'file' porque já funcionou no seu import
|
|
||||||
form.append('file', file);
|
|
||||||
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
this.http.delete(`${this.apiBase}/${r.id}`).subscribe({
|
||||||
this.http.post<{ imported: number }>(`${this.apiBase}/import-excel`, form).subscribe({
|
next: async () => { await this.showToast('Removido com sucesso.'); if(fromGroup && this.expandedGroup) { this.toggleGroup(this.expandedGroup); } else { this.refreshData(); } },
|
||||||
next: async (r) => {
|
error: async () => { this.loading = false; await this.showToast('Erro ao remover.'); }
|
||||||
await this.showToast(`Importação concluída: ${r?.imported ?? 0} linhas.`);
|
|
||||||
this.page = 1;
|
|
||||||
this.loadFromApi();
|
|
||||||
},
|
|
||||||
error: async () => {
|
|
||||||
this.loading = false;
|
|
||||||
await this.showToast('Falha ao importar Excel. Verifique a aba "GERAL" e o formato .xlsx.');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========= DETALHES / FINANCEIRO =========
|
async onCadastrarLinha() { await this.showToast('Em breve.'); }
|
||||||
private getById(id: string, cb: (d: ApiLineDetail) => void) {
|
|
||||||
this.http.get<ApiLineDetail>(`${this.apiBase}/${id}`).subscribe({
|
|
||||||
next: (d) => cb(d),
|
|
||||||
error: async () => {
|
|
||||||
await this.showToast('Erro ao carregar dados da linha.');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async onDetalhes(row: LineRow) {
|
private async showToast(message: string) { if (!isPlatformBrowser(this.platformId)) return; this.toastMessage = message; this.cdr.detectChanges(); if (!this.successToast?.nativeElement) return; try { const bs = await import('bootstrap'); const toastInstance = bs.Toast.getOrCreateInstance(this.successToast.nativeElement, { autohide: true, delay: 3000 }); toastInstance.show(); } catch (error) { console.error(error); } }
|
||||||
this.detailOpen = true;
|
formatMoney(v: any): string { if (v == null || Number.isNaN(v)) return '-'; return new Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(v); }
|
||||||
this.detailData = null;
|
formatNumber(v: any): string { if (v == null || Number.isNaN(v)) return '-'; return new Intl.NumberFormat('pt-BR').format(v); }
|
||||||
|
formatFranquia(v: any): string { if (v == null || Number.isNaN(v)) return '-'; return `${new Intl.NumberFormat('pt-BR').format(v)} GB`; }
|
||||||
|
formatDateBr(iso: any): string { if (!iso) return '-'; const d = new Date(iso); return Number.isNaN(d.getTime()) ? '-' : new Intl.DateTimeFormat('pt-BR').format(d); }
|
||||||
|
statusClass(s: any): string { const n = (s??'').toLowerCase(); if(n.includes('bloq')||n.includes('perda')) return 'is-blocked'; if(n.includes('ativo')) return 'is-active'; return ''; }
|
||||||
|
statusLabel(s: any): string { return s || '-'; }
|
||||||
|
private mapSortKeyToApi(sortKey: keyof LineRow): string { const map: Record<string, string> = { item: 'item', linha: 'linha', cliente: 'cliente', status: 'status', skil: 'skil', contrato: 'vencConta' }; return map[String(sortKey)] ?? 'item'; }
|
||||||
|
private isoToDateInput(iso: string | null | undefined): string { if (!iso) return ''; const dt = new Date(iso); return Number.isNaN(dt.getTime()) ? '' : dt.toISOString().slice(0, 10); }
|
||||||
|
private dateInputToIso(dateStr: string | null | undefined): string | null { const s = (dateStr ?? '').trim(); return s ? new Date(`${s}T00:00:00.000Z`).toISOString() : null; }
|
||||||
|
private toNullableNumber(v: any): number | null { if (v === null || v === undefined || v === '') return null; const n = Number(String(v).trim().replace(',', '.')); return Number.isFinite(n) ? n : null; }
|
||||||
|
private toInt(v: any): number { const n = parseInt(String(v ?? '0'), 10); return Number.isFinite(n) ? n : 0; }
|
||||||
|
private toEditModel(d: ApiLineDetail) { return { ...d, dataBloqueio: this.isoToDateInput(d.dataBloqueio), dataEntregaOpera: this.isoToDateInput(d.dataEntregaOpera), dataEntregaCliente: this.isoToDateInput(d.dataEntregaCliente) }; }
|
||||||
|
|
||||||
this.getById(row.id, (d) => {
|
async onImportExcel() { if (!this.excelInput?.nativeElement) return; this.excelInput.nativeElement.value = ''; this.excelInput.nativeElement.click(); }
|
||||||
this.detailData = d;
|
onExcelSelected(ev: Event) { const file = (ev.target as HTMLInputElement).files?.[0]; if (!file) return; const form = new FormData(); form.append('file', file); this.loading = true; this.http.post<{ imported: number }>(`${this.apiBase}/import-excel`, form).subscribe({ next: async (r) => { await this.showToast(`Sucesso! ${r?.imported ?? 0} registros importados.`); this.page = 1; this.loadFromApi(); }, error: async () => { this.loading = false; await this.showToast('Falha ao importar planilha.'); } }); }
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async onFinanceiro(row: LineRow) {
|
|
||||||
this.financeOpen = true;
|
|
||||||
this.financeData = null;
|
|
||||||
|
|
||||||
this.getById(row.id, (d) => {
|
|
||||||
this.financeData = d;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
closeDetail() {
|
|
||||||
this.detailOpen = false;
|
|
||||||
this.detailData = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
closeFinance() {
|
|
||||||
this.financeOpen = false;
|
|
||||||
this.financeData = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========= REMOVER =========
|
|
||||||
async onRemover(row: LineRow) {
|
|
||||||
if (!confirm(`Deseja remover a linha ${row.linha}?`)) return;
|
|
||||||
|
|
||||||
this.loading = true;
|
|
||||||
|
|
||||||
this.http.delete<void>(`${this.apiBase}/${row.id}`).subscribe({
|
|
||||||
next: async () => {
|
|
||||||
await this.showToast('Linha removida com sucesso.');
|
|
||||||
if (this.rows.length === 1 && this.page > 1) this.page -= 1;
|
|
||||||
this.loadFromApi();
|
|
||||||
},
|
|
||||||
error: async () => {
|
|
||||||
this.loading = false;
|
|
||||||
await this.showToast('Erro ao remover a linha.');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========= BOTÕES (mantidos) =========
|
|
||||||
async onCadastrarLinha() {
|
|
||||||
await this.showToast('Cadastro de linha será implementado.');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue