Compare commits

...

7 Commits

Author SHA1 Message Date
aa8b0061c9 feat: Actualización general de la aplicación
- Contratos, tarjetas, postulaciones, categorías y reportes
- Servicios: auth, ichamba, env, language, firebase, interceptor
- Guards, modelos, componentes y páginas de verificación
- Configuración: angular.json, tsconfig, polyfills, environments
- Capacitor: capacitor.config.json y android settings

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-17 08:18:40 -06:00
db0d0001fa feat: Side menu dinámico, login social y traducciones hero
- app.component: menú lateral con roles de usuario, ChangeDetectorRef
  para re-render tras login, integración OneSignal al iniciar sesión
- auth/login: botones Google y Apple con estilos, navegación corregida
- auth/register y forgot: mejoras de UX y navegación
- landing: sombra en botones del footer
- i18n: claves hero (select, bank, bank_account, fee, required) en es/en

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-17 08:18:12 -06:00
0efe318db3 feat: Mejoras en formulario hero, estilos globales y OneSignal
- Formulario hero: validación por campo con estado touched/submitted,
  mensajes de error inline, máscara de moneda en cuota, autocomplete
  flotante para dirección y categorías con clearInput, chips para
  categorías y palabras clave, campos banco/CLABE/RFC
- Estilos globales: border-radius y sombra en ion-button, borde para
  botones light sobre fondo claro, sin borde en toolbars de color
- OneSignal: reescritura del servicio con login/logout, addTag y
  routing por título de notificación usando NgZone
- FAQ: color primary en acordeón activo/desplegado

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 21:23:13 -06:00
CarlosTorres
9f2a0d62e0 Fix formulario de postulación y configuración de producción
- Actualizar API_URL a jobhero-api.consultoria-as.com
- Arreglar autocomplete de dirección para sincronizar con GPS
- Corregir número interior para que sea editable y no se autollene incorrectamente
- Cambiar ionChange a ionInput para lista de sugerencias
- Agregar configuración de firma para APK release

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 08:59:38 +00:00
CarlosTorres
22e4585bb9 feat: Implementar ion-chips, bypass de pago y mejoras UI
- Implementar ion-chips para categorías y keywords en hero page
- Agregar bypass de pago en hire page para pruebas
- Mover progress bar en dashboard
- Corregir shared-components module (remover AccordionComponent eliminado)
- Corregir eventos Ionic (ionInput/ionChange)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 23:48:16 +00:00
4afaf69d10 Merge pull request 'WIP - Agregar barra de progreso para los contratos pendientes y encabezados' (#2) from dev_alex into main 2026-01-27 15:26:33 -08:00
68673baf99 Merge pull request 'WIP - Actualizacion de acordeon en FAQ' (#1) from dev_alex into main 2026-01-27 14:36:16 -08:00
86 changed files with 14300 additions and 10085 deletions

View File

@@ -16,8 +16,17 @@ android {
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~' ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
} }
} }
signingConfigs {
release {
storeFile file('../../jobhero-release.keystore')
storePassword 'JobHero2024!'
keyAlias 'jobhero'
keyPassword 'JobHero2024!'
}
}
buildTypes { buildTypes {
release { release {
signingConfig signingConfigs.release
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }

View File

@@ -9,7 +9,6 @@ android {
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle" apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies { dependencies {
implementation project(':capacitor-community-facebook-login')
implementation project(':capacitor-community-http') implementation project(':capacitor-community-http')
implementation project(':capacitor-app') implementation project(':capacitor-app')
implementation project(':capacitor-browser') implementation project(':capacitor-browser')
@@ -21,9 +20,7 @@ dependencies {
implementation project(':capacitor-preferences') implementation project(':capacitor-preferences')
implementation project(':capacitor-splash-screen') implementation project(':capacitor-splash-screen')
implementation project(':capacitor-status-bar') implementation project(':capacitor-status-bar')
implementation project(':codetrix-studio-capacitor-google-auth') implementation "com.onesignal:OneSignal:5.9.4"
implementation "com.onesignal:OneSignal:5.1.38"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10"
} }
apply from: "../../node_modules/onesignal-cordova-plugin/build-extras-onesignal.gradle" apply from: "../../node_modules/onesignal-cordova-plugin/build-extras-onesignal.gradle"

View File

@@ -2,9 +2,6 @@
include ':capacitor-android' include ':capacitor-android'
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor') project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
include ':capacitor-community-facebook-login'
project(':capacitor-community-facebook-login').projectDir = new File('../node_modules/@capacitor-community/facebook-login/android')
include ':capacitor-community-http' include ':capacitor-community-http'
project(':capacitor-community-http').projectDir = new File('../node_modules/@capacitor-community/http/android') project(':capacitor-community-http').projectDir = new File('../node_modules/@capacitor-community/http/android')
@@ -37,6 +34,3 @@ project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capa
include ':capacitor-status-bar' include ':capacitor-status-bar'
project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android') project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android')
include ':codetrix-studio-capacitor-google-auth'
project(':codetrix-studio-capacitor-google-auth').projectDir = new File('../node_modules/@codetrix-studio/capacitor-google-auth/android')

View File

@@ -177,7 +177,8 @@
} }
}, },
"cli": { "cli": {
"defaultCollection": "@ionic/angular-toolkit" "defaultCollection": "@ionic/angular-toolkit",
"analytics": false
}, },
"schematics": { "schematics": {
"@ionic/angular-toolkit:component": { "@ionic/angular-toolkit:component": {

1
capacitor.config.json Normal file
View File

@@ -0,0 +1 @@
{}

22092
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -12,15 +12,14 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "~18.2.14", "@angular/animations": "~22.0.1",
"@angular/common": "~18.2.14", "@angular/common": "~22.0.1",
"@angular/compiler": "~18.2.14", "@angular/compiler": "~22.0.1",
"@angular/core": "~18.2.14", "@angular/core": "~22.0.1",
"@angular/forms": "~18.2.14", "@angular/forms": "~22.0.1",
"@angular/platform-browser": "~18.2.14", "@angular/platform-browser": "~22.0.1",
"@angular/platform-browser-dynamic": "~18.2.14", "@angular/platform-browser-dynamic": "~22.0.1",
"@angular/router": "~18.2.14", "@angular/router": "~22.0.1",
"@capacitor-community/facebook-login": "^7.0.1",
"@capacitor-community/http": "^1.4.1", "@capacitor-community/http": "^1.4.1",
"@capacitor/android": "^6.0.0", "@capacitor/android": "^6.0.0",
"@capacitor/app": "^6.0.0", "@capacitor/app": "^6.0.0",
@@ -34,40 +33,40 @@
"@capacitor/preferences": "^6.0.0", "@capacitor/preferences": "^6.0.0",
"@capacitor/splash-screen": "^6.0.0", "@capacitor/splash-screen": "^6.0.0",
"@capacitor/status-bar": "^6.0.0", "@capacitor/status-bar": "^6.0.0",
"@codetrix-studio/capacitor-google-auth": "^3.4.0-rc.4", "@ionic/angular": "^8.8.10",
"@ionic/angular": "^8.7.17",
"@ngx-translate/core": "~14.0.0", "@ngx-translate/core": "~14.0.0",
"@ngx-translate/http-loader": "~7.0.0", "@ngx-translate/http-loader": "~7.0.0",
"onesignal-cordova-plugin": "^5.2.19", "firebase": "^12.14.0",
"onesignal-cordova-plugin": "^5.3.12",
"rxjs": "~7.8.1", "rxjs": "~7.8.1",
"swiper": "^11.2.10", "swiper": "^11.2.10",
"tslib": "^2.6.0", "tslib": "^2.6.0",
"zone.js": "~0.14.10" "zone.js": "~0.15.0"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "~18.2.21", "@angular-devkit/build-angular": "~22.0.1",
"@angular-eslint/builder": "^21.1.0", "@angular-eslint/builder": "^22.0.0",
"@angular-eslint/eslint-plugin": "^21.1.0", "@angular-eslint/eslint-plugin": "^22.0.0",
"@angular-eslint/eslint-plugin-template": "^21.1.0", "@angular-eslint/eslint-plugin-template": "^22.0.0",
"@angular-eslint/schematics": "^21.1.0", "@angular-eslint/schematics": "^22.0.0",
"@angular-eslint/template-parser": "^21.1.0", "@angular-eslint/template-parser": "^22.0.0",
"@angular/cli": "~18.2.21", "@angular/cli": "~22.0.1",
"@angular/compiler-cli": "~18.2.14", "@angular/compiler-cli": "~22.0.1",
"@angular/language-service": "~18.2.14", "@angular/language-service": "~22.0.1",
"@capacitor/cli": "5.2.1", "@capacitor/cli": "5.2.1",
"@ionic/angular-toolkit": "^12.3.0", "@ionic/angular-toolkit": "^12.3.0",
"@types/jasmine": "~4.3.0", "@types/jasmine": "~4.3.0",
"@types/node": "~18.18.0", "@types/node": "^20.0.0",
"@typescript-eslint/eslint-plugin": "^8.53.0", "@typescript-eslint/eslint-plugin": "^8.61.0",
"@typescript-eslint/parser": "^8.53.0", "@typescript-eslint/parser": "^8.61.0",
"eslint": "^8.57.1", "eslint": "^10.0.0",
"jasmine-core": "~4.6.0", "jasmine-core": "~4.6.0",
"karma": "~6.4.0", "karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0", "karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0", "karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0", "karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0", "karma-jasmine-html-reporter": "~2.0.0",
"typescript": "~5.4.5" "typescript": "~6.0.3"
}, },
"description": "An Ionic project" "description": "An Ionic project"
} }

View File

@@ -8,12 +8,46 @@
</ion-header> </ion-header>
<ion-content> <ion-content>
<ion-list> <ion-list>
<ion-menu-toggle auto-hide="false" *ngFor="let p of appPages"> <ion-menu-toggle auto-hide="false" [class.ion-hide]="userRole === 0">
<ion-item [routerDirection]="'root'" [routerLink]="[p.url]"> <ion-item [routerDirection]="'root'" [routerLink]="['/dashboard']">
<ion-icon slot="start" [name]="p.icon"></ion-icon> <ion-icon slot="start" name="home"></ion-icon>
<ion-label> <ion-label>{{'menu.home' | translate}}</ion-label>
{{p.title}} </ion-item>
</ion-label> </ion-menu-toggle>
<ion-menu-toggle auto-hide="false" [class.ion-hide]="userRole === 0">
<ion-item [routerDirection]="'root'" [routerLink]="['/cards']">
<ion-icon slot="start" name="card"></ion-icon>
<ion-label>{{'menu.cards' | translate}}</ion-label>
</ion-item>
</ion-menu-toggle>
<ion-menu-toggle auto-hide="false" [class.ion-hide]="userRole < 2">
<ion-item [routerDirection]="'root'" [routerLink]="['/postulations']">
<ion-icon slot="start" name="hammer"></ion-icon>
<ion-label>{{'menu.postulations' | translate}}</ion-label>
</ion-item>
</ion-menu-toggle>
<ion-menu-toggle auto-hide="false" [class.ion-hide]="userRole === 0">
<ion-item [routerDirection]="'root'" [routerLink]="['/contracts']">
<ion-icon slot="start" name="file-tray-full"></ion-icon>
<ion-label>{{'menu.contracts' | translate}}</ion-label>
</ion-item>
</ion-menu-toggle>
<ion-menu-toggle auto-hide="false" [class.ion-hide]="userRole === 0">
<ion-item [routerDirection]="'root'" [routerLink]="['/faq']">
<ion-icon slot="start" name="information-circle"></ion-icon>
<ion-label>{{'menu.faq' | translate}}</ion-label>
</ion-item>
</ion-menu-toggle>
<ion-menu-toggle auto-hide="false" [class.ion-hide]="userRole < 2">
<ion-item [routerDirection]="'root'" [routerLink]="['/start']">
<ion-icon slot="start" name="send"></ion-icon>
<ion-label>{{'menu.start' | translate}}</ion-label>
</ion-item>
</ion-menu-toggle>
<ion-menu-toggle auto-hide="false" [class.ion-hide]="userRole !== 1">
<ion-item [routerDirection]="'root'" [routerLink]="['/hero']">
<ion-icon slot="start" name="ribbon"></ion-icon>
<ion-label>{{'menu.hero' | translate}}</ion-label>
</ion-item> </ion-item>
</ion-menu-toggle> </ion-menu-toggle>
<ion-item (click)="logout()"> <ion-item (click)="logout()">

View File

@@ -1,4 +1,4 @@
import { Component } from '@angular/core'; import { Component, OnInit, ChangeDetectorRef } from '@angular/core';
import { Platform, NavController, LoadingController } from '@ionic/angular'; import { Platform, NavController, LoadingController } from '@ionic/angular';
import { EventService } from './services/event.service'; import { EventService } from './services/event.service';
import { StatusBar, Style } from '@capacitor/status-bar'; import { StatusBar, Style } from '@capacitor/status-bar';
@@ -13,17 +13,17 @@ import { OneSignalService } from './services/onesignal.service';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
templateUrl: 'app.component.html' templateUrl: 'app.component.html',
standalone: false
}) })
export class AppComponent { export class AppComponent implements OnInit {
private loading: any; private loading: any;
userRole: number = 0;
public appPages: any[] = [];
constructor( constructor(
private platform: Platform, private platform: Platform,
private authService: AuthService, public authService: AuthService,
private languageService: LanguageService, private languageService: LanguageService,
private translateService: TranslateService, private translateService: TranslateService,
private navCtrl: NavController, private navCtrl: NavController,
@@ -31,75 +31,20 @@ export class AppComponent {
private alertService: AlertService, private alertService: AlertService,
private loadingCtrl: LoadingController, private loadingCtrl: LoadingController,
private oneSignalService: OneSignalService, private oneSignalService: OneSignalService,
private cdr: ChangeDetectorRef,
) { ) {
this.initializeApp(); this.initializeApp();
this.events.subscribe('set_role', role => { this.events.subscribe('set_role', role => {
// Set OneSignal user tags when role is set (user logged in) this.userRole = role ?? 0;
this.cdr.detectChanges();
this.setupOneSignalUser(role); this.setupOneSignalUser(role);
if (role >= 2){
this.appPages = [
{
title: this.translateService.instant('menu.home'),
url: '/dashboard',
icon: 'home'
},
{
title: this.translateService.instant('menu.cards'),
url: '/cards',
icon: 'card'
},
{
title: this.translateService.instant('menu.postulations'),
url: '/postulations',
icon: 'hammer'
},
{
title: this.translateService.instant('menu.contracts'),
url: '/contracts',
icon: 'filing'
},
{
title: this.translateService.instant('menu.faq'),
url: '/faq',
icon: 'information-circle'
},
{
title: this.translateService.instant('menu.start'),
url: '/start',
icon: 'send'
}
];
} else {
this.appPages = [
{
title: this.translateService.instant('menu.home'),
url: '/dashboard',
icon: 'home'
},
{
title: this.translateService.instant('menu.cards'),
url: '/cards',
icon: 'card'
},
{
title: this.translateService.instant('menu.contracts'),
url: '/contracts',
icon: 'filing'
},
{
title: this.translateService.instant('menu.faq'),
url: '/faq',
icon: 'information-circle'
},
{
title: this.translateService.instant('menu.hero'),
url: '/hero',
icon: 'ribbon'
}
];
}
}); });
} }
ngOnInit() {
this.userRole = this.authService.userRole;
}
async initializeApp() { async initializeApp() {
await this.platform.ready(); await this.platform.ready();
@@ -114,7 +59,6 @@ export class AppComponent {
} }
this.languageService.getDefaultLanguage(); this.languageService.getDefaultLanguage();
this.authService.getToken();
} }
private async setupOneSignalUser(role: number) { private async setupOneSignalUser(role: number) {

View File

@@ -1,4 +1,5 @@
import { NgModule } from '@angular/core'; import { NgModule, APP_INITIALIZER } from '@angular/core';
import { AuthService } from './services/auth.service';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router'; import { RouteReuseStrategy } from '@angular/router';
@@ -6,7 +7,8 @@ import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { HttpClient, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import { HttpClient, provideHttpClient, withInterceptorsFromDi, HTTP_INTERCEPTORS } from '@angular/common/http';
import { AuthInterceptorService } from './services/auth-interceptor.service';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { TranslateHttpLoader } from '@ngx-translate/http-loader';
@@ -16,6 +18,10 @@ export function createTranslateLoader(http: HttpClient) {
return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
} }
function initAuth(authService: AuthService): () => Promise<void> {
return () => authService.initialize();
}
@NgModule({ @NgModule({
declarations: [AppComponent], declarations: [AppComponent],
bootstrap: [AppComponent], bootstrap: [AppComponent],
@@ -34,6 +40,8 @@ export function createTranslateLoader(http: HttpClient) {
], ],
providers: [ providers: [
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }, { provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
{ provide: HTTP_INTERCEPTORS, useClass: AuthInterceptorService, multi: true },
{ provide: APP_INITIALIZER, useFactory: initAuth, deps: [AuthService], multi: true },
provideHttpClient(withInterceptorsFromDi()) provideHttpClient(withInterceptorsFromDi())
] ]
}) })

View File

@@ -44,7 +44,8 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
useExisting: forwardRef(() => RatingComponent), useExisting: forwardRef(() => RatingComponent),
multi: true multi: true
} }
] ],
standalone: false
}) })
export class RatingComponent implements ControlValueAccessor { export class RatingComponent implements ControlValueAccessor {
@Input() readonly: string = 'false'; @Input() readonly: string = 'false';

View File

@@ -2,15 +2,12 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { IonicModule } from '@ionic/angular'; import { IonicModule } from '@ionic/angular';
@NgModule({ @NgModule({
declarations: [AccordionComponent], declarations: [],
imports: [ imports: [
CommonModule, CommonModule,
IonicModule IonicModule
], ],
exports: [ exports: []
]
}) })
export class SharedComponentsModule { } export class SharedComponentsModule { }

View File

@@ -1,7 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router'; import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router';
import { Observable } from 'rxjs';
import { User } from 'src/app/models/user';
import { AuthService } from '../services/auth.service'; import { AuthService } from '../services/auth.service';
@Injectable({ @Injectable({
@@ -9,34 +7,24 @@ import { AuthService } from '../services/auth.service';
}) })
export class AuthGuard implements CanActivate { export class AuthGuard implements CanActivate {
user: User;
constructor( constructor(
private router: Router, private router: Router,
private authService: AuthService private authService: AuthService
) {} ) {}
canActivate( canActivate(
next: ActivatedRouteSnapshot, next: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean { state: RouterStateSnapshot): boolean {
const currentUser = this.authService.isLoggedIn; if (this.authService.isReported) {
const userVerified = this.authService.isVerified;
const userReported = this.authService.isReported;
//if (userVerified == false) {
//this.router.navigate(['/verify']);
// return false;
//} else if (userReported == true) {
if (userReported == true) {
this.router.navigate(['/landing']); this.router.navigate(['/landing']);
return false; return false;
} else {
if (currentUser) {
// authorised so return true
return true;
}
} }
// not logged in so redirect to login page with the return url
if (this.authService.isLoggedIn) {
return true;
}
this.router.navigate(['/landing']); this.router.navigate(['/landing']);
return false; return false;
} }

View File

@@ -9,7 +9,7 @@ import { AuthService } from '../services/auth.service';
}) })
export class AuthoriginGuard implements CanActivate { export class AuthoriginGuard implements CanActivate {
user: User; user!: User;
constructor( constructor(
private router: Router, private router: Router,

View File

@@ -4,6 +4,7 @@ import { Component } from '@angular/core';
selector: 'app-home', selector: 'app-home',
templateUrl: 'home.page.html', templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'], styleUrls: ['home.page.scss'],
standalone: false
}) })
export class HomePage { export class HomePage {

View File

@@ -1,8 +1,8 @@
export class User { export class User {
id: number; id!: number;
name: string; name!: string;
email: string; email!: string;
phone: string; phone!: string;
phone_verified_at: string; phone_verified_at!: string;
reported: boolean; reported!: boolean;
} }

View File

@@ -8,8 +8,8 @@
<ion-title>{{'auth.forgot' | translate}}</ion-title> <ion-title>{{'auth.forgot' | translate}}</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<p text-wrap>{{'auth.forgot_instructions' | translate}}</p><br> <p class="ion-text-wrap">{{'auth.forgot_instructions' | translate}}</p><br>
<form #form="ngForm" (ngSubmit)="forgot(form)" method="post"> <form #form="ngForm" (ngSubmit)="forgot(form)" method="post">
<ion-item> <ion-item>
<ion-label position="floating">{{'auth.email' | translate}}</ion-label> <ion-label position="floating">{{'auth.email' | translate}}</ion-label>

View File

@@ -1,52 +1,52 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { NavController, LoadingController } from '@ionic/angular'; import { NavController, LoadingController } from '@ionic/angular';
import { NgForm } from '@angular/forms'; import { NgForm } from '@angular/forms';
import { AuthService } from 'src/app/services/auth.service';
import { AlertService } from 'src/app/services/alert.service'; import { AlertService } from 'src/app/services/alert.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { FirebaseAuthService } from 'src/app/services/firebase-auth.service';
@Component({ @Component({
selector: 'app-forgot', selector: 'app-forgot',
templateUrl: './forgot.page.html', templateUrl: './forgot.page.html',
styleUrls: ['./forgot.page.scss'], styleUrls: ['./forgot.page.scss'],
standalone: false
}) })
export class ForgotPage implements OnInit { export class ForgotPage implements OnInit {
private loading; private loading: HTMLIonLoadingElement | null = null;
constructor( constructor(
private authService: AuthService, private firebaseAuthService: FirebaseAuthService,
private navCtrl: NavController, private navCtrl: NavController,
private alertService: AlertService, private alertService: AlertService,
private translateService: TranslateService, private translateService: TranslateService,
private loadingCtrl: LoadingController private loadingCtrl: LoadingController
) { } ) { }
ngOnInit() {
} ngOnInit() { }
// Dismiss Forgot Modal
dismissForgot() { dismissForgot() {
this.navCtrl.back(); this.navCtrl.back();
} }
// On Register button tap, dismiss login modal and open register modal
forgot(form: NgForm) { async forgot(form: NgForm) {
this.loadingCtrl.create().then((overlay) => { this.loading = await this.loadingCtrl.create();
this.loading = overlay; await this.loading.present();
this.loading.present();
}); try {
this.authService.forgot(form.value.email).subscribe( await this.firebaseAuthService.sendPasswordReset(form.value.email);
data => { if (this.loading) this.loading.dismiss();
this.loading.dismiss(); this.alertService.presentToast(this.translateService.instant('alerts.reset_pass'));
this.dismissForgot();
} catch (e: any) {
if (this.loading) this.loading.dismiss();
if (e.code === 'auth/user-not-found') {
// Por seguridad mostramos el mismo mensaje aunque no exista el usuario
this.alertService.presentToast(this.translateService.instant('alerts.reset_pass')); this.alertService.presentToast(this.translateService.instant('alerts.reset_pass'));
},
error => {
this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['message']);
console.log(error);
},
() => {
this.dismissForgot(); this.dismissForgot();
} else {
this.alertService.presentToast(this.translateService.instant('alerts.error') + e.message);
} }
); }
} }
} }

View File

@@ -8,7 +8,7 @@
<ion-title>{{'auth.login' | translate}}</ion-title> <ion-title>{{'auth.login' | translate}}</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<form #form="ngForm" (ngSubmit)="login(form)" method="post"> <form #form="ngForm" (ngSubmit)="login(form)" method="post">
<ion-item> <ion-item>
<ion-label position="floating">{{'auth.email' | translate}}</ion-label> <ion-label position="floating">{{'auth.email' | translate}}</ion-label>
@@ -22,11 +22,27 @@
<br> <br>
<ion-button type="submit" expand="full" color="primary">{{'auth.login' | translate}}</ion-button> <ion-button type="submit" expand="full" color="primary">{{'auth.login' | translate}}</ion-button>
</form> </form>
<ion-text><p text-center (click)="forgotModal()"><u>{{'auth.forgot' | translate}}</u></p></ion-text> <ion-text><p class="ion-text-center" (click)="forgotModal()"><u>{{'auth.forgot' | translate}}</u></p></ion-text>
<br><br> <br><br>
<ion-button expand="full" color="facebook" (click)="loginFacebook()">{{'auth.fb_login' | translate}}</ion-button> <!-- Google Sign-In — branding oficial: fondo blanco, logo G coloreado, borde gris -->
<ion-button expand="full" color="danger" (click)="loginGoogle()">{{'auth.google_login' | translate}}</ion-button> <button class="btn-social btn-google" (click)="loginGoogle()">
<p text-center>{{'auth.signup_ad' | translate}}</p> <svg class="btn-social__icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z" fill="#4285F4"/>
<path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853"/>
<path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l3.66-2.84z" fill="#FBBC05"/>
<path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335"/>
</svg>
<span class="btn-social__label">{{'auth.google_login' | translate}}</span>
</button>
<!-- Apple Sign-In — branding oficial: fondo negro, logo Apple blanco, SF font -->
<button class="btn-social btn-apple" (click)="loginApple()">
<svg class="btn-social__icon btn-social__icon--apple" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.7 9.05 7.4c1.42.07 2.4.78 3.23.8 1.22-.24 2.39-.93 3.68-.84 1.56.12 2.73.72 3.5 1.9-3.22 1.93-2.46 5.91.59 7.03-.69 1.55-1.6 3.08-3 4zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z" fill="#FFFFFF"/>
</svg>
<span class="btn-social__label">{{'auth.apple_login' | translate}}</span>
</button>
<p class="ion-text-center">{{'auth.signup_ad' | translate}}</p>
<ion-button expand="full" color="secondary" (click)="registerModal()">{{'auth.signup' | translate}}</ion-button> <ion-button expand="full" color="secondary" (click)="registerModal()">{{'auth.signup' | translate}}</ion-button>
<ion-text><p text-center>{{'auth.terms_1' | translate}}<u (click)="openTerms()">{{'auth.terms_2' | translate}}</u>{{'auth.terms_3' | translate}}</p></ion-text> <ion-text><p class="ion-text-center">{{'auth.terms_1' | translate}}<u (click)="openTerms()">{{'auth.terms_2' | translate}}</u>{{'auth.terms_3' | translate}}</p></ion-text>
</ion-content> </ion-content>

View File

@@ -0,0 +1,63 @@
.btn-social {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 44px;
border-radius: 4px;
border: none;
cursor: pointer;
font-size: 14px;
font-weight: 500;
letter-spacing: 0.06em;
margin-bottom: 12px;
padding: 0 12px;
transition: box-shadow 0.2s ease;
&__icon {
width: 20px;
height: 20px;
margin-right: 12px;
flex-shrink: 0;
&--apple {
width: 18px;
height: 18px;
}
}
&__label {
flex: 1;
text-align: center;
margin-right: 32px; // compensa el ancho del icono para centrar visualmente
text-transform: uppercase;
}
&:active {
box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.15);
}
}
// Google: fondo blanco, borde gris, texto oscuro
.btn-google {
background-color: #ffffff;
border: 1px solid #DADCE0;
color: #3c4043;
font-family: 'Roboto', sans-serif;
&:hover {
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
}
// Apple: fondo negro, texto blanco, font del sistema
.btn-apple {
background-color: #000000;
color: #ffffff;
font-family: -apple-system, 'SF Pro Display', BlinkMacSystemFont, sans-serif;
border-radius: 6px;
&:hover {
background-color: #1a1a1a;
}
}

View File

@@ -4,22 +4,24 @@ import { NgForm } from '@angular/forms';
import { AuthService } from 'src/app/services/auth.service'; import { AuthService } from 'src/app/services/auth.service';
import { AlertService } from 'src/app/services/alert.service'; import { AlertService } from 'src/app/services/alert.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { FacebookLogin, FacebookLoginResponse } from '@capacitor-community/facebook-login'; import { FirebaseAuthService } from 'src/app/services/firebase-auth.service';
import { GoogleAuth } from '@codetrix-studio/capacitor-google-auth';
import { Browser } from '@capacitor/browser'; import { Browser } from '@capacitor/browser';
import { firstValueFrom } from 'rxjs';
@Component({ @Component({
selector: 'app-login', selector: 'app-login',
templateUrl: './login.page.html', templateUrl: './login.page.html',
styleUrls: ['./login.page.scss'] styleUrls: ['./login.page.scss'],
standalone: false
}) })
export class LoginPage implements OnInit { export class LoginPage implements OnInit {
private loading: any; private loading: HTMLIonLoadingElement | null = null;
constructor( constructor(
private authService: AuthService, private authService: AuthService,
private firebaseAuthService: FirebaseAuthService,
private navCtrl: NavController, private navCtrl: NavController,
private alertService: AlertService, private alertService: AlertService,
private translateService: TranslateService, private translateService: TranslateService,
@@ -45,68 +47,73 @@ export class LoginPage implements OnInit {
this.loading = await this.loadingCtrl.create(); this.loading = await this.loadingCtrl.create();
await this.loading.present(); await this.loading.present();
this.authService.login(form.value.email, form.value.password).subscribe( try {
data => { const idToken = await this.firebaseAuthService.signInWithEmail(
if (this.loading) this.loading.dismiss(); form.value.email,
}, form.value.password
error => { );
if (this.loading) this.loading.dismiss();
if (JSON.stringify(error['status']) == '401') { this.authService.loginWithFirebase(idToken).subscribe(
this.alertService.presentToast(this.translateService.instant('alerts.login_error')); (data: any) => {},
} (error: any) => {
else { if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['message']); if (JSON.stringify(error['status']) == '401') {
console.log(error); this.alertService.presentToast(this.translateService.instant('alerts.login_error'));
} } else {
}, this.alertService.presentToast(this.translateService.instant('alerts.error') + error['message']);
() => { }
if (this.loading) this.loading.dismiss(); },
this.dismissLogin(); () => { this.navigateAfterLogin(); }
this.navCtrl.navigateRoot('/dashboard'); );
this.alertService.presentToast(this.translateService.instant('alerts.login')); } catch (e: any) {
} if (this.loading) this.loading.dismiss();
); const msg = this.getFirebaseErrorMessage(e.code);
this.alertService.presentToast(msg);
}
} }
async loginFacebook() { private async navigateAfterLogin() {
this.loading = await this.loadingCtrl.create(); try {
await this.loading.present(); await firstValueFrom(this.authService.user());
} catch { }
if (this.loading) this.loading.dismiss();
this.navCtrl.navigateRoot('/dashboard');
this.alertService.presentToast(this.translateService.instant('alerts.login'));
}
try { private getFirebaseErrorMessage(code: string): string {
// Login with permissions switch (code) {
const result = await FacebookLogin.login({ permissions: ['public_profile', 'email'] }); case 'auth/wrong-password':
case 'auth/user-not-found':
case 'auth/invalid-credential':
return this.translateService.instant('alerts.login_error');
case 'auth/too-many-requests':
return this.translateService.instant('alerts.too_many_requests');
default:
return this.translateService.instant('alerts.error') + code;
}
}
if (result.accessToken) { async loginApple() {
// Get user ID and Token this.loading = await this.loadingCtrl.create();
const fb_id = result.accessToken.userId; await this.loading.present();
const fb_token = result.accessToken.token;
console.log("ID: " + fb_id); try {
console.log("Token: " + fb_token); const idToken = await this.firebaseAuthService.signInWithApple();
this.authService.login_register_fb(fb_token, fb_id).subscribe( this.authService.loginWithFirebase(idToken).subscribe(
data => { (data: any) => {},
}, (error: any) => {
error => { if (this.loading) this.loading.dismiss();
this.loading.dismiss(); this.alertService.presentToast(this.translateService.instant('alerts.error') + error);
this.alertService.presentToast(this.translateService.instant('alerts.error') + error); console.log(error);
console.log(error); },
}, () => { this.navigateAfterLogin(); }
() => { );
this.loading.dismiss(); } catch (e) {
this.dismissLogin(); if (this.loading) this.loading.dismiss();
this.navCtrl.navigateRoot('/dashboard'); this.alertService.presentToast(this.translateService.instant('alerts.error') + e);
this.alertService.presentToast(this.translateService.instant('alerts.login')); }
}
);
} else {
this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.timeout_error'));
}
} catch (e) {
this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.error') + e);
}
} }
async loginGoogle() { async loginGoogle() {
@@ -114,32 +121,19 @@ export class LoginPage implements OnInit {
await this.loading.present(); await this.loading.present();
try { try {
const res = await GoogleAuth.signIn(); const idToken = await this.firebaseAuthService.signInWithGoogle();
console.log(res);
const google_id = res.id; this.authService.loginWithFirebase(idToken).subscribe(
const google_token = res.authentication.accessToken; (data: any) => {},
(error: any) => {
console.log("ID: " + google_id); if (this.loading) this.loading.dismiss();
console.log("Token: " + google_token);
this.authService.login_register_googlePlus(google_token, google_id).subscribe(
data => {
},
error => {
this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.error') + error); this.alertService.presentToast(this.translateService.instant('alerts.error') + error);
console.log(error); console.log(error);
}, },
() => { () => { this.navigateAfterLogin(); }
this.loading.dismiss();
this.dismissLogin();
this.navCtrl.navigateRoot('/dashboard');
this.alertService.presentToast(this.translateService.instant('alerts.login'));
}
); );
} catch (err) { } catch (err) {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.error') + err); this.alertService.presentToast(this.translateService.instant('alerts.error') + err);
console.log(err); console.log(err);
} }

View File

@@ -8,7 +8,7 @@
<ion-title>{{'auth.signup' | translate}}</ion-title> <ion-title>{{'auth.signup' | translate}}</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<form #form="ngForm" (ngSubmit)="register(form)" method="post"> <form #form="ngForm" (ngSubmit)="register(form)" method="post">
<ion-item> <ion-item>
<ion-label position="floating">{{'auth.name' | translate}}</ion-label> <ion-label position="floating">{{'auth.name' | translate}}</ion-label>
@@ -37,7 +37,7 @@
<br><br> <br><br>
<ion-row> <ion-row>
<ion-col size="9.5"> <ion-col size="9.5">
<p text-center style="margin-bottom:0;margin-top:0.25em;color:#4d4d4d">{{'auth.terms_1' | translate}}<u (click)="openTerms()">{{'auth.terms_2' | translate}}</u>{{'auth.terms_3' | translate}}</p> <p class="ion-text-center" style="margin-bottom:0;margin-top:0.25em;color:#4d4d4d">{{'auth.terms_1' | translate}}<u (click)="openTerms()">{{'auth.terms_2' | translate}}</u>{{'auth.terms_3' | translate}}</p>
</ion-col> </ion-col>
<ion-col size="2.5"> <ion-col size="2.5">
<ion-item lines="none"> <ion-item lines="none">
@@ -48,6 +48,6 @@
<br> <br>
<ion-button type="submit" expand="full" color="secondary">{{'auth.signup' | translate}}</ion-button> <ion-button type="submit" expand="full" color="secondary">{{'auth.signup' | translate}}</ion-button>
</form> </form>
<br><p text-center>{{'auth.login_ad' | translate}}</p> <br><p class="ion-text-center">{{'auth.login_ad' | translate}}</p>
<ion-button expand="full" color="primary" (click)="loginModal()">{{'auth.login' | translate}}</ion-button> <ion-button expand="full" color="primary" (click)="loginModal()">{{'auth.login' | translate}}</ion-button>
</ion-content> </ion-content>

View File

@@ -4,85 +4,93 @@ import { AuthService } from 'src/app/services/auth.service';
import { NgForm } from '@angular/forms'; import { NgForm } from '@angular/forms';
import { AlertService } from 'src/app/services/alert.service'; import { AlertService } from 'src/app/services/alert.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { FirebaseAuthService } from 'src/app/services/firebase-auth.service';
import { Browser } from '@capacitor/browser'; import { Browser } from '@capacitor/browser';
@Component({ @Component({
selector: 'app-register', selector: 'app-register',
templateUrl: './register.page.html', templateUrl: './register.page.html',
styleUrls: ['./register.page.scss'], styleUrls: ['./register.page.scss'],
standalone: false
}) })
export class RegisterPage implements OnInit { export class RegisterPage implements OnInit {
loading: any = null; loading: HTMLIonLoadingElement | null = null;
terms = false; terms = false;
constructor( constructor(
private authService: AuthService, private authService: AuthService,
private firebaseAuthService: FirebaseAuthService,
private translateService: TranslateService, private translateService: TranslateService,
private navCtrl: NavController, private navCtrl: NavController,
private loadingCtrl: LoadingController, private loadingCtrl: LoadingController,
private alertService: AlertService private alertService: AlertService
) { } ) { }
ngOnInit() {
} ngOnInit() { }
// Dismiss Register Modal
dismissRegister() { dismissRegister() {
this.navCtrl.navigateRoot('/landing'); this.navCtrl.navigateRoot('/landing');
} }
// On Login button tap, dismiss Register modal and open login Modal
loginModal() { loginModal() {
this.navCtrl.navigateForward('/login'); this.navCtrl.navigateForward('/login');
} }
updateChecked () { updateChecked() {
if (this.terms == true) { this.terms = !this.terms;
this.terms = false;
console.log(this.terms);
} else {
this.terms = true;
console.log(this.terms);
}
} }
register(form: NgForm) { async register(form: NgForm) {
if (!this.terms) {
if (this.terms == true) {
if (form.value.name && form.value.email && form.value.phone && form.value.password && form.value.password1) {
if (form.value.password == form.value.password1) {
this.loadingCtrl.create().then((overlay) => {
this.loading = overlay;
this.loading.present();
});
this.authService.register(form.value.name, form.value.email, form.value.phone, form.value.password).subscribe(
data => {
this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.signup'));
},
error => {
if (JSON.stringify(error['status']) == '422') {
this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.signup_error'));
}
else {
this.loading.dismiss();
console.log(error);
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['message']);
}
},
() => {
}
);
} else {
this.alertService.presentToast(this.translateService.instant('alerts.signup_error_1'));
}
} else {
this.alertService.presentToast(this.translateService.instant('alerts.signup_error_2'));
}
} else {
this.alertService.presentToast(this.translateService.instant('alerts.signup_error_3')); this.alertService.presentToast(this.translateService.instant('alerts.signup_error_3'));
return;
} }
const { name, email, phone, password, password1 } = form.value;
if (!name || !email || !phone || !password || !password1) {
this.alertService.presentToast(this.translateService.instant('alerts.signup_error_2'));
return;
}
if (password !== password1) {
this.alertService.presentToast(this.translateService.instant('alerts.signup_error_1'));
return;
}
this.loading = await this.loadingCtrl.create();
await this.loading.present();
try {
// Firebase crea la cuenta con email + password
const idToken = await this.firebaseAuthService.registerWithEmail(email, password);
// Backend crea el perfil y devuelve el token de la app
this.authService.registerWithFirebase(idToken, name, phone, email).subscribe(
(data: any) => {},
(error: any) => {
if (this.loading) this.loading.dismiss();
if (error['status'] === 422) {
this.alertService.presentToast(this.translateService.instant('alerts.signup_error'));
} else {
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['message']);
}
},
() => {
if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.signup'));
this.navCtrl.navigateRoot('/dashboard');
}
);
} catch (e: any) {
if (this.loading) this.loading.dismiss();
if (e.code === 'auth/email-already-in-use') {
this.alertService.presentToast(this.translateService.instant('alerts.signup_error'));
} else {
this.alertService.presentToast(this.translateService.instant('alerts.error') + e.message);
}
}
} }
async openTerms() { async openTerms() {

View File

@@ -6,7 +6,7 @@
<ion-title>{{'cards.add' | translate}}</ion-title> <ion-title>{{'cards.add' | translate}}</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<form #form="ngForm" id="card_form" (ngSubmit)="addcard(form)" method="post"> <form #form="ngForm" id="card_form" (ngSubmit)="addcard(form)" method="post">
<ion-item [class.ng-invalid]="!holder_check"> <ion-item [class.ng-invalid]="!holder_check">
@@ -52,10 +52,10 @@
</ion-row> </ion-row>
<ion-row> <ion-row>
<ion-col size="6"> <ion-col size="6">
<p text-center>{{'cards.openpay_2' | translate}}<p> <p class="ion-text-center">{{'cards.openpay_2' | translate}}<p>
</ion-col> </ion-col>
<ion-col size="6" style="border-left: 1px solid #d0d0d0"> <ion-col size="6" style="border-left: 1px solid #d0d0d0">
<p text-center>{{'cards.openpay_3' | translate}}<p> <p class="ion-text-center">{{'cards.openpay_3' | translate}}<p>
</ion-col> </ion-col>
</ion-row> </ion-row>
<ion-row> <ion-row>

View File

@@ -14,22 +14,23 @@ declare var OpenPay: any;
selector: 'app-addcard', selector: 'app-addcard',
templateUrl: './addcard.page.html', templateUrl: './addcard.page.html',
styleUrls: ['./addcard.page.scss'], styleUrls: ['./addcard.page.scss'],
standalone: false
}) })
export class AddcardPage implements OnInit { export class AddcardPage implements OnInit {
private loading; private loading: HTMLIonLoadingElement | null = null;
card_check = true; card_check = true;
date_check = true; date_check = true;
cvv_check = true; cvv_check = true;
holder_check = null; holder_check: boolean | null = null;
line1_check = null; line1_check: boolean | null = null;
line2_check = null; line2_check: boolean | null = null;
line3_check = null; line3_check: boolean | null = null;
postal_code_check = null; postal_code_check: boolean | null = null;
city_check = null; city_check: boolean | null = null;
state_check = null; state_check: boolean | null = null;
month_number = null; month_number: any = null;
year_number = null; year_number: any = null;
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
@@ -147,28 +148,28 @@ export class AddcardPage implements OnInit {
"country_code":"MX" "country_code":"MX"
}*/ }*/
}, },
onSuccess => { (onSuccess: any) => {
let token = onSuccess.data.id; let token = onSuccess.data.id;
let device_id = (<HTMLInputElement>document.getElementById('deviceDataId')).value; let device_id = (<HTMLInputElement>document.getElementById('deviceDataId')).value;
this.ichambaService.addCard(token, device_id).subscribe( this.ichambaService.addCard(token, device_id).subscribe(
data => { (data: any) => {
if (data['type'] == "error") { if (data['type'] == "error") {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(data['message']); this.alertService.presentToast(data['message']);
} else { } else {
this.events.publish('refreshcards', 'data'); this.events.publish('refreshcards', 'data');
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.dismissAddcard(); this.dismissAddcard();
this.alertService.presentToast(this.translateService.instant('alerts.added_card')); this.alertService.presentToast(this.translateService.instant('alerts.added_card'));
} }
}, error => { }, (error: any) => {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']); this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']);
}); });
//console.log(onSuccess.data.id); //console.log(onSuccess.data.id);
//console.log(document.getElementById('deviceDataId').value); //console.log(document.getElementById('deviceDataId').value);
}, onError => { }, (onError: any) => {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.geo_error') + onError['status']); this.alertService.presentToast(this.translateService.instant('alerts.geo_error') + onError['status']);
}); });
} }

View File

@@ -6,11 +6,11 @@
<ion-title>{{'cards.header' | translate}}</ion-title> <ion-title>{{'cards.header' | translate}}</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<ion-card *ngFor="let card of cards"> <ion-card *ngFor="let card of cards">
<ion-item> <ion-item>
<ion-label> <ion-label>
<h2 text-capitalize>{{ card.brand }}</h2> <h2 class="ion-text-capitalize">{{ card.brand }}</h2>
<p>{{card.card_number}}</p> <p>{{card.card_number}}</p>
</ion-label> </ion-label>
<ion-button color="danger" (click)="deletecard(card.id)"> <ion-button color="danger" (click)="deletecard(card.id)">

View File

@@ -12,10 +12,11 @@ import { AlertService } from 'src/app/services/alert.service';
selector: 'app-cards', selector: 'app-cards',
templateUrl: './cards.page.html', templateUrl: './cards.page.html',
styleUrls: ['./cards.page.scss'], styleUrls: ['./cards.page.scss'],
standalone: false
}) })
export class CardsPage implements OnInit { export class CardsPage implements OnInit {
cards = []; cards: any[] = [];
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,

View File

@@ -25,16 +25,16 @@
</ion-item> </ion-item>
<ion-item> <ion-item>
<ion-label position="fixed">{{'categories.address' | translate}}</ion-label> <ion-label position="fixed">{{'categories.address' | translate}}</ion-label>
<ion-input [(ngModel)]="addressAutocomplete" (ionChange)="autocomplete($event)" value="{{ myAddress }}" (ionFocus)="showlist()"></ion-input> <ion-input [(ngModel)]="addressAutocomplete" (ionInput)="autocomplete($event)" (ionFocus)="showlist()"></ion-input>
</ion-item> </ion-item>
<ion-list *ngIf="showif"> <ion-list *ngIf="showif && placesSearch && placesSearch.length > 0">
<ion-item button=true (click)="geoloc(places.place_id, places.description, places.terms[1].value)" *ngFor="let places of placesSearch" class="place"> <ion-item button=true (click)="geoloc(places.place_id, places.description)" *ngFor="let places of placesSearch" class="place">
{{ places.description }} {{ places.description }}
</ion-item> </ion-item>
</ion-list> </ion-list>
<ion-item hidden> <ion-item>
<ion-label position="fixed">{{'categories.int_number' | translate}}</ion-label> <ion-label position="fixed">{{'categories.int_number' | translate}}</ion-label>
<ion-input value="{{ myIntnumber }}" disabled></ion-input> <ion-input [(ngModel)]="myIntnumber" placeholder="Opcional"></ion-input>
</ion-item> </ion-item>
<ion-item> <ion-item>
<ion-label position="fixed">{{'categories.references' | translate}}</ion-label> <ion-label position="fixed">{{'categories.references' | translate}}</ion-label>

View File

@@ -13,6 +13,7 @@ declare var google: any;
selector: 'app-category', selector: 'app-category',
templateUrl: './category.page.html', templateUrl: './category.page.html',
styleUrls: ['./category.page.scss'], styleUrls: ['./category.page.scss'],
standalone: false
}) })
export class CategoryPage implements OnInit { export class CategoryPage implements OnInit {
@@ -22,20 +23,20 @@ export class CategoryPage implements OnInit {
//amount: number = null; //amount: number = null;
//amount_check = true; //amount_check = true;
minyear: string = (new Date().getFullYear() + '-' + ((new Date().getMonth() + 1) < 10 ? '0' : '') + (new Date().getMonth() + 1) + '-' + (new Date().getDate() < 10 ? '0' : '') + new Date().getDate()).toString(); minyear: string = (new Date().getFullYear() + '-' + ((new Date().getMonth() + 1) < 10 ? '0' : '') + (new Date().getMonth() + 1) + '-' + (new Date().getDate() < 10 ? '0' : '') + new Date().getDate()).toString();
maxyear: string = null; maxyear: string | null = null;
mintime: number; mintime: number = 0;
maxtime: number; maxtime: number = 0;
setHour: any; setHour: any;
setDate: any; setDate: any;
references: string; references: string = '';
details: string; details: string = '';
differenceDate: number; differenceDate: number = 0;
differenceHour: number; differenceHour: number = 0;
myPosition: any = {}; myPosition: any = {};
myAddress: string = null; myAddress: string | null = null;
myIntnumber: string = null; myIntnumber: string | null = null;
addressAutocomplete: string = ''; addressAutocomplete: string = '';
placesSearch: string = ''; placesSearch: any = '';
showif = true; showif = true;
constructor( constructor(
@@ -54,7 +55,7 @@ export class CategoryPage implements OnInit {
ngOnInit() { ngOnInit() {
this.category = this.activatedRoute.snapshot.paramMap.get('category'); this.category = this.activatedRoute.snapshot.paramMap.get('category');
this.ichambaService.getParameters() this.ichambaService.getParameters()
.subscribe( data => { .subscribe( (data: any) => {
this.mintime = data['min_time']; this.mintime = data['min_time'];
this.maxtime = data['max_time']; this.maxtime = data['max_time'];
}); });
@@ -102,6 +103,7 @@ export class CategoryPage implements OnInit {
const address = results[0].formatted_address; const address = results[0].formatted_address;
console.log("data_: ", address); console.log("data_: ", address);
this.myAddress = address; this.myAddress = address;
this.addressAutocomplete = address; // Sincronizar con el input
} }
}); });
}); });
@@ -134,7 +136,7 @@ export class CategoryPage implements OnInit {
this.placesSearch = null; this.placesSearch = null;
} }
console.log(this.addressAutocomplete) console.log(this.addressAutocomplete)
new google.maps.places.AutocompleteService().getPredictions({ input: this.addressAutocomplete }, predictions => { new google.maps.places.AutocompleteService().getPredictions({ input: this.addressAutocomplete }, (predictions: any) => {
this.ngZone.run(() => { this.ngZone.run(() => {
this.placesSearch = predictions; this.placesSearch = predictions;
console.log(predictions); console.log(predictions);
@@ -142,12 +144,12 @@ export class CategoryPage implements OnInit {
}); });
} }
geoloc(place_id: string, place_description: string, place_intnumber: string) { geoloc(place_id: string, place_description: string) {
this.myAddress = place_description; this.myAddress = place_description;
this.myIntnumber = place_intnumber; this.addressAutocomplete = place_description; // Sincronizar con el input
console.log(place_id); console.log(place_id);
this.hidelist(); this.hidelist();
new google.maps.Geocoder().geocode({ placeId: place_id }, coordinates => { new google.maps.Geocoder().geocode({ placeId: place_id }, (coordinates: any) => {
this.ngZone.run(() => { this.ngZone.run(() => {
console.log(coordinates[0].geometry.location.lat() + ", " + coordinates[0].geometry.location.lng()); console.log(coordinates[0].geometry.location.lat() + ", " + coordinates[0].geometry.location.lng());
this.myPosition = { this.myPosition = {
@@ -193,20 +195,20 @@ export class CategoryPage implements OnInit {
this.loading.present(); this.loading.present();
}); });
if (!Number.isInteger(parseInt(this.myIntnumber))) { if (!Number.isInteger(parseInt(this.myIntnumber ?? ''))) {
this.myIntnumber = null; this.myIntnumber = null;
} }
this.ichambaService.addPostulation(this.category, this.myAddress, this.myIntnumber, this.references, this.myPosition.latitude, this.myPosition.longitude, this.setDate, this.setHour, this.details).subscribe( this.ichambaService.addPostulation(this.category, this.myAddress!, this.myIntnumber ?? '', this.references, this.myPosition.latitude, this.myPosition.longitude, this.setDate, this.setHour, this.details).subscribe(
data => { (data: any) => {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
if (data['message'] == 'No providers') { if (data['message'] == 'No providers') {
this.alertService.presentToast(this.translateService.instant('alerts.no_provider')); this.alertService.presentToast(this.translateService.instant('alerts.no_provider'));
} else { } else {
this.navCtrl.navigateRoot('/dashboard'); this.navCtrl.navigateRoot('/dashboard');
this.alertService.presentToast(this.translateService.instant('alerts.categories_success')); this.alertService.presentToast(this.translateService.instant('alerts.categories_success'));
} }
}, error => { }, (error: any) => {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']); this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']);
}); });
} else { } else {

View File

@@ -6,8 +6,8 @@
<ion-title>{{'contracts.header' | translate}}</ion-title> <ion-title>{{'contracts.header' | translate}}</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<h2 text-capitalize style="padding-bottom: 0.5em">{{'contracts.header_2' | translate}}</h2> <h2 class="ion-text-capitalize" style="padding-bottom: 0.5em">{{'contracts.header_2' | translate}}</h2>
<ion-refresher slot="fixed" (ionRefresh)="refresh($event)"> <ion-refresher slot="fixed" (ionRefresh)="refresh($event)">
<ion-refresher-content></ion-refresher-content> <ion-refresher-content></ion-refresher-content>
</ion-refresher> </ion-refresher>
@@ -15,15 +15,15 @@
<ion-card *ngIf="ccontract.status==1"> <ion-card *ngIf="ccontract.status==1">
<ion-item style="--border-color: #fff"> <ion-item style="--border-color: #fff">
<ion-label> <ion-label>
<h2 *ngIf="lang===true"text-capitalize>{{ ccontract.category }}</h2> <h2 *ngIf="lang===true" class="ion-text-capitalize">{{ ccontract.category }}</h2>
<h2 *ngIf="lang===false"text-capitalize>{{ ccontract.en_category }}</h2> <h2 *ngIf="lang===false" class="ion-text-capitalize">{{ ccontract.en_category }}</h2>
<p text-wrap>{{ ccontract.address }}</p> <p class="ion-text-wrap">{{ ccontract.address }}</p>
<p text-wrap text-capitalize>{{ ccontracts_dates[i] }}</p> <p class="ion-text-wrap ion-text-capitalize">{{ ccontracts_dates[i] }}</p>
<p text-wrap text-capitalize>{{'contracts.supplier' | translate}}: {{ ccontract.supplier }}</p> <p class="ion-text-wrap ion-text-capitalize">{{'contracts.supplier' | translate}}: {{ ccontract.supplier }}</p>
<p text-wrap>{{'contracts.phone' | translate}}: <a href="tel:{{ ccontract.phone }}">{{ ccontract.phone }}</a></p> <p class="ion-text-wrap">{{'contracts.phone' | translate}}: <a href="tel:{{ ccontract.phone }}">{{ ccontract.phone }}</a></p>
<p text-wrap text-capitalize>{{'contracts.amount' | translate}}: ${{ ccontract.amount }}</p> <p class="ion-text-wrap ion-text-capitalize">{{'contracts.amount' | translate}}: ${{ ccontract.amount }}</p>
<h2 text-wrap>{{'contracts.start_pin' | translate}}<b>{{ ccontract.code }}</b></h2> <h2 class="ion-text-wrap">{{'contracts.start_pin' | translate}}<b>{{ ccontract.code }}</b></h2>
<p text-wrap>{{'contracts.info_pin' | translate}}</p> <p class="ion-text-wrap">{{'contracts.info_pin' | translate}}</p>
</ion-label> </ion-label>
</ion-item> </ion-item>
<ion-button *ngIf="ccontract.past_due < 0" style="height: 4.0em; padding-right: 1.0em; padding-bottom:1.0em; float: right" color="danger" (click)="cancelContract(ccontract.id, ccontract.date)">{{'contracts.cancel_1.1' | translate}}<br>{{'contracts.cancel_1.2' | translate}}</ion-button> <ion-button *ngIf="ccontract.past_due < 0" style="height: 4.0em; padding-right: 1.0em; padding-bottom:1.0em; float: right" color="danger" (click)="cancelContract(ccontract.id, ccontract.date)">{{'contracts.cancel_1.1' | translate}}<br>{{'contracts.cancel_1.2' | translate}}</ion-button>

View File

@@ -13,12 +13,13 @@ import { AlertController } from '@ionic/angular';
selector: 'app-contracted', selector: 'app-contracted',
templateUrl: './contracted.page.html', templateUrl: './contracted.page.html',
styleUrls: ['./contracted.page.scss'], styleUrls: ['./contracted.page.scss'],
standalone: false
}) })
export class ContractedPage implements OnInit { export class ContractedPage implements OnInit {
ccontracts = []; ccontracts: any[] = [];
ccontracts_dates = []; ccontracts_dates: any[] = [];
lang: boolean; lang: boolean = false;
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
@@ -47,7 +48,7 @@ export class ContractedPage implements OnInit {
} }
} }
refresh(event) { refresh(event: any) {
this.ichambaService.getCurrentcontracts().subscribe( this.ichambaService.getCurrentcontracts().subscribe(
data => { data => {
this.ccontracts = data; this.ccontracts = data;
@@ -90,10 +91,10 @@ export class ContractedPage implements OnInit {
this.presentAlert(id) this.presentAlert(id)
} else { */ } else { */
this.ichambaService.cancelContract(id).subscribe( this.ichambaService.cancelContract(id).subscribe(
data => { (data: any) => {
this.getccontracts(); this.getccontracts();
this.alertService.presentToast(data['message']); this.alertService.presentToast(data['message']);
}, error => { }, (error: any) => {
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']); this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']);
}); });
//} //}
@@ -114,10 +115,10 @@ export class ContractedPage implements OnInit {
text: 'Confirmar', text: 'Confirmar',
handler: () => { handler: () => {
this.ichambaService.cancelContract(id).subscribe( this.ichambaService.cancelContract(id).subscribe(
data => { (data: any) => {
this.getccontracts(); this.getccontracts();
this.alertService.presentToast(data['message']); this.alertService.presentToast(data['message']);
}, error => { }, (error: any) => {
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']); this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']);
}); });
} }

View File

@@ -10,6 +10,7 @@ import { AlertService } from 'src/app/services/alert.service';
selector: 'app-contracts', selector: 'app-contracts',
templateUrl: './contracts.page.html', templateUrl: './contracts.page.html',
styleUrls: ['./contracts.page.scss'], styleUrls: ['./contracts.page.scss'],
standalone: false
}) })
export class ContractsPage implements OnInit { export class ContractsPage implements OnInit {

View File

@@ -6,8 +6,8 @@
<ion-title>Añadir Fondos</ion-title> <ion-title>Añadir Fondos</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<p text-wrap>Está por añadir un fondo extra al servicio realizado por <b>{{ supplier }}</b>. <p class="ion-text-wrap">Está por añadir un fondo extra al servicio realizado por <b>{{ supplier }}</b>.
Para continuar, seleccione la tarjeta con la que desee pagar el servicio e ingrese el código Para continuar, seleccione la tarjeta con la que desee pagar el servicio e ingrese el código
de seguridad de la tarjeta.</p><br> de seguridad de la tarjeta.</p><br>
<ion-item [class.ng-invalid]="!amount_check"> <ion-item [class.ng-invalid]="!amount_check">

View File

@@ -15,18 +15,19 @@ declare var OpenPay: any;
selector: 'app-extra', selector: 'app-extra',
templateUrl: './extra.page.html', templateUrl: './extra.page.html',
styleUrls: ['./extra.page.scss'], styleUrls: ['./extra.page.scss'],
standalone: false
}) })
export class ExtraPage implements OnInit { export class ExtraPage implements OnInit {
private loading; private loading: HTMLIonLoadingElement | null = null;
amount: number = null; amount: number | null = null;
amount_check = true; amount_check = true;
code_check = true; code_check = true;
cards = []; cards: any[] = [];
card_id = null; card_id: any = null;
supplier = null; supplier: any = null;
cards_menu = null; cards_menu: any = null;
contract_id: number = null; contract_id: number | null = null;
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
@@ -104,16 +105,16 @@ export class ExtraPage implements OnInit {
this.loading = overlay; this.loading = overlay;
this.loading.present(); this.loading.present();
}); });
this.ichambaService.addExtra(this.contract_id, this.amount, this.card_id, code, device_id).subscribe( this.ichambaService.addExtra(this.contract_id!, this.amount!, this.card_id, code, device_id).subscribe(
data => { (data: any) => {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
if (data['message'] = 'extra_added') { if (data['message'] == 'extra_added') {
this.alertService.presentToast("Fondo extra añadido con éxito"); this.alertService.presentToast("Fondo extra añadido con éxito");
} }
this.events.publish('refreshpcontracts', 'data'); this.events.publish('refreshpcontracts', 'data');
this.navCtrl.navigateRoot('/contracts/contracted'); this.navCtrl.navigateRoot('/contracts/contracted');
}, error => { }, (error: any) => {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast("Por favor contacte a soporte técnico, Estatus:" + error['status']); this.alertService.presentToast("Por favor contacte a soporte técnico, Estatus:" + error['status']);
}); });
//console.log(onSuccess.data.id); //console.log(onSuccess.data.id);

View File

@@ -6,8 +6,8 @@
<ion-title>{{'contract.header' | translate}}</ion-title> <ion-title>{{'contract.header' | translate}}</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<h2 text-capitalize style="padding-bottom: 0.5em">{{'contracts.header_3' | translate}}</h2> <h2 class="ion-text-capitalize" style="padding-bottom: 0.5em">{{'contracts.header_3' | translate}}</h2>
<ion-refresher slot="fixed" (ionRefresh)="refresh($event)"> <ion-refresher slot="fixed" (ionRefresh)="refresh($event)">
<ion-refresher-content></ion-refresher-content> <ion-refresher-content></ion-refresher-content>
</ion-refresher> </ion-refresher>
@@ -15,13 +15,13 @@
<ion-card> <ion-card>
<ion-item style="--border-color: #fff"> <ion-item style="--border-color: #fff">
<ion-label> <ion-label>
<h2 text-capitalize *ngIf="lang===true">{{ fcontract.category }}</h2> <h2 class="ion-text-capitalize" *ngIf="lang===true">{{ fcontract.category }}</h2>
<h2 text-capitalize *ngIf="lang===false">{{ fcontract.en_category }}</h2> <h2 class="ion-text-capitalize" *ngIf="lang===false">{{ fcontract.en_category }}</h2>
<h2 text-capitalize *ngIf="fcontract.parent">{{'contracts.parent' | translate}}</h2> <h2 class="ion-text-capitalize" *ngIf="fcontract.parent">{{'contracts.parent' | translate}}</h2>
<p text-wrap>{{ fcontract.address }}</p> <p class="ion-text-wrap">{{ fcontract.address }}</p>
<p text-wrap text-capitalize>{{ fcontracts_dates[i] }}</p> <p class="ion-text-wrap ion-text-capitalize">{{ fcontracts_dates[i] }}</p>
<p text-wrap text-capitalize>{{'contracts.supplier' | translate}}: {{ fcontract.supplier }}</p> <p class="ion-text-wrap ion-text-capitalize">{{'contracts.supplier' | translate}}: {{ fcontract.supplier }}</p>
<p text-wrap text-capitalize>{{'contracts.amount' | translate}}: ${{ fcontract.amount }}</p> <p class="ion-text-wrap ion-text-capitalize">{{'contracts.amount' | translate}}: ${{ fcontract.amount }}</p>
<p>{{'contracts.status' | translate}}: {{ fcontract.status }}</p> <p>{{'contracts.status' | translate}}: {{ fcontract.status }}</p>
</ion-label> </ion-label>
</ion-item> </ion-item>

View File

@@ -15,12 +15,13 @@ import { AlertController } from '@ionic/angular';
selector: 'app-finished', selector: 'app-finished',
templateUrl: './finished.page.html', templateUrl: './finished.page.html',
styleUrls: ['./finished.page.scss'], styleUrls: ['./finished.page.scss'],
standalone: false
}) })
export class FinishedPage implements OnInit { export class FinishedPage implements OnInit {
fcontracts = []; fcontracts: any[] = [];
fcontracts_dates = []; fcontracts_dates: any[] = [];
lang: boolean; lang: boolean = false;
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
@@ -51,7 +52,7 @@ export class FinishedPage implements OnInit {
} }
} }
refresh(event) { refresh(event: any) {
this.ichambaService.getFinishedcontracts().subscribe( this.ichambaService.getFinishedcontracts().subscribe(
data => { data => {
this.fcontracts = data; this.fcontracts = data;

View File

@@ -6,31 +6,31 @@
<ion-title>{{'contracts.hire' | translate}}</ion-title> <ion-title>{{'contracts.hire' | translate}}</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<p text-wrap>{{'contracts.hire_info_1' | translate}} <b>{{ supplier }}</b> {{'contracts.hire_info_2' | translate}}<br> <p class="ion-text-wrap">{{'contracts.hire_info_1' | translate}} <b>{{ supplier }}</b> {{'contracts.hire_info_2' | translate}}<br>
{{'contracts.hire_pay' | translate}}</p><br> {{'contracts.hire_pay' | translate}}</p><br>
<ion-row> <ion-row>
<ion-col size="9"> <ion-col size="9">
<p text-left style="margin:0">{{'contracts.fee_amount' | translate}}:</p> <p class="ion-text-start" style="margin:0">{{'contracts.fee_amount' | translate}}:</p>
</ion-col> </ion-col>
<ion-col size="3"> <ion-col size="3">
<p text-right style="margin:0">${{ fee | number: '1.2-2'}}</p> <p class="ion-text-end" style="margin:0">${{ fee | number: '1.2-2'}}</p>
</ion-col> </ion-col>
</ion-row> </ion-row>
<ion-row> <ion-row>
<ion-col size="9"> <ion-col size="9">
<p text-left style="margin:0">{{'contracts.discount_amount' | translate}}:</p> <p class="ion-text-start" style="margin:0">{{'contracts.discount_amount' | translate}}:</p>
</ion-col> </ion-col>
<ion-col size="3"> <ion-col size="3">
<p text-right style="margin:0">${{ discount | number: '1.2-2'}}</p> <p class="ion-text-end" style="margin:0">${{ discount | number: '1.2-2'}}</p>
</ion-col> </ion-col>
</ion-row> </ion-row>
<ion-row> <ion-row>
<ion-col size="9"> <ion-col size="9">
<p text-left style="margin:0"><b>{{'contracts.final_amount' | translate}}:</b></p> <p class="ion-text-start" style="margin:0"><b>{{'contracts.final_amount' | translate}}:</b></p>
</ion-col> </ion-col>
<ion-col size="3"> <ion-col size="3">
<p text-right style="margin:0"><b>${{ final_amount | number: '1.2-2'}}</b></p> <p class="ion-text-end" style="margin:0"><b>${{ final_amount | number: '1.2-2'}}</b></p>
</ion-col> </ion-col>
</ion-row> </ion-row>
<br> <br>
@@ -41,7 +41,7 @@
<ion-button style="height: 3em" item-end (click)="checkCoupon()" expand="full" color="primary">{{'contracts.validate' | translate}}</ion-button> <ion-button style="height: 3em" item-end (click)="checkCoupon()" expand="full" color="primary">{{'contracts.validate' | translate}}</ion-button>
</ion-item> </ion-item>
</ion-list> </ion-list>
<ion-item> <ion-item *ngIf="!paymentBypass">
<ion-label>{{'cards.card' | translate}}</ion-label> <ion-label>{{'cards.card' | translate}}</ion-label>
<ion-select style="max-width:90%" interface="action-sheet" [(ngModel)]="cards_menu" (ionChange)="selected_card($event)"> <ion-select style="max-width:90%" interface="action-sheet" [(ngModel)]="cards_menu" (ionChange)="selected_card($event)">
<ion-select-option>Agregar tarjeta</ion-select-option> <ion-select-option>Agregar tarjeta</ion-select-option>
@@ -49,13 +49,18 @@
</ion-select> </ion-select>
</ion-item> </ion-item>
<form #form="ngForm" id="card_form" (ngSubmit)="createContract(form)" method="post"> <form #form="ngForm" id="card_form" (ngSubmit)="createContract(form)" method="post">
<ion-item [class.ng-invalid]="!code_check"> <ion-item *ngIf="!paymentBypass" [class.ng-invalid]="!code_check">
<ion-label position="floating">CVV</ion-label> <ion-label position="floating">CVV</ion-label>
<ion-input type="password" ngModel name="code" (ionChange)="code_checker($event)" [class.ng-invalid]="!code_check" size="3" maxlength="4"></ion-input> <ion-input type="password" ngModel name="code" (ionChange)="code_checker($event)" [class.ng-invalid]="!code_check" size="3" maxlength="4"></ion-input>
</ion-item><br><br> </ion-item>
<ion-note *ngIf="paymentBypass" color="warning" style="display: block; text-align: center; margin: 1em 0;">
<b>MODO DE PRUEBA:</b> El pago será simulado
</ion-note>
<br><br>
<ion-button type="submit" expand="full" color="secondary">{{'contracts.hire_confirm' | translate}}</ion-button> <ion-button type="submit" expand="full" color="secondary">{{'contracts.hire_confirm' | translate}}</ion-button>
</form> </form>
<br> <br>
<div *ngIf="!paymentBypass">
<ion-row class="ion-align-items-center"> <ion-row class="ion-align-items-center">
<ion-col size="4"> <ion-col size="4">
<img src="/assets/openpay/openpay_color.png" style="padding:0.25em 0.5em"/> <img src="/assets/openpay/openpay_color.png" style="padding:0.25em 0.5em"/>
@@ -66,10 +71,10 @@
</ion-row> </ion-row>
<ion-row> <ion-row>
<ion-col size="6"> <ion-col size="6">
<p text-center>{{'cards.openpay_2' | translate}}<p> <p class="ion-text-center">{{'cards.openpay_2' | translate}}<p>
</ion-col> </ion-col>
<ion-col size="6" style="border-left: 1px solid #d0d0d0"> <ion-col size="6" style="border-left: 1px solid #d0d0d0">
<p text-center>{{'cards.openpay_3' | translate}}<p> <p class="ion-text-center">{{'cards.openpay_3' | translate}}<p>
</ion-col> </ion-col>
</ion-row> </ion-row>
<ion-row> <ion-row>
@@ -106,4 +111,5 @@
<img src="/assets/openpay/bbva.png"/> <img src="/assets/openpay/bbva.png"/>
</ion-col> </ion-col>
</ion-row> </ion-row>
</div>
</ion-content> </ion-content>

View File

@@ -16,23 +16,25 @@ declare var OpenPay: any;
selector: 'app-hire', selector: 'app-hire',
templateUrl: './hire.page.html', templateUrl: './hire.page.html',
styleUrls: ['./hire.page.scss'], styleUrls: ['./hire.page.scss'],
standalone: false
}) })
export class HirePage implements OnInit { export class HirePage implements OnInit {
private loading; private loading: HTMLIonLoadingElement | null = null;
code_check = true; code_check = true;
cards = []; cards: any[] = [];
code= null; code: any = null;
device_id = null; device_id: any = null;
card_id = null; card_id: any = null;
supplier = null; supplier: any = null;
supplier_id = null; supplier_id: any = null;
postulation_id = null; postulation_id: any = null;
fee = null; fee: any = null;
discount = 0; discount = 0;
final_amount = null; final_amount: any = null;
coupon = null; coupon: any = null;
cards_menu = null; cards_menu: any = null;
paymentBypass = false;
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
@@ -59,11 +61,14 @@ export class HirePage implements OnInit {
} }
ngOnInit() { ngOnInit() {
OpenPay.setId(this.env.MERCHANT_ID); this.paymentBypass = this.env.PAYMENT_BYPASS;
OpenPay.setApiKey(this.env.PUBLIC_API_KEY); if (!this.paymentBypass) {
console.log(OpenPay.getSandboxMode()); OpenPay.setId(this.env.MERCHANT_ID);
var deviceDataId = OpenPay.deviceData.setup("card_form"); OpenPay.setApiKey(this.env.PUBLIC_API_KEY);
this.getcards(); console.log(OpenPay.getSandboxMode());
var deviceDataId = OpenPay.deviceData.setup("card_form");
this.getcards();
}
} }
newcard() { newcard() {
@@ -105,16 +110,16 @@ export class HirePage implements OnInit {
this.loading.present(); this.loading.present();
}); });
this.ichambaService.checkCoupon(this.postulation_id, this.supplier_id, this.coupon).subscribe( this.ichambaService.checkCoupon(this.postulation_id, this.supplier_id, this.coupon).subscribe(
data => { (data: any) => {
if (data) { if (data) {
if (data['name'] == "used") { if (data['name'] == "used") {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.coupon_used')); this.alertService.presentToast(this.translateService.instant('alerts.coupon_used'));
} else if (data['name'] == "expired") { } else if (data['name'] == "expired") {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.coupon_expired')); this.alertService.presentToast(this.translateService.instant('alerts.coupon_expired'));
} else if (data['name'] == this.coupon) { } else if (data['name'] == this.coupon) {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.discount = (data['amount'] + (this.fee * (data['percentage']/100))); this.discount = (data['amount'] + (this.fee * (data['percentage']/100)));
console.log(this.discount); console.log(this.discount);
if (this.discount > this.fee){ if (this.discount > this.fee){
@@ -124,23 +129,53 @@ export class HirePage implements OnInit {
console.log(this.final_amount); console.log(this.final_amount);
this.alertService.presentToast(this.translateService.instant('alerts.coupon_valid')); this.alertService.presentToast(this.translateService.instant('alerts.coupon_valid'));
} else if (data['name'] == "success") { } else if (data['name'] == "success") {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.events.publish('refreshpcontracts', 'data'); this.events.publish('refreshpcontracts', 'data');
this.navCtrl.navigateRoot('/contracts/contracted'); this.navCtrl.navigateRoot('/contracts/contracted');
this.alertService.presentToast(this.translateService.instant('alerts.hire')); this.alertService.presentToast(this.translateService.instant('alerts.hire'));
} }
} else { } else {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.nocoupon')); this.alertService.presentToast(this.translateService.instant('alerts.nocoupon'));
} }
}, error => { }, (error: any) => {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']); this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']);
}); });
} }
} }
createContract(form: NgForm) { createContract(form: NgForm) {
// Si el bypass está activo, enviar con valores dummy
if (this.paymentBypass) {
this.loadingCtrl.create().then((overlay) => {
this.loading = overlay;
this.loading.present();
});
this.ichambaService.createContract(this.postulation_id, this.supplier_id, 'BYPASS', this.coupon, '000', 'BYPASS').subscribe(
(data: any) => {
if (data['type'] == "error") {
if (this.loading) this.loading.dismiss();
this.alertService.presentToast(data['message']);
} else if (data['name'] == "used") {
if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('contracts.coupon_used'));
} else if (data['name'] == "expired") {
if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('contracts.coupon_expired'));
} else {
if (this.loading) this.loading.dismiss();
this.events.publish('refreshpcontracts', 'data');
this.navCtrl.navigateRoot('/contracts/contracted');
this.alertService.presentToast(this.translateService.instant('alerts.hire'));
}
}, (error: any) => {
if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']);
});
return;
}
if (this.card_id != "Agregar tarjeta") { if (this.card_id != "Agregar tarjeta") {
if (this.code_check) { if (this.code_check) {
let code = form.value.code; let code = form.value.code;
@@ -152,24 +187,24 @@ export class HirePage implements OnInit {
this.loading.present(); this.loading.present();
}); });
this.ichambaService.createContract(this.postulation_id, this.supplier_id, this.card_id, this.coupon, code, device_id).subscribe( this.ichambaService.createContract(this.postulation_id, this.supplier_id, this.card_id, this.coupon, code, device_id).subscribe(
data => { (data: any) => {
if (data['type'] == "error") { if (data['type'] == "error") {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(data['message']); this.alertService.presentToast(data['message']);
} else if (data['name'] == "used") { } else if (data['name'] == "used") {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('contracts.coupon_used')); this.alertService.presentToast(this.translateService.instant('contracts.coupon_used'));
} else if (data['name'] == "expired") { } else if (data['name'] == "expired") {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('contracts.coupon_expired')); this.alertService.presentToast(this.translateService.instant('contracts.coupon_expired'));
} else { } else {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.events.publish('refreshpcontracts', 'data'); this.events.publish('refreshpcontracts', 'data');
this.navCtrl.navigateRoot('/contracts/contracted'); this.navCtrl.navigateRoot('/contracts/contracted');
this.alertService.presentToast(this.translateService.instant('alerts.hire')); this.alertService.presentToast(this.translateService.instant('alerts.hire'));
} }
}, error => { }, (error: any) => {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']); this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']);
}); });
//console.log(onSuccess.data.id); //console.log(onSuccess.data.id);

View File

@@ -12,6 +12,7 @@ import { DomSanitizer } from '@angular/platform-browser';
selector: 'app-nohome', selector: 'app-nohome',
templateUrl: './nohome.page.html', templateUrl: './nohome.page.html',
styleUrls: ['./nohome.page.scss'], styleUrls: ['./nohome.page.scss'],
standalone: false
}) })
export class NohomePage implements OnInit { export class NohomePage implements OnInit {
@@ -81,7 +82,7 @@ export class NohomePage implements OnInit {
send() { send() {
this.ichambaService.noHomeConfirm(this.contract_id, this.myPosition.latitude, this.myPosition.longitude, this.description).subscribe( this.ichambaService.noHomeConfirm(this.contract_id, this.myPosition.latitude, this.myPosition.longitude, this.description).subscribe(
data => { (data: any) => {
this.alertService.presentToast(data['message']); this.alertService.presentToast(data['message']);
this.navCtrl.navigateRoot('/dashboard'); this.navCtrl.navigateRoot('/dashboard');
}, error => { }, error => {

View File

@@ -6,18 +6,18 @@
<ion-title>{{'contracts.header' | translate}}</ion-title> <ion-title>{{'contracts.header' | translate}}</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<h2 text-capitalize style="padding-bottom: 0.5em">{{'contracts.header_1' | translate}}</h2> <h2 class="ion-text-capitalize" style="padding-bottom: 0.5em">{{'contracts.header_1' | translate}}</h2>
<ion-refresher slot="fixed" (ionRefresh)="refresh($event)"> <ion-refresher slot="fixed" (ionRefresh)="refresh($event)">
<ion-refresher-content></ion-refresher-content> <ion-refresher-content></ion-refresher-content>
</ion-refresher> </ion-refresher>
<ion-card *ngFor="let pcontract of pcontracts; let i = index"> <ion-card *ngFor="let pcontract of pcontracts; let i = index">
<ion-item> <ion-item>
<ion-label> <ion-label>
<h2 *ngIf="lang===true" text-capitalize>{{ pcontract.category }}</h2> <h2 *ngIf="lang===true" class="ion-text-capitalize">{{ pcontract.category }}</h2>
<h2 *ngIf="lang===false" text-capitalize>{{ pcontract.en_category }}</h2> <h2 *ngIf="lang===false" class="ion-text-capitalize">{{ pcontract.en_category }}</h2>
<p text-wrap>{{pcontract.address}}</p> <p class="ion-text-wrap">{{pcontract.address}}</p>
<p text-wrap text-capitalize>{{pcontracts_dates[i]}}</p> <p class="ion-text-wrap ion-text-capitalize">{{pcontracts_dates[i]}}</p>
</ion-label> </ion-label>
<ion-button style="height: 3em; padding-left: 0.5em;" color="secondary" (click)="viewsuppliers(pcontract.id)">{{'contracts.viewsuppliers_1.1' | translate}}<br>{{'contracts.viewsuppliers_1.2' | translate}}</ion-button> <ion-button style="height: 3em; padding-left: 0.5em;" color="secondary" (click)="viewsuppliers(pcontract.id)">{{'contracts.viewsuppliers_1.1' | translate}}<br>{{'contracts.viewsuppliers_1.2' | translate}}</ion-button>
</ion-item> </ion-item>

View File

@@ -12,12 +12,13 @@ import { AlertService } from 'src/app/services/alert.service';
selector: 'app-pending', selector: 'app-pending',
templateUrl: './pending.page.html', templateUrl: './pending.page.html',
styleUrls: ['./pending.page.scss'], styleUrls: ['./pending.page.scss'],
standalone: false
}) })
export class PendingPage implements OnInit { export class PendingPage implements OnInit {
pcontracts = []; pcontracts: any[] = [];
pcontracts_dates = []; pcontracts_dates: any[] = [];
lang: boolean; lang: boolean = false;
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
@@ -45,7 +46,7 @@ export class PendingPage implements OnInit {
} }
} }
refresh (event) { refresh (event: any) {
this.ichambaService.getPendingcontracts().subscribe( this.ichambaService.getPendingcontracts().subscribe(
data => { data => {
this.pcontracts = data; this.pcontracts = data;

View File

@@ -6,18 +6,18 @@
<ion-title>Contratos</ion-title> <ion-title>Contratos</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<h2 text-capitalize style="padding-bottom: 0.5em">Reagendados</h2> <h2 class="ion-text-capitalize" style="padding-bottom: 0.5em">Reagendados</h2>
<ng-container *ngFor="let ccontract of ccontracts; let i = index"> <ng-container *ngFor="let ccontract of ccontracts; let i = index">
<ion-card *ngIf="ccontract.status==2"> <ion-card *ngIf="ccontract.status==2">
<ion-item> <ion-item>
<ion-label> <ion-label>
<h2 text-capitalize>{{ ccontract.category }}</h2> <h2 class="ion-text-capitalize">{{ ccontract.category }}</h2>
<p text-wrap>{{ ccontract.address }}</p> <p class="ion-text-wrap">{{ ccontract.address }}</p>
<p text-wrap text-capitalize>{{ ccontracts_dates[i] }}</p> <p class="ion-text-wrap ion-text-capitalize">{{ ccontracts_dates[i] }}</p>
<p text-wrap text-capitalize>Proveedor: {{ ccontract.supplier }}</p> <p class="ion-text-wrap ion-text-capitalize">Proveedor: {{ ccontract.supplier }}</p>
<p>Monto: ${{ ccontract.amount }}</p> <p>Monto: ${{ ccontract.amount }}</p>
<p *ngIf="ccontract.time_limit < 10" text-wrap>Código de inicio de servicio: ${{ ccontract.code }} (Por favor, dar este código <p *ngIf="ccontract.time_limit < 10" class="ion-text-wrap">Código de inicio de servicio: ${{ ccontract.code }} (Por favor, dar este código
al proveedor para iniciar el servicio)</p> al proveedor para iniciar el servicio)</p>
</ion-label> </ion-label>
<ion-button style="height: 3em; padding-left: 0.5em;" color="danger">Cancelar<br>contrato</ion-button> <ion-button style="height: 3em; padding-left: 0.5em;" color="danger">Cancelar<br>contrato</ion-button>

View File

@@ -10,11 +10,12 @@ import { AlertService } from 'src/app/services/alert.service';
selector: 'app-redated', selector: 'app-redated',
templateUrl: './redated.page.html', templateUrl: './redated.page.html',
styleUrls: ['./redated.page.scss'], styleUrls: ['./redated.page.scss'],
standalone: false
}) })
export class RedatedPage implements OnInit { export class RedatedPage implements OnInit {
ccontracts = []; ccontracts: any[] = [];
ccontracts_dates = []; ccontracts_dates: any[] = [];
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,

View File

@@ -6,8 +6,8 @@
<ion-title>{{'contracts.report_header' | translate}}</ion-title> <ion-title>{{'contracts.report_header' | translate}}</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<h2 text-center>{{'contracts.report_description' | translate}}</h2> <h2 class="ion-text-center">{{'contracts.report_description' | translate}}</h2>
<ion-item> <ion-item>
<ion-textarea [(ngModel)]="comment">{{'contracts.report_commentaries' | translate}}</ion-textarea> <ion-textarea [(ngModel)]="comment">{{'contracts.report_commentaries' | translate}}</ion-textarea>
</ion-item> </ion-item>

View File

@@ -12,11 +12,12 @@ import { AlertService } from 'src/app/services/alert.service';
selector: 'app-report', selector: 'app-report',
templateUrl: './report.page.html', templateUrl: './report.page.html',
styleUrls: ['./report.page.scss'], styleUrls: ['./report.page.scss'],
standalone: false
}) })
export class ReportPage implements OnInit { export class ReportPage implements OnInit {
private loading; private loading: HTMLIonLoadingElement | null = null;
contract_id: number = null; contract_id: number | null = null;
comment: any; comment: any;
constructor( constructor(
@@ -40,13 +41,13 @@ export class ReportPage implements OnInit {
this.loading = overlay; this.loading = overlay;
this.loading.present(); this.loading.present();
}); });
this.ichambaService.reportContract(this.contract_id, this.comment).subscribe( this.ichambaService.reportContract(this.contract_id!, this.comment).subscribe(
data => { (data: any) => {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.report_send')); this.alertService.presentToast(this.translateService.instant('alerts.report_send'));
this.navCtrl.navigateRoot('/dashboard'); this.navCtrl.navigateRoot('/dashboard');
}, error => { }, (error: any) => {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast("Por favor contacte a soporte técnico, Estatus:" + error['status']); this.alertService.presentToast("Por favor contacte a soporte técnico, Estatus:" + error['status']);
}); });
} else { } else {

View File

@@ -6,8 +6,8 @@
<ion-title>{{'contracts.review_header' | translate}}</ion-title> <ion-title>{{'contracts.review_header' | translate}}</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<h2 text-center>{{'contracts.review_description' | translate}}</h2> <h2 class="ion-text-center">{{'contracts.review_description' | translate}}</h2>
<div class="rate_div"> <div class="rate_div">
<rating [(ngModel)]="rate" <rating [(ngModel)]="rate"
readonly="false" readonly="false"

View File

@@ -11,12 +11,13 @@ import { AlertService } from 'src/app/services/alert.service';
selector: 'app-review', selector: 'app-review',
templateUrl: './review.page.html', templateUrl: './review.page.html',
styleUrls: ['./review.page.scss'], styleUrls: ['./review.page.scss'],
standalone: false
}) })
export class ReviewPage implements OnInit { export class ReviewPage implements OnInit {
private loading; private loading: HTMLIonLoadingElement | null = null;
rate: any; rate: any;
contract_id: number = null; contract_id: number | null = null;
comment: any; comment: any;
constructor( constructor(
@@ -33,7 +34,7 @@ export class ReviewPage implements OnInit {
this.contract_id = Number(this.activatedRoute.snapshot.paramMap.get('contract_id')); this.contract_id = Number(this.activatedRoute.snapshot.paramMap.get('contract_id'));
} }
onRateChange(rating){ onRateChange(rating: any){
console.log("changed rating: " + rating); console.log("changed rating: " + rating);
// do your stuff // do your stuff
} }
@@ -44,13 +45,13 @@ export class ReviewPage implements OnInit {
this.loading = overlay; this.loading = overlay;
this.loading.present(); this.loading.present();
}); });
this.ichambaService.reviewContract(this.contract_id, this.rate, this.comment).subscribe( this.ichambaService.reviewContract(this.contract_id!, this.rate, this.comment).subscribe(
data => { (data: any) => {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(data['message']); this.alertService.presentToast(data['message']);
this.navCtrl.navigateRoot('/dashboard'); this.navCtrl.navigateRoot('/dashboard');
}, error => { }, (error: any) => {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']); this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']);
}); });
} else { } else {

View File

@@ -18,10 +18,10 @@ ion-input{
<ion-title>{{'contracts.start_header' | translate}}</ion-title> <ion-title>{{'contracts.start_header' | translate}}</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<form #form="ngForm" id="start_form" (ngSubmit)="startservice(form)" method="post"> <form #form="ngForm" id="start_form" (ngSubmit)="startservice(form)" method="post">
<h1 text-center>{{'contracts.start_description_1.1' | translate}}</h1> <h1 class="ion-text-center">{{'contracts.start_description_1.1' | translate}}</h1>
<ion-row text-center> <ion-row class="ion-text-center">
<ion-col> <ion-col>
<ion-input ngModel name="otp1" #otp1 required maxLength="1" type="number" (keyup)="otpController($event,otp2,'')"> <ion-input ngModel name="otp1" #otp1 required maxLength="1" type="number" (keyup)="otpController($event,otp2,'')">
</ion-input> </ion-input>
@@ -37,7 +37,7 @@ ion-input{
</ion-input> </ion-input>
</ion-col> </ion-col>
</ion-row> </ion-row>
<p text-justify>{{'contracts.start_description_1.2' | translate}}</p> <p class="ion-text-justify">{{'contracts.start_description_1.2' | translate}}</p>
<br> <br>
<ion-button type="submit" expand="full" color="primary">{{'contracts.start_send' | translate}}</ion-button> <ion-button type="submit" expand="full" color="primary">{{'contracts.start_send' | translate}}</ion-button>
</form> </form>

View File

@@ -10,11 +10,12 @@ import { AlertService } from 'src/app/services/alert.service';
selector: 'app-start', selector: 'app-start',
templateUrl: './start.page.html', templateUrl: './start.page.html',
styleUrls: ['./start.page.scss'], styleUrls: ['./start.page.scss'],
standalone: false
}) })
export class StartPage implements OnInit { export class StartPage implements OnInit {
private loading; private loading: HTMLIonLoadingElement | null = null;
pin: number = null; pin: number | null = null;
constructor( constructor(
private authService: AuthService, private authService: AuthService,
@@ -28,7 +29,7 @@ export class StartPage implements OnInit {
ngOnInit() { ngOnInit() {
} }
otpController(event,next,prev){ otpController(event: any, next: any, prev: any){
if (event.target.value.length > 1){ if (event.target.value.length > 1){
event.target.value = event.target.value.slice(-1); event.target.value = event.target.value.slice(-1);
next.setFocus(); next.setFocus();
@@ -49,18 +50,18 @@ export class StartPage implements OnInit {
this.loading = overlay; this.loading = overlay;
this.loading.present(); this.loading.present();
}); });
this.ichambaService.startContract(this.pin).subscribe( this.ichambaService.startContract(this.pin!).subscribe(
data => { (data: any) => {
if (data['message'] == "No service") { if (data['message'] == "No service") {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast("No hay ningún servicio agendado a esta hora"); this.alertService.presentToast("No hay ningún servicio agendado a esta hora");
} else { } else {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast(data['message']); this.alertService.presentToast(data['message']);
this.navCtrl.navigateRoot('/dashboard'); this.navCtrl.navigateRoot('/dashboard');
} }
}, error => { }, (error: any) => {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast("Por favor contacte a soporte técnico, Estatus:" + error['status']); this.alertService.presentToast("Por favor contacte a soporte técnico, Estatus:" + error['status']);
}); });
console.log(form.value.otp1 + form.value.otp2 + form.value.otp3 + form.value.otp4 + form.value.otp5 + form.value.otp6) console.log(form.value.otp1 + form.value.otp2 + form.value.otp3 + form.value.otp4 + form.value.otp5 + form.value.otp6)
@@ -72,19 +73,19 @@ export class StartPage implements OnInit {
this.loading.present(); this.loading.present();
}); });
this.ichambaService.noHomeCheck().subscribe( this.ichambaService.noHomeCheck().subscribe(
data => { (data: any) => {
if (data['message'] == "wait") { if (data['message'] == "wait") {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast("Por favor espere a los 10 minutos de tolerancia de la hora acordada"); this.alertService.presentToast("Por favor espere a los 10 minutos de tolerancia de la hora acordada");
} else if (data['message'] == "no-contract") { } else if (data['message'] == "no-contract") {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast("No hay contratos citados a esta hora"); this.alertService.presentToast("No hay contratos citados a esta hora");
} else { } else {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.navCtrl.navigateForward(['/nohome/', data['id']]); this.navCtrl.navigateForward(['/nohome/', data['id']]);
} }
}, error => { }, (error: any) => {
this.loading.dismiss(); if (this.loading) this.loading.dismiss();
this.alertService.presentToast("Por favor contacte a soporte técnico, Estatus:" + error['status']); this.alertService.presentToast("Por favor contacte a soporte técnico, Estatus:" + error['status']);
} }
); );

View File

@@ -4,6 +4,7 @@ import { Component, OnInit } from '@angular/core';
selector: 'app-comments', selector: 'app-comments',
templateUrl: './comments.page.html', templateUrl: './comments.page.html',
styleUrls: ['./comments.page.scss'], styleUrls: ['./comments.page.scss'],
standalone: false
}) })
export class CommentsPage implements OnInit { export class CommentsPage implements OnInit {

View File

@@ -6,11 +6,11 @@
<ion-title>{{'contracts.viewsuppliers_header' | translate}}</ion-title> <ion-title>{{'contracts.viewsuppliers_header' | translate}}</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<h3 *ngIf="lang===true" text-capitalize>{{ pcontractssuppliers_category[0] }}</h3> <h3 *ngIf="lang===true" class="ion-text-capitalize">{{ pcontractssuppliers_category[0] }}</h3>
<h3 *ngIf="lang===false" text-capitalize>{{ pcontractssuppliers_en_category[0] }}</h3> <h3 *ngIf="lang===false" class="ion-text-capitalize">{{ pcontractssuppliers_en_category[0] }}</h3>
<p text-capitalize>{{ pcontractssuppliers_address[0] }}</p> <p class="ion-text-capitalize">{{ pcontractssuppliers_address[0] }}</p>
<p text-capitalize style="margin-top: -0.6em">{{ pcontractssuppliers_dates[0] }}</p> <p class="ion-text-capitalize" style="margin-top: -0.6em">{{ pcontractssuppliers_dates[0] }}</p>
<ion-refresher slot="fixed" (ionRefresh)="refresh($event)"> <ion-refresher slot="fixed" (ionRefresh)="refresh($event)">
<ion-refresher-content></ion-refresher-content> <ion-refresher-content></ion-refresher-content>
</ion-refresher> </ion-refresher>
@@ -20,11 +20,11 @@
</ion-card-header> </ion-card-header>
<ion-item *ngIf="pcontractsupplier.supplier != null"> <ion-item *ngIf="pcontractsupplier.supplier != null">
<ion-label> <ion-label>
<h2 text-wrap text-capitalize *ngIf="pcontractsupplier.supplier != null">{{ pcontractsupplier.supplier }}</h2> <h2 class="ion-text-wrap ion-text-capitalize" *ngIf="pcontractsupplier.supplier != null">{{ pcontractsupplier.supplier }}</h2>
<p text-wrap *ngIf="pcontractsupplier.supplier != null"><ion-icon name="checkmark-circle" color="secondary" *ngIf="pcontractsupplier.membership != false"></ion-icon> {{ pcontractssuppliers_certified[i] }}</p> <p class="ion-text-wrap" *ngIf="pcontractsupplier.supplier != null"><ion-icon name="checkmark-circle" color="secondary" *ngIf="pcontractsupplier.membership != false"></ion-icon> {{ pcontractssuppliers_certified[i] }}</p>
<p text-wrap *ngIf="pcontractsupplier.supplier != null">{{'contracts.viewsuppliers_tags' | translate}}: {{ pcontractsupplier.tags }}</p> <p class="ion-text-wrap" *ngIf="pcontractsupplier.supplier != null">{{'contracts.viewsuppliers_tags' | translate}}: {{ pcontractsupplier.tags }}</p>
<p text-wrap *ngIf="pcontractsupplier.supplier != null">{{'contracts.viewsuppliers_fee' | translate}}: ${{ pcontractsupplier.fee }}</p> <p class="ion-text-wrap" *ngIf="pcontractsupplier.supplier != null">{{'contracts.viewsuppliers_fee' | translate}}: ${{ pcontractsupplier.fee }}</p>
<p text-wrap *ngIf="pcontractsupplier.supplier != null">{{'contracts.viewsuppliers_rate' | translate}}: {{ pcontractsupplier.score }} de 5 <ion-icon name="star"></ion-icon></p> <p class="ion-text-wrap" *ngIf="pcontractsupplier.supplier != null">{{'contracts.viewsuppliers_rate' | translate}}: {{ pcontractsupplier.score }} de 5 <ion-icon name="star"></ion-icon></p>
</ion-label> </ion-label>
<ion-button style="height: 3em; padding-left: 0.5em;" color="secondary" (click)="hiresupplier(pcontractsupplier.supplier_id, pcontractsupplier.id, pcontractsupplier.supplier, pcontractsupplier.fee)">{{'contracts.viewsuppliers_hire' | translate}}</ion-button> <ion-button style="height: 3em; padding-left: 0.5em;" color="secondary" (click)="hiresupplier(pcontractsupplier.supplier_id, pcontractsupplier.id, pcontractsupplier.supplier, pcontractsupplier.fee)">{{'contracts.viewsuppliers_hire' | translate}}</ion-button>
</ion-item> </ion-item>

View File

@@ -14,19 +14,20 @@ import { HirePage } from '../hire/hire.page';
selector: 'app-viewsuppliers', selector: 'app-viewsuppliers',
templateUrl: './viewsuppliers.page.html', templateUrl: './viewsuppliers.page.html',
styleUrls: ['./viewsuppliers.page.scss'], styleUrls: ['./viewsuppliers.page.scss'],
standalone: false
}) })
export class ViewsuppliersPage implements OnInit { export class ViewsuppliersPage implements OnInit {
postulation_id = null; postulation_id: string | null = null;
pcontractssuppliers = []; pcontractssuppliers: any[] = [];
pcontractssuppliers_dates = []; pcontractssuppliers_dates: any[] = [];
pcontractssuppliers_certified = []; pcontractssuppliers_certified: any[] = [];
pcontractssuppliers_category = []; pcontractssuppliers_category: any[] = [];
pcontractssuppliers_en_category = []; pcontractssuppliers_en_category: any[] = [];
pcontractssuppliers_address = []; pcontractssuppliers_address: any[] = [];
pcontractssuppliers_amount = []; pcontractssuppliers_amount: any[] = [];
pcontractssuppliers_fee = []; pcontractssuppliers_fee: any[] = [];
lang: boolean; lang: boolean = false;
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
@@ -45,7 +46,7 @@ export class ViewsuppliersPage implements OnInit {
ngOnInit() { ngOnInit() {
this.postulation_id = this.activatedRoute.snapshot.paramMap.get('postulation_id'); this.postulation_id = this.activatedRoute.snapshot.paramMap.get('postulation_id');
this.getPostulants(this.postulation_id); this.getPostulants(this.postulation_id ?? '');
if (this.languageService.getDefaultLanguage() == 'es') { if (this.languageService.getDefaultLanguage() == 'es') {
this.lang = true; this.lang = true;
} else { } else {
@@ -53,9 +54,9 @@ export class ViewsuppliersPage implements OnInit {
} }
} }
refresh(event) { refresh(event: any) {
this.ichambaService.getPostulants(this.postulation_id).subscribe( this.ichambaService.getPostulants(this.postulation_id ?? '').subscribe(
data => { (data: any) => {
this.pcontractssuppliers = data; this.pcontractssuppliers = data;
for (var i of this.pcontractssuppliers) { for (var i of this.pcontractssuppliers) {
if (this.languageService.getDefaultLanguage() == 'es') { if (this.languageService.getDefaultLanguage() == 'es') {
@@ -80,7 +81,7 @@ export class ViewsuppliersPage implements OnInit {
getPostulants(postulation_id: String) { getPostulants(postulation_id: String) {
this.ichambaService.getPostulants(postulation_id).subscribe( this.ichambaService.getPostulants(postulation_id).subscribe(
data => { (data: any) => {
this.pcontractssuppliers = data; this.pcontractssuppliers = data;
for (var i of this.pcontractssuppliers) { for (var i of this.pcontractssuppliers) {
if (this.languageService.getDefaultLanguage() == 'es') { if (this.languageService.getDefaultLanguage() == 'es') {

View File

@@ -26,7 +26,7 @@ ion-item:active:after {
<ion-title>{{'dashboard.header' | translate}}</ion-title> <ion-title>{{'dashboard.header' | translate}}</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<div class="autocomplete"> <div class="autocomplete">
<ion-searchbar <ion-searchbar
(ionInput)="search($event)" (ionInput)="search($event)"
@@ -42,47 +42,47 @@ ion-item:active:after {
<ion-refresher slot="fixed" (ionRefresh)="refresh($event)"> <ion-refresher slot="fixed" (ionRefresh)="refresh($event)">
<ion-refresher-content></ion-refresher-content> <ion-refresher-content></ion-refresher-content>
</ion-refresher> </ion-refresher>
<ng-container *ngIf="user != undefined"> <ng-container *ngIf="authService.isLoggedIn">
<div *ngIf="!isContract"> <div *ngIf="!isContract">
<ion-card style="box-shadow:none"> <ion-card style="box-shadow:none">
<img class="ion-justify-content-center" src="/assets/slides/ic_dashboard.svg" style="max-width:22.5em; margin:auto"/> <img class="ion-justify-content-center" src="/assets/slides/ic_dashboard.svg" style="max-width:22.5em; margin:auto"/>
<ion-text color="dark" class="ion-text-center"><h2>{{'dashboard.slogan' | translate}}</h2></ion-text> <ion-text color="dark" class="ion-text-center"><h2>{{'dashboard.slogan' | translate}}</h2></ion-text>
<h3 class="ion-text-center" color="medium">{{'dashboard.welcome' | translate}} {{ user["name"] }}</h3> <h3 class="ion-text-center" color="medium">{{'dashboard.welcome' | translate}} {{ authService.userName }}</h3>
</ion-card> </ion-card>
</div> </div>
</ng-container> </ng-container>
<ng-container *ngIf="pcontracts?.length > 0"> <ng-container *ngIf="pcontracts?.length > 0">
<h2 text-capitalize style="padding-bottom: 0.5em">{{'contracts.header_1' | translate}}</h2> <h2 class="ion-text-capitalize" style="padding-bottom: 0.5em">{{'contracts.header_1' | translate}}</h2>
</ng-container> </ng-container>
<ion-card *ngFor="let pcontract of pcontracts; let i = index"> <ion-card *ngFor="let pcontract of pcontracts; let i = index">
<ion-item> <ion-item>
<ion-progress-bar type="indeterminate"></ion-progress-bar>
<ion-label> <ion-label>
<h2 text-capitalize>{{ pcontract.category }}</h2> <h2 class="ion-text-capitalize">{{ pcontract.category }}</h2>
<p text-wrap><ion-icon name="search"></ion-icon> {{'contracts.postulating' | translate}}</p> <ion-progress-bar type="indeterminate"></ion-progress-bar>
<p text-wrap>{{pcontract.address}}</p> <p class="ion-text-wrap"><ion-icon name="search"></ion-icon> {{'contracts.postulating' | translate}}</p>
<p text-wrap text-capitalize>{{pcontracts_dates[i]}}</p> <p class="ion-text-wrap">{{pcontract.address}}</p>
<p class="ion-text-wrap ion-text-capitalize">{{pcontracts_dates[i]}}</p>
</ion-label> </ion-label>
<ion-button style="height: 3em; padding-left: 0.5em;" color="secondary" (click)="viewsuppliers(pcontract.id)">{{'contracts.viewsuppliers_1.1' | translate}}<br>{{'contracts.viewsuppliers_1.2' | translate}}</ion-button> <ion-button style="height: 3em; padding-left: 0.5em;" color="secondary" (click)="viewsuppliers(pcontract.id)">{{'contracts.viewsuppliers_1.1' | translate}}<br>{{'contracts.viewsuppliers_1.2' | translate}}</ion-button>
</ion-item> </ion-item>
</ion-card> </ion-card>
<ng-container *ngIf="ccontracts?.length > 0"> <ng-container *ngIf="ccontracts?.length > 0">
<h2 text-capitalize style="padding-bottom: 0.5em">{{'contracts.header_2' | translate}}</h2> <h2 class="ion-text-capitalize" style="padding-bottom: 0.5em">{{'contracts.header_2' | translate}}</h2>
</ng-container> </ng-container>
<ng-container *ngFor="let ccontract of ccontracts; let i = index"> <ng-container *ngFor="let ccontract of ccontracts; let i = index">
<ion-card *ngIf="ccontract.status==1"> <ion-card *ngIf="ccontract.status==1">
<ion-item style="--border-color: #fff"> <ion-item style="--border-color: #fff">
<ion-label> <ion-label>
<h2 *ngIf="lang===true" text-capitalize>{{ ccontract.category }}</h2> <h2 *ngIf="lang===true" class="ion-text-capitalize">{{ ccontract.category }}</h2>
<h2 *ngIf="lang===false" text-capitalize>{{ ccontract.en_category }}</h2> <h2 *ngIf="lang===false" class="ion-text-capitalize">{{ ccontract.en_category }}</h2>
<p text-wrap><ion-icon name="briefcase"></ion-icon> {{'contracts.hired' | translate}}</p> <p class="ion-text-wrap"><ion-icon name="briefcase"></ion-icon> {{'contracts.hired' | translate}}</p>
<p text-wrap>{{ ccontract.address }}</p> <p class="ion-text-wrap">{{ ccontract.address }}</p>
<p text-wrap text-capitalize>{{ ccontracts_dates[i] }}</p> <p class="ion-text-wrap ion-text-capitalize">{{ ccontracts_dates[i] }}</p>
<p text-wrap text-capitalize>{{'contracts.supplier' | translate}}: {{ ccontract.supplier }}</p> <p class="ion-text-wrap ion-text-capitalize">{{'contracts.supplier' | translate}}: {{ ccontract.supplier }}</p>
<p text-wrap>{{'contracts.phone' | translate}}: <a href="tel:{{ ccontract.phone }}">{{ ccontract.phone }}</a></p> <p class="ion-text-wrap">{{'contracts.phone' | translate}}: <a href="tel:{{ ccontract.phone }}">{{ ccontract.phone }}</a></p>
<p text-wrap>{{'contracts.amount' | translate}}: ${{ ccontract.amount }}</p> <p class="ion-text-wrap">{{'contracts.amount' | translate}}: ${{ ccontract.amount }}</p>
<h2 text-wrap>{{'contracts.start_pin' | translate}}<b>{{ ccontract.code }}</b></h2> <h2 class="ion-text-wrap">{{'contracts.start_pin' | translate}}<b>{{ ccontract.code }}</b></h2>
<p text-wrap>{{'contracts.info_pin' | translate}}</p> <p class="ion-text-wrap">{{'contracts.info_pin' | translate}}</p>
</ion-label> </ion-label>
</ion-item> </ion-item>
<ion-button *ngIf="ccontract.past_due < 0" style="height: 4.0em; padding-right: 1.0em; padding-bottom:1.0em; float: right" color="danger" (click)="cancelContract(ccontract.id, ccontract.date)">{{'contracts.cancel_1.1' | translate}}<br>{{'contracts.cancel_1.2' | translate}}</ion-button> <ion-button *ngIf="ccontract.past_due < 0" style="height: 4.0em; padding-right: 1.0em; padding-bottom:1.0em; float: right" color="danger" (click)="cancelContract(ccontract.id, ccontract.date)">{{'contracts.cancel_1.1' | translate}}<br>{{'contracts.cancel_1.2' | translate}}</ion-button>

View File

@@ -13,11 +13,13 @@ import { User } from 'src/app/models/user';
selector: 'app-dashboard', selector: 'app-dashboard',
templateUrl: './dashboard.page.html', templateUrl: './dashboard.page.html',
styleUrls: ['./dashboard.page.scss'], styleUrls: ['./dashboard.page.scss'],
standalone: false
}) })
export class DashboardPage implements OnInit { export class DashboardPage implements OnInit {
private loading: any; private loading: any;
user!: User; user!: User;
userName: string = '';
categories: any[] = []; categories: any[] = [];
aux_categories: any[] = []; aux_categories: any[] = [];
showList: boolean = false; showList: boolean = false;
@@ -31,7 +33,7 @@ export class DashboardPage implements OnInit {
constructor( constructor(
private menu: MenuController, private menu: MenuController,
private navCtrl: NavController, private navCtrl: NavController,
private authService: AuthService, public authService: AuthService,
private ichambaService: IchambaService, private ichambaService: IchambaService,
private alertService: AlertService, private alertService: AlertService,
private translateService: TranslateService, private translateService: TranslateService,
@@ -62,7 +64,7 @@ export class DashboardPage implements OnInit {
this.getccontracts(); this.getccontracts();
} }
refresh(event) { refresh(event: any) {
this.getpcontracts(); this.getpcontracts();
this.ichambaService.getCurrentcontracts().subscribe( this.ichambaService.getCurrentcontracts().subscribe(
data => { data => {
@@ -144,10 +146,10 @@ export class DashboardPage implements OnInit {
this.presentAlert(id) this.presentAlert(id)
} else { */ } else { */
this.ichambaService.cancelContract(id).subscribe( this.ichambaService.cancelContract(id).subscribe(
data => { (data: any) => {
this.getccontracts(); this.getccontracts();
this.alertService.presentToast(data['message']); this.alertService.presentToast(data['message']);
}, error => { }, (error: any) => {
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']); this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']);
}); });
//} //}
@@ -188,7 +190,7 @@ check(category_string: String) {
this.navCtrl.navigateForward(['/category/', category_string]) this.navCtrl.navigateForward(['/category/', category_string])
} else { } else {
this.loading.dismiss(); this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.error')); this.alertService.presentToast(this.translateService.instant('alerts.no_service'));
} }
}, error => { }, error => {
this.loading.dismiss(); this.loading.dismiss();
@@ -198,12 +200,6 @@ check(category_string: String) {
} }
ionViewWillEnter() { ionViewWillEnter() {
this.authService.user().subscribe( this.authService.user().subscribe({ error: () => {} });
user => {
this.user = user;
// TODO: Send OneSignal tag when Capacitor plugin is configured
// OneSignal.sendTag("iChamba_ID", user['id'].toString());
}
);
} }
} }

View File

@@ -8,7 +8,7 @@
</ion-header> </ion-header>
<ion-content> <ion-content>
<h2 padding text-capitalize style="padding-bottom: 0.25em">{{'faq.header' | translate}}</h2> <h2 class="ion-padding ion-text-capitalize" style="padding-bottom: 0.25em">{{'faq.header' | translate}}</h2>
<ion-accordion-group [multiple]="true" [value]="['first', 'third']"> <ion-accordion-group [multiple]="true" [value]="['first', 'third']">
<ion-accordion> <ion-accordion>
<ion-item slot="header" color="light"> <ion-item slot="header" color="light">
@@ -18,49 +18,49 @@
</ion-accordion> </ion-accordion>
<ion-accordion> <ion-accordion>
<ion-item slot="header" color="light"> <ion-item slot="header" color="light">
<ion-label>{{'faq.faq_2' | translate}}®</ion-label> <ion-label>{{'faq.faq_2' | translate}}</ion-label>
</ion-item> </ion-item>
<div class="ion-padding" slot="content">{{'faq.faq_2.1' | translate}}</div> <div class="ion-padding" slot="content">{{'faq.faq_2.1' | translate}}</div>
</ion-accordion> </ion-accordion>
<ion-accordion> <ion-accordion>
<ion-item slot="header" color="light"> <ion-item slot="header" color="light">
<ion-label>{{'faq.faq_3' | translate}}®</ion-label> <ion-label>{{'faq.faq_3' | translate}}</ion-label>
</ion-item> </ion-item>
<div class="ion-padding" slot="content">{{'faq.faq_3.1' | translate}}</div> <div class="ion-padding" slot="content">{{'faq.faq_3.1' | translate}}</div>
</ion-accordion> </ion-accordion>
<ion-accordion> <ion-accordion>
<ion-item slot="header" color="light"> <ion-item slot="header" color="light">
<ion-label>{{'faq.faq_4' | translate}}®</ion-label> <ion-label>{{'faq.faq_4' | translate}}</ion-label>
</ion-item> </ion-item>
<div class="ion-padding" slot="content">{{'faq.faq_4.1' | translate}}</div> <div class="ion-padding" slot="content">{{'faq.faq_4.1' | translate}}</div>
</ion-accordion> </ion-accordion>
<ion-accordion> <ion-accordion>
<ion-item slot="header" color="light"> <ion-item slot="header" color="light">
<ion-label>{{'faq.faq_5' | translate}}®</ion-label> <ion-label>{{'faq.faq_5' | translate}}</ion-label>
</ion-item> </ion-item>
<div class="ion-padding" slot="content">{{'faq.faq_5.1' | translate}}</div> <div class="ion-padding" slot="content">{{'faq.faq_5.1' | translate}}</div>
</ion-accordion> </ion-accordion>
<ion-accordion> <ion-accordion>
<ion-item slot="header" color="light"> <ion-item slot="header" color="light">
<ion-label>{{'faq.faq_6' | translate}}®</ion-label> <ion-label>{{'faq.faq_6' | translate}}</ion-label>
</ion-item> </ion-item>
<div class="ion-padding" slot="content">{{'faq.faq_6.1' | translate}}</div> <div class="ion-padding" slot="content">{{'faq.faq_6.1' | translate}}</div>
</ion-accordion> </ion-accordion>
<ion-accordion> <ion-accordion>
<ion-item slot="header" color="light"> <ion-item slot="header" color="light">
<ion-label>{{'faq.faq_7' | translate}}®</ion-label> <ion-label>{{'faq.faq_7' | translate}}</ion-label>
</ion-item> </ion-item>
<div class="ion-padding" slot="content">{{'faq.faq_7.1' | translate}}</div> <div class="ion-padding" slot="content">{{'faq.faq_7.1' | translate}}</div>
</ion-accordion> </ion-accordion>
<ion-accordion> <ion-accordion>
<ion-item slot="header" color="light"> <ion-item slot="header" color="light">
<ion-label>{{'faq.faq_8' | translate}}®</ion-label> <ion-label>{{'faq.faq_8' | translate}}</ion-label>
</ion-item> </ion-item>
<div class="ion-padding" slot="content">{{'faq.faq_8.1' | translate}}</div> <div class="ion-padding" slot="content">{{'faq.faq_8.1' | translate}}</div>
</ion-accordion> </ion-accordion>
<ion-accordion> <ion-accordion>
<ion-item slot="header" color="light"> <ion-item slot="header" color="light">
<ion-label>{{'faq.faq_9' | translate}}®</ion-label> <ion-label>{{'faq.faq_9' | translate}}</ion-label>
</ion-item> </ion-item>
<div class="ion-padding" slot="content">{{'faq.faq_9.1' | translate}}</div> <div class="ion-padding" slot="content">{{'faq.faq_9.1' | translate}}</div>
</ion-accordion> </ion-accordion>

View File

@@ -1,5 +1,5 @@
ion-accordion.accordion-expanding ion-item[slot='header'], ion-accordion.accordion-expanding ion-item[slot='header'],
ion-accordion.accordion-expanded ion-item[slot='header'] { ion-accordion.accordion-expanded ion-item[slot='header'] {
--background: var(--ion-color-primary); --ion-color-base: var(--ion-color-primary) !important;
--color: var(--ion-color-primary-contrast); --ion-color-contrast: var(--ion-color-primary-contrast) !important;
} }

View File

@@ -4,6 +4,7 @@ import { Component, OnInit } from '@angular/core';
selector: 'app-faq', selector: 'app-faq',
templateUrl: './faq.page.html', templateUrl: './faq.page.html',
styleUrls: ['./faq.page.scss'], styleUrls: ['./faq.page.scss'],
standalone: false
}) })
export class FaqPage implements OnInit { export class FaqPage implements OnInit {

View File

@@ -9,60 +9,124 @@
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<ion-item> <ion-item [class.ion-invalid]="(submitted || touched['name']) && !name" [class.ion-touched]="submitted || touched['name']">
<ion-label position="floating">{{'hero.name' | translate}}</ion-label> <ion-label position="floating">{{'hero.name' | translate}}</ion-label>
<ion-input [(ngModel)]="name"></ion-input> <ion-input [(ngModel)]="name" (ionBlur)="markTouched('name')"></ion-input>
</ion-item> </ion-item>
<br> <span class="error-msg" *ngIf="(submitted || touched['name']) && !name">{{'hero.required' | translate}}</span>
<ion-item> <ion-item [class.ion-invalid]="(submitted || touched['rfc']) && !rfc" [class.ion-touched]="submitted || touched['rfc']">
<ion-label>{{'hero.categories' | translate}}</ion-label> <ion-label position="floating">RFC</ion-label>
<ion-select [(ngModel)]="categories_input" multiple="true" okText="Aceptar" cancelText="Cancelar" placeholder="{{'hero.categories_placeholder' | translate}}"> <ion-input [(ngModel)]="rfc" (ionBlur)="markTouched('rfc')"></ion-input>
<ion-select-option *ngFor="let category of categories" [value]="category">{{category}}</ion-select-option>
</ion-select>
</ion-item> </ion-item>
<br> <span class="error-msg" *ngIf="(submitted || touched['rfc']) && !rfc">{{'hero.required' | translate}}</span>
<ion-item> <!-- CATEGORÍAS CON CHIPS -->
<ion-label position="floating">{{'hero.keywords' | translate}}</ion-label> <div class="dropdown-container">
<ion-input [(ngModel)]="keywords_text" placeholder="{{'hero.keywords_placeholder' | translate}}"></ion-input> <ion-item class="tags-item" [class.ion-invalid]="(submitted || touched['categories']) && categories_input.length === 0" [class.ion-touched]="submitted || touched['categories']">
</ion-item> <div class="tags-row">
<ion-note padding>{{'hero.keywords_hint' | translate}}</ion-note> <span class="chip-section-label">{{'hero.categories' | translate}}</span>
<ion-chip *ngFor="let cat of categories_input" color="primary">
<ion-label color="light">_</ion-label> <ion-label>{{cat}}</ion-label>
<ion-icon name="close-circle" (click)="removeCategory(cat)"></ion-icon>
<ion-item> </ion-chip>
<ion-label position="floating">Dirección</ion-label> <ion-input
<ion-input [(ngModel)]="addressAutocomplete" (ionChange)="autocomplete($event)" value="{{ myAddress }}" (ionFocus)="showlist()"></ion-input> [(ngModel)]="categorySearchText"
</ion-item> (ionInput)="filterCategories($event)"
<ion-list *ngIf="showif"> (ionBlur)="hideCategoryList()"
<ion-item button=true (click)="geoloc(places.place_id, places.description, places.terms[1].value)" *ngFor="let places of placesSearch" class="place"> [clearInput]="true"
{{ places.description }} placeholder="{{'hero.categories_placeholder' | translate}}">
</ion-input>
</div>
</ion-item> </ion-item>
</ion-list> <span class="error-msg" *ngIf="(submitted || touched['categories']) && categories_input.length === 0">Selecciona al menos una categoría</span>
<ion-item hidden> <ion-list *ngIf="showCategoryDropdown && filteredCategories.length > 0" class="dropdown-list">
<ion-item *ngFor="let category of filteredCategories" button (click)="selectCategory(category)">
{{category}}
</ion-item>
</ion-list>
</div>
<!-- PALABRAS CLAVE CON CHIPS -->
<ion-item class="tags-item">
<div class="tags-row">
<span class="chip-section-label">{{'hero.keywords' | translate}}</span>
<ion-chip *ngFor="let keyword of keywords" color="primary">
<ion-label>{{keyword}}</ion-label>
<ion-icon name="close-circle" (click)="removeKeyword(keyword)"></ion-icon>
</ion-chip>
<ion-input
[(ngModel)]="keywordInput"
(keydown)="onKeywordKeydown($event)"
(ionBlur)="addKeyword($event)"
placeholder="{{'hero.keywords_placeholder' | translate}}">
</ion-input>
</div>
</ion-item>
<ion-note class="ion-padding">{{'hero.keywords_hint' | translate}}</ion-note>
<!-- DIRECCIÓN CON AUTOCOMPLETE FLOTANTE -->
<div class="dropdown-container">
<ion-item [class.ion-invalid]="(submitted || touched['address']) && !myAddress" [class.ion-touched]="submitted || touched['address']">
<ion-label position="floating">{{'categories.address' | translate}}</ion-label>
<ion-input [(ngModel)]="addressAutocomplete" (ionInput)="autocomplete($event)" (ionFocus)="showlist()" (ionBlur)="blurAddressList()" [clearInput]="true"></ion-input>
</ion-item>
<span class="error-msg" *ngIf="(submitted || touched['address']) && !myAddress">{{'alerts.valid_address' | translate}}</span>
<ion-list *ngIf="showif && placesSearch?.length" class="dropdown-list">
<ion-item button=true (click)="geoloc(places.place_id, places.description, places.terms[1].value)" *ngFor="let places of placesSearch" class="place">
{{ places.description }}
</ion-item>
</ion-list>
</div>
<ion-item class="ion-hide">
<ion-label position="fixed">Latitud</ion-label> <ion-label position="fixed">Latitud</ion-label>
<ion-input value="{{ myPosition.latitude }}" disabled></ion-input> <ion-input value="{{ myPosition.latitude }}" disabled></ion-input>
</ion-item> </ion-item>
<ion-item hidden> <ion-item class="ion-hide">
<ion-label position="fixed">Longitud</ion-label> <ion-label position="fixed">Longitud</ion-label>
<ion-input value="{{ myPosition.longitude }}" disabled></ion-input> <ion-input value="{{ myPosition.longitude }}" disabled></ion-input>
</ion-item> </ion-item>
<ion-item>
<ion-label>{{'hero.discover' | translate}}</ion-label> <ion-item [class.ion-invalid]="(submitted || touched['bank']) && selectedBank === null" [class.ion-touched]="submitted || touched['bank']">
<ion-select value={selectedReference} okText="Aceptar" cancelText="Cancelar" (ionChange)="selected_reference($event)"> <ion-label>{{'hero.bank' | translate}}</ion-label>
<ion-select-option value="1">{{'hero.radio' | translate}}</ion-select-option> <ion-select [(ngModel)]="selectedBank" placeholder="{{'hero.select' | translate}}" okText="Aceptar" cancelText="Cancelar" (ionBlur)="markTouched('bank')">
<ion-select-option value="2">{{'hero.tv' | translate}}</ion-select-option> <ion-select-option *ngFor="let bank of banks" [value]="bank.id">{{bank.name}}</ion-select-option>
<ion-select-option value="3">{{'hero.social' | translate}}</ion-select-option>
<ion-select-option value="4">{{'hero.friends' | translate}}</ion-select-option>
<ion-select-option value="5">{{'hero.other' | translate}}</ion-select-option>
</ion-select> </ion-select>
</ion-item> </ion-item>
<ion-item *ngIf="showinput"> <span class="error-msg" *ngIf="(submitted || touched['bank']) && selectedBank === null">{{'hero.required' | translate}}</span>
<ion-label position="floating">{{'hero.discover_details' | translate}}</ion-label>
<ion-input [(ngModel)]="reference"></ion-input> <ion-item [class.ion-invalid]="(submitted || touched['bankAccount']) && !bankAccount" [class.ion-touched]="submitted || touched['bankAccount']">
<ion-label position="floating">{{'hero.bank_account' | translate}}</ion-label>
<ion-input [(ngModel)]="bankAccount" type="number" (ionBlur)="markTouched('bankAccount')"></ion-input>
</ion-item> </ion-item>
<span class="error-msg" *ngIf="(submitted || touched['bankAccount']) && !bankAccount">{{'hero.required' | translate}}</span>
<ion-item [class.ion-invalid]="(submitted || touched['fee']) && fee === null" [class.ion-touched]="submitted || touched['fee']">
<ion-label position="floating">{{'hero.fee' | translate}}</ion-label>
<ion-input [(ngModel)]="feeDisplay" (ionInput)="onFeeInput($event)" (ionBlur)="markTouched('fee')" type="text" inputmode="decimal"></ion-input>
</ion-item>
<span class="error-msg" *ngIf="(submitted || touched['fee']) && fee === null">{{'hero.required' | translate}}</span>
<ion-item [class.ion-invalid]="(submitted || touched['reference']) && !selectedReference" [class.ion-touched]="submitted || touched['reference']">
<ion-label>{{'hero.discover' | translate}}</ion-label>
<ion-select [(ngModel)]="selectedReference" placeholder="{{'hero.select' | translate}}" okText="Aceptar" cancelText="Cancelar" (ionChange)="selected_reference($event)" (ionBlur)="markTouched('reference')">
<ion-select-option [value]="1">{{'hero.radio' | translate}}</ion-select-option>
<ion-select-option [value]="2">{{'hero.tv' | translate}}</ion-select-option>
<ion-select-option [value]="3">{{'hero.social' | translate}}</ion-select-option>
<ion-select-option [value]="4">{{'hero.friends' | translate}}</ion-select-option>
<ion-select-option [value]="5">{{'hero.other' | translate}}</ion-select-option>
</ion-select>
</ion-item>
<span class="error-msg" *ngIf="(submitted || touched['reference']) && !selectedReference">{{'hero.required' | translate}}</span>
<ion-item *ngIf="showinput" [class.ion-invalid]="(submitted || touched['referenceDetail']) && !reference" [class.ion-touched]="submitted || touched['referenceDetail']">
<ion-label position="floating">{{'hero.discover_details' | translate}}</ion-label>
<ion-input [(ngModel)]="reference" (ionBlur)="markTouched('referenceDetail')"></ion-input>
</ion-item>
<span class="error-msg" *ngIf="(submitted || touched['referenceDetail']) && showinput && !reference">{{'hero.required' | translate}}</span>
<br> <br>
<br> <br>
<ion-button type="submit" expand="full" color="secondary" (click)="addHero()">{{'hero.signup' | translate}}</ion-button> <ion-button type="submit" expand="full" color="secondary" (click)="addHero()">{{'hero.signup' | translate}}</ion-button>

View File

@@ -0,0 +1,95 @@
.tags-item {
--inner-padding-end: 8px;
--padding-top: 4px;
--padding-bottom: 4px;
}
.chip-section-label {
flex-basis: 100%;
font-size: 12px;
padding-top: 8px;
padding-bottom: 2px;
}
.tags-row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 4px;
padding: 0 0 6px;
width: 100%;
ion-chip {
margin: 0;
height: 30px;
flex-shrink: 0;
ion-label {
font-size: 13px;
}
ion-icon {
cursor: pointer;
font-size: 18px;
}
}
ion-input {
min-width: 120px;
flex: 1;
}
}
.dropdown-container {
position: relative;
}
.dropdown-list {
position: absolute;
top: 100%;
left: 16px;
right: 16px;
z-index: 100;
max-height: 200px;
overflow-y: auto;
border: 1px solid var(--ion-color-light-shade);
border-radius: 8px;
background: var(--ion-background-color, #fff);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
ion-item {
--min-height: 40px;
font-size: 14px;
cursor: pointer;
&:hover {
--background: var(--ion-color-light);
}
}
}
ion-item.ion-invalid.ion-touched {
--border-color: var(--ion-color-danger);
--highlight-color-invalid: var(--ion-color-danger);
ion-label {
color: var(--ion-color-danger) !important;
}
}
.error-msg {
display: block;
font-size: 12px;
color: var(--ion-color-danger);
padding: 2px 16px 4px;
}
ion-chip[color="primary"] {
--background: var(--ion-color-primary);
--color: var(--ion-color-primary-contrast);
}
ion-chip[color="secondary"] {
--background: var(--ion-color-secondary);
--color: var(--ion-color-secondary-contrast);
}

View File

@@ -1,6 +1,8 @@
import { Component, OnInit, NgZone } from '@angular/core'; import { Component, OnInit, NgZone } from '@angular/core';
import { NavController, LoadingController } from '@ionic/angular'; import { NavController, LoadingController } from '@ionic/angular';
import { AuthService } from 'src/app/services/auth.service'; import { AuthService } from 'src/app/services/auth.service';
import { TranslateService } from '@ngx-translate/core';
import { LanguageService } from 'src/app/services/language.service';
import { IchambaService } from 'src/app/services/ichamba.service'; import { IchambaService } from 'src/app/services/ichamba.service';
import { AlertService } from 'src/app/services/alert.service'; import { AlertService } from 'src/app/services/alert.service';
@@ -10,6 +12,7 @@ declare var google: any;
selector: 'app-hero', selector: 'app-hero',
templateUrl: './hero.page.html', templateUrl: './hero.page.html',
styleUrls: ['./hero.page.scss'], styleUrls: ['./hero.page.scss'],
standalone: false
}) })
export class HeroPage implements OnInit { export class HeroPage implements OnInit {
@@ -17,139 +20,224 @@ export class HeroPage implements OnInit {
categories: any[] = []; categories: any[] = [];
categories_input: any[] = []; categories_input: any[] = [];
categories_rearranged: any[] = []; categories_rearranged: any[] = [];
keywords: any[] = []; filteredCategories: any[] = [];
keywords_string: any[] = []; categorySearchText: string = '';
keywords_text: string = ''; showCategoryDropdown: boolean = false;
aux_categories: any[] = []; keywords: string[] = [];
keywordInput: string = '';
myPosition: any = {}; myPosition: any = {};
myAddress: string | null = null; myAddress: string | null = null;
myIntnumber: string | null = null; myIntnumber: string | null = null;
banks: any[] = [];
reference: string | null = null; reference: string | null = null;
name: string | null = null; name: string | null = null;
rfc: string | null = null;
selectedBank: number | null = null;
bankAccount: number | null = null;
fee: number | null = null;
feeDisplay: string = '';
selectedReference: number = 0; selectedReference: number = 0;
addressAutocomplete: string = ''; addressAutocomplete: string = '';
placesSearch: any = ''; placesSearch: any = '';
showinput: boolean = false; showinput: boolean = false;
showif = true; showif = true;
submitted: boolean = false;
touched: { [key: string]: boolean } = {};
constructor( constructor(
private navCtrl: NavController, private navCtrl: NavController,
private loadingCtrl: LoadingController, private loadingCtrl: LoadingController,
private authService: AuthService, private authService: AuthService,
private alertService: AlertService, private alertService: AlertService,
private translateService: TranslateService,
private languageService: LanguageService,
private ichambaService: IchambaService, private ichambaService: IchambaService,
private ngZone: NgZone, private ngZone: NgZone,
) { } ) { }
ngOnInit() { ngOnInit() {
/*this.categories = ["carpintero","jardinero","abogado","administrador","agente inmobiliario","agente de seguros","albañil",
"arquitecto","asistente personal","becario","cerrajero","chef","chofer","contratista","contador","diseñador de interiores",
"cantante","diseñador grafico","edecan","electricista","estilista","servicios financieros","fontanero","fotografo","produccion de videos",
"hostess","lavado de tapicerias","aire acondicionado","almacenista","ayudante","azulejero","cerrajero automotriz","cortinas metalicas",
"electrico automotriz","entretenimiento","fisioterapeuta","grua","herrero","ingeniero civil","laminado automotriz","limpieza","limpieza del hogar",
"mantenimiento","mariachi","masajista","marmolero","mecanico","mercadotecnia","mesero","modelo","musico","niñera","pintor","pintura automotriz",
"plomero","programador","publicista","recepcionista","remodelacion","repartidor","reparacion de celulares","reparacion de electronicos","soldador",
"tabla roquero","tapicero","tecnico en gas","tuneame la nave","traductor","tutor","vendedor","veterinario","vidrio y aluminio","reparacion de computadoras",
"mantenimiento de camiones","consultor","capacitacion","maestro","barbero","agencia de colocacion","agencia de viajes","paseador de perros","banquete",
"almacenaje","impermeabilizacion","redes de internet"];*/
this.ichambaService.getCategories() this.ichambaService.getCategories()
.subscribe( categories => { .subscribe( categories => {
this.categories = categories; this.categories = categories;
this.aux_categories = categories; this.filteredCategories = categories;
})
this.ichambaService.getBanks()
.subscribe( banks => {
this.banks = banks;
}) })
} }
// ========== CATEGORÍAS CON CHIPS ==========
filterCategories(event: any) {
const searchTerm = (event.detail?.value || event.target?.value || '').toLowerCase();
this.categorySearchText = searchTerm;
if (searchTerm.length > 0) {
this.filteredCategories = this.categories.filter(cat =>
cat.toLowerCase().includes(searchTerm) && !this.categories_input.includes(cat)
);
this.showCategoryDropdown = true;
} else {
this.filteredCategories = this.categories.filter(cat => !this.categories_input.includes(cat));
this.showCategoryDropdown = false;
}
}
selectCategory(category: string) {
if (!this.categories_input.includes(category)) {
this.categories_input.push(category);
}
this.categorySearchText = '';
this.showCategoryDropdown = false;
this.filteredCategories = this.categories.filter(cat => !this.categories_input.includes(cat));
}
removeCategory(category: string) {
const index = this.categories_input.indexOf(category);
if (index > -1) {
this.categories_input.splice(index, 1);
}
this.filteredCategories = this.categories.filter(cat => !this.categories_input.includes(cat));
}
hideCategoryList() {
setTimeout(() => {
this.showCategoryDropdown = false;
this.touched['categories'] = true;
}, 200);
}
// ========== PALABRAS CLAVE CON CHIPS ==========
addKeyword(event?: any) {
this.touched['keywords'] = true;
const value = this.keywordInput?.trim();
if (value && value.length > 0) {
// Separar por comas si hay varias palabras
const newKeywords = value.split(',').map((k: string) => k.trim()).filter((k: string) => k.length > 0);
newKeywords.forEach((keyword: string) => {
if (!this.keywords.includes(keyword)) {
this.keywords.push(keyword);
}
});
this.keywordInput = '';
}
}
onKeywordKeydown(event: KeyboardEvent) {
if (event.key === 'Enter' || event.key === ',') {
event.preventDefault();
this.addKeyword();
} else if (event.key === 'Backspace' && !this.keywordInput && this.keywords.length > 0) {
this.keywords.pop();
}
}
removeKeyword(keyword: string) {
const index = this.keywords.indexOf(keyword);
if (index > -1) {
this.keywords.splice(index, 1);
}
}
dismissHero() { dismissHero() {
this.navCtrl.navigateRoot('/landing'); this.navCtrl.navigateRoot('/dashboard');
} }
autocomplete(ev: any) { autocomplete(ev: any) {
if (!this.addressAutocomplete.trim().length) { const value = (ev.detail?.value ?? this.addressAutocomplete).trim();
this.myAddress = null;
if (!value.length) {
this.placesSearch = null; this.placesSearch = null;
return;
} }
console.log(this.addressAutocomplete) new google.maps.places.AutocompleteService().getPredictions({ input: value }, (predictions: any) => {
new google.maps.places.AutocompleteService().getPredictions({ input: this.addressAutocomplete }, predictions => {
this.ngZone.run(() => { this.ngZone.run(() => {
this.placesSearch = predictions; this.placesSearch = predictions;
console.log(predictions);
}); });
}); });
} }
geoloc(place_id: string, place_description: string, place_intnumber: string) { geoloc(place_id: string, place_description: string, place_intnumber: string) {
this.myAddress = place_description; this.myAddress = place_description;
this.addressAutocomplete = place_description;
this.myIntnumber = place_intnumber; this.myIntnumber = place_intnumber;
console.log(place_id); this.placesSearch = null;
this.hidelist(); this.hidelist();
new google.maps.Geocoder().geocode({ placeId: place_id }, coordinates => { new google.maps.Geocoder().geocode({ placeId: place_id }, (coordinates: any) => {
this.ngZone.run(() => { this.ngZone.run(() => {
console.log(coordinates[0].geometry.location.lat() + ", " + coordinates[0].geometry.location.lng()); const result = coordinates[0];
this.myPosition = { this.myPosition = {
latitude: coordinates[0].geometry.location.lat(), latitude: result.geometry.location.lat(),
longitude: coordinates[0].geometry.location.lng() longitude: result.geometry.location.lng()
} };
}); });
}); });
} }
selected_reference(ev: any) { selected_reference(ev: any) {
console.log(ev.target.value); this.showinput = ev.detail.value === 5;
this.selectedReference = ev.target.value; }
if (this.selectedReference == 5) {
this.showinput = true; onFeeInput(ev: any) {
} else { const raw = (ev.detail?.value ?? '').replace(/[^0-9.]/g, '');
this.showinput = false; const parts = raw.split('.');
} const integer = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
const decimal = parts.length > 1 ? '.' + parts[1].slice(0, 2) : '';
this.feeDisplay = raw ? `$${integer}${decimal}` : '';
this.fee = raw ? parseFloat(raw) : null;
} }
addHero(){ addHero(){
// categories_input is now an array of values directly from ion-select this.submitted = true;
this.categories_rearranged = this.categories_input.slice(); const categoriesString = this.categories_input.join(',');
const keywordsString = this.keywords.length > 0 ? this.keywords.join(', ') : '';
// keywords_text is now a string, split by comma if (
if (this.keywords_text && this.keywords_text.trim().length > 0) { this.name &&
this.keywords_string = this.keywords_text.split(',').map(k => k.trim()).filter(k => k.length > 0); this.rfc &&
} this.categories_input.length > 0 &&
this.myAddress &&
if (this.name && this.categories_input && this.myAddress && this.myPosition.latitude && this.myPosition.longitude && this.selectedReference){ this.myPosition.latitude &&
if (this.selectedReference == 5 && this.reference) { this.myPosition.longitude &&
this.loadingCtrl.create().then((overlay) => { this.selectedBank !== null &&
this.loading = overlay; this.bankAccount &&
this.loading.present(); this.fee !== null &&
}); this.selectedReference
) {
this.ichambaService.addHero(this.name, this.categories_rearranged.join(','), (this.keywords_string.join(', ') == "" ? null : this.keywords_string.join(', ')), this.myAddress, this.myPosition.latitude, this.myPosition.longitude, this.selectedReference, this.reference).subscribe( if (this.selectedReference === 5 && !this.reference) {
data => {
this.loading.dismiss();
this.alertService.presentToast(data['message']);
this.navCtrl.navigateRoot('/dashboard');
}, error => {
this.loading.dismiss();
this.alertService.presentToast("Por favor contacte a soporte técnico, Estatus:" + error['status']);
});
} else if (this.selectedReference !== 5) {
this.loadingCtrl.create().then((overlay) => {
this.loading = overlay;
this.loading.present();
});
this.ichambaService.addHero(this.name, this.categories_rearranged.join(','), (this.keywords_string.join(', ') == "" ? null : this.keywords_string.join(', ')), this.myAddress, this.myPosition.latitude, this.myPosition.longitude, this.selectedReference, this.reference).subscribe(
data => {
this.loading.dismiss();
this.alertService.presentToast(data['message']);
this.navCtrl.navigateRoot('/dashboard');
}, error => {
this.loading.dismiss();
this.alertService.presentToast("Por favor contacte a soporte técnico, Estatus:" + error['status']);
});
} else {
this.alertService.presentToast("Por favor, específique cómo supo de nosotros"); this.alertService.presentToast("Por favor, específique cómo supo de nosotros");
return;
} }
this.loadingCtrl.create().then((overlay) => {
this.loading = overlay;
this.loading.present();
});
this.ichambaService.addHero(this.name!, this.rfc!, categoriesString, keywordsString, this.myAddress!, this.myPosition.latitude, this.myPosition.longitude, this.selectedBank ?? 0, this.bankAccount ?? 0, this.fee ?? 0, this.selectedReference, this.reference ?? '').subscribe(
(data: any) => {
if (this.loading) this.loading.dismiss();
this.alertService.presentToast(data['message']);
this.navCtrl.navigateRoot('/dashboard');
}, (error: any) => {
if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['status']);
});
} else { } else {
this.alertService.presentToast("Llene todos los datos solicitados"); this.alertService.presentToast("Llene todos los datos solicitados");
} }
} }
markTouched(field: string) {
this.touched[field] = true;
}
blurAddressList() {
setTimeout(() => {
this.hidelist();
this.touched['address'] = true;
}, 200);
}
showlist() { showlist() {
this.showif = true; this.showif = true;
} }

View File

@@ -6,6 +6,10 @@ ion-footer {
--ion-background-color: #175ccc; --ion-background-color: #175ccc;
} }
ion-footer ion-button::part(native) {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
ion-header ion-toolbar { ion-header ion-toolbar {
--min-height: 60px; --min-height: 60px;
} }

View File

@@ -11,6 +11,7 @@ register();
selector: 'app-landing', selector: 'app-landing',
templateUrl: './landing.page.html', templateUrl: './landing.page.html',
styleUrls: ['./landing.page.scss'], styleUrls: ['./landing.page.scss'],
standalone: false
}) })
export class LandingPage implements OnInit { export class LandingPage implements OnInit {

View File

@@ -6,8 +6,8 @@
<ion-title>Postulaciones</ion-title> <ion-title>Postulaciones</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<h2 text-capitalize style="padding-bottom: 0.5em">Ya contratado</h2> <h2 class="ion-text-capitalize" style="padding-bottom: 0.5em">Ya contratado</h2>
<ion-refresher slot="fixed" (ionRefresh)="refresh($event)"> <ion-refresher slot="fixed" (ionRefresh)="refresh($event)">
<ion-refresher-content></ion-refresher-content> <ion-refresher-content></ion-refresher-content>
</ion-refresher> </ion-refresher>
@@ -15,13 +15,13 @@
<ion-card> <ion-card>
<ion-item> <ion-item>
<ion-label> <ion-label>
<h2 text-capitalize>{{ postulation.category }}</h2> <h2 class="ion-text-capitalize">{{ postulation.category }}</h2>
<ion-text color="primary"><p text-wrap (click)="openMaps(postulation.lat, postulation.lng)"><b><u>{{postulation.address}}</u></b></p></ion-text> <ion-text color="primary"><p class="ion-text-wrap" (click)="openMaps(postulation.lat, postulation.lng)"><b><u>{{postulation.address}}</u></b></p></ion-text>
<p text-wrap>Télefono: <a href="tel:{{ postulation.phone }}">{{ postulation.phone }}</a></p> <p class="ion-text-wrap">Télefono: <a href="tel:{{ postulation.phone }}">{{ postulation.phone }}</a></p>
<p text-wrap>Referencias: {{postulation.references}}</p> <p class="ion-text-wrap">Referencias: {{postulation.references}}</p>
<p text-wrap text-capitalize>{{postulations_dates[i]}}</p> <p class="ion-text-wrap ion-text-capitalize">{{postulations_dates[i]}}</p>
<p text-wrap>Monto: {{postulation.amount}}</p> <p class="ion-text-wrap">Monto: {{postulation.amount}}</p>
<p text-wrap>Detalles: {{postulation.details}}</p> <p class="ion-text-wrap">Detalles: {{postulation.details}}</p>
</ion-label> </ion-label>
</ion-item> </ion-item>
</ion-card> </ion-card>

View File

@@ -11,6 +11,7 @@ import { Browser } from '@capacitor/browser';
selector: 'app-already', selector: 'app-already',
templateUrl: './already.page.html', templateUrl: './already.page.html',
styleUrls: ['./already.page.scss'], styleUrls: ['./already.page.scss'],
standalone: false
}) })
export class AlreadyPage implements OnInit { export class AlreadyPage implements OnInit {

View File

@@ -6,8 +6,8 @@
<ion-title>Postulaciones</ion-title> <ion-title>Postulaciones</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<h2 text-capitalize style="padding-bottom: 0.5em">Por postularse</h2> <h2 class="ion-text-capitalize" style="padding-bottom: 0.5em">Por postularse</h2>
<ion-refresher slot="fixed" (ionRefresh)="refresh($event)"> <ion-refresher slot="fixed" (ionRefresh)="refresh($event)">
<ion-refresher-content></ion-refresher-content> <ion-refresher-content></ion-refresher-content>
</ion-refresher> </ion-refresher>
@@ -15,12 +15,12 @@
<ion-card *ngIf="!postulation.already_post"> <ion-card *ngIf="!postulation.already_post">
<ion-item> <ion-item>
<ion-label> <ion-label>
<h2 text-capitalize>{{ postulation.category }}</h2> <h2 class="ion-text-capitalize">{{ postulation.category }}</h2>
<ion-text color="primary"><p text-wrap (click)="openMaps(postulation.lat, postulation.lng)"><b><u>{{postulation.address}}</u></b></p></ion-text> <ion-text color="primary"><p class="ion-text-wrap" (click)="openMaps(postulation.lat, postulation.lng)"><b><u>{{postulation.address}}</u></b></p></ion-text>
<p text-wrap>Referencias: {{postulation.references}}</p> <p class="ion-text-wrap">Referencias: {{postulation.references}}</p>
<p text-wrap text-capitalize>{{postulations_dates[i]}}</p> <p class="ion-text-wrap ion-text-capitalize">{{postulations_dates[i]}}</p>
<p text-wrap>Detalles: {{postulation.details}}</p> <p class="ion-text-wrap">Detalles: {{postulation.details}}</p>
<p text-wrap>Tiempo restante: {{postulation.time_limit}} minutos</p> <p class="ion-text-wrap">Tiempo restante: {{postulation.time_limit}} minutos</p>
</ion-label> </ion-label>
<ion-button style="height: 3em; padding-left: 0.5em;" color="secondary" (click)="addpostulation(postulation.id)">Postularse</ion-button> <ion-button style="height: 3em; padding-left: 0.5em;" color="secondary" (click)="addpostulation(postulation.id)">Postularse</ion-button>
</ion-item> </ion-item>

View File

@@ -11,6 +11,7 @@ import { Browser } from '@capacitor/browser';
selector: 'app-current', selector: 'app-current',
templateUrl: './current.page.html', templateUrl: './current.page.html',
styleUrls: ['./current.page.scss'], styleUrls: ['./current.page.scss'],
standalone: false
}) })
export class CurrentPage implements OnInit { export class CurrentPage implements OnInit {
@@ -35,7 +36,7 @@ export class CurrentPage implements OnInit {
this.getpostulations(); this.getpostulations();
} }
refresh(event) { refresh(event: any) {
this.ichambaService.getPostulation().subscribe( this.ichambaService.getPostulation().subscribe(
data => { data => {
this.postulations = data; this.postulations = data;
@@ -63,10 +64,10 @@ export class CurrentPage implements OnInit {
addpostulation(id: String) { addpostulation(id: String) {
this.ichambaService.setPostulation(id).subscribe( this.ichambaService.setPostulation(id).subscribe(
data => { (data: any) => {
this.getpostulations(); this.getpostulations();
this.alertService.presentToast(data['message']); this.alertService.presentToast(data['message']);
}, error => { }, (error: any) => {
this.alertService.presentToast("Por favor contacte a soporte técnico, Estatus:" + error['status']); this.alertService.presentToast("Por favor contacte a soporte técnico, Estatus:" + error['status']);
}); });
} }

View File

@@ -6,8 +6,8 @@
<ion-title>Postulaciones</ion-title> <ion-title>Postulaciones</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<h2 text-capitalize style="padding-bottom: 0.5em">Finalizadas</h2> <h2 class="ion-text-capitalize" style="padding-bottom: 0.5em">Finalizadas</h2>
<ion-refresher slot="fixed" (ionRefresh)="refresh($event)"> <ion-refresher slot="fixed" (ionRefresh)="refresh($event)">
<ion-refresher-content></ion-refresher-content> <ion-refresher-content></ion-refresher-content>
</ion-refresher> </ion-refresher>
@@ -15,10 +15,10 @@
<ion-card> <ion-card>
<ion-item> <ion-item>
<ion-label> <ion-label>
<h2 text-capitalize>{{ postulation.category }}</h2> <h2 class="ion-text-capitalize">{{ postulation.category }}</h2>
<p text-wrap>{{ postulation.address }}</p> <p class="ion-text-wrap">{{ postulation.address }}</p>
<p text-wrap text-capitalize>{{ postulations_dates[i] }}</p> <p class="ion-text-wrap ion-text-capitalize">{{ postulations_dates[i] }}</p>
<p text-wrap text-capitalize>Estado: {{ postulation.status }}</p> <p class="ion-text-wrap ion-text-capitalize">Estado: {{ postulation.status }}</p>
</ion-label> </ion-label>
<br> <br>
</ion-item> </ion-item>

View File

@@ -10,11 +10,12 @@ import { AlertService } from 'src/app/services/alert.service';
selector: 'app-ended', selector: 'app-ended',
templateUrl: './ended.page.html', templateUrl: './ended.page.html',
styleUrls: ['./ended.page.scss'], styleUrls: ['./ended.page.scss'],
standalone: false
}) })
export class EndedPage implements OnInit { export class EndedPage implements OnInit {
postulations = []; postulations: any[] = [];
postulations_dates = []; postulations_dates: any[] = [];
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
@@ -35,7 +36,7 @@ export class EndedPage implements OnInit {
this.getfinishedpostulations(); this.getfinishedpostulations();
} }
refresh(event) { refresh(event: any) {
this.ichambaService.getFinishedPostulation().subscribe( this.ichambaService.getFinishedPostulation().subscribe(
data => { data => {
this.postulations = data; this.postulations = data;

View File

@@ -10,6 +10,7 @@ import { AlertService } from 'src/app/services/alert.service';
selector: 'app-postulations', selector: 'app-postulations',
templateUrl: './postulations.page.html', templateUrl: './postulations.page.html',
styleUrls: ['./postulations.page.scss'], styleUrls: ['./postulations.page.scss'],
standalone: false
}) })
export class PostulationsPage implements OnInit { export class PostulationsPage implements OnInit {

View File

@@ -4,6 +4,7 @@ import { Component, OnInit } from '@angular/core';
selector: 'app-reports', selector: 'app-reports',
templateUrl: './reports.page.html', templateUrl: './reports.page.html',
styleUrls: ['./reports.page.scss'], styleUrls: ['./reports.page.scss'],
standalone: false
}) })
export class ReportsPage implements OnInit { export class ReportsPage implements OnInit {

View File

@@ -0,0 +1,33 @@
import { Injectable } from '@angular/core';
import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpErrorResponse } from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { NavController } from '@ionic/angular';
import { Preferences } from '@capacitor/preferences';
import { getApps } from 'firebase/app';
import { getAuth, signOut as firebaseSignOut } from 'firebase/auth';
@Injectable({ providedIn: 'root' })
export class AuthInterceptorService implements HttpInterceptor {
constructor(private navCtrl: NavController) {}
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
return next.handle(req).pipe(
catchError((error: HttpErrorResponse) => {
if (error.status === 401) {
this.clearAndRedirect();
}
return throwError(() => error);
})
);
}
private clearAndRedirect() {
Preferences.remove({ key: 'token' });
if (getApps().length > 0) {
firebaseSignOut(getAuth()).catch(() => {});
}
this.navCtrl.navigateRoot('/login');
}
}

View File

@@ -1,11 +1,14 @@
import { HttpClient, HttpHeaders } from '@angular/common/http'; import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { EventService } from './event.service'; import { EventService } from './event.service';
import { tap } from 'rxjs/operators'; import { of, firstValueFrom } from 'rxjs';
import { tap, catchError } from 'rxjs/operators';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Preferences } from '@capacitor/preferences'; import { Preferences } from '@capacitor/preferences';
import { EnvService } from './env.service'; import { EnvService } from './env.service';
import { User } from '../models/user'; import { User } from '../models/user';
import { getAuth, signOut as firebaseSignOut } from 'firebase/auth';
import { getApps } from 'firebase/app';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@@ -15,9 +18,12 @@ export class AuthService {
isLoggedIn = false; isLoggedIn = false;
isVerified = false; isVerified = false;
isReported = false; isReported = false;
userName: string = '';
userRole: number = 0;
role: any; role: any;
token:any; token: any;
userInfo:any; userInfo: any;
private initPromise: Promise<void> | null = null;
constructor( constructor(
private http: HttpClient, private http: HttpClient,
@@ -26,11 +32,11 @@ export class AuthService {
private router: Router private router: Router
) { } ) { }
login(email: String, password: String) { loginWithFirebase(idToken: string) {
return this.http.post(this.env.API_URL + 'auth/login', return this.http.post(this.env.API_URL + 'auth/firebase',
{email: email, password: password} { firebase_token: idToken }
).pipe( ).pipe(
tap(token => { tap((token: any) => {
if (token['verified'] != null) { if (token['verified'] != null) {
this.isVerified = true; this.isVerified = true;
} }
@@ -38,101 +44,90 @@ export class AuthService {
this.isReported = true; this.isReported = true;
} }
Preferences.set({ key: 'token', value: JSON.stringify(token) }) Preferences.set({ key: 'token', value: JSON.stringify(token) })
.then( .then(() => {
() => { console.log('Token Stored');
console.log('Token Stored'); }).catch(error => console.error('Error storing item', error));
}
).catch(error => console.error('Error storing item', error));
this.token = token; this.token = token;
this.isLoggedIn = true; this.isLoggedIn = true;
this.userRole = token['role'] ?? 0;
this.events.publish('set_role', token['role']); this.events.publish('set_role', token['role']);
return token; return token;
}), }),
); );
} }
login_register_fb(fb_token: String, fb_id: String) { registerWithFirebase(idToken: string, name: string, phone: string, email: string) {
return this.http.post(this.env.API_URL + 'auth/fb',
{access_token: fb_token, social_id: fb_id + "_facebook"}
).pipe(
tap(token => {
if (token['verified'] != null) {
this.isVerified = true;
}
if (token['reported'] == 1) {
this.isReported = true;
}
Preferences.set({ key: 'token', value: JSON.stringify(token) })
.then(
() => {
console.log('Token Stored');
}
).catch(error => console.error('Error storing item', error));
this.token = token;
this.isLoggedIn = true;
this.events.publish('set_role', token['role']);
return token;
}),
);
}
login_register_googlePlus(google_token: String, google_id: String) {
return this.http.post(this.env.API_URL + 'auth/google',
{access_token: google_token}
).pipe(
tap(token => {
if (token['verified'] != null) {
this.isVerified = true;
}
if (token['reported'] == 1) {
this.isReported = true;
}
Preferences.set({ key: 'token', value: JSON.stringify(token) })
.then(
() => {
console.log('Token Stored');
}
).catch(error => console.error('Error storing item', error));
this.token = token;
this.isLoggedIn = true;
this.events.publish('set_role', token['role']);
return token;
}),
);
}
register(name: String, email: String, phone: Number, password: String) {
return this.http.post(this.env.API_URL + 'auth/register', return this.http.post(this.env.API_URL + 'auth/register',
{name: name, email: email, phone: phone, password: password, secret: this.env.SECRET} { firebase_token: idToken, name: name, phone: phone, email: email }
) ).pipe(
tap((token: any) => {
if (token['verified'] != null) {
this.isVerified = true;
}
Preferences.set({ key: 'token', value: JSON.stringify(token) })
.catch(error => console.error('Error storing item', error));
this.token = token;
this.isLoggedIn = true;
this.events.publish('set_role', token['role']);
return token;
})
);
} }
logout() { logout() {
const headers = new HttpHeaders({ this.clearSession();
'Authorization': this.token["token_type"]+" "+this.token["access_token"]
}); const tokenType = this.token?.['token_type'];
return this.http.get(this.env.API_URL + 'auth/logout', { headers: headers }) const accessToken = this.token?.['access_token'];
.pipe( if (!tokenType || !accessToken) {
tap(data => { return of(null);
Preferences.remove({ key: 'token' }); }
this.isLoggedIn = false;
this.isVerified = false; const headers = new HttpHeaders({ 'Authorization': `${tokenType} ${accessToken}` });
delete this.token; return this.http.get(this.env.API_URL + 'auth/logout', { headers }).pipe(
return data; catchError(() => of(null))
}, );
error => { }
Preferences.remove({ key: 'token' });
this.isLoggedIn = false; initialize(): Promise<void> {
this.isVerified = false; if (!this.initPromise) {
}) this.initPromise = this.runInitialize();
) }
return this.initPromise;
}
private async runInitialize(): Promise<void> {
await this.getToken();
if (this.isLoggedIn) {
try {
await firstValueFrom(this.user());
} catch {
this.clearSession();
}
}
}
clearSession() {
this.initPromise = null;
if (getApps().length > 0) {
firebaseSignOut(getAuth()).catch(() => {});
}
Preferences.remove({ key: 'token' });
this.isLoggedIn = false;
this.isVerified = false;
this.userName = '';
this.userRole = 0;
delete this.token;
} }
user() { user() {
if (!this.token?.['token_type'] || !this.token?.['access_token']) {
return of(null);
}
const headers = new HttpHeaders({ const headers = new HttpHeaders({
'Authorization': this.token["token_type"]+" "+this.token["access_token"] 'Authorization': this.token["token_type"]+" "+this.token["access_token"]
}); });
return this.http.get<User>(this.env.API_URL + 'auth/user', { headers: headers }) return this.http.get<User>(this.env.API_URL + 'auth/user', { headers: headers })
.pipe( .pipe(
tap(user => { tap((user: any) => {
if (user['phone_verified_at'] != null) { if (user['phone_verified_at'] != null) {
this.isVerified = true; this.isVerified = true;
} else { } else {
@@ -143,9 +138,10 @@ export class AuthService {
} else { } else {
this.isReported = false; this.isReported = false;
} }
this.userName = user['name'] ?? '';
this.userRole = user['role_id'] ?? 0;
this.events.publish('set_role', user['role_id']); this.events.publish('set_role', user['role_id']);
console.log("after login:", user); console.log("after login:", user);
return user;
}) })
) )
} }
@@ -177,8 +173,4 @@ export class AuthService {
{ phone: phone_string }, { headers: headers }); { phone: phone_string }, { headers: headers });
} }
forgot(email: String) {
return this.http.post(this.env.API_URL + 'auth/forgot/password',
{ email: email });
}
} }

View File

@@ -4,11 +4,14 @@ import { Injectable } from '@angular/core';
providedIn: 'root' providedIn: 'root'
}) })
export class EnvService { export class EnvService {
API_URL = 'http://192.168.10.207:8080/api/'; API_URL = 'http://jobhero.test/api/';
SECRET = 'wBIIKuDbrxNKzQhAUGiZLoaoQ4MichAN3wP2AP7B'; SECRET = 'wBIIKuDbrxNKzQhAUGiZLoaoQ4MichAN3wP2AP7B';
MERCHANT_ID = 'm9k4beuso5az0wjqztvt'; MERCHANT_ID = 'm9k4beuso5az0wjqztvt';
PUBLIC_API_KEY = 'pk_9465179493384689a8d2da9adc825411'; PUBLIC_API_KEY = 'pk_9465179493384689a8d2da9adc825411';
ONESIGNAL_APP_ID = 'c854ae89-7ff7-4216-a70e-5fdff0cd8e10'; ONESIGNAL_APP_ID = 'c854ae89-7ff7-4216-a70e-5fdff0cd8e10';
// Bypass de pago para pruebas (cambiar a false para producción)
PAYMENT_BYPASS = true;
constructor() { } constructor() { }
} }

View File

@@ -0,0 +1,63 @@
import { Injectable } from '@angular/core';
import { initializeApp, getApps, FirebaseApp } from 'firebase/app';
import {
getAuth,
Auth,
GoogleAuthProvider,
OAuthProvider,
signInWithPopup,
signInWithEmailAndPassword,
createUserWithEmailAndPassword,
sendPasswordResetEmail,
signOut,
UserCredential
} from 'firebase/auth';
import { environment } from 'src/environments/environment';
@Injectable({
providedIn: 'root'
})
export class FirebaseAuthService {
private app: FirebaseApp;
private auth: Auth;
constructor() {
// Avoid re-initializing if Firebase is already initialized
this.app = getApps().length > 0
? getApps()[0]
: initializeApp(environment.firebaseConfig);
this.auth = getAuth(this.app);
}
async signInWithGoogle(): Promise<string> {
const provider = new GoogleAuthProvider();
const credential: UserCredential = await signInWithPopup(this.auth, provider);
return credential.user.getIdToken();
}
async signInWithApple(): Promise<string> {
const provider = new OAuthProvider('apple.com');
provider.addScope('email');
provider.addScope('name');
const credential: UserCredential = await signInWithPopup(this.auth, provider);
return credential.user.getIdToken();
}
async signInWithEmail(email: string, password: string): Promise<string> {
const credential: UserCredential = await signInWithEmailAndPassword(this.auth, email, password);
return credential.user.getIdToken();
}
async registerWithEmail(email: string, password: string): Promise<string> {
const credential: UserCredential = await createUserWithEmailAndPassword(this.auth, email, password);
return credential.user.getIdToken();
}
async sendPasswordReset(email: string): Promise<void> {
return sendPasswordResetEmail(this.auth, email);
}
async signOut(): Promise<void> {
return signOut(this.auth);
}
}

View File

@@ -26,6 +26,10 @@ export class IchambaService {
return this.http.get<any[]>(this.env.API_URL + 'parameters'); return this.http.get<any[]>(this.env.API_URL + 'parameters');
} }
getBanks() {
return this.http.get<any[]>(this.env.API_URL + 'banks');
}
checkCategories(category_string: String) { checkCategories(category_string: String) {
const headers = new HttpHeaders({ const headers = new HttpHeaders({
'Authorization': this.authService.token["token_type"]+" "+this.authService.token["access_token"] 'Authorization': this.authService.token["token_type"]+" "+this.authService.token["access_token"]
@@ -201,11 +205,11 @@ export class IchambaService {
{ contract_id: contract_id, amount: amount, card_id: card_id, code: code, device_id: device_id }, { headers: headers }); { contract_id: contract_id, amount: amount, card_id: card_id, code: code, device_id: device_id }, { headers: headers });
} }
addHero(name: String, categories: String, tags: String, address: String, lat: Number, lng: Number, reference_options: Number, reference: String) { addHero(name: String, rfc: String, categories: String, tags: String, address: String, lat: Number, lng: Number, bank: Number, bank_account: Number, fee: Number, reference_options: Number, reference: String) {
const headers = new HttpHeaders({ const headers = new HttpHeaders({
'Authorization': this.authService.token["token_type"]+" "+this.authService.token["access_token"] 'Authorization': this.authService.token["token_type"]+" "+this.authService.token["access_token"]
}); });
return this.http.post(this.env.API_URL + 'add-hero', return this.http.post(this.env.API_URL + 'add-hero',
{name: name, categories: categories, tags: tags, address: address, lat: lat, lng: lng, reference_options: reference_options, reference: reference}, { headers: headers }); {name: name, rfc: rfc, categories: categories, tags: tags, address: address, lat: lat, lng: lng, bank: bank, bank_account: bank_account, fee: fee, reference_options: reference_options, reference: reference}, { headers: headers });
} }
} }

View File

@@ -11,13 +11,13 @@ export class LanguageService {
) { } ) { }
getDefaultLanguage() { getDefaultLanguage() {
let language = this.translate.getBrowserLang(); let language = this.translate.getBrowserLang() ?? 'es';
this.translate.setDefaultLang(language); this.translate.setDefaultLang(language);
console.log(language); console.log(language);
return language; return language;
} }
setLanguage(setLang) { setLanguage(setLang: string) {
this.translate.use(setLang); this.translate.use(setLang);
} }
} }

View File

@@ -1,7 +1,9 @@
import { Injectable } from '@angular/core'; import { Injectable, NgZone } from '@angular/core';
import { Capacitor } from '@capacitor/core'; import { Capacitor } from '@capacitor/core';
import { NavController } from '@ionic/angular';
import { EnvService } from './env.service'; import { EnvService } from './env.service';
import { Router } from '@angular/router'; import { AlertService } from './alert.service';
import { EventService } from './event.service';
declare var OneSignalPlugin: any; declare var OneSignalPlugin: any;
@@ -13,78 +15,78 @@ export class OneSignalService {
constructor( constructor(
private env: EnvService, private env: EnvService,
private router: Router private navCtrl: NavController,
private alertService: AlertService,
private events: EventService,
private ngZone: NgZone,
) { } ) { }
async init(): Promise<void> { async init(): Promise<void> {
if (this.initialized || !Capacitor.isNativePlatform()) { if (this.initialized || !Capacitor.isNativePlatform()) return;
return;
}
try { try {
// Initialize OneSignal
OneSignalPlugin.initialize(this.env.ONESIGNAL_APP_ID); OneSignalPlugin.initialize(this.env.ONESIGNAL_APP_ID);
// Request notification permission
OneSignalPlugin.Notifications.requestPermission(true).then((accepted: boolean) => { OneSignalPlugin.Notifications.requestPermission(true).then((accepted: boolean) => {
console.log('OneSignal notification permission:', accepted ? 'accepted' : 'denied'); console.log('OneSignal permission:', accepted ? 'accepted' : 'denied');
}); });
// Handle notification clicks // Foreground: show alert + navigate
OneSignalPlugin.Notifications.addEventListener('click', (event: any) => {
console.log('OneSignal notification clicked:', event);
this.handleNotificationClick(event);
});
// Handle foreground notifications
OneSignalPlugin.Notifications.addEventListener('foregroundWillDisplay', (event: any) => { OneSignalPlugin.Notifications.addEventListener('foregroundWillDisplay', (event: any) => {
console.log('OneSignal notification received in foreground:', event); const notification = event.getNotification();
// Display the notification notification.display();
event.getNotification().display(); this.ngZone.run(() => {
this.alertService.presentAlert(notification.title, notification.body, ['OK']);
this.navigateByTitle(notification.title);
});
});
// Tap on notification: navigate only
OneSignalPlugin.Notifications.addEventListener('click', (event: any) => {
const title = event.notification?.title;
this.ngZone.run(() => this.navigateByTitle(title));
}); });
this.initialized = true; this.initialized = true;
console.log('OneSignal initialized successfully');
} catch (error) { } catch (error) {
console.error('Error initializing OneSignal:', error); console.error('Error initializing OneSignal:', error);
} }
} }
async setUserId(userId: number | string): Promise<void> { private navigateByTitle(title: string): void {
if (!Capacitor.isNativePlatform()) { if (title === 'Proveedor: hay nueva postulación' || title === 'Hero: there is a new postulation') {
return; this.navCtrl.navigateRoot('/postulations');
this.events.publish('refreshpostulations', 'data');
} else if (title === 'Búsqueda Finalizada' || title === 'Search finished') {
this.navCtrl.navigateRoot('/contracts');
} else if (title === 'Usuario: el proveedor ha iniciado el servicio' || title === 'User: the Hero has started the service') {
this.navCtrl.navigateRoot('/contracts');
} }
}
async setUserId(userId: number | string): Promise<void> {
if (!Capacitor.isNativePlatform()) return;
try { try {
// Set user tag for targeting OneSignalPlugin.login(String(userId));
OneSignalPlugin.User.addTag('iChamba_ID', String(userId)); OneSignalPlugin.User.addTag('iChamba_ID', String(userId));
console.log('OneSignal user tag set:', userId);
} catch (error) { } catch (error) {
console.error('Error setting OneSignal user tag:', error); console.error('Error setting OneSignal user:', error);
} }
} }
async setUserRole(roleId: number | string): Promise<void> { async setUserRole(roleId: number | string): Promise<void> {
if (!Capacitor.isNativePlatform()) { if (!Capacitor.isNativePlatform()) return;
return;
}
try { try {
OneSignalPlugin.User.addTag('iChamba_Role', String(roleId)); OneSignalPlugin.User.addTag('iChamba_Role', String(roleId));
console.log('OneSignal role tag set:', roleId);
} catch (error) { } catch (error) {
console.error('Error setting OneSignal role tag:', error); console.error('Error setting OneSignal role tag:', error);
} }
} }
async clearTags(): Promise<void> { async clearTags(): Promise<void> {
if (!Capacitor.isNativePlatform()) { if (!Capacitor.isNativePlatform()) return;
return;
}
try { try {
OneSignalPlugin.User.removeTags(['iChamba_ID', 'iChamba_Role']); OneSignalPlugin.User.removeTags(['iChamba_ID', 'iChamba_Role']);
console.log('OneSignal tags cleared');
} catch (error) { } catch (error) {
console.error('Error clearing OneSignal tags:', error); console.error('Error clearing OneSignal tags:', error);
} }
@@ -92,38 +94,20 @@ export class OneSignalService {
async logout(): Promise<void> { async logout(): Promise<void> {
await this.clearTags(); await this.clearTags();
} if (Capacitor.isNativePlatform()) {
try {
private handleNotificationClick(event: any): void { OneSignalPlugin.logout();
const data = event?.notification?.additionalData; } catch (error) {
console.error('Error logging out OneSignal:', error);
if (data) {
// Handle navigation based on notification data
if (data.route) {
this.router.navigate([data.route]);
} else if (data.type) {
switch (data.type) {
case 'contract':
this.router.navigate(['/contracts']);
break;
case 'postulation':
this.router.navigate(['/postulations']);
break;
default:
this.router.navigate(['/dashboard']);
}
} }
} }
} }
async getPlayerId(): Promise<string | null> { async getPlayerId(): Promise<string | null> {
if (!Capacitor.isNativePlatform()) { if (!Capacitor.isNativePlatform()) return null;
return null;
}
try { try {
const deviceState = await OneSignalPlugin.User.pushSubscription.getId(); const id = await OneSignalPlugin.User.pushSubscription.getId();
return deviceState || null; return id || null;
} catch (error) { } catch (error) {
console.error('Error getting OneSignal player ID:', error); console.error('Error getting OneSignal player ID:', error);
return null; return null;

View File

@@ -6,7 +6,7 @@
<ion-title>Verificar Telefono</ion-title> <ion-title>Verificar Telefono</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content class="ion-padding">
<form #form="ngForm" (ngSubmit)="verifyMe(form)" method="post"> <form #form="ngForm" (ngSubmit)="verifyMe(form)" method="post">
<ion-button type="submit" expand="full" color="facebook">Verificame</ion-button> <ion-button type="submit" expand="full" color="facebook">Verificame</ion-button>
</form> </form>

View File

@@ -8,7 +8,8 @@ import { AlertService } from 'src/app/services/alert.service';
@Component({ @Component({
selector: 'app-verify', selector: 'app-verify',
templateUrl: 'verify.page.html', templateUrl: 'verify.page.html',
styleUrls: ['verify.page.scss'] styleUrls: ['verify.page.scss'],
standalone: false
}) })
export class VerifyPage implements OnInit { export class VerifyPage implements OnInit {
@@ -28,12 +29,12 @@ export class VerifyPage implements OnInit {
// auth.service.ts // auth.service.ts
verifyMe(form: NgForm) { verifyMe(form: NgForm) {
this.authService.verifyUser(this.phone_string).subscribe( this.authService.verifyUser(this.phone_string).subscribe(
data => { (data: any) => {
console.log(data); console.log(data);
this.authService.isVerified = true this.authService.isVerified = true
this.navCtrl.navigateRoot('/dashboard') this.navCtrl.navigateRoot('/dashboard')
}, },
error => { (error: any) => {
console.log(error); console.log(error);
} }
); );
@@ -44,11 +45,11 @@ export class VerifyPage implements OnInit {
await this.loading.present(); await this.loading.present();
this.authService.logout().subscribe( this.authService.logout().subscribe(
data => { (data: any) => {
this.alertService.presentToast("Sesión finalizada"); this.alertService.presentToast("Sesión finalizada");
// TODO: Clear OneSignal tag when Capacitor plugin is configured // TODO: Clear OneSignal tag when Capacitor plugin is configured
}, },
error => { (error: any) => {
if (this.loading) this.loading.dismiss(); if (this.loading) this.loading.dismiss();
console.log(error); console.log(error);
}, },

View File

@@ -14,7 +14,7 @@
"login": "Log in", "login": "Log in",
"signup": "Sign up", "signup": "Sign up",
"forgot": "Forgot your password?", "forgot": "Forgot your password?",
"fb_login": "Continue with Facebook", "apple_login": "Continue with Apple",
"google_login": "Continue with Google", "google_login": "Continue with Google",
"email": "Email", "email": "Email",
"password": "Password", "password": "Password",
@@ -142,7 +142,12 @@
"keywords_hint": "Separate keywords with commas", "keywords_hint": "Separate keywords with commas",
"address": "Address", "address": "Address",
"discover": "How did you hear about us?", "discover": "How did you hear about us?",
"select": "Select",
"discover_details": "Please specify how you found out about us", "discover_details": "Please specify how you found out about us",
"bank": "Bank",
"bank_account": "Bank account",
"fee": "Minimum fee",
"required": "Field required",
"signup": "Sign up", "signup": "Sign up",
"radio": "Radio", "radio": "Radio",
"tv": "TV", "tv": "TV",

View File

@@ -14,7 +14,7 @@
"login": "Iniciar sesión", "login": "Iniciar sesión",
"signup": "Registrate", "signup": "Registrate",
"forgot": "¿Olvidó su contraseña?", "forgot": "¿Olvidó su contraseña?",
"fb_login": "Iniciar sesión con Facebook", "apple_login": "Iniciar sesión con Apple",
"google_login": "Iniciar sesión con Google", "google_login": "Iniciar sesión con Google",
"email": "Correo electrónico", "email": "Correo electrónico",
"password": "Contraseña", "password": "Contraseña",
@@ -142,7 +142,12 @@
"keywords_hint": "Separa las palabras clave con comas", "keywords_hint": "Separa las palabras clave con comas",
"address": "Dirección", "address": "Dirección",
"discover": "¿Cómo supiste de nosotros?", "discover": "¿Cómo supiste de nosotros?",
"select": "Seleccionar",
"discover_details": "Específica como supiste de nosotros", "discover_details": "Específica como supiste de nosotros",
"bank": "Banco",
"bank_account": "CLABE Interbancaria",
"fee": "Cuota mínima",
"required": "Campo requerido",
"signup": "Registrarse", "signup": "Registrarse",
"radio": "Radio", "radio": "Radio",
"tv": "TV", "tv": "TV",

View File

@@ -1,3 +1,12 @@
export const environment = { export const environment = {
production: true production: true,
firebaseConfig: {
apiKey: 'AIzaSyAX-O73xSGMAXL6OaQYyTEsZ6ykxPG2ZOo',
authDomain: 'ichamba-1562349005909.firebaseapp.com',
databaseURL: 'https://ichamba-1562349005909.firebaseio.com',
projectId: 'ichamba-1562349005909',
storageBucket: 'ichamba-1562349005909.firebasestorage.app',
messagingSenderId: '679874302148',
appId: '1:679874302148:web:ffb4c82c0f94e412007991'
}
}; };

View File

@@ -1,16 +1,12 @@
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
export const environment = { export const environment = {
production: false production: false,
firebaseConfig: {
apiKey: 'AIzaSyAX-O73xSGMAXL6OaQYyTEsZ6ykxPG2ZOo',
authDomain: 'ichamba-1562349005909.firebaseapp.com',
databaseURL: 'https://ichamba-1562349005909.firebaseio.com',
projectId: 'ichamba-1562349005909',
storageBucket: 'ichamba-1562349005909.firebasestorage.app',
messagingSenderId: '679874302148',
appId: '1:679874302148:web:ffb4c82c0f94e412007991'
}
}; };
/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.

View File

@@ -74,6 +74,24 @@ ion-app {
} }
} }
// Consistent button styling to match social login buttons
ion-button::part(native) {
border-radius: 6px;
font-weight: 500;
letter-spacing: 0.06em;
box-shadow: none;
}
// Border for light-colored buttons so they don't blend into white backgrounds
ion-button[color="light"]::part(native) {
border: 1px solid #DADCE0;
}
// No border when light button is inside a colored toolbar
ion-toolbar:not([color="light"]):not([color=""]) ion-button[color="light"]::part(native) {
border: none;
}
.rate_div { .rate_div {
rating { rating {

View File

@@ -35,7 +35,7 @@
* will put import in the top of bundle, so user need to create a separate file * will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags * in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js. * into that file, and then add the following code before importing zone.js.
* import './zone-flags.ts'; * import './zone-flags';
* *
* The flags allowed in zone-flags.ts are listed here. * The flags allowed in zone-flags.ts are listed here.
* *
@@ -52,7 +52,7 @@
* *
*/ */
import './zone-flags.ts'; import './zone-flags';
/*************************************************************************************************** /***************************************************************************************************
* Zone JS is required by default for Angular itself. * Zone JS is required by default for Angular itself.

View File

@@ -1,22 +1,24 @@
{ {
"compileOnSave": false, "compileOnSave": false,
"compilerOptions": { "compilerOptions": {
"skipLibCheck": true,
"baseUrl": "./", "baseUrl": "./",
"skipLibCheck": true,
"outDir": "./dist/out-tsc", "outDir": "./dist/out-tsc",
"sourceMap": true, "sourceMap": true,
"declaration": false, "declaration": false,
"module": "esnext", "module": "ES2022",
"moduleResolution": "node", "moduleResolution": "bundler",
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"importHelpers": true, "importHelpers": true,
"target": "es5", "target": "ES2022",
"useDefineForClassFields": false,
"ignoreDeprecations": "6.0",
"typeRoots": [ "typeRoots": [
"node_modules/@types" "node_modules/@types"
], ],
"lib": [ "lib": [
"es2018", "ES2022",
"dom" "dom"
] ]
}, },