diff --git a/webgis/index.html b/webgis/index.html
index 26607c1..db9e428 100644
--- a/webgis/index.html
+++ b/webgis/index.html
@@ -545,10 +545,19 @@
Immagini
+
+
+
+ Documenti
+
+
+
diff --git a/webgis/js/components/NotConserved.js b/webgis/js/components/NotConserved.js
index 10ca854..ced4358 100644
--- a/webgis/js/components/NotConserved.js
+++ b/webgis/js/components/NotConserved.js
@@ -7,7 +7,7 @@ export class NotConserved {
/**
* @param {object} data
*/
- set siteData(data) {
+ set data(data) {
this._data = data;
}
@@ -71,16 +71,67 @@ export class NotConserved {
* @param {Function} gallery
*/
async setImages(imageContainer, gallery) {
- let record = await this.fetchData(`${window.API_URL}/not_conserved/${this._data.id}`)
+ //let record = await this.fetchData(`${window.API_URL}/not_conserved/${this._data.id}`)
- if (record.images.length) {
- this.images = record.images;
+ if (this._data.images.length) {
+ this.images = this._data.images;
imageContainer.innerHTML = this.renderImages();
gallery('not-conserved-gallery', this.images);
} else
imageContainer.innerHTML = 'Nessuna risorsa visuale disponibile
';
}
+ async renderDocs() {
+ let record = await this.fetchData(`${window.API_URL}/not_conserved/${this._data.id}`);
+
+ this.documentation = record.documents.filter(d => d.type === 'documentazione')
+ this.publications = record.documents.filter(d => d.type === 'pubblicazione');
+
+ let content = `
+
+
+
+
+ Documentazione di archivio |
+
---|
Titolo | Luogo di conservazione | Download |
+
+
+ `;
+
+ for (const doc of this.documentation) {
+ content += `
+ ${doc.title} | ${doc.conservationPlace} |
+ PDF
+ |
+ `;
+ }
+ if (this.publications.length) {
+ content += `
+
+
+ Pubblicazioni del progetto Carta Archeologica |
+
---|
Titolo | Autori | Download |
+
+
+ `;
+ for (const doc of this.publications) {
+ content += `
+ ${doc.title} | ${doc.authors} |
+ PDF
+ |
+ `;
+ }
+ }
+ content += `
+
+
+
+
+ `;
+
+ return content;
+ }
+
async biblio(recordId) {
let record = await this.fetchData(`${window.API_URL}/not_conserved/${recordId}`);
diff --git a/webgis/js/ui.js b/webgis/js/ui.js
index a69ffec..86ada0f 100644
--- a/webgis/js/ui.js
+++ b/webgis/js/ui.js
@@ -166,11 +166,12 @@ UI.openNotConserModal = function (data, selector) {
for (let tab of dataTabs) tab.innerHTML = '';
let notConserved = new NotConserved();
- notConserved.siteData = data;
+ notConserved.data = data;
// For Stimulus biblio_controller
window.Biblio = notConserved;
notConserved.render().then(html => modal.querySelector('#not-conserved-sheet').innerHTML = html);
+ notConserved.renderDocs().then(html => modal.querySelector('#documents').innerHTML = html);
notConserved.setImages(modal.querySelector('#photos'), this.imageGallery);
modal.classList.add('is-active');
}