import Utils from "./utils.js"; /** * @class Prehistoric */ export class Prehistoric { biblioElements = []; set data(data) { this._data = data; } /** * * @todo Biblio * @returns {string} The HTML */ async render() { return `

Denominazione: ${this._data.denomination}

Periodo: ${this._data.period}

Località generica: ${this._data.genericPlace}

Descrizione breve
${this._data.description}

Conservazione: ${this._data.conservation}

Autore scheda: ${this._data.author}

`; /*

Bibliografia: ${await this.biblio(this._data.id)}

*/ } /** * @param {HTMLElement} imageContainer * @param {Function} gallery */ async setImages(imageContainer, gallery) { if (this._data.images?.length) { imageContainer.innerHTML = Utils.renderImages('prehist-gallery', this._data.images); gallery('prehist-gallery', this._data.images); } else imageContainer.innerHTML = '

Nessuna risorsa visuale disponibile

'; } /** * @param {number} recordId */ async biblio(recordId) { let {citations, biblioElements} = await Utils.buildBibliography('prehistoric', recordId); this.biblioElements = biblioElements; return citations; } getReference(id) { return this.biblioElements.find(ref => { let regex = new RegExp('ref-'+id+'"'); return ref.match(regex); }); } }