Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { TurnoService } from './../../../../services/turnos/turno.service';
import { Auth } from '@andes/auth';
import { forkJoin } from 'rxjs';
import { PacienteService } from '../../../../core/mpi/services/paciente.service';
import { ConstantesService } from './../../../../services/constantes.service';

@Component({
selector: 'suspender-agenda',
Expand All @@ -24,11 +25,18 @@ export class SuspenderAgendaComponent implements OnInit {
@Output() cerrarSidebar = new EventEmitter<any>();


constructor(public plex: Plex, public auth: Auth, public serviceAgenda: AgendaService, public smsService: SmsService, public turnosService: TurnoService, public pacienteService: PacienteService) { }
constructor(
public plex: Plex,
public auth: Auth,
public serviceAgenda: AgendaService,
public smsService: SmsService,
public turnosService: TurnoService,
public pacienteService: PacienteService,
public constantesService: ConstantesService) { }

public mostrarHeaderCompleto = false; // Pongo false por defecto, estipo que arranca así. [Agregado para AOT]
public motivoSuspensionSelect = { select: null };
public motivoSuspension: { id: number; nombre: string }[];
public motivoSuspension: Array<{ key: string; nombre: string }> = [];
public estadosAgenda = EstadosAgenda;
public ag;
public showData = false;
Expand All @@ -42,20 +50,10 @@ export class SuspenderAgendaComponent implements OnInit {
*/
public turnos = [];
ngOnInit() {
this.motivoSuspension = [
{
id: 1,
nombre: 'edilicia'
},
{
id: 2,
nombre: 'profesional'
},
{
id: 3,
nombre: 'organizacion'
}];
this.motivoSuspensionSelect.select = this.motivoSuspension[1];
this.constantesService.search({ source: 'citas:motivos:suspension' }).subscribe((constantes) => {
this.motivoSuspension = constantes;
this.motivoSuspensionSelect.select = this.motivoSuspension[1] || this.motivoSuspension[0] || null;
});
if (this.agenda.estado === 'suspendida') {
let sinTelefono = [];
this.agenda.bloques.forEach(bloque => {
Expand Down Expand Up @@ -114,7 +112,7 @@ export class SuspenderAgendaComponent implements OnInit {
suspenderAgenda() {
this.showConfirmar = false;
this.showData = true;
if (this.motivoSuspensionSelect.select.nombre === null) {
if (!this.motivoSuspensionSelect.select?.nombre) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@
<form #formulario="ngForm">
<plex-title titulo="Suspender Agenda" size="md"></plex-title>
<plex-select [(ngModel)]="motivoSuspensionSelect.select" name="motivoSuspension" [data]="motivoSuspension"
label="Motivos de Suspensión" placeholder="Seleccione un motivo de suspensión" [required]="true">
label="Motivos de Suspensión" placeholder="Seleccione un motivo de suspensión" [required]="true"
idField="key" labelField="nombre">
</plex-select>
<div class="mt-3 float-right">
<plex-button type="danger" label="Cancelar" (click)="cancelar()">
Expand All @@ -346,4 +347,4 @@
</plex-button>
</div>
</form>
</ng-container>
</ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { TurnoService } from './../../../../services/turnos/turno.service';
import { SmsService } from './../../../../services/turnos/sms.service';
import { Auth } from '@andes/auth';
import { mergeMap } from 'rxjs/operators';
import { ConstantesService } from './../../../../services/constantes.service';

@Component({
selector: 'suspender-turno',
Expand All @@ -31,7 +32,7 @@ export class SuspenderTurnoComponent implements OnInit {

public reasignar: any = {};

public motivoSuspension: any[];
public motivoSuspension: Array<{ key: string; nombre: string }> = [];
public motivoSuspensionSelect = { select: null };
public seleccionadosSMS = [];
public avisoSuspension = 'no enviado';
Expand All @@ -43,7 +44,8 @@ export class SuspenderTurnoComponent implements OnInit {
public listaEsperaService: ListaEsperaService,
public serviceAgenda: AgendaService,
public smsService: SmsService,
public turnosService: TurnoService
public turnosService: TurnoService,
public constantesService: ConstantesService
) { }

ngOnInit() {
Expand All @@ -53,22 +55,10 @@ export class SuspenderTurnoComponent implements OnInit {
}

this.turnos = this.turnosSeleccionados;

this.motivoSuspension = [
{
id: 1,
nombre: 'edilicia'
}, {
id: 2,
nombre: 'profesional'
},
{
id: 3,
nombre: 'organizacion'
}
];

this.motivoSuspensionSelect.select = this.motivoSuspension[1];
this.constantesService.search({ source: 'citas:motivos:suspension' }).subscribe((constantes) => {
this.motivoSuspension = constantes;
this.motivoSuspensionSelect.select = this.motivoSuspension[1] || this.motivoSuspension[0] || null;
});
}


Expand Down Expand Up @@ -97,7 +87,7 @@ export class SuspenderTurnoComponent implements OnInit {

suspenderTurno() {

if (this.motivoSuspensionSelect.select.nombre === null) {
if (!this.motivoSuspensionSelect.select?.nombre) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
<div class="row">
<div class="col-12">
<plex-select [(ngModel)]="motivoSuspensionSelect.select" name="motivoSuspension" [data]="motivoSuspension"
label="Motivo de Suspensión" placeholder="Seleccione un motivo de suspensión">
label="Motivo de Suspensión" placeholder="Seleccione un motivo de suspensión"
idField="key" labelField="nombre">
</plex-select>
</div>
</div>
Expand All @@ -49,4 +50,4 @@
</div>
</div>
</div>
</ng-container>
</ng-container>
5 changes: 1 addition & 4 deletions src/app/interfaces/turnos/ITurno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ export interface ITurno {
nroCarpeta: string;
}];
nota: string;
motivoSuspension: {
type: string;
enum: ['edilicia', 'profesional', 'organizacion', 'agendaSuspendida'];
};
motivoSuspension: string;
avisoSuspension: {
type: string;
enum: ['pendiente', 'no enviado', 'enviado', 'fallido'];
Expand Down
Loading