niris-public-community-components 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +59 -8
- package/dev/form-niris.html +29 -0
- package/dev/text-area-niris.html +8 -5
- package/dist/form-niris.d.ts +70 -0
- package/dist/form-niris.d.ts.map +1 -0
- package/dist/form-niris.js +1127 -0
- package/dist/form-niris.js.map +1 -0
- package/dist/form-to-niris.js +847 -0
- package/dist/generated/locale-codes.d.ts +14 -0
- package/dist/generated/locale-codes.d.ts.map +1 -0
- package/dist/generated/locale-codes.js +23 -0
- package/dist/generated/locale-codes.js.map +1 -0
- package/dist/generated/locales/ca.d.ts +61 -0
- package/dist/generated/locales/ca.d.ts.map +1 -0
- package/dist/generated/locales/ca.js +65 -0
- package/dist/generated/locales/ca.js.map +1 -0
- package/dist/generated/locales/en.d.ts +61 -0
- package/dist/generated/locales/en.d.ts.map +1 -0
- package/dist/generated/locales/en.js +65 -0
- package/dist/generated/locales/en.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/locale-codes-c2f86156.js +72 -0
- package/dist/map-niris.d.ts +25 -0
- package/dist/map-niris.d.ts.map +1 -0
- package/dist/map-niris.js +200 -0
- package/dist/map-niris.js.map +1 -0
- package/dist/styles/globalStyles.d.ts +2 -0
- package/dist/styles/globalStyles.d.ts.map +1 -0
- package/dist/styles/globalStyles.js +170 -0
- package/dist/styles/globalStyles.js.map +1 -0
- package/dist/test/my-element_test.d.ts +7 -0
- package/dist/test/my-element_test.d.ts.map +1 -0
- package/dist/test/my-element_test.js +47 -0
- package/dist/test/my-element_test.js.map +1 -0
- package/dist/types.d.ts +85 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/index.html +5 -3
- package/package.json +27 -5
- package/rollup.config.js +6 -2
- package/src/form-niris.ts +1203 -0
- package/src/generated/locale-codes.ts +25 -0
- package/src/generated/locales/ca.ts +71 -0
- package/src/generated/locales/en.ts +71 -0
- package/src/lit-localize.json +15 -0
- package/src/map-niris.ts +215 -0
- package/src/styles/globalStyles.ts +170 -0
- package/src/textarea-to-niris.ts +33 -12
- package/src/types.ts +90 -0
- package/src/xliff/ca.xlf +239 -0
- package/src/xliff/en.xlf +239 -0
- package/tsconfig.json +1 -1
- package/my-element.js +0 -79
@@ -0,0 +1,1127 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
import { LitElement, html, css, nothing } from 'lit';
|
8
|
+
import { property, state } from 'lit/decorators.js';
|
9
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
10
|
+
import { choose } from 'lit/directives/choose.js';
|
11
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
12
|
+
import { when } from 'lit/directives/when.js';
|
13
|
+
import { Task } from '@lit/task';
|
14
|
+
import { globalStyles } from './styles/globalStyles';
|
15
|
+
import { msg, localized } from '@lit/localize';
|
16
|
+
import { CharacteristicTypeEnum, } from './types';
|
17
|
+
import { configureLocalization } from '@lit/localize';
|
18
|
+
// Generated via output.localeCodesModule
|
19
|
+
import { sourceLocale, targetLocales } from './generated/locale-codes.js';
|
20
|
+
// https://github.com/Leaflet/Leaflet/issues/7055
|
21
|
+
// https://github.com/Leaflet/Leaflet/pull/7174
|
22
|
+
// https://github.com/Leaflet/Leaflet/pull/6239
|
23
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
24
|
+
// @ts-ignore
|
25
|
+
import * as L from 'leaflet/dist/leaflet-src.esm.js';
|
26
|
+
export const { getLocale, setLocale } = configureLocalization({
|
27
|
+
sourceLocale,
|
28
|
+
targetLocales,
|
29
|
+
loadLocale: (locale) => import(`./generated/locales/${locale}.js`),
|
30
|
+
});
|
31
|
+
/* TODO:
|
32
|
+
- Boton volver, ruta por property o volver atras mirando hsitory
|
33
|
+
- Mascaras
|
34
|
+
- Validaciones archivos extensiones.
|
35
|
+
*/
|
36
|
+
/**
|
37
|
+
* An example element.
|
38
|
+
*/
|
39
|
+
let FormNiris = class FormNiris extends LitElement {
|
40
|
+
constructor() {
|
41
|
+
super();
|
42
|
+
this.defaultLat = '39.5701058'; // Palma de Mallorca
|
43
|
+
this.defaultLon = '2.6487098';
|
44
|
+
this.locale = 'es';
|
45
|
+
this.isCitizen = true;
|
46
|
+
this.activeMap = false;
|
47
|
+
this.ubiDistricts = [];
|
48
|
+
this.submited = false;
|
49
|
+
this.error = false;
|
50
|
+
this.incidenceId = '';
|
51
|
+
this.extensionFiles = '';
|
52
|
+
/* Map */
|
53
|
+
this.domain = 'https://iris2-backend-demo-iris-community.labs.apsl.io/services/iris/api-public';
|
54
|
+
// TODO property for lat and lon
|
55
|
+
this.street = '';
|
56
|
+
this.streetNumber = '';
|
57
|
+
this.latitude = '';
|
58
|
+
this.longitude = '';
|
59
|
+
this.loading = false;
|
60
|
+
this._fetchFields = new Task(this, {
|
61
|
+
task: async ([detailID], { signal }) => {
|
62
|
+
const response = await fetch(`${this.getApiUrl()}/details/${detailID}/fields`, {
|
63
|
+
headers: {
|
64
|
+
'Accept-Language': this.locale,
|
65
|
+
},
|
66
|
+
signal
|
67
|
+
});
|
68
|
+
if (!response.ok) {
|
69
|
+
this.error = true;
|
70
|
+
}
|
71
|
+
const data = await response.json();
|
72
|
+
this.area = data.area;
|
73
|
+
this.element = data.element;
|
74
|
+
this.detail = data.detail;
|
75
|
+
this.characteristics = data.characteristics;
|
76
|
+
this.extensionFiles = data.extension_files;
|
77
|
+
const ubiInfo = data.mandatory_drupal_fields.ubication;
|
78
|
+
if (ubiInfo?.street_name && ubiInfo?.number) {
|
79
|
+
this.activeMap = true;
|
80
|
+
this._loadMap();
|
81
|
+
}
|
82
|
+
return data;
|
83
|
+
},
|
84
|
+
args: () => [this.detailID],
|
85
|
+
});
|
86
|
+
this.detailID = undefined;
|
87
|
+
this.actionUrl = '';
|
88
|
+
this.apiUrl = '';
|
89
|
+
this.area = '';
|
90
|
+
this.element = '';
|
91
|
+
this.detail = '';
|
92
|
+
this.extensionFiles = '';
|
93
|
+
this.characteristics = [];
|
94
|
+
this.locale = this.locale ? this.locale : 'es';
|
95
|
+
setLocale(this.locale);
|
96
|
+
// Map
|
97
|
+
L.Icon.Default.imagePath = `https://unpkg.com/leaflet@${L.version}/dist/images/`;
|
98
|
+
this._markerIcon = new L.Icon({
|
99
|
+
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-blue.png',
|
100
|
+
shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
|
101
|
+
iconSize: [25, 41],
|
102
|
+
iconAnchor: [12, 41],
|
103
|
+
popupAnchor: [1, -34],
|
104
|
+
shadowSize: [41, 41],
|
105
|
+
});
|
106
|
+
}
|
107
|
+
getApiUrl() {
|
108
|
+
if (this.apiUrl.endsWith('/')) {
|
109
|
+
return this.apiUrl.slice(0, this.apiUrl.lastIndexOf('/'));
|
110
|
+
}
|
111
|
+
else {
|
112
|
+
return this.apiUrl;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
_loadMap() {
|
116
|
+
const mapEl = this.shadowRoot?.querySelector('#map');
|
117
|
+
this._map = L.map(mapEl, {
|
118
|
+
markerZoomAnimation: false,
|
119
|
+
attributionControl: false,
|
120
|
+
}).setView([this.defaultLat, this.defaultLon], 15);
|
121
|
+
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
122
|
+
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
123
|
+
}).addTo(this._map);
|
124
|
+
this._map.on('click', (e) => this.onMapClick(e));
|
125
|
+
}
|
126
|
+
firstUpdated() {
|
127
|
+
/* Disable default form validation */
|
128
|
+
const form = this.shadowRoot?.querySelector('form');
|
129
|
+
form?.setAttribute('novalidate', '');
|
130
|
+
this.addOnChangEventToInputs();
|
131
|
+
}
|
132
|
+
addOnChangEventToInputs() {
|
133
|
+
const inputs = Array.from(this.shadowRoot?.querySelectorAll('input') ?? []);
|
134
|
+
inputs.forEach((input) => {
|
135
|
+
input.addEventListener('keyup', () => {
|
136
|
+
input.setCustomValidity('');
|
137
|
+
});
|
138
|
+
});
|
139
|
+
}
|
140
|
+
/* Lifecycle */
|
141
|
+
connectedCallback() {
|
142
|
+
super.connectedCallback();
|
143
|
+
this._fetchDistricts();
|
144
|
+
}
|
145
|
+
async _fetchDistricts() {
|
146
|
+
const response = await fetch(`${this.getApiUrl()}/districts`, {
|
147
|
+
headers: {
|
148
|
+
'Accept-Language': this.locale,
|
149
|
+
},
|
150
|
+
});
|
151
|
+
if (!response.ok) {
|
152
|
+
throw new Error(response.statusText);
|
153
|
+
}
|
154
|
+
const data = await response.json();
|
155
|
+
data.results.map((district) => {
|
156
|
+
this.ubiDistricts.push({ value: `${district.id}`, label: district.name });
|
157
|
+
});
|
158
|
+
}
|
159
|
+
updated() {
|
160
|
+
this.addOnChangEventToInputs();
|
161
|
+
}
|
162
|
+
changeTab(value) {
|
163
|
+
this.isCitizen = value;
|
164
|
+
}
|
165
|
+
render() {
|
166
|
+
let content = html ``;
|
167
|
+
if (this.error || this.submited) {
|
168
|
+
content = this.error ? this.renderError() : this.renderSuccess();
|
169
|
+
}
|
170
|
+
else {
|
171
|
+
content = this.renderForm();
|
172
|
+
}
|
173
|
+
return html ` ${this.renderHeader()}
|
174
|
+
<main class="container">${content}</main>`;
|
175
|
+
}
|
176
|
+
renderError() {
|
177
|
+
return html `
|
178
|
+
<section class="success-submit">
|
179
|
+
<article class="success-submit__card success-submit__card--error ">
|
180
|
+
<svg
|
181
|
+
class="succes-submit__svg succes-submit__svg--error"
|
182
|
+
xmlns="http://www.w3.org/2000/svg"
|
183
|
+
width="100px"
|
184
|
+
height="100px"
|
185
|
+
viewBox="0 0 24 24"
|
186
|
+
fill="none"
|
187
|
+
>
|
188
|
+
<path
|
189
|
+
d="M10.0303 8.96965C9.73741 8.67676 9.26253 8.67676 8.96964 8.96965C8.67675 9.26255 8.67675 9.73742 8.96964 10.0303L10.9393 12L8.96966 13.9697C8.67677 14.2625 8.67677 14.7374 8.96966 15.0303C9.26255 15.3232 9.73743 15.3232 10.0303 15.0303L12 13.0607L13.9696 15.0303C14.2625 15.3232 14.7374 15.3232 15.0303 15.0303C15.3232 14.7374 15.3232 14.2625 15.0303 13.9696L13.0606 12L15.0303 10.0303C15.3232 9.73744 15.3232 9.26257 15.0303 8.96968C14.7374 8.67678 14.2625 8.67678 13.9696 8.96968L12 10.9393L10.0303 8.96965Z"
|
190
|
+
/>
|
191
|
+
<path
|
192
|
+
fill-rule="evenodd"
|
193
|
+
clip-rule="evenodd"
|
194
|
+
d="M12 1.25C6.06294 1.25 1.25 6.06294 1.25 12C1.25 17.9371 6.06294 22.75 12 22.75C17.9371 22.75 22.75 17.9371 22.75 12C22.75 6.06294 17.9371 1.25 12 1.25ZM2.75 12C2.75 6.89137 6.89137 2.75 12 2.75C17.1086 2.75 21.25 6.89137 21.25 12C21.25 17.1086 17.1086 21.25 12 21.25C6.89137 21.25 2.75 17.1086 2.75 12Z"
|
195
|
+
/>
|
196
|
+
</svg>
|
197
|
+
<h2 class="succes-submit__title">${msg('Ha ocurrido un error')}</h2>
|
198
|
+
<p class="success-submit__text">
|
199
|
+
${msg('Sentimos las molestias. Vuelva a intentelo más tarde')}.
|
200
|
+
</p>
|
201
|
+
<a class="success-submit__anchor btn btn-error text-center" href="/"
|
202
|
+
>${msg('Volver')}</a
|
203
|
+
>
|
204
|
+
</article>
|
205
|
+
</section>
|
206
|
+
`;
|
207
|
+
}
|
208
|
+
renderSuccess() {
|
209
|
+
return html `
|
210
|
+
<section class="success-submit">
|
211
|
+
<article class="success-submit__card">
|
212
|
+
<svg
|
213
|
+
class="succes-submit__svg"
|
214
|
+
xmlns="http://www.w3.org/2000/svg"
|
215
|
+
width="100px"
|
216
|
+
height="100px"
|
217
|
+
viewBox="0 0 24 24"
|
218
|
+
fill="none"
|
219
|
+
>
|
220
|
+
<path
|
221
|
+
d="M16.0303 10.0303C16.3232 9.73744 16.3232 9.26256 16.0303 8.96967C15.7374 8.67678 15.2626 8.67678 14.9697 8.96967L10.5 13.4393L9.03033 11.9697C8.73744 11.6768 8.26256 11.6768 7.96967 11.9697C7.67678 12.2626 7.67678 12.7374 7.96967 13.0303L9.96967 15.0303C10.2626 15.3232 10.7374 15.3232 11.0303 15.0303L16.0303 10.0303Z"
|
222
|
+
/>
|
223
|
+
<path
|
224
|
+
fill-rule="evenodd"
|
225
|
+
clip-rule="evenodd"
|
226
|
+
d="M12 1.25C6.06294 1.25 1.25 6.06294 1.25 12C1.25 17.9371 6.06294 22.75 12 22.75C17.9371 22.75 22.75 17.9371 22.75 12C22.75 6.06294 17.9371 1.25 12 1.25ZM2.75 12C2.75 6.89137 6.89137 2.75 12 2.75C17.1086 2.75 21.25 6.89137 21.25 12C21.25 17.1086 17.1086 21.25 12 21.25C6.89137 21.25 2.75 17.1086 2.75 12Z"
|
227
|
+
/>
|
228
|
+
</svg>
|
229
|
+
<h2 class="succes-submit__title">${msg('¡Ficha creada!')}</h2>
|
230
|
+
<p class="success-submit__text">
|
231
|
+
${msg('El codi de seguiment és')}:
|
232
|
+
<strong class="color-primary">${this.incidenceId}</strong>
|
233
|
+
</p>
|
234
|
+
<button type="button" class="success-submit__anchor btn text-center" @click="${() => history.back()}">${msg('Volver')}:</button>
|
235
|
+
</article>
|
236
|
+
</section>
|
237
|
+
`;
|
238
|
+
}
|
239
|
+
renderHeader() {
|
240
|
+
return html `
|
241
|
+
<header class="header">
|
242
|
+
<h1 class="header__title">
|
243
|
+
${this.area} > ${this.element} > ${this.detail}
|
244
|
+
</h1>
|
245
|
+
<p class="header__info">
|
246
|
+
${msg('Agradecemos que nos haya hecho llegar su reconocimiento, el cual se hará llegar al departamento responsable. Con esta información, damos por contestada su comunicación')}.
|
247
|
+
</p>
|
248
|
+
<p class="header__info info--danger">
|
249
|
+
${msg('Los campos marcados con un (*) son obligatorios.')}
|
250
|
+
</p>
|
251
|
+
</header>
|
252
|
+
`;
|
253
|
+
}
|
254
|
+
renderForm() {
|
255
|
+
const classesActiveCitizen = this.isCitizen ? 'tablink--active' : '';
|
256
|
+
const classesActiveCompnay = !this.isCitizen ? 'tablink--active' : '';
|
257
|
+
const stylesCharacteristics = {
|
258
|
+
display: this.characteristics.length == 0 ? 'none' : '',
|
259
|
+
};
|
260
|
+
return html `
|
261
|
+
<section class="record">
|
262
|
+
<h2 class="record__comment">${msg('Mensaje')}</h2>
|
263
|
+
<form method="post" @submit=${this.onSubmit}>
|
264
|
+
<input
|
265
|
+
type="hidden"
|
266
|
+
name="detailId"
|
267
|
+
value="${ifDefined(this.detailID)}"
|
268
|
+
/>
|
269
|
+
<label for="comments">${msg('Escriba brevemente su mensaje')}*:</label>
|
270
|
+
<textarea
|
271
|
+
id="comments"
|
272
|
+
name="comments"
|
273
|
+
required
|
274
|
+
minlength="4"
|
275
|
+
placeholder=${msg('Escribe tu consulta aquí')}
|
276
|
+
></textarea>
|
277
|
+
<label for="file">${msg('Añadir archivo')}</label>
|
278
|
+
<input
|
279
|
+
multiple
|
280
|
+
accept=".${this.extensionFiles.split(';').join(',.')}"
|
281
|
+
type="file"
|
282
|
+
name="file"
|
283
|
+
id="input_1"
|
284
|
+
aria-describedby="help-input_1"
|
285
|
+
/>
|
286
|
+
<p class="text-error"></p>
|
287
|
+
<div class="help-text" id="file">
|
288
|
+
${msg('Aceptados:')} ${this.extensionFiles}
|
289
|
+
</div>
|
290
|
+
|
291
|
+
<section class="map">
|
292
|
+
<h2 class="text-center">${msg('Ubicación')}</h2>
|
293
|
+
<div id="map" ?hidden=${!this.activeMap}></div>
|
294
|
+
${when(this.activeMap, () => this.renderMap(), () => this.ubiDistricts.length > 0
|
295
|
+
? html `
|
296
|
+
<div>
|
297
|
+
<label for="map-district">${msg('Distrito*:')}</label>
|
298
|
+
<select
|
299
|
+
required
|
300
|
+
id="map-district"
|
301
|
+
name="location.district"
|
302
|
+
>
|
303
|
+
${this.ubiDistricts.map((district) => html `<option value="${district.value}">
|
304
|
+
${district.label}
|
305
|
+
</option>`)}
|
306
|
+
</select>
|
307
|
+
</div>
|
308
|
+
`
|
309
|
+
: html ``)}
|
310
|
+
</section>
|
311
|
+
|
312
|
+
<h2
|
313
|
+
class="text-center color-primary"
|
314
|
+
style=${styleMap(stylesCharacteristics)}
|
315
|
+
>
|
316
|
+
${msg('Características de la petición')}
|
317
|
+
</h2>
|
318
|
+
<section class="characteristics-form">
|
319
|
+
${this._fetchFields.render({
|
320
|
+
pending: () => html `<p>${msg('Cargando formulario')}...</p>`,
|
321
|
+
complete: () => html `
|
322
|
+
${this.characteristics.map((characteristic) => html `
|
323
|
+
<div>
|
324
|
+
<label for="niris-${characteristic.id}"
|
325
|
+
>${characteristic.title}${characteristic.mandatory
|
326
|
+
? '*'
|
327
|
+
: ''}:</label
|
328
|
+
>
|
329
|
+
${choose(characteristic.type, [
|
330
|
+
[
|
331
|
+
CharacteristicTypeEnum.Number,
|
332
|
+
() => html `<input
|
333
|
+
id="niris-${characteristic.id}"
|
334
|
+
name="characteristic-${characteristic.id}"
|
335
|
+
type="number"
|
336
|
+
?required=${characteristic.mandatory}
|
337
|
+
placeholder=${characteristic.explanatory_text}
|
338
|
+
/>`,
|
339
|
+
],
|
340
|
+
[
|
341
|
+
CharacteristicTypeEnum.Options,
|
342
|
+
() => html `<select
|
343
|
+
id="niris-${characteristic.id}"
|
344
|
+
name="characteristic-${characteristic.id}"
|
345
|
+
?required=${characteristic.mandatory}
|
346
|
+
>
|
347
|
+
${characteristic.options.map((option) => html `<option value="${option}">
|
348
|
+
${option}
|
349
|
+
</option>`)}
|
350
|
+
</select>`,
|
351
|
+
],
|
352
|
+
[
|
353
|
+
CharacteristicTypeEnum.Date,
|
354
|
+
() => html `<input
|
355
|
+
id="niris-${characteristic.id}"
|
356
|
+
name="characteristic-${characteristic.id}"
|
357
|
+
type="date"
|
358
|
+
?required=${characteristic.mandatory}
|
359
|
+
/>`,
|
360
|
+
],
|
361
|
+
[
|
362
|
+
CharacteristicTypeEnum.Time,
|
363
|
+
() => html `<input
|
364
|
+
id="niris-${characteristic.id}"
|
365
|
+
name="characteristic-${characteristic.id}"
|
366
|
+
type="time"
|
367
|
+
?required=${characteristic.mandatory}
|
368
|
+
/>`,
|
369
|
+
],
|
370
|
+
[
|
371
|
+
CharacteristicTypeEnum.Text,
|
372
|
+
() => html `<input
|
373
|
+
id="niris-${characteristic.id}"
|
374
|
+
name="characteristic-${characteristic.id}"
|
375
|
+
type="text"
|
376
|
+
?required=${characteristic.mandatory}
|
377
|
+
placeholder=${characteristic.explanatory_text}
|
378
|
+
/>`,
|
379
|
+
],
|
380
|
+
], () => html `<p>${msg('Not implemented')}</p>`)}
|
381
|
+
</div>
|
382
|
+
`)}
|
383
|
+
`,
|
384
|
+
error: () => html `<p>${msg('Error cargando el formulario')}</p>`,
|
385
|
+
})}
|
386
|
+
</section>
|
387
|
+
|
388
|
+
<h2 class="text-center">${msg('Datos personales')}</h2>
|
389
|
+
<div class="tab">
|
390
|
+
<div
|
391
|
+
class="tab__tablink ${classesActiveCitizen}"
|
392
|
+
@click=${() => this.changeTab(true)}
|
393
|
+
>
|
394
|
+
${msg('Ciudadano')}
|
395
|
+
</div>
|
396
|
+
<div
|
397
|
+
class="tab__tablink ${classesActiveCompnay}"
|
398
|
+
@click="${() => this.changeTab(false)}"
|
399
|
+
>
|
400
|
+
${msg('Empresa/Entidad')}
|
401
|
+
</div>
|
402
|
+
</div>
|
403
|
+
<div class="tab__tabcontent">
|
404
|
+
${this.isCitizen
|
405
|
+
? this.renderCitizenForm()
|
406
|
+
: this.renderCompanyForm()}
|
407
|
+
</div>
|
408
|
+
<button id="submit-btn" type="submit" ?disabled=${this.loading}>
|
409
|
+
<div class="loader" ?hidden=${!this.loading} id="loader"></div>
|
410
|
+
${this.loading ? 'Enviando' : 'Enviar'}
|
411
|
+
<!-- TODO -->
|
412
|
+
</button>
|
413
|
+
</form>
|
414
|
+
</section>
|
415
|
+
`;
|
416
|
+
}
|
417
|
+
renderCitizenForm() {
|
418
|
+
return html `
|
419
|
+
<div>
|
420
|
+
<label for="nameCitizen">${msg('Nombre')}*:</label>
|
421
|
+
<input id="nameCitizen" name="nameCitizen" type="text" required />
|
422
|
+
</div>
|
423
|
+
|
424
|
+
<div>
|
425
|
+
<label for="firstSurname">${msg('Primer apellido')}*:</label>
|
426
|
+
<input id="firstSurname" name="firstSurname" type="text" />
|
427
|
+
</div>
|
428
|
+
|
429
|
+
<div>
|
430
|
+
<label for="secondSurname">${msg('Segundo apellido')}*:</label>
|
431
|
+
<input id="secondSurname" name="secondSurname" type="text" required />
|
432
|
+
</div>
|
433
|
+
|
434
|
+
<div>
|
435
|
+
<label for="document-type">${msg('Tipo de Documento')}*:</label>
|
436
|
+
<select id="typeDocument" name="typeDocument" required>
|
437
|
+
<option value="0" selected>${msg('NIF/DNI')}</option>
|
438
|
+
<option value="1">${msg('NIE')}</option>
|
439
|
+
<option value="2">${msg('Passaporte')}</option>
|
440
|
+
</select>
|
441
|
+
</div>
|
442
|
+
|
443
|
+
<div>
|
444
|
+
<label for="numberDocument">${msg('Núm. Documento')}*:</label>
|
445
|
+
<input
|
446
|
+
id="numberDocument"
|
447
|
+
name="numberDocument"
|
448
|
+
type="text"
|
449
|
+
required
|
450
|
+
/>
|
451
|
+
</div>
|
452
|
+
|
453
|
+
<div>
|
454
|
+
<label for="birthYear">${msg('Año de nacimiento')}:</label>
|
455
|
+
<select id="birthYear" name="birthYear">
|
456
|
+
${this.years().map((year) => html `<option value="${year}">${year}</option>`)}
|
457
|
+
</select>
|
458
|
+
</div>
|
459
|
+
|
460
|
+
${this.ubiDistricts.length > 0
|
461
|
+
? html `
|
462
|
+
<div>
|
463
|
+
<label for="district">${msg('Distrito')}*:</label>
|
464
|
+
<select required id="district" name="district">
|
465
|
+
${this.ubiDistricts.map((district) => html `<option value="${district.value}">
|
466
|
+
${district.label}
|
467
|
+
</option>`)}
|
468
|
+
</select>
|
469
|
+
</div>
|
470
|
+
`
|
471
|
+
: nothing}
|
472
|
+
|
473
|
+
<div>
|
474
|
+
<label for="email">${msg('Correo electrónico')}*:</label>
|
475
|
+
<input
|
476
|
+
id="email"
|
477
|
+
name="email"
|
478
|
+
type="email"
|
479
|
+
required
|
480
|
+
placeholder=${msg('Escribe tu correo')}
|
481
|
+
/>
|
482
|
+
</div>
|
483
|
+
|
484
|
+
<div>
|
485
|
+
<label for="email_confirm">${msg('Confirma correo electrónico')}*:</label>
|
486
|
+
<input
|
487
|
+
id="email_confirm"
|
488
|
+
name="email_confirm"
|
489
|
+
@focusout=${(event) => this.confirmEmail(event)}
|
490
|
+
type="email"
|
491
|
+
required
|
492
|
+
placeholder=${msg('Confirma tu correo')}
|
493
|
+
/>
|
494
|
+
<span class="text-error" hidden id="email_confirm_error"
|
495
|
+
>${msg('Los emails no conciden')}</span
|
496
|
+
>
|
497
|
+
</div>
|
498
|
+
|
499
|
+
<div>
|
500
|
+
<label for="phone">${msg('Teléfono')}*:</label>
|
501
|
+
<input
|
502
|
+
id="phone"
|
503
|
+
name="phone"
|
504
|
+
type="tel"
|
505
|
+
minlength="9"
|
506
|
+
placeholder=${msg('Escribe tu teléfono')}
|
507
|
+
/>
|
508
|
+
</div>
|
509
|
+
`;
|
510
|
+
}
|
511
|
+
renderCompanyForm() {
|
512
|
+
return html `
|
513
|
+
<div>
|
514
|
+
<label for="socialReason">${msg('Razón social')}*:</label>
|
515
|
+
<input id="socialReason" name="socialReason" type="text" required />
|
516
|
+
</div>
|
517
|
+
|
518
|
+
<div>
|
519
|
+
<label for="contactPerson">${msg('Persona de contacto')}*:</label>
|
520
|
+
<input id="contactPerson" name="contactPerson" type="text" required />
|
521
|
+
</div>
|
522
|
+
|
523
|
+
<div>
|
524
|
+
<label for="cif">${msg('CIF')}*:</label>
|
525
|
+
<input id="cif" name="cif" type="text" required />
|
526
|
+
</div>
|
527
|
+
|
528
|
+
<div>
|
529
|
+
<label for="email">${msg('Email')}*:</label>
|
530
|
+
<input
|
531
|
+
id="email"
|
532
|
+
name="email"
|
533
|
+
type="text"
|
534
|
+
type="email"
|
535
|
+
required
|
536
|
+
/>
|
537
|
+
</div>
|
538
|
+
|
539
|
+
<div>
|
540
|
+
<label for="email_confirm">${msg('Confirma el email')}*:</label>
|
541
|
+
<input
|
542
|
+
id="email_confirm"
|
543
|
+
name="email_confirm"
|
544
|
+
type="text"
|
545
|
+
type="email"
|
546
|
+
required
|
547
|
+
@focusout=${(event) => this.confirmEmail(event)}
|
548
|
+
/>
|
549
|
+
<span class="text-error" hidden id="email_confirm_error"
|
550
|
+
>${msg('Los emails no conciden')}</span
|
551
|
+
>
|
552
|
+
</div>
|
553
|
+
|
554
|
+
<div>
|
555
|
+
<label for="phone">${msg('Idioma de la respuesta')}*:</label>
|
556
|
+
<select id="phone" name="language" required>
|
557
|
+
<option value="es" selected>${msg('Español')}</option>
|
558
|
+
<option value="ca">${msg('Catalán')}</option>
|
559
|
+
<option value="en">${msg('Inglés')}</option>
|
560
|
+
</select>
|
561
|
+
</div>
|
562
|
+
`;
|
563
|
+
}
|
564
|
+
renderMap() {
|
565
|
+
return html `
|
566
|
+
<link
|
567
|
+
rel="stylesheet"
|
568
|
+
href="https://cdn.skypack.dev/leaflet/dist/leaflet.css"
|
569
|
+
/>
|
570
|
+
<section class="map-form">
|
571
|
+
<div>
|
572
|
+
<label for="map-address">${msg('Calle')}*:</label>
|
573
|
+
<input
|
574
|
+
id="map-address"
|
575
|
+
required
|
576
|
+
type="text"
|
577
|
+
@keyup="${(event) => (this.street = event.target.value)}"
|
578
|
+
.value="${this.street}"
|
579
|
+
name="address"
|
580
|
+
/>
|
581
|
+
<input name="latitude" hidden .value="${this.latitude}" />
|
582
|
+
<input name="longitude" hidden .value="${this.longitude}" />
|
583
|
+
</div>
|
584
|
+
|
585
|
+
<div>
|
586
|
+
<label for="map-number">${msg('Número')}*:</label>
|
587
|
+
<input
|
588
|
+
id="map-number"
|
589
|
+
@keyup="${(event) => (this.streetNumber = event.target.value)}"
|
590
|
+
.value="${this.streetNumber}"
|
591
|
+
required
|
592
|
+
type="text"
|
593
|
+
name="number"
|
594
|
+
/>
|
595
|
+
</div>
|
596
|
+
|
597
|
+
<div>
|
598
|
+
<button
|
599
|
+
type="button"
|
600
|
+
.disabled="${!Boolean(this.street.length)}"
|
601
|
+
@click="${this.searchAddress}"
|
602
|
+
>
|
603
|
+
${msg('Buscar')}
|
604
|
+
</button>
|
605
|
+
</div>
|
606
|
+
</section>
|
607
|
+
|
608
|
+
<section class="map-form-grid">
|
609
|
+
<div>
|
610
|
+
<label for="map-floor">${msg('Piso')}:</label>
|
611
|
+
<input id="map-floor" type="text" name="floor" />
|
612
|
+
</div>
|
613
|
+
|
614
|
+
<div>
|
615
|
+
<label for="map-stair">${msg('Escalera')}:</label>
|
616
|
+
<input id="map-stair" type="text" name="stair" />
|
617
|
+
</div>
|
618
|
+
|
619
|
+
<div>
|
620
|
+
<label for="map-door">${msg('Puerta')}:</label>
|
621
|
+
<input id="map-door" type="text" name="door" />
|
622
|
+
</div>
|
623
|
+
</section>
|
624
|
+
`;
|
625
|
+
}
|
626
|
+
async onSubmit(event) {
|
627
|
+
this.loading = true;
|
628
|
+
event.preventDefault();
|
629
|
+
event.stopImmediatePropagation();
|
630
|
+
const form = event.target;
|
631
|
+
if (!form.checkValidity()) {
|
632
|
+
form.reportValidity();
|
633
|
+
this.loading = false;
|
634
|
+
return;
|
635
|
+
}
|
636
|
+
const files = form.file.files;
|
637
|
+
const formData = new FormData();
|
638
|
+
const value = Object.fromEntries(new FormData(form).entries());
|
639
|
+
if (this.activeMap) {
|
640
|
+
value.location = {};
|
641
|
+
value.location['address'] = value.address;
|
642
|
+
value.location['number'] = value.number;
|
643
|
+
value.location['latitude'] = value.latitude;
|
644
|
+
value.location['longitude'] = value.longitude;
|
645
|
+
value.location['floor'] = value.floor;
|
646
|
+
value.location['stair'] = value.stair;
|
647
|
+
value.location['door'] = value.door;
|
648
|
+
}
|
649
|
+
else {
|
650
|
+
value.location = { district: value.district };
|
651
|
+
}
|
652
|
+
//Save the file separated from the body
|
653
|
+
value.file = [];
|
654
|
+
if (files.length > 0) {
|
655
|
+
for (let i = 0; i < files.length; i++) {
|
656
|
+
const file = {
|
657
|
+
filename: files[i].name,
|
658
|
+
file: files[i],
|
659
|
+
};
|
660
|
+
value.file.push(file);
|
661
|
+
}
|
662
|
+
}
|
663
|
+
// add inputs with name starting with "characteristic-" to the values object adding a new key "characteristics"
|
664
|
+
const characteristics = Object.keys(value).filter((key) => key.startsWith('characteristic-'));
|
665
|
+
value.characteristics = characteristics.map((key) => {
|
666
|
+
const id = key.split('-')[1];
|
667
|
+
// @ts-ignore
|
668
|
+
const val = value[key];
|
669
|
+
// @ts-ignore
|
670
|
+
delete value[key];
|
671
|
+
return { id, value: val };
|
672
|
+
});
|
673
|
+
formData.append('body', JSON.stringify(value));
|
674
|
+
const response = await fetch(`${this.getApiUrl()}/incidences`, {
|
675
|
+
headers: {
|
676
|
+
'Accept-Language': this.locale,
|
677
|
+
},
|
678
|
+
method: 'POST',
|
679
|
+
body: formData,
|
680
|
+
});
|
681
|
+
if (!response.ok && response.status !== 400) {
|
682
|
+
this.error = true;
|
683
|
+
this.loading = false;
|
684
|
+
return;
|
685
|
+
}
|
686
|
+
if (response.status === 400) {
|
687
|
+
const data = await response.json();
|
688
|
+
this.handlerError(data);
|
689
|
+
}
|
690
|
+
else {
|
691
|
+
const data = await response.json();
|
692
|
+
this.incidenceId = data.incidenceId;
|
693
|
+
this.submited = true;
|
694
|
+
}
|
695
|
+
this.loading = false;
|
696
|
+
}
|
697
|
+
handlerError(data) {
|
698
|
+
const errors = data;
|
699
|
+
Object.keys(errors).map((key) => {
|
700
|
+
const input = this.shadowRoot?.getElementById(`${key}`);
|
701
|
+
if (key in errors && input) {
|
702
|
+
input.setCustomValidity(errors[key]);
|
703
|
+
input.reportValidity();
|
704
|
+
}
|
705
|
+
});
|
706
|
+
if ('characteristics' in errors) {
|
707
|
+
const characteristics = errors['characteristics'];
|
708
|
+
for (let [key, errors] of characteristics.entries()) {
|
709
|
+
if (Object.keys(errors).length !== 0) {
|
710
|
+
debugger;
|
711
|
+
const input = this.shadowRoot?.getElementById(`niris-${key}`);
|
712
|
+
errors.value.forEach((error) => {
|
713
|
+
input.setCustomValidity(error);
|
714
|
+
input.reportValidity();
|
715
|
+
});
|
716
|
+
}
|
717
|
+
}
|
718
|
+
}
|
719
|
+
}
|
720
|
+
confirmEmail(event) {
|
721
|
+
const email = this.shadowRoot?.getElementById('email');
|
722
|
+
const emailConfirm = this.shadowRoot?.getElementById('email_confirm');
|
723
|
+
const error = this.shadowRoot?.getElementById('email_confirm_error');
|
724
|
+
const submit = this.shadowRoot?.getElementById('submit-btn');
|
725
|
+
if (email.value !== emailConfirm.value) {
|
726
|
+
error.hidden = false;
|
727
|
+
submit.disabled = true;
|
728
|
+
emailConfirm.classList.add('invalid');
|
729
|
+
}
|
730
|
+
else {
|
731
|
+
error.hidden = true;
|
732
|
+
submit.disabled = false;
|
733
|
+
emailConfirm.classList.remove('invalid');
|
734
|
+
}
|
735
|
+
event.target.reportValidity();
|
736
|
+
}
|
737
|
+
years() {
|
738
|
+
const currentYear = new Date().getFullYear();
|
739
|
+
const years = [];
|
740
|
+
for (let i = currentYear - 100; i <= currentYear; i++) {
|
741
|
+
years.push(i);
|
742
|
+
}
|
743
|
+
years.reverse();
|
744
|
+
return years;
|
745
|
+
}
|
746
|
+
async onMapClick(e) {
|
747
|
+
if (this._marker) {
|
748
|
+
this._map.removeLayer(this._marker);
|
749
|
+
}
|
750
|
+
this._marker = new L.marker([e.latlng.lat, e.latlng.lng], {
|
751
|
+
icon: this._markerIcon,
|
752
|
+
}).addTo(this._map);
|
753
|
+
try {
|
754
|
+
const response = await fetch(`${this.domain}/geo_proxy/ubication/reverse/?lat=${e.latlng.lat}&lon=${e.latlng.lng}`, {
|
755
|
+
headers: {
|
756
|
+
'Accept-Language': this.locale,
|
757
|
+
},
|
758
|
+
});
|
759
|
+
if (!response.ok) {
|
760
|
+
throw new Error(response.statusText);
|
761
|
+
}
|
762
|
+
else {
|
763
|
+
const ubi = await response.json();
|
764
|
+
this.street = ubi.street;
|
765
|
+
this.streetNumber = ubi.street2;
|
766
|
+
this.latitude = ubi.latitude;
|
767
|
+
this.longitude = ubi.longitude;
|
768
|
+
}
|
769
|
+
}
|
770
|
+
catch (error) {
|
771
|
+
console.info(error);
|
772
|
+
}
|
773
|
+
}
|
774
|
+
async searchAddress() {
|
775
|
+
try {
|
776
|
+
const response = await fetch(`${this.domain}/geo_proxy/ubication/search/?q=${this.street}, ${this.streetNumber}`, {
|
777
|
+
headers: {
|
778
|
+
'Accept-Language': this.locale,
|
779
|
+
},
|
780
|
+
});
|
781
|
+
if (this._marker) {
|
782
|
+
this._map.removeLayer(this._marker);
|
783
|
+
}
|
784
|
+
const data = await response.json();
|
785
|
+
this._marker = new L.marker([data[0].lat, data[0].lon]).addTo(this._map);
|
786
|
+
this._map.setView([data[0].lat, data[0].lon], 15);
|
787
|
+
}
|
788
|
+
catch (error) {
|
789
|
+
console.error(error);
|
790
|
+
}
|
791
|
+
}
|
792
|
+
};
|
793
|
+
FormNiris.styles = [
|
794
|
+
globalStyles,
|
795
|
+
css `
|
796
|
+
:host {
|
797
|
+
--primary-color: #03599d;
|
798
|
+
--padding: 0.7rem 0.7rem;
|
799
|
+
--font-size: 1rem;
|
800
|
+
--border-radius: 0rem;
|
801
|
+
--font-weight: 500;
|
802
|
+
--font-family: 'Arial', sans-serif;
|
803
|
+
--color-button: #fff;
|
804
|
+
--error-color: #c23939;
|
805
|
+
--tab-secondary-color: #ced1d7;
|
806
|
+
}
|
807
|
+
/* Style the tab */
|
808
|
+
.tab {
|
809
|
+
overflow: hidden;
|
810
|
+
background-color: #e5e7eb;
|
811
|
+
width: 100%;
|
812
|
+
}
|
813
|
+
|
814
|
+
/* Style the buttons inside the tab */
|
815
|
+
.tab__tablink {
|
816
|
+
background-color: inherit;
|
817
|
+
float: left;
|
818
|
+
border: none;
|
819
|
+
outline: none;
|
820
|
+
cursor: pointer;
|
821
|
+
padding: 14px 0px;
|
822
|
+
transition: 0.3s;
|
823
|
+
font-size: 17px;
|
824
|
+
line-height: 20px;
|
825
|
+
width: 50%;
|
826
|
+
text-align: center;
|
827
|
+
font-weight: bold;
|
828
|
+
color: #4b5563;
|
829
|
+
border-top: 4px solid var(--tab-secondary-color);
|
830
|
+
background-color: var(--tab-secondary-color);
|
831
|
+
}
|
832
|
+
.tab__tabcontent {
|
833
|
+
display: grid;
|
834
|
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
835
|
+
gap: 0.5rem;
|
836
|
+
justify-content: space-between;
|
837
|
+
width: 100%;
|
838
|
+
background-color: #e5e7eb;
|
839
|
+
padding: 1.5rem;
|
840
|
+
color: #676774;
|
841
|
+
font-size: 16px;
|
842
|
+
line-height: 20px;
|
843
|
+
font-weight: 500;
|
844
|
+
}
|
845
|
+
|
846
|
+
.tablink--active {
|
847
|
+
background-color: #e5e7eb;
|
848
|
+
color: #4b5563;
|
849
|
+
border-top: 4px solid var(--primary-color);
|
850
|
+
}
|
851
|
+
|
852
|
+
.tab__tablink:not(.tablink--active):hover {
|
853
|
+
filter: brightness(90%);
|
854
|
+
color: #545466;
|
855
|
+
}
|
856
|
+
|
857
|
+
.container {
|
858
|
+
max-width: 1280px;
|
859
|
+
width: 100%;
|
860
|
+
margin: 0 auto;
|
861
|
+
}
|
862
|
+
|
863
|
+
.header {
|
864
|
+
padding: 2rem;
|
865
|
+
text-align: center;
|
866
|
+
margin: 0 auto;
|
867
|
+
background-color: #f5f5f5;
|
868
|
+
}
|
869
|
+
|
870
|
+
.header__info {
|
871
|
+
margin: 0.5rem auto;
|
872
|
+
max-width: 1280px;
|
873
|
+
color: #676774;
|
874
|
+
}
|
875
|
+
.header__title {
|
876
|
+
font-size: 1.8rem;
|
877
|
+
}
|
878
|
+
|
879
|
+
.info--danger {
|
880
|
+
color: red;
|
881
|
+
}
|
882
|
+
|
883
|
+
.record {
|
884
|
+
width: 70%;
|
885
|
+
margin: 0 auto;
|
886
|
+
}
|
887
|
+
|
888
|
+
.record__comment {
|
889
|
+
font-size: 1.5rem;
|
890
|
+
margin-bottom: 2rem;
|
891
|
+
text-align: center;
|
892
|
+
}
|
893
|
+
|
894
|
+
/* utility classes */
|
895
|
+
.color-primary {
|
896
|
+
color: var(--primary-color);
|
897
|
+
}
|
898
|
+
|
899
|
+
.hide {
|
900
|
+
display: none;
|
901
|
+
}
|
902
|
+
|
903
|
+
.text-center {
|
904
|
+
text-align: center;
|
905
|
+
}
|
906
|
+
|
907
|
+
.mx-auto {
|
908
|
+
margin: 0 auto;
|
909
|
+
}
|
910
|
+
|
911
|
+
.self-center {
|
912
|
+
align-self: center;
|
913
|
+
}
|
914
|
+
|
915
|
+
.help-text {
|
916
|
+
font-size: 0.9rem;
|
917
|
+
color: #676774;
|
918
|
+
}
|
919
|
+
|
920
|
+
/* characteristics-form" */
|
921
|
+
.characteristics-form {
|
922
|
+
display: grid;
|
923
|
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
924
|
+
gap: 0.5rem;
|
925
|
+
}
|
926
|
+
|
927
|
+
/* Success Card */
|
928
|
+
.success-submit {
|
929
|
+
display: flex;
|
930
|
+
justify-content: center;
|
931
|
+
align-items: center;
|
932
|
+
}
|
933
|
+
|
934
|
+
.success-submit__card {
|
935
|
+
margin: 4rem 0;
|
936
|
+
width: 25rem;
|
937
|
+
height: 35rem;
|
938
|
+
-webkit-box-shadow: 2px 2px 15px 0px rgba(77, 77, 77, 0.5);
|
939
|
+
-moz-box-shadow: 2px 2px 15px 0px rgba(77, 77, 77, 0.5);
|
940
|
+
box-shadow: 2px 2px 15px 0px rgba(77, 77, 77, 0.5);
|
941
|
+
display: flex;
|
942
|
+
flex-direction: column;
|
943
|
+
justify-content: space-between;
|
944
|
+
align-items: center;
|
945
|
+
border-top: 5px solid var(--primary-color);
|
946
|
+
}
|
947
|
+
|
948
|
+
.success-submit__card:hover {
|
949
|
+
-webkit-box-shadow: 2px 2px 15px 0px rgba(77, 77, 77, 0.5);
|
950
|
+
-moz-box-shadow: 2px 2px 15px 0px rgba(77, 77, 77, 0.5);
|
951
|
+
box-shadow: 4px 4px 17px 2px rgba(77, 77, 77, 0.5);
|
952
|
+
transition: 0.5s;
|
953
|
+
}
|
954
|
+
|
955
|
+
.success-submit__card--error {
|
956
|
+
border-top: 5px solid var(--error-color);
|
957
|
+
}
|
958
|
+
|
959
|
+
.succes-submit__svg {
|
960
|
+
margin-top: 20%;
|
961
|
+
fill: var(--primary-color);
|
962
|
+
filter: opacity(70%);
|
963
|
+
}
|
964
|
+
|
965
|
+
.succes-submit__svg:hover {
|
966
|
+
transform: rotate(360deg);
|
967
|
+
transition: 0.5s;
|
968
|
+
}
|
969
|
+
|
970
|
+
.succes-submit__svg--error {
|
971
|
+
fill: var(--error-color);
|
972
|
+
}
|
973
|
+
|
974
|
+
.succes-submit__title {
|
975
|
+
font-size: 1.8rem;
|
976
|
+
margin-bottom: 2rem;
|
977
|
+
color: #373e47;
|
978
|
+
}
|
979
|
+
|
980
|
+
.success-submit__text {
|
981
|
+
font-size: 1.3rem;
|
982
|
+
padding: 0 3rem;
|
983
|
+
text-align: center;
|
984
|
+
}
|
985
|
+
|
986
|
+
.success-submit__anchor {
|
987
|
+
font-size: 1.2rem;
|
988
|
+
text-decoration: none;
|
989
|
+
width: 100%;
|
990
|
+
padding: 1rem;
|
991
|
+
}
|
992
|
+
|
993
|
+
/* Map */
|
994
|
+
#map {
|
995
|
+
margin-bottom: 2rem;
|
996
|
+
width: 100%;
|
997
|
+
height: 30vh;
|
998
|
+
border: 1px solid #676774;
|
999
|
+
}
|
1000
|
+
.map-form {
|
1001
|
+
display: flex;
|
1002
|
+
justify-content: space-between;
|
1003
|
+
align-items: flex-end;
|
1004
|
+
gap: 1rem;
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
.map-form div:nth-child(1) {
|
1008
|
+
flex-basis: 60%;
|
1009
|
+
}
|
1010
|
+
.map-form div:nth-child(2) {
|
1011
|
+
flex-basis: 30%;
|
1012
|
+
}
|
1013
|
+
.map-form button {
|
1014
|
+
flex-basis: 20%;
|
1015
|
+
margin-bottom: 0.5rem;
|
1016
|
+
}
|
1017
|
+
|
1018
|
+
.map-form-grid {
|
1019
|
+
display: grid;
|
1020
|
+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
1021
|
+
gap: 1rem;
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
.loader {
|
1025
|
+
width: 18px;
|
1026
|
+
padding: 4px;
|
1027
|
+
float: left;
|
1028
|
+
aspect-ratio: 1;
|
1029
|
+
border-radius: 50%;
|
1030
|
+
background: #ffffff;
|
1031
|
+
--_m:
|
1032
|
+
conic-gradient(#22222200 10%,#000),
|
1033
|
+
linear-gradient(#000 0 0) content-box;
|
1034
|
+
-webkit-mask: var(--_m);
|
1035
|
+
mask: var(--_m);
|
1036
|
+
-webkit-mask-composite: source-out;
|
1037
|
+
mask-composite: subtract;
|
1038
|
+
animation: l3 1s infinite linear;
|
1039
|
+
}
|
1040
|
+
@keyframes l3 {to{transform: rotate(1turn)}}
|
1041
|
+
|
1042
|
+
/* Media queries */
|
1043
|
+
@media screen and (max-width: 640px) {
|
1044
|
+
.record {
|
1045
|
+
width: 96%;
|
1046
|
+
}
|
1047
|
+
.success-submit__card {
|
1048
|
+
width: 80%;
|
1049
|
+
}
|
1050
|
+
}
|
1051
|
+
`,
|
1052
|
+
];
|
1053
|
+
__decorate([
|
1054
|
+
property({ type: Number })
|
1055
|
+
], FormNiris.prototype, "detailID", void 0);
|
1056
|
+
__decorate([
|
1057
|
+
property({ type: String })
|
1058
|
+
], FormNiris.prototype, "actionUrl", void 0);
|
1059
|
+
__decorate([
|
1060
|
+
property({ type: String })
|
1061
|
+
], FormNiris.prototype, "apiUrl", void 0);
|
1062
|
+
__decorate([
|
1063
|
+
property({ type: String })
|
1064
|
+
], FormNiris.prototype, "area", void 0);
|
1065
|
+
__decorate([
|
1066
|
+
property({ type: String })
|
1067
|
+
], FormNiris.prototype, "element", void 0);
|
1068
|
+
__decorate([
|
1069
|
+
property({ type: String })
|
1070
|
+
], FormNiris.prototype, "detail", void 0);
|
1071
|
+
__decorate([
|
1072
|
+
property({ type: Array })
|
1073
|
+
], FormNiris.prototype, "characteristics", void 0);
|
1074
|
+
__decorate([
|
1075
|
+
property({ type: String })
|
1076
|
+
], FormNiris.prototype, "defaultLat", void 0);
|
1077
|
+
__decorate([
|
1078
|
+
property({ type: String })
|
1079
|
+
], FormNiris.prototype, "defaultLon", void 0);
|
1080
|
+
__decorate([
|
1081
|
+
property({ type: String })
|
1082
|
+
], FormNiris.prototype, "locale", void 0);
|
1083
|
+
__decorate([
|
1084
|
+
state()
|
1085
|
+
], FormNiris.prototype, "isCitizen", void 0);
|
1086
|
+
__decorate([
|
1087
|
+
state()
|
1088
|
+
], FormNiris.prototype, "activeMap", void 0);
|
1089
|
+
__decorate([
|
1090
|
+
state()
|
1091
|
+
], FormNiris.prototype, "ubiDistricts", void 0);
|
1092
|
+
__decorate([
|
1093
|
+
state()
|
1094
|
+
], FormNiris.prototype, "submited", void 0);
|
1095
|
+
__decorate([
|
1096
|
+
state()
|
1097
|
+
], FormNiris.prototype, "error", void 0);
|
1098
|
+
__decorate([
|
1099
|
+
state()
|
1100
|
+
], FormNiris.prototype, "incidenceId", void 0);
|
1101
|
+
__decorate([
|
1102
|
+
state()
|
1103
|
+
], FormNiris.prototype, "extensionFiles", void 0);
|
1104
|
+
__decorate([
|
1105
|
+
property({ type: String })
|
1106
|
+
], FormNiris.prototype, "domain", void 0);
|
1107
|
+
__decorate([
|
1108
|
+
state()
|
1109
|
+
], FormNiris.prototype, "street", void 0);
|
1110
|
+
__decorate([
|
1111
|
+
state()
|
1112
|
+
], FormNiris.prototype, "streetNumber", void 0);
|
1113
|
+
__decorate([
|
1114
|
+
state()
|
1115
|
+
], FormNiris.prototype, "latitude", void 0);
|
1116
|
+
__decorate([
|
1117
|
+
state()
|
1118
|
+
], FormNiris.prototype, "longitude", void 0);
|
1119
|
+
__decorate([
|
1120
|
+
state()
|
1121
|
+
], FormNiris.prototype, "loading", void 0);
|
1122
|
+
FormNiris = __decorate([
|
1123
|
+
localized()
|
1124
|
+
], FormNiris);
|
1125
|
+
export { FormNiris };
|
1126
|
+
customElements.define('form-niris', FormNiris);
|
1127
|
+
//# sourceMappingURL=form-niris.js.map
|