diff --git a/miapp/vistascita b/miapp/vistascita new file mode 160000 index 0000000..7048af1 --- /dev/null +++ b/miapp/vistascita @@ -0,0 +1 @@ +Subproject commit 7048af195c4554a9e3f0f7514e97780b5f9eb7d4 diff --git a/package.json b/package.json index b851512..74d3df0 100644 --- a/package.json +++ b/package.json @@ -26,30 +26,33 @@ "@angular/platform-browser-dynamic": "^13.2.6", "@angular/router": "^13.2.6", "@ng-bootstrap/ng-bootstrap": "12.0.1", - "@popperjs/core": "^2.11.4", "@ngui/map": "0.30.3", + "@popperjs/core": "^2.11.6", "@types/googlemaps": "3.39.14", "arrive": "2.4.1", - "bootstrap": "4.5.2", + "bootstrap": "^4.5.2", "bootstrap-notify": "3.1.3", "chart.js": "2.9.4", "chartist": "0.11.4", "core-js": "3.21.1", "express": "4.18.0", - "jquery": "3.5.1", + "jquery": "^3.5.1", "moment": "2.29.1", + "ng2-search-filter": "^0.5.1", + "ngx-pagination": "^6.0.2", "ngx-toastr": "14.3.0", "rxjs": "^7.5.5", + "sweetalert2": "^11.4.32", "zone.js": "~0.11.5" }, "devDependencies": { - "@angular-devkit/build-angular": "^13.2.6", + "@angular-devkit/build-angular": "^13.3.9", "@angular/cli": "^13.2.6", "@angular/compiler-cli": "^13.2.6", "@angular/language-service": "13.2.6", + "@types/chartist": "0.11.0", "@types/jasmine": "~3.10.3", "@types/jasminewd2": "~2.0.10", - "@types/chartist": "0.11.0", "@types/jquery": "3.5.1", "@types/node": "16.3.2", "codelyzer": "6.0.2", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 5cc6ad6..53918a6 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -2,35 +2,64 @@ import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; import { ToastrModule } from "ngx-toastr"; - import { SidebarModule } from './sidebar/sidebar.module'; import { FooterModule } from './shared/footer/footer.module'; import { NavbarModule} from './shared/navbar/navbar.module'; import { FixedPluginModule} from './shared/fixedplugin/fixedplugin.module'; - import { AppComponent } from './app.component'; import { AppRoutes } from './app.routing'; - import { AdminLayoutComponent } from './layouts/admin-layout/admin-layout.component'; +import { HttpClientModule } from '@angular/common/http'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgxPaginationModule } from "ngx-pagination"; +import { FiltercitasPipe } from './pipe/filtercitas.pipe'; + @NgModule({ declarations: [ AppComponent, - AdminLayoutComponent + AdminLayoutComponent, + FiltercitasPipe, + + + + ], imports: [ - BrowserAnimationsModule, + BrowserAnimationsModule, RouterModule.forRoot(AppRoutes,{ useHash: true }), + SidebarModule, NavbarModule, ToastrModule.forRoot(), FooterModule, - FixedPluginModule + FixedPluginModule, + HttpClientModule, + FormsModule, + + ReactiveFormsModule, + NgbModule, + + NgxPaginationModule, + + + + + ], + exports:[ + ReactiveFormsModule, + FormsModule, + FiltercitasPipe, + + ], + providers: [], bootstrap: [AppComponent] }) export class AppModule { } + diff --git a/src/app/layouts/admin-layout/admin-layout.module.ts b/src/app/layouts/admin-layout/admin-layout.module.ts index 6944ceb..2bbd09a 100644 --- a/src/app/layouts/admin-layout/admin-layout.module.ts +++ b/src/app/layouts/admin-layout/admin-layout.module.ts @@ -1,7 +1,7 @@ import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; +import { FormsModule,ReactiveFormsModule} from '@angular/forms'; import { AdminLayoutRoutes } from './admin-layout.routing'; @@ -13,15 +13,27 @@ import { IconsComponent } from '../../pages/icons/icons.component'; import { MapsComponent } from '../../pages/maps/maps.component'; import { NotificationsComponent } from '../../pages/notifications/notifications.component'; import { UpgradeComponent } from '../../pages/upgrade/upgrade.component'; - +import { PacientesComponent } from 'app/pages/componentes/pacientes/pacientes.component'; +import { ServiciosComponent } from 'app/pages/componentes/servicios/servicios.component'; +import { CitasComponent } from 'app/pages/componentes/citas/citas.component'; +import { EstadosComponent } from 'app/pages/componentes/estados/estados.component'; +import { FormularioServiciosComponent } from 'app/pages/componentes/servicios/formulario-servicios/formulario-servicios.component'; +import { FormularioPacientesComponent } from 'app/pages/componentes/pacientes/formulario-pacientes/formulario-pacientes.component'; +import { FormularioCitasComponent} from 'app/pages/componentes/citas/formulario-citas/formulario-citas.component'; +import { FormularioEstadosComponent } from 'app/pages/componentes/estados/formulario-estados/formulario-estados.component'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgxPaginationModule } from 'ngx-pagination'; + + @NgModule({ imports: [ CommonModule, RouterModule.forChild(AdminLayoutRoutes), + ReactiveFormsModule, FormsModule, - NgbModule + + NgbModule,NgxPaginationModule ], declarations: [ DashboardComponent, @@ -32,7 +44,16 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; IconsComponent, MapsComponent, NotificationsComponent, - ] + PacientesComponent, + ServiciosComponent, + CitasComponent, + EstadosComponent, + FormularioServiciosComponent, + FormularioPacientesComponent, + FormularioCitasComponent, + FormularioEstadosComponent + + ] }) export class AdminLayoutModule {} diff --git a/src/app/layouts/admin-layout/admin-layout.routing.ts b/src/app/layouts/admin-layout/admin-layout.routing.ts index 4ef801d..72aa742 100644 --- a/src/app/layouts/admin-layout/admin-layout.routing.ts +++ b/src/app/layouts/admin-layout/admin-layout.routing.ts @@ -8,6 +8,11 @@ import { IconsComponent } from '../../pages/icons/icons.component'; import { MapsComponent } from '../../pages/maps/maps.component'; import { NotificationsComponent } from '../../pages/notifications/notifications.component'; import { UpgradeComponent } from '../../pages/upgrade/upgrade.component'; +import { PacientesComponent } from 'app/pages/componentes/pacientes/pacientes.component'; +import { Servicios } from 'app/model/servicios'; +import { ServiciosComponent } from 'app/pages/componentes/servicios/servicios.component'; +import { CitasComponent } from 'app/pages/componentes/citas/citas.component'; +import { EstadosComponent } from 'app/pages/componentes/estados/estados.component'; export const AdminLayoutRoutes: Routes = [ { path: 'dashboard', component: DashboardComponent }, @@ -17,5 +22,8 @@ export const AdminLayoutRoutes: Routes = [ { path: 'icons', component: IconsComponent }, { path: 'maps', component: MapsComponent }, { path: 'notifications', component: NotificationsComponent }, - { path: 'upgrade', component: UpgradeComponent } + { path: 'citas/:id', component: CitasComponent }, + { path: 'pacientes', component: PacientesComponent }, + { path: 'servicios', component: ServiciosComponent}, + { path: 'estados', component:EstadosComponent} ]; diff --git a/src/app/model/citas.ts b/src/app/model/citas.ts new file mode 100644 index 0000000..3d9f8a9 --- /dev/null +++ b/src/app/model/citas.ts @@ -0,0 +1,16 @@ +import { Estados } from "./estados"; +import { Pacientes } from "./pacientes"; +import { Servicios } from "./servicios"; + +export class Citas { + + id:number; + fecha:Date; + paciente:Pacientes; + servicios:Servicios[]; + servi:Servicios; + estado:Estados; + + + +} diff --git a/src/app/model/estados.ts b/src/app/model/estados.ts new file mode 100644 index 0000000..efdd090 --- /dev/null +++ b/src/app/model/estados.ts @@ -0,0 +1,7 @@ + + +export class Estados{ + id:number; + nombre:String; + +} \ No newline at end of file diff --git a/src/app/model/pacientes.ts b/src/app/model/pacientes.ts new file mode 100644 index 0000000..3315be2 --- /dev/null +++ b/src/app/model/pacientes.ts @@ -0,0 +1,13 @@ +import { Usuarios } from "./usuarios"; + +export class Pacientes { + usuarios:Usuarios = new Usuarios; + id: number; + cedula: String; + nombre: String; + apellidos: String; + direccion: String; + telefono: String; + entidad: String; + paciente:Pacientes; + } diff --git a/src/app/model/servicios.ts b/src/app/model/servicios.ts new file mode 100644 index 0000000..0b56b22 --- /dev/null +++ b/src/app/model/servicios.ts @@ -0,0 +1,6 @@ +export class Servicios { + eid:number; + nombre:String; +servicio:Servicios; + +} diff --git a/src/app/model/usuarios.ts b/src/app/model/usuarios.ts new file mode 100644 index 0000000..8eb89bd --- /dev/null +++ b/src/app/model/usuarios.ts @@ -0,0 +1,9 @@ +export class Usuarios { + uid: number; + nombres: String; + apellidos: String; + cedula: String; + estado: String; + nusuario: String; + passwd: String; +} diff --git a/src/app/pages/componentes/citas/citas.component.html b/src/app/pages/componentes/citas/citas.component.html new file mode 100644 index 0000000..b8fad6c --- /dev/null +++ b/src/app/pages/componentes/citas/citas.component.html @@ -0,0 +1,80 @@ +
+
+
+
+

Pacientes

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
id + Cedula + + Nombres y Apellidos + + + Entidad +
{{idPaciente}}{{paciente?.paciente?.cedula}}{{paciente?.paciente?.nombre}} {{paciente?.paciente?.apellidos}}{{paciente?.paciente?.entidad}}
+ +
EstadofechanombresNumero Identificacionservicios
{{c.estado?.nombre }}{{c?.fecha | date:"yyyy-MM-dd"}} {{c.paciente?.nombre }} {{paciente?.apellidos}}{{c.paciente?.cedula}}{{c.servicio?.nombre}}
+ +
+
+
+ +
+ \ No newline at end of file diff --git a/src/app/pages/componentes/citas/citas.component.ts b/src/app/pages/componentes/citas/citas.component.ts new file mode 100644 index 0000000..4cd0b4b --- /dev/null +++ b/src/app/pages/componentes/citas/citas.component.ts @@ -0,0 +1,123 @@ + +import { Component,OnInit,Output,EventEmitter,Input } from '@angular/core'; + +import { FormBuilder, FormGroup } from '@angular/forms'; +import { ActivatedRoute, Params, Router } from '@angular/router'; +import { Pacientes } from 'app/model/pacientes'; +import { ServiciosService } from 'app/services/servicios.service'; +import { Citas } from 'app/model/citas'; +import { Servicios } from 'app/model/servicios'; + +import Swal from 'sweetalert2'; +import { Estados } from 'app/model/estados'; + + +@Component({ + selector: 'app-citas', + templateUrl: 'citas.component.html' +}) + +export class CitasComponent{ + idPaciente; + pacientes:Pacientes[]; + paciente:Pacientes; + pa:Pacientes; + servicio:Servicios[]; + citas:Citas[]; + cita:Citas; + query: ''; + estado:Estados; + + + filterpost:''; + p:number =1 ; + total:number=0; + tamano:number=8; + servi:Servicios; + @Input() idservicio:Servicios; + @Input() idrecibo:Pacientes; + + + + constructor(private route: ActivatedRoute,public servicioservice:ServiciosService,private router:Router, public serviciosservice: ServiciosService) + { } + + + + buscarIdPaciente(){ + this.idPaciente = this.route.snapshot.paramMap.get('id'); + this.servicioservice.buscarIdPaciente(this.idPaciente).subscribe( + dato=>{ + console.log(this.paciente=dato) + } + ) + console.log('hola5', this.pa=this.idPaciente); + console.log('hol6',this.paciente=this.pa) + + + } + + ngOnInit():void{ + this.buscarIdPaciente(); + this.listarCitas(); + + } + + seleccionCita(c:Citas){ + + + console.log('seleccionCita',this.cita=c); + + } + + + listarCitas(){ + + this.serviciosservice.listarCitas(this.p,this.tamano).subscribe( + (dato:any)=>{ + console.log(dato); + setTimeout(()=>{ + this.citas= dato.content + this.total=dato.totalElements + }) + + + }) + } + + + listarFiltro(){ + this.servicioservice.filtrarId(this.query).subscribe( + (dato:any)=> { + console.log('filtro',dato); + setTimeout(()=>{ + this.citas= dato.content + this.total=dato.totalElements + }) + + }) + + } + +OnSubmit():void{ + this.listarFiltro(); + +} + + /*irCita(c:any){ + console.log(this.cita=c); + }*/ + + + ngOnchanges():void{ + if(this.servicio){ + + } + else{ + this.servicio=null + } + } + + + +} \ No newline at end of file diff --git a/src/app/pages/componentes/citas/formulario-citas/formulario-citas.component.html b/src/app/pages/componentes/citas/formulario-citas/formulario-citas.component.html new file mode 100644 index 0000000..278bf89 --- /dev/null +++ b/src/app/pages/componentes/citas/formulario-citas/formulario-citas.component.html @@ -0,0 +1,77 @@ + + + +
+
+

Guardar Citas

+
+ + + +
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ +
+ +
+
+ +
+
+
+
+ +
+ + + + + \ No newline at end of file diff --git a/src/app/pages/componentes/citas/formulario-citas/formulario-citas.component.ts b/src/app/pages/componentes/citas/formulario-citas/formulario-citas.component.ts new file mode 100644 index 0000000..aedae4c --- /dev/null +++ b/src/app/pages/componentes/citas/formulario-citas/formulario-citas.component.ts @@ -0,0 +1,152 @@ +import {Component,OnInit,Output,EventEmitter,Input} from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import {ActivatedRoute, Router, RouterLink} from '@angular/router'; +import {Citas} from 'app/model/citas'; +import { Pacientes } from 'app/model/pacientes'; +import {Servicios} from 'app/model/servicios' +import { ServiciosService } from 'app/services/servicios.service'; +import Swal from 'sweetalert2'; +import { formatDate } from '@angular/common'; +import { Estados } from 'app/model/estados'; + +@Component({ + selector: 'app-formulario-citas', + templateUrl: 'formulario-citas.component.html' +}) +export class FormularioCitasComponent{ + formCitas: FormGroup; + idPaciente; + servicios:Servicios[]; + estados:Estados[]; + // servicio:Servicios; + p:number=1; + tamano:number=8; + total:number=0; + cita:Citas= new Citas; + paciente:Pacientes; + dateControl:''; + //s:Servicios; + @Input() pacienr:Pacientes; + @Input() servicir:Servicios; + @Input() citarecibo:Citas; + + + @Output() propagarCita= new EventEmitter(); + idPacienteUrl:any; + constructor(public servicioservice:ServiciosService,public router:Router,public route:ActivatedRoute,public fb:FormBuilder){ + this.idPacienteUrl = this.route.snapshot.paramMap.get('id'); + + + this.formCitas=this.fb.group({ + id:'', + servicio:'', + estado:'', + //estado:'', + //fecha:'', + + // id:'', + fecha:['', [ + Validators + .required, + // validates date format yyyy-mm-dd with regular expression + Validators.pattern(/^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$/) + ]] + + } + ); + //this.formCitas.get('servicio').contro valueChanges((value)=>console.log(value)) + + console.log('formulario',this.formCitas); + + } + guardarCitas(cita:any){ + console.log('guardarCitas',cita.value); + + cita.value.paciente + = {'id':this.idPacienteUrl}; + this.servicioservice.guardarCita(cita.value).subscribe(dato=>{ + console.log(dato); + + + Swal.fire(`Cita asignada con fechab ${cita.value.fecha} correctamente `) + this.formCitas.reset(); + this.cita=null; + this.irCitas(); + + + }) + } + + nuevoReset(){ + this.formCitas.reset(); + } + irCitas(){ + this.propagarCita.emit(this.cita); + } + + listServiciosp(){ + this.servicioservice.listserviciosp().subscribe(dato=> + { + console.log('servi123',this.servicios=dato) + }) + } + + listarEstados(){ + this.servicioservice.listarEstados(this.p,this.tamano).subscribe((dato:any)=>{ + console.log(dato); + setTimeout(()=>{ + this.estados= dato.content + this.total=dato.totalElements + }) + }) + } + + + + onSubmit():void{ + this.guardarCitas(this.formCitas); + } + comparaServicio(s1:Servicios,s2:Servicios){ + return s1== null || s2==null || s1==undefined || s2== undefined ?false : s1.eid === s2.eid ; + } + + ngOnInit(): void { + + this.listServiciosp(); + this.listarEstados(); + + + } + + + seleccionEstado(e1:Estados,e2:Estados){ + return e1==null || e2==null || e1== undefined || e2== undefined ?false: e1.id===e2.id + + } + + ngOnChanges():void{ + + if(this.citarecibo){ + this.formCitas.patchValue(this.citarecibo); + } + else this.cita=new Citas();{ + + } + + } + + + + + /* ngOnchanges():void{ + if(this.pacienr){ + } + else(this.pacienr=null) + } + ngOnchanges():void{ + if(this.servicio){ + } + else(this.servicio + =null) +}*/ +} diff --git a/src/app/pages/componentes/estados/estados.component.html b/src/app/pages/componentes/estados/estados.component.html new file mode 100644 index 0000000..14a2c02 --- /dev/null +++ b/src/app/pages/componentes/estados/estados.component.html @@ -0,0 +1,51 @@ +
+
+
+
+

Lista de Estados

+ +
+
+
+ + + + + + + + + + + + + + + + + +
+ id + + Nombres + +
{{es?.id}} {{es?.nombre}} + + +
+ +
+ + + +
+
+
+
+ + +
+ +
+
+ diff --git a/src/app/pages/componentes/estados/estados.component.ts b/src/app/pages/componentes/estados/estados.component.ts new file mode 100644 index 0000000..f2fff8f --- /dev/null +++ b/src/app/pages/componentes/estados/estados.component.ts @@ -0,0 +1,42 @@ +import { Component } from "@angular/core"; +import { ActivatedRoute, Route, Router, RouterLink } from "@angular/router"; +import { Estados } from "app/model/estados"; +import { ServiciosService } from "app/services/servicios.service"; + +@Component({ + selector: 'app-estados', + templateUrl: 'estados.component.html' +}) + + + + +export class EstadosComponent{ + + p:number=1; + total:number=0; + tamano:number=8; + estados:Estados[]; + estado:Estados; + constructor(public servicioservice:ServiciosService,public route:ActivatedRoute,public router:Router){} + + listarEstados(){ + this.servicioservice.listarEstados(this.p,this.tamano).subscribe((dato:any) =>{ + console.log(dato); + setTimeout(()=>{ + this.estados= dato.content + this.total=dato.totalElements + }) + }) + } + + ngOnInit(): void { + this.listarEstados(); + } + +selectEstado(es:Estados){ + console.log(this.estado=es); +} + + +} \ No newline at end of file diff --git a/src/app/pages/componentes/estados/formulario-estados/formulario-estados.component.html b/src/app/pages/componentes/estados/formulario-estados/formulario-estados.component.html new file mode 100644 index 0000000..3f3fce4 --- /dev/null +++ b/src/app/pages/componentes/estados/formulario-estados/formulario-estados.component.html @@ -0,0 +1,38 @@ +
+ +
+

Estado

+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/src/app/pages/componentes/estados/formulario-estados/formulario-estados.component.ts b/src/app/pages/componentes/estados/formulario-estados/formulario-estados.component.ts new file mode 100644 index 0000000..0beefb9 --- /dev/null +++ b/src/app/pages/componentes/estados/formulario-estados/formulario-estados.component.ts @@ -0,0 +1,65 @@ +import { ServiciosService } from "app/services/servicios.service"; +import {Component, Output,EventEmitter,Input} from '@angular/core'; +import {Router} from '@angular/router'; +import { FormBuilder, FormGroup } from "@angular/forms"; +import { Estados } from "app/model/estados"; +import Swal from "sweetalert2"; +import { Route } from "@angular/router"; + + +@Component({ +selector: 'app-formulario-estados', +templateUrl: 'formulario-estados.component.html' +}) + + + +export class FormularioEstadosComponent{ + + formEstado:FormGroup; + estado:Estados= new Estados; + @Output() propagares= new EventEmitter(); + @Input() estarecibo:Estados; + + constructor(public serviceservice:ServiciosService,public router:Router,public fb:FormBuilder){ + this.formEstado=fb.group({ + id:'', + nombre:'' + }) + } + + guardarEstado(estado:any){ + this.serviceservice.guardarEstado(estado.value).subscribe(dato=>{ + console.log(estado); + Swal.fire(`mensaje,${estado.value.nombre} correctamente`); + + this.formEstado.reset(); + this.estado.nombre=null; + this.eventoEstado(); + }) + } + + + eventoEstado(){ + this.propagares.emit(this.estado); + } + + onSumit():void{ + this.guardarEstado(this.formEstado); + } + + resetEstado(){ + this.formEstado.reset(); + } + + ngOnChanges(){ + if( this.estarecibo){ + this.formEstado.patchValue(this.estarecibo); + + } + else{ + this.estado = new Estados(); + } + } + +} \ No newline at end of file diff --git a/src/app/pages/componentes/pacientes/formulario-pacientes/formulario-pacientes.component.html b/src/app/pages/componentes/pacientes/formulario-pacientes/formulario-pacientes.component.html new file mode 100644 index 0000000..378cb4d --- /dev/null +++ b/src/app/pages/componentes/pacientes/formulario-pacientes/formulario-pacientes.component.html @@ -0,0 +1,61 @@ +
+ +
+

Guardar Paciente

+
+
+ +
+ +
+
+ +
+ + + +

{{pacirecibo?.nombre}}

+ + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ + +
+
+
+ +
+ + + + + + + diff --git a/src/app/pages/componentes/pacientes/formulario-pacientes/formulario-pacientes.component.ts b/src/app/pages/componentes/pacientes/formulario-pacientes/formulario-pacientes.component.ts new file mode 100644 index 0000000..1fb6588 --- /dev/null +++ b/src/app/pages/componentes/pacientes/formulario-pacientes/formulario-pacientes.component.ts @@ -0,0 +1,90 @@ +import {Component,OnInit,Output,EventEmitter,Input} from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import {Router} from '@angular/router'; +import {Pacientes} from 'app/model/pacientes'; +import { ServiciosService } from 'app/services/servicios.service'; +import Swal from 'sweetalert2'; + +@Component({ + selector: 'app-formulario-pacientes', + templateUrl: 'formulario-pacientes.component.html' +}) + +export class FormularioPacientesComponent{ + formCamilo:FormGroup; + @Output() propagar= new EventEmitter() ; + pacientes :Pacientes= new Pacientes(); + // @Output() mostrar= new EventEmitter() + @Input() pacirecibo:Pacientes; + constructor(public servicioservice:ServiciosService,public router:Router,public fb:FormBuilder){ + this.formCamilo = this.fb.group({ + id:'', + cedula:'', + nombre:'', + apellidos: '', + direccion: '', + telefono: '', + entidad: '' + }) + } + + ngOnInit(){ + + } + + + + + public guardarPaciente(paciente:any){ + + this.servicioservice.guardarPacientes(paciente.value).subscribe( + dato=>{ + console.log(dato); + Swal.fire(`paciente creado ${paciente.value.nombre} ${paciente.value.apellidos } `,'con exito'); + this.formCamilo.reset(); + this.pacientes.nombre=null; + this.irPaciente(); + } + ) + + + } + nuevoPaciente(){ + this.formCamilo.reset(); +} + + + irPaciente() { + this.propagar.emit(this.pacientes); + } + + + onSubmit():void{ + this.guardarPaciente(this.formCamilo); + + } + + +ngOnChanges(): void { + + if(this.pacirecibo){ +this.formCamilo.patchValue(this.pacirecibo) +} + else this.pacientes=new Pacientes();{ + + } + + } + + + + //Called before any other lifecycle hook. Use it to inject dependencies, but avoid any serious work here. + //Add '${implements OnChanges}' to the class. + +} + + + + + + diff --git a/src/app/pages/componentes/pacientes/pacientes.component.html b/src/app/pages/componentes/pacientes/pacientes.component.html new file mode 100644 index 0000000..c7309f2 --- /dev/null +++ b/src/app/pages/componentes/pacientes/pacientes.component.html @@ -0,0 +1,53 @@ +
+
+
+
+

Pacientes

+ +
+
+
+ + + + + + + + + + + + + + + + + + + +
+ Cedula + + Nombres y Apellidos + + + Entidad +
{{pa.cedula}}{{pa.nombre}} {{pa.apellidos}}{{pa.entidad}} +
+ +
+ + +
+
+ +
+
+
+
+
+ +
+ + diff --git a/src/app/pages/componentes/pacientes/pacientes.component.ts b/src/app/pages/componentes/pacientes/pacientes.component.ts new file mode 100644 index 0000000..e91a039 --- /dev/null +++ b/src/app/pages/componentes/pacientes/pacientes.component.ts @@ -0,0 +1,60 @@ + +import { Component,OnInit,Output,EventEmitter,Input } from '@angular/core'; +import { Pacientes } from 'app/model/pacientes'; +import { ActivatedRoute,Router } from '@angular/router'; +import { ServiciosService } from 'app/services/servicios.service'; + +@Component({ + selector: 'app-pacientes', + templateUrl: 'pacientes.component.html' +}) + +export class PacientesComponent{ + + id:any; + pacientes: Pacientes[]; + pacirecibo:Pacientes; + p:number=1; + tamano:number=8; + total:number=0; + @Output() enviar=new EventEmitter(); + pacien:Pacientes; + + + constructor( + public serviciosservice: ServiciosService, public route:ActivatedRoute, private router:Router ) {} + + ngOnInit(): void { + this.listarPacientes(); + } + + listarPacientes() { + this.serviciosservice + .listarPacientes(this.p,this.tamano) + .subscribe((dato:any)=>{ + console.log(dato); + setTimeout(()=>{ + this.pacientes= dato.content + this.total=dato.totalElements + }) + } ) + +} + +buscarIdPaciente(pa:Pacientes){ +console.log(this.pacien=pa); +} + + +citaPaciente(id:number){ + console.log('ivan',id); + this.router.navigate([`/citas/${id}`], { relativeTo: this.route }); + +} + +/* realiza el filtro falta desde listar +capturarString(filtro){ + listarPacientes(filtro) +}*/ + +} diff --git a/src/app/pages/componentes/servicios/formulario-servicios/formulario-servicios.component.html b/src/app/pages/componentes/servicios/formulario-servicios/formulario-servicios.component.html new file mode 100644 index 0000000..461b0ea --- /dev/null +++ b/src/app/pages/componentes/servicios/formulario-servicios/formulario-servicios.component.html @@ -0,0 +1,27 @@ +
+
+

Guardar Servicio

+
+
+
+
+
+
+ + + + + + +
+ +
+
+
+
+ +
+
+
+
+
diff --git a/src/app/pages/componentes/servicios/formulario-servicios/formulario-servicios.component.ts b/src/app/pages/componentes/servicios/formulario-servicios/formulario-servicios.component.ts new file mode 100644 index 0000000..6e55e33 --- /dev/null +++ b/src/app/pages/componentes/servicios/formulario-servicios/formulario-servicios.component.ts @@ -0,0 +1,67 @@ +import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { Router } from '@angular/router'; +import { Servicios } from 'app/model/servicios'; +import { ServiciosService } from 'app/services/servicios.service'; +import Swal from 'sweetalert2'; + +@Component({ + selector: 'app-formulario-servicios', + templateUrl: 'formulario-servicios.component.html' +}) + +export class FormularioServiciosComponent { + + formservicios:FormGroup; + + @Output() propagar = new EventEmitter(); + @Input() servirecibo:Servicios; + servicios: Servicios = new Servicios(); + // @Input() servirecibo:Servicios; + constructor(public servicioservice: ServiciosService, public route: Router,fb:FormBuilder) { + this.formservicios=fb.group({ + eid:['',[Validators.required,Validators.minLength(1)]], + nombre:['',[Validators.required,Validators.minLength(4)]] + + }) + + } + + + public guardarServicio(servicios:any) { + + + this.servicioservice.guardarServicios(servicios.value).subscribe(dato => { + console.log(this.servicios) + Swal.fire('Nuevo servicio', + `servicio ${servicios.value.nombre} creado con exito`, + 'success' + ); + this.formservicios.reset(); + this.servicios.nombre = null; + this.irServicio(); + + } + ) + + } + + public irServicio() { + this.propagar.emit(this.servicios); + } + + public onSumit(): void { + this.guardarServicio(this.formservicios); + } + + public ngOnChanges(): void { + if(this.servirecibo){ + this.formservicios.patchValue(this.servirecibo) + }else{ + this.servicios=new Servicios(); + } + + } + +} + diff --git a/src/app/pages/componentes/servicios/servicios.component.html b/src/app/pages/componentes/servicios/servicios.component.html new file mode 100644 index 0000000..262cf0c --- /dev/null +++ b/src/app/pages/componentes/servicios/servicios.component.html @@ -0,0 +1,53 @@ +
+
+ +
+
+

Servicios

+
+
+
+ + + + + + + + + + + + + + + +
+ Id + + Nombre +
+ {{s.eid}} + + {{s.nombre}} + +
+ + + + +
+ + + +
+
+
+
+ + + +
+ +
+
diff --git a/src/app/pages/componentes/servicios/servicios.component.ts b/src/app/pages/componentes/servicios/servicios.component.ts new file mode 100644 index 0000000..f4d4bab --- /dev/null +++ b/src/app/pages/componentes/servicios/servicios.component.ts @@ -0,0 +1,46 @@ +import { Component } from '@angular/core'; +import { Servicios } from 'app/model/servicios'; +import { ServiciosService } from 'app/services/servicios.service'; + +@Component({ + selector: 'app-servicios', + templateUrl: 'servicios.component.html' +}) + +export class ServiciosComponent { + servicios: Servicios[]; + collection = []; + p:number =1 ; + total:number=0; + tamano:number=8; + servi:Servicios; + constructor(public serviciosservice: ServiciosService) { + this.listarServicios(); + + } + + ngOnInit(): void { + this.listarServicios(); + } + + listarServicios() { + console.log(this.p, this.tamano); + this.serviciosservice.listarServicios(this.p,this.tamano) + .subscribe((dato:any) => { + console.log(dato); + setTimeout(()=>{ + this.servicios = dato.content + this.total=dato.totalElements + }) + + }); + } + +buscarServicio(s:Servicios){ + console.log( this.servi=s); + +} + + + +} diff --git a/src/app/pipe/filtercitas.pipe.spec.ts b/src/app/pipe/filtercitas.pipe.spec.ts new file mode 100644 index 0000000..3268748 --- /dev/null +++ b/src/app/pipe/filtercitas.pipe.spec.ts @@ -0,0 +1,8 @@ +import { FiltercitasPipe } from './filtercitas.pipe'; + +describe('FiltercitasPipe', () => { + it('create an instance', () => { + const pipe = new FiltercitasPipe(); + expect(pipe).toBeTruthy(); + }); +}); diff --git a/src/app/pipe/filtercitas.pipe.ts b/src/app/pipe/filtercitas.pipe.ts new file mode 100644 index 0000000..7943e1b --- /dev/null +++ b/src/app/pipe/filtercitas.pipe.ts @@ -0,0 +1,12 @@ +import { Pipe, PipeTransform } from '@angular/core'; +import { Citas } from 'app/model/citas'; +import { Pacientes } from 'app/model/pacientes'; + +@Pipe({ + name: 'filtercitas' +}) +export class FiltercitasPipe implements PipeTransform { + + transform(value: any[], query: string) { + } +} \ No newline at end of file diff --git a/src/app/services/servicios.service.ts b/src/app/services/servicios.service.ts new file mode 100644 index 0000000..d34066c --- /dev/null +++ b/src/app/services/servicios.service.ts @@ -0,0 +1,124 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from '@angular/common/http'; +import { Servicios } from '../model/servicios'; +import { catchError, identity, map, Observable, throwError } from 'rxjs'; +import { Pacientes } from '../model/pacientes'; +import { Citas } from '../model/citas'; +import Swal from 'sweetalert2'; +import { Estados } from '../model/estados'; +@Injectable({ + providedIn: 'root' +}) +export class ServiciosService { +URL_BACKEND='http://localhost:8080/'; +servicios:Servicios[]; +pacientes:Pacientes[]; +citas:Citas[]; +eid:number; +nombre:String; +estados:Estados; + + constructor(public http: HttpClient) { } + + listarEstados(pagina:number,size:number){ + return this.http.get(this.URL_BACKEND+`api/estados/consultar/${(pagina?pagina:1)-1},${size}`); + + } + listarServicios(pagina:number ,size:number){ + return this.http.get(this.URL_BACKEND+`api/servicios/consultar/${(pagina?pagina:1)-1},${size}`); + } + + listarPacientes(pagina:number,size:number){ + return this.http.get(this.URL_BACKEND+`api/pacientes/consultar/${(pagina?pagina:1)-1},${size}`); + } + listarCitas(pagina:number,size:number){ + return this.http.get(this.URL_BACKEND+ `api/citas/consultar/${(pagina?pagina:1)-1},${size}`); + + } + filtrarId(id:any){ + return this.http.get(this.URL_BACKEND+`api/citas/listarid?id=${id}&pagina=0&size=8`); + } + + guardarServicios(servicios:Servicios) : Observable{ + return this.http.post(this.URL_BACKEND+'api/servicios/create',servicios).pipe( + catchError(e =>{ + console.error(e.error.mensaje); + Swal.fire('error',e.error.mensaje,'error'); + return throwError(e); + }) + ); + } + guardarEstado(estado:Estados){ + return this.http.post(this.URL_BACKEND+'api/estados/guardar',estado).pipe( + catchError(e=>{ + console.error(e.error.mensaje) + Swal.fire('error',e.error.mensaje,'error') + return throwError(e); + }) + ) + } + guardarCita(cita:Citas){ + + return this.http.post(this.URL_BACKEND+'api/citas/guardar',cita).pipe( + catchError(e=>{ + console.error(e.error.mensaje) + Swal.fire(`error no se completo la operacion ${e.error.mensaje}`) + return throwError(e); + + }) + ) + + } + listserviciosp(){ +return this.http.get(this.URL_BACKEND+'api/servicios/consultasp') + + } + guardarPacientes(pacientes:Pacientes){ + return this.http.post(this.URL_BACKEND+'api/pacientes/guardar',pacientes).pipe( + catchError(e=>{ + console.error(e.error.mensaje) + Swal.fire('error no se completo la operacions',e.error.mensaje,'error') + return throwError(e) + }) + ) + } + + + + buscarIdPaciente(id:number) : Observable{ + return this.http.get(this.URL_BACKEND+ `api/pacientes/consultarid/${id}`).pipe( + catchError(e =>{ + console.error(e.error.mensaje); + Swal.fire('error no se completo la operacions',e.error.mensaje,'error'); + return throwError(e); + + }) + ) + } + + actualizarServicio(eid:number,servicios:Servicios): Observable{ + return this.http.put(this.URL_BACKEND+ `servicios/update/${servicios.eid}`,servicios) + } + + buscarNombre(nombre:String) : Observable{ + return this.http.get(this.URL_BACKEND+ `api/servicios/listarnombre?nombre=${nombre}`); + } + + buscarid(eid:number) : Observable{ + return this.http.get(this.URL_BACKEND+ `api/servicios/listareid/${eid}`).pipe( + catchError(e =>{ + console.error(e.error.mensaje); + Swal.fire('error no se completo la operacions',e.error.mensaje,'error'); + return throwError(e); + + }) + ) + } + + eliminarServicio(eid:number){ + return this.http.delete(this.URL_BACKEND+ `api/servicios/delete/${eid}`); + } + + + +} diff --git a/src/app/sidebar/sidebar.component.ts b/src/app/sidebar/sidebar.component.ts index 3c327d3..29e7e5a 100644 --- a/src/app/sidebar/sidebar.component.ts +++ b/src/app/sidebar/sidebar.component.ts @@ -10,7 +10,10 @@ export interface RouteInfo { export const ROUTES: RouteInfo[] = [ { path: '/dashboard', title: 'Dashboard', icon:'nc-bank', class: '' }, - { path: '/icons', title: 'Icons', icon:'nc-diamond', class: '' }, + { path: '/pacientes', title: 'Pacientes', icon:'nc-single-02', class: '' }, + { path: '/servicios', title: 'Servicios', icon:'nc-globe', class: '' }, + { path: '/citas', title: 'Citas', icon:'nc-paper', class: '' }, + { path: '/estados', title: 'Estados', icon:'nc-diamond', class: '' }, { path: '/maps', title: 'Maps', icon:'nc-pin-3', class: '' }, { path: '/notifications', title: 'Notifications', icon:'nc-bell-55', class: '' }, { path: '/user', title: 'User Profile', icon:'nc-single-02', class: '' }, diff --git a/src/tsconfig.app.json b/src/tsconfig.app.json index cf49d7f..50be499 100644 --- a/src/tsconfig.app.json +++ b/src/tsconfig.app.json @@ -5,8 +5,12 @@ "baseUrl": "", "types": [] }, + + + "exclude": [ "test.ts", + "**/*.spec.ts" ] }