130 lines
3.6 KiB
TypeScript
130 lines
3.6 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { HttpClient } from '@angular/common/http';
|
|
import { environment } from '../../environments/environment';
|
|
|
|
export interface MacrophonyPlan {
|
|
planoContrato?: string | null;
|
|
gb?: string | number | null;
|
|
valorIndividualComSvas?: string | number | null;
|
|
franquiaGb?: string | number | null;
|
|
totalLinhas?: number | string | null;
|
|
valorTotal?: string | number | null;
|
|
vivoTravel?: boolean | string | number | null;
|
|
}
|
|
|
|
export interface MacrophonyTotals {
|
|
franquiaGbTotal?: string | number | null;
|
|
totalLinhasTotal?: number | string | null;
|
|
valorTotal?: string | number | null;
|
|
}
|
|
|
|
export interface VivoLineResumo {
|
|
skil?: string | null;
|
|
cliente?: string | null;
|
|
qtdLinhas?: number | string | null;
|
|
franquiaTotal?: string | number | null;
|
|
valorContratoVivo?: string | number | null;
|
|
franquiaLine?: string | number | null;
|
|
valorContratoLine?: string | number | null;
|
|
lucro?: string | number | null;
|
|
}
|
|
|
|
export interface VivoLineTotals {
|
|
qtdLinhasTotal?: number | string | null;
|
|
franquiaTotal?: string | number | null;
|
|
valorContratoVivo?: string | number | null;
|
|
franquiaLine?: string | number | null;
|
|
valorContratoLine?: string | number | null;
|
|
lucro?: string | number | null;
|
|
}
|
|
|
|
export interface ClienteEspecial {
|
|
nome?: string | null;
|
|
valor?: string | number | null;
|
|
}
|
|
|
|
export interface PlanoContratoResumo {
|
|
planoContrato?: string | null;
|
|
gb?: string | number | null;
|
|
valorIndividualComSvas?: string | number | null;
|
|
franquiaGb?: string | number | null;
|
|
totalLinhas?: number | string | null;
|
|
valorTotal?: string | number | null;
|
|
}
|
|
|
|
export interface PlanoContratoTotal {
|
|
valorTotal?: string | number | null;
|
|
}
|
|
|
|
export interface LineTotal {
|
|
tipo?: string | null;
|
|
valorTotalLine?: string | number | null;
|
|
lucroTotalLine?: string | number | null;
|
|
qtdLinhas?: number | string | null;
|
|
}
|
|
|
|
export interface GbDistribuicao {
|
|
gb?: string | number | null;
|
|
qtd?: number | string | null;
|
|
soma?: string | number | null;
|
|
}
|
|
|
|
export interface GbDistribuicaoTotal {
|
|
totalLinhas?: number | string | null;
|
|
somaTotal?: string | number | null;
|
|
}
|
|
|
|
export interface ReservaLine {
|
|
ddd?: string | number | null;
|
|
franquiaGb?: string | number | null;
|
|
qtdLinhas?: number | string | null;
|
|
total?: string | number | null;
|
|
}
|
|
|
|
export interface ReservaPorFranquia {
|
|
franquiaGb?: string | number | null;
|
|
totalLinhas?: number | string | null;
|
|
}
|
|
|
|
export interface ReservaPorDdd {
|
|
ddd?: string | number | null;
|
|
totalLinhas?: number | string | null;
|
|
porFranquia?: ReservaPorFranquia[];
|
|
}
|
|
|
|
export interface ReservaTotal {
|
|
qtdLinhasTotal?: number | string | null;
|
|
total?: string | number | null;
|
|
}
|
|
|
|
export interface ResumoResponse {
|
|
macrophonyPlans?: MacrophonyPlan[];
|
|
macrophonyTotals?: MacrophonyTotals;
|
|
vivoLineResumos?: VivoLineResumo[];
|
|
vivoLineTotals?: VivoLineTotals;
|
|
clienteEspeciais?: ClienteEspecial[];
|
|
planoContratoResumos?: PlanoContratoResumo[];
|
|
planoContratoTotal?: PlanoContratoTotal;
|
|
lineTotais?: LineTotal[];
|
|
gbDistribuicao?: GbDistribuicao[];
|
|
gbDistribuicaoTotal?: GbDistribuicaoTotal;
|
|
reservaLines?: ReservaLine[];
|
|
reservaPorDdd?: ReservaPorDdd[];
|
|
totalGeralLinhasReserva?: number | string | null;
|
|
reservaTotal?: ReservaTotal;
|
|
}
|
|
|
|
@Injectable({ providedIn: 'root' })
|
|
export class ResumoService {
|
|
private readonly apiBase: string;
|
|
|
|
constructor(private http: HttpClient) {
|
|
const raw = (environment.apiUrl || '').replace(/\/+$/, '');
|
|
this.apiBase = raw.toLowerCase().endsWith('/api') ? raw : `${raw}/api`;
|
|
}
|
|
|
|
getResumo() {
|
|
return this.http.get<ResumoResponse>(`${this.apiBase}/resumo`);
|
|
}
|
|
}
|