Mejoras en solicitud de servicios y registro de proveedores

- Actualizar API key de Google Maps
- Corregir búsqueda de categorías en dashboard (ionInput + ev.detail.value)
- Limitar solicitud de servicios a máximo 2 días de anticipación
- Agregar validación de fecha y hora antes de crear postulación
- Corregir visualización de categorías en registro de héroe
- Agregar traducción select_date_time

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CarlosTorres
2026-01-27 04:08:01 +00:00
parent 103f7f45a0
commit e7ad9e1d26
8 changed files with 40 additions and 18 deletions

View File

@@ -23,8 +23,8 @@ const config: CapacitorConfig = {
SplashShowOnlyFirstTime: 'false', SplashShowOnlyFirstTime: 'false',
SplashScreen: 'screen', SplashScreen: 'screen',
SplashScreenDelay: '3000', SplashScreenDelay: '3000',
GOOGLE_MAPS_ANDROID_API_KEY: 'AIzaSyBmkTsg0-1VKllM_vHD6V1EhPnF0YUP-88', GOOGLE_MAPS_ANDROID_API_KEY: 'AIzaSyC_1FWK6tQ7VTPRJLxf2Mn2DEo3E28UF3k',
GOOGLE_MAPS_IOS_API_KEY: 'AIzaSyBmkTsg0-1VKllM_vHD6V1EhPnF0YUP-88' GOOGLE_MAPS_IOS_API_KEY: 'AIzaSyC_1FWK6tQ7VTPRJLxf2Mn2DEo3E28UF3k'
} }
} }
}; };

View File

@@ -60,11 +60,10 @@ export class CategoryPage implements OnInit {
}); });
this.getCurrentLocation(); this.getCurrentLocation();
console.log(this.minyear); console.log(this.minyear);
if (new Date().getMonth() == 11) { // Máximo 2 días de anticipación
this.maxyear = ((new Date().getFullYear()+1) + '-' + '01' + '-' + (new Date().getDate() < 10 ? '0' : '') + new Date().getDate()).toString(); const maxDate = new Date();
} else { maxDate.setDate(maxDate.getDate() + 2);
this.maxyear = (new Date().getFullYear() + '-' + ((new Date().getMonth() + 2) < 10 ? '0' : '') + (new Date().getMonth() + 2) +'-' + (new Date().getDate() < 10 ? '0' : '') + new Date().getDate()).toString(); this.maxyear = maxDate.toISOString().slice(0, 10);
}
console.log(this.maxyear); console.log(this.maxyear);
} }
@@ -160,13 +159,34 @@ export class CategoryPage implements OnInit {
} }
addpostulation() { addpostulation() {
// Validar que fecha y hora estén seleccionadas
if (!this.setDate || !this.setHour) {
this.alertService.presentToast(this.translateService.instant('alerts.select_date_time') || 'Selecciona fecha y hora');
return;
}
// Calcular diferencia de fecha directamente
const today = new Date();
today.setHours(0, 0, 0, 0);
const selectedDate = new Date(this.setDate);
selectedDate.setHours(0, 0, 0, 0);
this.differenceDate = selectedDate.getTime() - today.getTime();
// Calcular diferencia de hora
this.differenceHour = (new Date(this.setHour).getTime() - new Date().getTime()); this.differenceHour = (new Date(this.setHour).getTime() - new Date().getTime());
console.log(this.differenceHour);
console.log("mintime:" + this.mintime * 3600000); console.log("differenceDate:", this.differenceDate);
console.log("maxtime:" + this.maxtime * 3600000) console.log("differenceHour:", this.differenceHour);
console.log("mintime:", this.mintime * 3600000);
// Máximo 2 días de anticipación (172800000 ms = 2 días)
const maxDays = 2 * 24 * 60 * 60 * 1000;
console.log("maxDays:", maxDays);
// Validación de tiempo mínimo (mismo día y menos de mintime horas)
if (this.differenceDate < 86400000 && this.differenceHour < (this.mintime * 3600000)) { if (this.differenceDate < 86400000 && this.differenceHour < (this.mintime * 3600000)) {
this.alertService.presentToast(this.translateService.instant('alerts.categories_mintime')); this.alertService.presentToast(this.translateService.instant('alerts.categories_mintime'));
} else if (this.differenceDate <= (this.maxtime * 3600000)) { } else if (this.differenceDate <= maxDays) {
if (this.myAddress && this.myPosition.latitude && this.myPosition.longitude) { if (this.myAddress && this.myPosition.latitude && this.myPosition.longitude) {
this.loadingCtrl.create().then((overlay) => { this.loadingCtrl.create().then((overlay) => {
this.loading = overlay; this.loading = overlay;

View File

@@ -29,8 +29,8 @@ ion-item:active:after {
<ion-content padding> <ion-content padding>
<div class="autocomplete"> <div class="autocomplete">
<ion-searchbar <ion-searchbar
(ionChange)="search($event)" (ionInput)="search($event)"
debounce=500 debounce="300"
placeholder="{{'dashboard.searchbox_placeholder' | translate}}"> placeholder="{{'dashboard.searchbox_placeholder' | translate}}">
</ion-searchbar> </ion-searchbar>
<ion-list *ngIf="showList"> <ion-list *ngIf="showList">

View File

@@ -157,14 +157,14 @@ export class DashboardPage implements OnInit {
this.categories = this.aux_categories; this.categories = this.aux_categories;
console.log(ev); console.log(ev);
let val = ev.target.value; let val = ev.detail.value || ev.target.value;
// if the value is an empty string don't filter the items // if the value is an empty string don't filter the items
if (val && val.trim() != '') { if (val && val.trim() != '') {
// Filter the items // Filter the items
this.categories = this.categories.filter((categories) => { this.categories = this.categories.filter((category) => {
return (categories.toLowerCase().indexOf(val.toLowerCase()) > -1); return (category.toLowerCase().indexOf(val.toLowerCase()) > -1);
}); });
// Show the results // Show the results

View File

@@ -19,7 +19,7 @@
<ion-item> <ion-item>
<ion-label>{{'hero.categories' | translate}}</ion-label> <ion-label>{{'hero.categories' | translate}}</ion-label>
<ion-select [(ngModel)]="categories_input" multiple="true" okText="Aceptar" cancelText="Cancelar" placeholder="{{'hero.categories_placeholder' | translate}}"> <ion-select [(ngModel)]="categories_input" multiple="true" okText="Aceptar" cancelText="Cancelar" placeholder="{{'hero.categories_placeholder' | translate}}">
<ion-select-option *ngFor="let category of categories" [value]="category.value">{{category.display}}</ion-select-option> <ion-select-option *ngFor="let category of categories" [value]="category">{{category}}</ion-select-option>
</ion-select> </ion-select>
</ion-item> </ion-item>
<br> <br>

View File

@@ -188,6 +188,7 @@
"categories_mintime": "Services must be requested at least 2 hours in advance", "categories_mintime": "Services must be requested at least 2 hours in advance",
"no_provider": "There are no heroes available in the area", "no_provider": "There are no heroes available in the area",
"valid_address": "Enter a valid address", "valid_address": "Enter a valid address",
"select_date_time": "Select date and time for the service",
"categories_maxtime": "Services must be requested with a maximum of 2 days in advance", "categories_maxtime": "Services must be requested with a maximum of 2 days in advance",
"categories_success": "Requested service, wait for a hero to apply to the postulation", "categories_success": "Requested service, wait for a hero to apply to the postulation",
"error": "Please contact technical support, Status:", "error": "Please contact technical support, Status:",

View File

@@ -188,6 +188,7 @@
"categories_mintime": "Los servicios deben solicitarse con mínimo 2 horas de anticipación", "categories_mintime": "Los servicios deben solicitarse con mínimo 2 horas de anticipación",
"no_provider": "No hay Heroes disponibles por la zona", "no_provider": "No hay Heroes disponibles por la zona",
"valid_address": "Ingrese una dirección válida", "valid_address": "Ingrese una dirección válida",
"select_date_time": "Selecciona fecha y hora del servicio",
"categories_maxtime": "Los servicios deben solicitarse con máximo 2 días de anticipación", "categories_maxtime": "Los servicios deben solicitarse con máximo 2 días de anticipación",
"categories_success": "Servicio solicitado, espere a que un Heroe se postule", "categories_success": "Servicio solicitado, espere a que un Heroe se postule",
"error": "Por favor contacte a soporte técnico, Estatus:", "error": "Por favor contacte a soporte técnico, Estatus:",

View File

@@ -7,7 +7,7 @@
<base href="/" /> <base href="/" />
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBmkTsg0-1VKllM_vHD6V1EhPnF0YUP-88&libraries=places"></script> <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC_1FWK6tQ7VTPRJLxf2Mn2DEo3E28UF3k&libraries=places"></script>
<script type="text/javascript" src="https://resources.openpay.mx/lib/openpay.v1.min.js"></script> <script type="text/javascript" src="https://resources.openpay.mx/lib/openpay.v1.min.js"></script>
<script type="text/javascript" src="https://resources.openpay.mx/lib/openpay-data-js/1.2.38/openpay-data.v1.min.js"></script> <script type="text/javascript" src="https://resources.openpay.mx/lib/openpay-data-js/1.2.38/openpay-data.v1.min.js"></script>