quitado el campo provincia
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Javi Gallego 2020-03-24 17:32:30 +01:00
parent 0793588ef3
commit a30a4bf961
7 changed files with 215 additions and 72 deletions

View File

@ -0,0 +1,115 @@
USE `vn`;
DROP procedure IF EXISTS `zone_getEvents`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` PROCEDURE `zone_getEvents`(
vGeoFk INT,
vDeliveryMethodFk VARCHAR(255),
vAgencyModeFk INT)
BEGIN
/**
* Returns available events for the passed province/postcode and agency.
*
* @param vGeoFk The geo id
* @param vAgencyModeFk The agency mode id
*/
DROP TEMPORARY TABLE IF EXISTS tmp.auxZone;
CREATE TEMPORARY TABLE tmp.auxZone
(id INT(11) PRIMARY KEY)
ENGINE = MEMORY;
IF vDeliveryMethodFk = 'pickUp' THEN
INSERT INTO tmp.auxZone
SELECT id
FROM zone
WHERE agencyModeFk = vAgencyModeFk;
ELSE
CALL zone_getFromGeo(vGeoFk);
IF vAgencyModeFk IS NOT NULL THEN
INSERT INTO tmp.auxZone
SELECT t.id
FROM tmp.zone t
JOIN zone z ON z.id = t.id
WHERE z.agencyModeFk = vAgencyModeFk;
ELSE
INSERT INTO tmp.auxZone
SELECT t.id
FROM tmp.zone t
JOIN zone z ON z.id = t.id
JOIN agencyMode am ON am.id = z.agencyModeFk
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
WHERE dm.`code` IN ('AGENCY', 'DELIVERY');
END IF;
DROP TEMPORARY TABLE tmp.zone;
END IF;
SELECT e.zoneFk, e.`type`, e.dated, e.`started`, e.`ended`, e.weekDays
FROM tmp.auxZone t
JOIN zoneEvent e ON e.zoneFk = t.id;
SELECT e.zoneFk, e.dated
FROM tmp.auxZone t
JOIN zoneExclusion e ON e.zoneFk = t.id;
DROP TEMPORARY TABLE IF EXISTS tmp.auxZone;
END$$
DELIMITER ;
USE `vn`;
DROP procedure IF EXISTS `zone_getEvents__`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` PROCEDURE `zone_getEvents__`(
vProvinceFk INT,
vPostCode VARCHAR(255),
vAgencyModeFk INT)
BEGIN
/**
* Returns available events for the passed province/postcode and agency.
*
* @param vAgencyModeFk The agency mode id
* @param vProvinceFk The province id
* @param vPostCode The postcode or %NULL to use the province
*/
DECLARE vGeoFk INT;
IF vPostCode IS NOT NULL THEN
SELECT p.geoFk INTO vGeoFk
FROM postCode p
JOIN town t ON t.id = p.townFk
WHERE p.`code` = vPostCode
AND t.provinceFk = vProvinceFk;
ELSE
SELECT geoFk INTO vGeoFk
FROM province
WHERE id = vProvinceFk;
END IF;
CALL zone_getFromGeo(vGeoFk);
IF vAgencyModeFk IS NOT NULL THEN
DELETE t FROM tmp.zone t
JOIN zone z ON z.id = t.id
WHERE z.agencyModeFk != vAgencyModeFk;
END IF;
SELECT e.zoneFk, e.`type`, e.dated, e.`started`, e.`ended`, e.weekDays
FROM tmp.zone t
JOIN zoneEvent e ON e.zoneFk = t.id;
SELECT e.zoneFk, e.dated
FROM tmp.zone t
JOIN zoneExclusion e ON e.zoneFk = t.id;
DROP TEMPORARY TABLE tmp.zone;
END$$
DELIMITER ;

View File

@ -1,9 +1,9 @@
Type: Tipo
File management: Gestión documental
File: Fichero
Hard copy: Copia
This file will be deleted: Este fichero va a ser borrado
Are you sure?: Estas seguro?
File deleted: Fichero eliminado
Remove file: Eliminar fichero
Download file: Descargar fichero
File: Fichero
File deleted: Fichero eliminado
Hard copy: Copia
My documentation: Mi documentacion
Remove file: Eliminar fichero
This file will be deleted: Este fichero va a ser borrado
Type: Tipo

View File

@ -1,20 +1,19 @@
Workers: Trabajadores
Last name: Apellidos
User data: Datos de usuario
Fiscal identifier: NIF
Email: E-mail
Department: Departamento
User id: Id de usuario
Role: Rol
Extension: Extensión
Go to client: Ir al cliente
Private Branch Exchange: Centralita
View worker: Ver trabajador
Worker id: Id trabajador
Fiscal Identifier: NIF
User name: Usuario
Departments: Departamentos
Calendar: Calendario
Data saved! User must access web: ¡Datos guardados! El usuario deberá acceder con su contraseña a la web para que los cambios surtan efecto.
Department: Departamento
Departments: Departamentos
Email: E-mail
Extension: Extensión
Fiscal identifier: NIF
Go to client: Ir al cliente
Last name: Apellidos
Private Branch Exchange: Centralita
Role: Rol
Search workers by id, firstName, lastName or user name: Buscar trabajadores por el identificador, nombre, apellidos o nombre de usuario
Time control: Control de horario
Data saved! User must access web: ¡Datos guardados! El usuario deberá acceder con su contraseña a la web para que los cambios surtan efecto.
User data: Datos de usuario
User name: Usuario
User id: Id de usuario
View worker: Ver trabajador
Worker id: Id trabajador
Workers: Trabajadores

View File

@ -4,19 +4,20 @@ module.exports = Self => {
description: 'Returns delivery days for a postcode',
accepts: [
{
arg: 'provinceFk',
arg: 'geoFk',
type: 'Number',
description: 'The province id',
required: true
description: 'The geo id'
}, {
arg: 'postCode',
arg: 'deliveryMethodFk',
type: 'String',
description: 'The postcode'
description: 'The delivery Method code',
required: true
}, {
arg: 'agencyModeFk',
type: 'Number',
description: 'The agency mode id'
}
],
returns: {
type: 'Object',
@ -28,10 +29,10 @@ module.exports = Self => {
}
});
Self.getEvents = async(provinceFk, postCode, agencyModeFk) => {
Self.getEvents = async(geoFk, deliveryMethodFk, agencyModeFk) => {
let [events, exclusions] = await Self.rawSql(
`CALL zone_getEvents(?, ?, ?)`,
[provinceFk, postCode, agencyModeFk]
[geoFk, deliveryMethodFk, agencyModeFk]
);
return {events, exclusions};
};

View File

@ -6,28 +6,35 @@
</div>
<vn-side-menu side="right">
<form ng-submit="$ctrl.onSubmit()" class="vn-pa-md">
<vn-autocomplete
label="Province"
ng-model="params.provinceFk"
url="Provinces"
fields="['countryFk']"
include="'country'">
<vn-radio
label="Pick up"
val="pickUp"
ng-model="params.deliveryMethodFk">
</vn-radio>
<vn-radio
label="Delivery"
val="delivery"
ng-model="params.deliveryMethodFk">
</vn-radio>
<vn-autocomplete vn-one
ng-show="params.deliveryMethodFk === 'delivery'"
label="Postcode"
ng-model="params.geoFk"
url="Postcodes/location"
fields="['code','townFk']"
order="code, townFk"
value-field="geoFk"
show-field="code">
<tpl-item>
<div>{{name}}</div>
<div class="text-caption text-secondary">
{{country.country}}
</div>
{{code}} - {{town.name}} ({{town.province.name}},
{{town.province.country.country}})
</tpl-item>
</vn-autocomplete>
<vn-textfield
vn-one
label="Postcode"
ng-model="params.postCode">
</vn-textfield>
<vn-autocomplete
label="Agency"
ng-model="params.agencyModeFk"
url="AgencyModes/isActive">
url="AgencyModes/isActive"
where="$ctrl.agencyFilter">
</vn-autocomplete>
<vn-submit label="Query" class="vn-mt-sm"></vn-submit>
</form>

View File

@ -5,6 +5,7 @@ import './style.scss';
class Controller extends Section {
$onInit() {
this.$.params = {};
this.$.params.deliveryMethodFk = 'delivery';
}
onSubmit() {
@ -18,6 +19,24 @@ class Controller extends Section {
});
}
get deliveryMethodFk() {
return this._deliveryMethod;
}
set deliveryMethodFk(value) {
this._deliveryMethod = value;
let filter;
if (value === 'pickUp')
filter = {where: {code: 'PICKUP'}};
else
filter = {where: {code: {neq: 'PICKUP'}}};
let json = encodeURIComponent(JSON.stringify(filter));
this.$http.get(`DeliveryMethods?filter=${json}`).then(json => {
let deliveryMethods = json.data.map(deliveryMethod => deliveryMethod.id);
this.agencyFilter = {deliveryMethodFk: {inq: deliveryMethods}};
});
}
onSelection($event, $events) {
if (!$events.length) return;

View File

@ -1,29 +1,31 @@
Agency: Agencia
Are you sure you want to delete this zone?: ¿Seguro de que quieres eliminar esta zona?
Clone: Clonar
Exceptions: Excepciones
Closing: Cierre
Delivery days: Días de entrega
Delivery: Entrega
Everyday: Todos los días
Exclusions: Exclusiones
From: Desde
Hour: Hora
Indefinitely: Indefinido
Inflation: Inflación
Locations: Localizaciones
Maximum m³: M³ máximo
New zone: Nueva zona
One day: Un día
Pick up: Recogida
Postcode: Código postal
Price: Precio
Query: Consultar
Province: Provincia
Range of dates: Rango de fechas
Search zone by id or name: Buscar zonas por identificador o nombre
This zone will be removed: La zona será eliminada
To: Hasta
Volumetric: Volumétrico
Warehouse: Almacén
Warehouses: Almacenes
Week days: Días de la semana
Exceptions: Excepciones
Exclusions: Exclusiones
Warehouse: Almacén
Hour: Hora
Price: Precio
Locations: Localizaciones
This zone will be removed: La zona será eliminada
Are you sure you want to delete this zone?: ¿Seguro de que quieres eliminar esta zona?
Zones: Zonas
New zone: Nueva zona
Volumetric: Volumétrico
Clone: Clonar
Search zone by id or name: Buscar zonas por identificador o nombre
From: Desde
To: Hasta
Closing: Cierre
One day: Un día
Range of dates: Rango de fechas
Indefinitely: Indefinido
Everyday: Todos los días
Delivery days: Días de entrega
Province: Provincia
Postcode: Código postal
Inflation: Inflación
Query: Consultar
Maximum m³: M³ máximo