Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend hist crud spa locais atend horario e urgencia #661

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8cb03b8
Ajusta template do form de medico
RogerDelNobre May 25, 2023
e8464f6
Ticket_id: #113517 Adiciona ao header link para convenio
RogerDelNobre May 31, 2023
50f8da7
Ticket_id: #113517 Cria componente grupo_local_atendimento
RogerDelNobre May 31, 2023
28ec5cd
Ticket_id: #113517 Cria model de grupo-local-atendimento
RogerDelNobre May 31, 2023
b026dc0
Ticket_id: #113517 Implementa service de grupo-local-atendimento
RogerDelNobre Jun 1, 2023
b73bc28
Ticket_id: #113517 Implementa endpoints de grupo-local-atendimento
RogerDelNobre Jun 1, 2023
b5afacd
Ticket_id: #113517 Implementa component de grupo-local-atendimento
RogerDelNobre Jun 1, 2023
12e5589
Ticket_id: #113517 Implementa template de grupo-local-atendimento
RogerDelNobre Jun 1, 2023
8b3645f
Ticket_id: #113516 Cria componente de local-de-atendimento-contato
RogerDelNobre Jun 5, 2023
162469f
Ticket_id: #113516 Cria componente de local-de-atendimento-urgencia
RogerDelNobre Jun 5, 2023
7f65ff2
Ticket_id: #113516 Ajusta header de local-de-atendimento
RogerDelNobre Jun 5, 2023
b7bfaa4
Ticket_id: #113516 Cria relacionamento empresa e local-de-atendimento…
RogerDelNobre Jun 5, 2023
6ab5a46
Ticket_id: #113516 Implementa abas de empresa em local-de-atendimento…
RogerDelNobre Jun 5, 2023
ab5dd84
Ticket_id: #113516 Implementa abas de contato em local-de-atendimento…
RogerDelNobre Jun 6, 2023
3194416
Ticket_id: #113516 Implementa componente de contato em local-de-atend…
RogerDelNobre Jun 6, 2023
113e534
Ticket_id: #113516 Implementa aba de urgencia em local-de-atendimento…
RogerDelNobre Jun 6, 2023
7bbc2a7
Ticket_id: #113516 Implementa componente de urgencia em local-de-aten…
RogerDelNobre Jun 6, 2023
825953a
Ticket_id: #113516 Ajusta local-de-atendimento create form
RogerDelNobre Jun 6, 2023
30c697c
Ticket_id: #113516 Ajusta componente local-de-atendimento create
RogerDelNobre Jun 6, 2023
763c8bf
Ticket_id: #113516 Ajusta model de local-de-atendimento
RogerDelNobre Jun 6, 2023
66ff74c
Ticket_id: #113516 Implementa aba de empresa em local-de-atendimento …
RogerDelNobre Jun 6, 2023
e788973
Ticket_id: #113516 Implementa aba de endereco em local-de-atendimento…
RogerDelNobre Jun 6, 2023
485a6c7
Ticket_id: #113516 Implementa aba de horario funcionamento em local-d…
RogerDelNobre Jun 6, 2023
231096b
Ticket_id: #113516 Ajusta template de versao exame create form
RogerDelNobre Jun 6, 2023
ded3ae7
Ticket_id: #113516 Cria regra css para centralizar texto input type time
RogerDelNobre Jun 6, 2023
e59a515
Ticket_id: #113516 Ignora o arquivo hint do vscode
RogerDelNobre Jun 6, 2023
9b434aa
Ticket_id: #113516 Implementa input autocomplete de grupo local aten…
RogerDelNobre Jun 9, 2023
5a32016
Ticket_id: #113516 Implementa input autocomplete de grupo Local Aten…
RogerDelNobre Jun 9, 2023
210e32a
Ticket_id: #113516 Ajusta Local Atendimento empresa componente
RogerDelNobre Jun 9, 2023
f791b39
Ticket_id: #113516 Ajusta Local Atendimento endereco componente
RogerDelNobre Jun 9, 2023
874def9
Ticket_id: #113516 Ajusta template Local Atendimento create
RogerDelNobre Jun 9, 2023
934fab3
Ticket_id: #113516 Inclui relacionamento de grupo_local_atendimetno …
RogerDelNobre Jun 9, 2023
64f8e75
Remove interpolacao de teste
RogerDelNobre Jun 12, 2023
b193690
Ticket_id: #113742 Inclui biblioteca hammerjs para mat-slide-toggle
RogerDelNobre Jun 13, 2023
9c2cce5
Ticket_id: #113742 Implementa mat-slide-toggle trabalha_24hrs na aba…
RogerDelNobre Jun 13, 2023
721fe7a
Ticket_id: #113742 Implementa mat-slide-toggle componente em horario…
RogerDelNobre Jun 13, 2023
226377e
Ticket_id: #113742 Atualiza versao do yarn
RogerDelNobre Jun 13, 2023
9bb5b93
Ticket_id: #113742 Ajusta model de local atendimento
RogerDelNobre Jun 14, 2023
910b3ff
Ticket_id: #113742 Ajusta imports do componente de local atendimento…
RogerDelNobre Jun 14, 2023
0c0b951
Ticket_id: #113742 Implementa template local atendimento aba Horario…
RogerDelNobre Jun 14, 2023
d523636
Ticket_id: #113742 Ajusta relacionamento no model de local de atendim…
RogerDelNobre Jun 19, 2023
13e0dfb
Ticket_id: #113742 Remove logs de desenvolvimento
RogerDelNobre Jun 19, 2023
ca90ef2
Ticket_id: #113742 Ajusta template parametros de grupo local atendimento
RogerDelNobre Jun 19, 2023
9f7ddaa
Ticket_id: #113742 Ajusta funcionamento do input autocomplete de grup…
RogerDelNobre Jun 19, 2023
52fdd46
Ticket_id: #113742 Implementa binding de localatendimento na aba conf…
RogerDelNobre Jun 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# Ignora Hints
.hintrc

# compiled output
/dist
/tmp
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"bootstrap": "^5.2.3",
"core-util-is": "^1.0.3",
"got": "^12.5.3",
"hammerjs": "^2.0.8",
"moment": "^2.29.1",
"ng-auto-complete": "^5.0.3",
"ngx-mask": "^15.1.0",
Expand Down
5 changes: 5 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { ExameCreateComponent } from './components/exame/exame-create/exame-crea
import { ExameDeleteComponent } from './components/exame/exame-delete/exame-delete.component';
import { ExameUpdateComponent } from './components/exame/exame-update/exame-update.component';
import { EspecialidadeComponent } from './components/especialidade/especialidade.component';
import { GrupoLocalAtendimentoComponent } from './components/grupo-local-atendimento/grupo-local-atendimento.component';
import { HomeComponent } from './views/home/home.component';
import { HibridoClientErrorComponent } from './components/hibrido-client-error/hibrido-client-error.component';
import { LaboratorioCreateComponent } from './components/laboratorio/laboratorio-create/laboratorio-create.component';
Expand Down Expand Up @@ -142,6 +143,10 @@ const routes: Routes = [
path: 'tipos_recurso',
component: TipoRecursoComponent,
},
{
path: 'grupos_locais',
component: GrupoLocalAtendimentoComponent,
},
{
path: 'hibrido_client_errors',
component: HibridoClientErrorComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<div class="d-flex justify-content-between col-sm-12 p-2">
<button mat-flat-button color="primary" class="col-sm-2 col-md-2 col-lg-2 float-start btn-primary" data-bs-toggle="collapse" data-bs-target="#collapseSearch"
aria-expanded="false" aria-controls="collapseSearch">
<mat-icon>search</mat-icon>
Buscar
</button>

<button appDebounceClick mat-flat-button color="primary" class="col-sm-1 col-md-1 col-lg-1 float-end btn-primary" data-bs-toggle="collapse" data-bs-target="#collapseForm"
aria-expanded="false" aria-controls="collapseForm" (click)="new();" *ngIf="!onCreate && !onEdit">
<mat-icon>add</mat-icon>
Novo
</button>
</div>

<div class="mat-elevation-z4">
<div class="collapse" id="collapseSearch">
<div class="card card-body">
<div class="row">
<div class="mb-3 col-md-3 row">
<mat-form-field appearance="fill">
<mat-label>Nome:</mat-label>
<input matInput #nome maxlength="100"
title="Filtre por nome"
(input)="search('nome', nome.value)"
>
</mat-form-field>
</div>
</div>
</div>
</div>

<div class="">
<div *ngIf="onCreate || onEdit">
<form #formCreateGrupoLocalAtendimento="ngForm" class="justify-content-md-center">

<mat-form-field appearance="fill" class="col-lg-6 col-md-6 p-2">
<mat-label>Nome:</mat-label>
<input
type="text"
aria-label="nome"
id="nome"
required
matInput
maxlength="50"
name="nome"
[(ngModel)]="currentRecord.nome"
#nome="ngModel"
>
<mat-error *ngIf="nome.invalid && (nome.dirty || nome.touched)">
<span *ngIf="nome.errors?.['required']">
O campo é obrigatório!
</span>
</mat-error>
</mat-form-field>

<div class="col-md-12 d-flex justify-content-end p-2">
<button mat-button type="submit"
(click)="addGridData()" *ngIf="onCreate"
[disabled]="formCreateGrupoLocalAtendimento.invalid">Inserir</button>
<button mat-button type="submit"
(click)="updateGridData()"
*ngIf="onEdit">Alterar</button>
<button mat-button color="warn" type="button"
(click)="cancelar()">Cancelar</button>
</div>
</form>
</div>
</div>
</div>

<div class="mat-elevation-z4">
<table
mat-table
[dataSource]="datasource"
matSort
matSortActive="id"
matSortDirection="desc"
matSortDisableClear
>

<!-- Nome Column -->
<ng-container matColumnDef="nome" class="col-2">
<th mat-header-cell *matHeaderCellDef mat-sort-header="nome">Nome</th>
<td mat-cell *matCellDef="let row">{{ row?.nome }}</td>
</ng-container>

<!-- action Column -->
<ng-container matColumnDef="action" class="col-1">
<th mat-header-cell *matHeaderCellDef> Ações </th>
<td mat-cell *matCellDef="let row; index as position">
<div class="row">

<div class="col-1 me-3">
<button mat-icon-button *ngIf="!onEdit" (click)="atualizar(row)">
<mat-icon class="edit text-success">edit</mat-icon>
</button>
</div>

<div class="col-1 me-3">
<button class="delete" mat-icon-button *ngIf="!onEdit" (click)="deleteGridData(row.id)">
<mat-icon class="delete text-danger">delete</mat-icon>
</button>
</div>

<ng-template #deleteDialog>
<mat-dialog-content class="mat-typography">
Deseja apagar esse registro?
</mat-dialog-content>
<mat-dialog-actions align="end">
<button mat-button mat-dialog-close>Cancel</button>
<button mat-button [mat-dialog-close]="true">Apagar</button>
</mat-dialog-actions>
</ng-template>
</div>
</td>
</ng-container>

<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table>
<mat-paginator
[length]="this.totalCount"
[pageSize]="5"
[pageSizeOptions]="[5, 10, 20, 50]">
</mat-paginator>
</div>

Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
import { CommonModule } from '@angular/common';
import {
Component,
OnInit,
AfterViewInit,
ViewChild,
TemplateRef,
ElementRef,
Input
} from '@angular/core';
import { GrupoLocalAtendimento } from '../model/grupo-local-atendimento.model';
import { GrupoLocalAtendimentoService } from '../service/grupo-local-atendimento.service';
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
import { MatSort, MatSortModule } from '@angular/material/sort';
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
import { merge } from 'rxjs';
import { Query } from '../model/query.model';
import { Subject, timer } from 'rxjs';
import { tap, debounceTime } from 'rxjs/operators';
import { MatButtonModule } from '@angular/material/button';
import { MatTabsModule } from '@angular/material/tabs';
import { MatSelectModule } from '@angular/material/select';
import { MatOptionModule } from '@angular/material/core';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { FormsModule } from '@angular/forms';
import { MatInputModule } from '@angular/material/input';
import { MatFormFieldModule } from '@angular/material/form-field';
import { NgIf, NgFor } from '@angular/common';
import { MatIconModule } from '@angular/material/icon';
import { MatDatepickerModule } from '@angular/material/datepicker';

@Component({
selector: 'app-grupo-local-atendimento',
templateUrl: './grupo-local-atendimento.component.html',
standalone: true,
imports: [
CommonModule, MatIconModule, NgIf, MatFormFieldModule, MatInputModule, FormsModule,
MatAutocompleteModule, NgFor, MatOptionModule, MatSelectModule, MatTabsModule,
MatButtonModule, MatTableModule, MatSortModule, MatDialogModule, MatPaginatorModule,
MatDatepickerModule
]
})
export class GrupoLocalAtendimentoComponent {
gruposLocaisAtendimento: GrupoLocalAtendimento[] =[];
datasource = new MatTableDataSource<any>([]);
records: any[] = [];
record!: any;
oldRecord: any;
currentRecord: any;
deletedRecords: any[] = [];
query: Query[] = [];
id!: number;
totalCount!: number;

@ViewChild('deleteDialog') deleteDialog: TemplateRef<any> | any;
@ViewChild(MatSort) sort: MatSort | any;
@ViewChild(MatPaginator) paginator: MatPaginator | any;

queries: Query[] = [];
subjectEspecialidade: Subject<any> = new Subject();
subjectOperadoraTelefonia: Subject<any> = new Subject();

onEdit = false;
onCreate = false;

displayedColumns = [
'nome',
'action'
];

constructor(
public dialog: MatDialog,
private recordService: GrupoLocalAtendimentoService
) {
this.currentRecord = new GrupoLocalAtendimento({});
this.record ||= new GrupoLocalAtendimento({});
}

ngOnInit(): void {
this.recordService.count().subscribe((totalCount) => {
this.totalCount = totalCount;
});

const query = new Query({ key: '', value: '', isNumeric: false });
}

ngAfterViewInit() {
this.loadPage();
this.sort.sortChange.subscribe(() => (this.paginator.pageIndex = 0)); // reseta o paginador depois de ordenar

merge(this.sort.sortChange, this.paginator.page) // Na ordenação ou paginação, carrega uma nova página
.pipe(tap(() => this.loadPage()))
.subscribe();
}

loadPage() {
this.recordService
.find(this.sort.active,
this.sort.direction,
this.paginator.pageIndex,
this.paginator.pageSize, this.query
).subscribe((records: any[]) => {
this.records = records;
this.datasource.data = [...this.records];
});
}

new(): void {
this.onCreate = true;
}

addGridData(): void {
this.onCreate = false;
this.onEdit = false;
this.recordService.create(this.currentRecord).subscribe((record) => {
// this.records.unshift(record);
// this.datasource.data = [...this.records];
this.recordService.showMessage('Grupo local de atendimento cadastrado com sucesso!');
this.loadPage();
});

this.currentRecord = new GrupoLocalAtendimento({});
}

updateGridData(): void {
this.onCreate = false;
this.onEdit = false;
this.recordService.update(this.currentRecord).subscribe((recurso) => {
this.recordService.showMessage('Grupo local de atendimento atualizado com sucesso!');
this.loadPage();
});
this.currentRecord = new GrupoLocalAtendimento({});
}

atualizar(row: GrupoLocalAtendimento): void {
console.warn('Passou no atualizar!!!!!!!')
console.table(row);
this.currentRecord = row;
this.onCreate = false;
this.onEdit = true;
}

cancelar(): void {
this.onCreate = false;
this.onEdit = false;
Object.assign(this.currentRecord, this.oldRecord);
this.currentRecord = new GrupoLocalAtendimento({});
}

deleteGridData(id: number): void {
const dialogRef = this.dialog.open(this.deleteDialog);
dialogRef.afterClosed().subscribe((result) => {
if (result) {
this.recordService.delete(id)
.subscribe((record) => {
this.recordService.showMessage('Grupo local de atendimento apagado com sucesso!');

// Carrega os dados do backend e faz refresh do datasource
this.loadPage();
this.datasource.data = [...this.records];
});
}
});
}

search(key: string, value: string, isNumeric: boolean = false): void {
const query = new Query({ key, value, isNumeric });
this.query = this.query.filter((q) => q.key !== key);
this.query.push(query);
this.paginator.pageIndex = 0;
this.loadPage();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<form class="example-container row container-fluid mt-4">
<div class="row justify-content-around">
<div>
<mat-form-field appearance="fill" class="col-lg-2 pe-2">
<mat-label>Telefone</mat-label>
<input matInput #telefone maxlength="13" mask="(00)0000-0000"
id="telefone" name="telefone" title="Telefone"
[(ngModel)]="this.empresa.telefone">
</mat-form-field>

<mat-form-field appearance="fill" class="col-lg-2 p-2">
<mat-label>Celular</mat-label>
<input matInput #fax maxlength="14"
mask="(00)00000-0000"
id="fax" name="fax" title="Fax"
[(ngModel)]="this.empresa.fax"/>
</mat-form-field>

<mat-form-field appearance="fill" class="col-lg-4 p-2">
<mat-label>E-mail</mat-label>
<input matInput #email maxlength="50"
id="email" name="email" title="Email"
[(ngModel)]="this.empresa.email">
</mat-form-field>

<mat-form-field appearance="fill" class="col-lg-4 ps-2">
<mat-label>E-mail Secundario</mat-label>
<input matInput #input
title="Email secundário" maxlength="50"/>
</mat-form-field>
</div>
</div>
</form>
Loading