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:
@@ -23,8 +23,8 @@ const config: CapacitorConfig = {
|
||||
SplashShowOnlyFirstTime: 'false',
|
||||
SplashScreen: 'screen',
|
||||
SplashScreenDelay: '3000',
|
||||
GOOGLE_MAPS_ANDROID_API_KEY: 'AIzaSyBmkTsg0-1VKllM_vHD6V1EhPnF0YUP-88',
|
||||
GOOGLE_MAPS_IOS_API_KEY: 'AIzaSyBmkTsg0-1VKllM_vHD6V1EhPnF0YUP-88'
|
||||
GOOGLE_MAPS_ANDROID_API_KEY: 'AIzaSyC_1FWK6tQ7VTPRJLxf2Mn2DEo3E28UF3k',
|
||||
GOOGLE_MAPS_IOS_API_KEY: 'AIzaSyC_1FWK6tQ7VTPRJLxf2Mn2DEo3E28UF3k'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -60,11 +60,10 @@ export class CategoryPage implements OnInit {
|
||||
});
|
||||
this.getCurrentLocation();
|
||||
console.log(this.minyear);
|
||||
if (new Date().getMonth() == 11) {
|
||||
this.maxyear = ((new Date().getFullYear()+1) + '-' + '01' + '-' + (new Date().getDate() < 10 ? '0' : '') + new Date().getDate()).toString();
|
||||
} else {
|
||||
this.maxyear = (new Date().getFullYear() + '-' + ((new Date().getMonth() + 2) < 10 ? '0' : '') + (new Date().getMonth() + 2) +'-' + (new Date().getDate() < 10 ? '0' : '') + new Date().getDate()).toString();
|
||||
}
|
||||
// Máximo 2 días de anticipación
|
||||
const maxDate = new Date();
|
||||
maxDate.setDate(maxDate.getDate() + 2);
|
||||
this.maxyear = maxDate.toISOString().slice(0, 10);
|
||||
console.log(this.maxyear);
|
||||
}
|
||||
|
||||
@@ -160,13 +159,34 @@ export class CategoryPage implements OnInit {
|
||||
}
|
||||
|
||||
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());
|
||||
console.log(this.differenceHour);
|
||||
console.log("mintime:" + this.mintime * 3600000);
|
||||
console.log("maxtime:" + this.maxtime * 3600000)
|
||||
|
||||
console.log("differenceDate:", this.differenceDate);
|
||||
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)) {
|
||||
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) {
|
||||
this.loadingCtrl.create().then((overlay) => {
|
||||
this.loading = overlay;
|
||||
|
||||
@@ -29,8 +29,8 @@ ion-item:active:after {
|
||||
<ion-content padding>
|
||||
<div class="autocomplete">
|
||||
<ion-searchbar
|
||||
(ionChange)="search($event)"
|
||||
debounce=500
|
||||
(ionInput)="search($event)"
|
||||
debounce="300"
|
||||
placeholder="{{'dashboard.searchbox_placeholder' | translate}}">
|
||||
</ion-searchbar>
|
||||
<ion-list *ngIf="showList">
|
||||
|
||||
@@ -157,14 +157,14 @@ export class DashboardPage implements OnInit {
|
||||
this.categories = this.aux_categories;
|
||||
|
||||
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 (val && val.trim() != '') {
|
||||
|
||||
// Filter the items
|
||||
this.categories = this.categories.filter((categories) => {
|
||||
return (categories.toLowerCase().indexOf(val.toLowerCase()) > -1);
|
||||
this.categories = this.categories.filter((category) => {
|
||||
return (category.toLowerCase().indexOf(val.toLowerCase()) > -1);
|
||||
});
|
||||
|
||||
// Show the results
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<ion-item>
|
||||
<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-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-item>
|
||||
<br>
|
||||
|
||||
@@ -188,6 +188,7 @@
|
||||
"categories_mintime": "Services must be requested at least 2 hours in advance",
|
||||
"no_provider": "There are no heroes available in the area",
|
||||
"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_success": "Requested service, wait for a hero to apply to the postulation",
|
||||
"error": "Please contact technical support, Status:",
|
||||
|
||||
@@ -188,6 +188,7 @@
|
||||
"categories_mintime": "Los servicios deben solicitarse con mínimo 2 horas de anticipación",
|
||||
"no_provider": "No hay Heroes disponibles por la zona",
|
||||
"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_success": "Servicio solicitado, espere a que un Heroe se postule",
|
||||
"error": "Por favor contacte a soporte técnico, Estatus:",
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<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-data-js/1.2.38/openpay-data.v1.min.js"></script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user