parent
cefc382a32
commit
716ddc06d9
@ -1,41 +0,0 @@
|
||||
import type {Add, Opcion} from "../../data/data_types";
|
||||
import {showWarning} from "../stores/popup.svelte";
|
||||
import {proyecto} from "../../data/data_proyecto";
|
||||
import {appState, selections} from "../stores/sel.svelte";
|
||||
|
||||
|
||||
|
||||
|
||||
function filterSuelo (opcion: Opcion, estancia?: string) : boolean {
|
||||
console.log("filterSuelo", selections['sln']['Suelos'], opcion.value);
|
||||
if (estancia && estancia !== 'sln') {
|
||||
if (selections['sln']['Suelos'] !== opcion.value) {
|
||||
showWarning(proyecto.textos.aviso_suelo);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function filterPuerta (add: Add, estancia?: string) : boolean {
|
||||
showWarning(proyecto.textos.aviso_puerta);
|
||||
return true
|
||||
}
|
||||
|
||||
function filterLavadora (add: Add, estancia?: string) : boolean {
|
||||
showWarning(proyecto.textos.aviso_lavadora);
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const optsFilters : Record <string,(opcion: Opcion, estancia?: string) => boolean> = {
|
||||
'filterSuelos' : filterSuelo,
|
||||
}
|
||||
|
||||
|
||||
export const addsFilters : Record <string,(add : Add, estancia?: string) => boolean> = {
|
||||
'filterPuerta' : filterPuerta,
|
||||
'filterLavadora' : filterLavadora,
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
import type {Add, Opcion} from "../../data/data_types";
|
||||
import {appState, selections } from "../stores/sel.svelte";
|
||||
import {showWarning} from "../stores/popup.svelte";
|
||||
import {proyecto} from "../../data/data_proyecto";
|
||||
|
||||
|
||||
export type TipoFiltro = 'filter' | 'notify' | 'all'
|
||||
|
||||
|
||||
|
||||
export interface Filtro {
|
||||
check : (value : string) => boolean
|
||||
msg? : string,
|
||||
txt? : string,
|
||||
tipo : TipoFiltro
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const filtros : Record <string, Filtro> = {
|
||||
'suelo' : {
|
||||
tipo: 'all',
|
||||
msg : 'suelo no valido',
|
||||
txt : proyecto.textos.aviso_suelo,
|
||||
check : (value : string) : boolean => selections['sln']['Suelos'] === value,
|
||||
},
|
||||
|
||||
'lavadora' : {
|
||||
tipo: 'notify',
|
||||
txt: proyecto.textos.aviso_puerta,
|
||||
check: (value: string): boolean => true,
|
||||
},
|
||||
|
||||
'puerta' : {
|
||||
tipo: 'notify',
|
||||
txt : proyecto.textos.aviso_puerta,
|
||||
check : (value : string) : boolean => true,
|
||||
}
|
||||
}
|
||||
@ -1,45 +0,0 @@
|
||||
import type {Add, Opcion} from "../../data/data_types";
|
||||
import {appState, selections } from "../stores/sel.svelte";
|
||||
import {showWarning} from "../stores/popup.svelte";
|
||||
import {proyecto} from "../../data/data_proyecto";
|
||||
|
||||
|
||||
|
||||
|
||||
export interface OpcionValidador {
|
||||
check : (value : string) => boolean
|
||||
msg? : string,
|
||||
txt? : string,
|
||||
}
|
||||
|
||||
|
||||
|
||||
function validaSuelo (value : string) : boolean {
|
||||
return selections['sln']['Suelos'] === value;
|
||||
}
|
||||
|
||||
|
||||
function validaLavadora (value : string) : boolean {
|
||||
showWarning(proyecto.textos.aviso_lavadora);
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
|
||||
function validaPuerta (add: Add, estancia?: string) : boolean {
|
||||
showWarning(proyecto.textos.aviso_puerta);
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
export const Validadores : Record <string, OpcionValidador> = {
|
||||
'suelo' : {
|
||||
check : validaSuelo,
|
||||
msg : 'suelo no valido',
|
||||
txt : proyecto.textos.aviso_suelo
|
||||
},
|
||||
'lavadora' : {
|
||||
check : validaLavadora,
|
||||
txt : proyecto.textos.aviso_puerta,
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue