feat: Reportes, chat de discusión y mejoras de navegación
- Tab "Reportados" en Contratos (cliente) y tab "Reportadas" en Postulaciones (proveedor) con skeleton loading e ionViewWillEnter
- Modal de chat para discusión de reportes: burbujas por rol (propio/otro/moderador), skeleton, input con cámara y envío
- Endpoints GET/POST contracts/reports/{id}/comments en ichamba.service
- userId guardado en AuthService desde auth/user para identificar mensajes propios
- Botón "Postularse" corregido con slot=end en ion-item
- Todas las secciones de tabs migradas de ngOnInit a ionViewWillEnter + ChangeDetectorRef.detectChanges()
- Android navigation bar reactiva al tema del sistema vía values/values-night styles.xml
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, ChangeDetectorRef } from '@angular/core';
|
||||
import { ModalController, MenuController, NavController } from '@ionic/angular';
|
||||
import { EventService } from '../../../services/event.service';
|
||||
import { EnvService } from 'src/app/services/env.service';
|
||||
@@ -14,11 +14,12 @@ import { AlertService } from 'src/app/services/alert.service';
|
||||
styleUrls: ['./pending.page.scss'],
|
||||
standalone: false
|
||||
})
|
||||
export class PendingPage implements OnInit {
|
||||
export class PendingPage {
|
||||
|
||||
pcontracts: any[] = [];
|
||||
pcontracts_dates: any[] = [];
|
||||
lang: boolean = false;
|
||||
loading = true;
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
@@ -31,32 +32,29 @@ export class PendingPage implements OnInit {
|
||||
private translateService: TranslateService,
|
||||
private languageService: LanguageService,
|
||||
private env: EnvService,
|
||||
private cdr: ChangeDetectorRef,
|
||||
) {
|
||||
this.events.subscribe('refreshpcontracts', (data) => {
|
||||
this.getpcontracts();
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
ionViewWillEnter() {
|
||||
this.lang = this.languageService.getDefaultLanguage() === 'es';
|
||||
this.loading = true;
|
||||
this.getpcontracts();
|
||||
if (this.languageService.getDefaultLanguage() == 'es') {
|
||||
this.lang = true;
|
||||
} else {
|
||||
this.lang = false
|
||||
}
|
||||
}
|
||||
|
||||
refresh (event: any) {
|
||||
refresh(event: any) {
|
||||
this.ichambaService.getPendingcontracts().subscribe(
|
||||
data => {
|
||||
this.pcontracts = data;
|
||||
this.pcontracts_dates = [];
|
||||
for (var i of this.pcontracts) {
|
||||
if (this.languageService.getDefaultLanguage() == 'es') {
|
||||
this.pcontracts_dates.push(new Date((new Date(i.date).toLocaleString('en-US') + ' UTC').replace("," ,"")).toLocaleDateString('es-US', { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute:'numeric', timeZoneName: 'long'}));
|
||||
} else {
|
||||
this.pcontracts_dates.push(new Date((new Date(i.date).toLocaleString('en-US') + ' UTC').replace("," ,"")).toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute:'numeric', timeZoneName: 'long'}));
|
||||
}
|
||||
const locale = this.lang ? 'es-US' : 'en-US';
|
||||
this.pcontracts_dates.push(new Date((new Date(i.date).toLocaleString('en-US') + ' UTC').replace(',', '')).toLocaleDateString(locale, { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric', timeZoneName: 'long' }));
|
||||
}
|
||||
this.cdr.detectChanges();
|
||||
event.target.complete();
|
||||
}, error => {
|
||||
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']);
|
||||
@@ -68,14 +66,15 @@ export class PendingPage implements OnInit {
|
||||
this.ichambaService.getPendingcontracts().subscribe(
|
||||
data => {
|
||||
this.pcontracts = data;
|
||||
this.pcontracts_dates = [];
|
||||
for (var i of this.pcontracts) {
|
||||
if (this.languageService.getDefaultLanguage() == 'es') {
|
||||
this.pcontracts_dates.push(new Date((new Date(i.date).toLocaleString('en-US') + ' UTC').replace("," ,"")).toLocaleDateString('es-US', { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute:'numeric', timeZoneName: 'long'}));
|
||||
} else {
|
||||
this.pcontracts_dates.push(new Date((new Date(i.date).toLocaleString('en-US') + ' UTC').replace("," ,"")).toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute:'numeric', timeZoneName: 'long'}));
|
||||
}
|
||||
const locale = this.lang ? 'es-US' : 'en-US';
|
||||
this.pcontracts_dates.push(new Date((new Date(i.date).toLocaleString('en-US') + ' UTC').replace(',', '')).toLocaleDateString(locale, { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric', timeZoneName: 'long' }));
|
||||
}
|
||||
this.loading = false;
|
||||
this.cdr.detectChanges();
|
||||
}, error => {
|
||||
this.loading = false;
|
||||
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user