diff --git a/.gitignore b/.gitignore index 6c21ed0f..842bcd83 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ # See http://help.github.com/ignore-files/ for more about ignoring files. +# Ignora Hints +.hintrc + # compiled output /dist /tmp diff --git a/package.json b/package.json index 25e5a8c9..65c714c2 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 716a1369..385feff1 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -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'; @@ -142,6 +143,10 @@ const routes: Routes = [ path: 'tipos_recurso', component: TipoRecursoComponent, }, + { + path: 'grupos_locais', + component: GrupoLocalAtendimentoComponent, + }, { path: 'hibrido_client_errors', component: HibridoClientErrorComponent, diff --git a/src/app/components/grupo-local-atendimento/grupo-local-atendimento.component.html b/src/app/components/grupo-local-atendimento/grupo-local-atendimento.component.html new file mode 100644 index 00000000..97278aba --- /dev/null +++ b/src/app/components/grupo-local-atendimento/grupo-local-atendimento.component.html @@ -0,0 +1,127 @@ +
+ + + +
+ +
+
+
+
+
+ + Nome: + + +
+
+
+
+ +
+
+
+ + + Nome: + + + + O campo é obrigatório! + + + + +
+ + + +
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + +
Nome{{ row?.nome }} Ações +
+ +
+ +
+ +
+ +
+ + + + Deseja apagar esse registro? + + + + + + +
+
+ + +
+ diff --git a/src/app/components/grupo-local-atendimento/grupo-local-atendimento.component.ts b/src/app/components/grupo-local-atendimento/grupo-local-atendimento.component.ts new file mode 100644 index 00000000..02218e8d --- /dev/null +++ b/src/app/components/grupo-local-atendimento/grupo-local-atendimento.component.ts @@ -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([]); + records: any[] = []; + record!: any; + oldRecord: any; + currentRecord: any; + deletedRecords: any[] = []; + query: Query[] = []; + id!: number; + totalCount!: number; + + @ViewChild('deleteDialog') deleteDialog: TemplateRef | any; + @ViewChild(MatSort) sort: MatSort | any; + @ViewChild(MatPaginator) paginator: MatPaginator | any; + + queries: Query[] = []; + subjectEspecialidade: Subject = new Subject(); + subjectOperadoraTelefonia: Subject = 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(); + } + +} diff --git a/src/app/components/local-de-atendimento/local-de-atendimento-create/local-de-atendimento-contato/local-de-atendimento-contato.component.html b/src/app/components/local-de-atendimento/local-de-atendimento-create/local-de-atendimento-contato/local-de-atendimento-contato.component.html new file mode 100644 index 00000000..0c20d15e --- /dev/null +++ b/src/app/components/local-de-atendimento/local-de-atendimento-create/local-de-atendimento-contato/local-de-atendimento-contato.component.html @@ -0,0 +1,33 @@ +
+
+
+ + Telefone + + + + + Celular + + + + + E-mail + + + + + E-mail Secundario + + +
+
+
diff --git a/src/app/components/local-de-atendimento/local-de-atendimento-create/local-de-atendimento-contato/local-de-atendimento-contato.component.ts b/src/app/components/local-de-atendimento/local-de-atendimento-create/local-de-atendimento-contato/local-de-atendimento-contato.component.ts new file mode 100644 index 00000000..65bcbfbf --- /dev/null +++ b/src/app/components/local-de-atendimento/local-de-atendimento-create/local-de-atendimento-contato/local-de-atendimento-contato.component.ts @@ -0,0 +1,28 @@ +import { Component, OnInit, Input } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { Empresa } from 'src/app/components/model/empresa.model'; +import { LocalDeAtendimento } from 'src/app/components/model/local-de-atendimento.model'; +import { MatInputModule } from '@angular/material/input'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { FormsModule } from '@angular/forms'; + +@Component({ + selector: 'app-local-de-atendimento-contato', + standalone: true, + templateUrl: './local-de-atendimento-contato.component.html', + imports: [CommonModule, FormsModule, MatFormFieldModule, MatInputModule] +}) +export class LocalDeAtendimentoContatoComponent implements OnInit { + @Input('localdeatendimento') localdeatendimento: LocalDeAtendimento; + @Input('empresa') empresa: Empresa; + + constructor() { + this.localdeatendimento = new LocalDeAtendimento({}); + this.empresa ||= new Empresa({}); + // console.table(this.empresa); + this.localdeatendimento.empresa = this.empresa; + } + ngOnInit(): void { + this.empresa ||= new Empresa({}); + } +} diff --git a/src/app/components/local-de-atendimento/local-de-atendimento-create/local-de-atendimento-create.component.html b/src/app/components/local-de-atendimento/local-de-atendimento-create/local-de-atendimento-create.component.html index f7a7ab9b..aad79adf 100644 --- a/src/app/components/local-de-atendimento/local-de-atendimento-create/local-de-atendimento-create.component.html +++ b/src/app/components/local-de-atendimento/local-de-atendimento-create/local-de-atendimento-create.component.html @@ -1,118 +1,156 @@
+

Cadastro de Local de Atendimento:

-
- - Local de Atendimento: - + + Local de Atendimento + - - CNES: - + + CNES + - - Grupo: - + + Grupo + + + + O campo é obrigatório! + + + + + {{grupo_local.nome}} + +
-
- - Chave de Publicação: - - - - - Local de Impressão: - - +
+ + Grupo Histórico no Laudo + + - - Grupo Histórico no Laudo: - - + + Chave de Publicação + + -
+ + Local de Impressão + + -
- - Coleta Interna - Coleta Externa - -
+
+
+ + Coleta Interna + Coleta Externa + +
-
- -
+
+
+
-