import { showError } from "@nextcloud/dialogs"; import { baseUrl, cur, LoadDT, showDone } from "../modules/mainFunction.mjs"; export class ThanatoProductFee { /** * * @param myresp instantiate thanato product fee object */ constructor(myresp) { this.id = myresp.id; this.thanatoFullName = ThanatoProductFee.getThanatoFullname(myresp); this.productReference = ((myresp.produit_reference == null || myresp.produit_reference.length === 0) ? '-' : myresp.produit_reference); this.htAmount = myresp.produit_ht_price; this.thanatoId = myresp.fk_thanato_id; this.productId = myresp.fk_product_id; } static getThanatoFullname(myresp){ let thanatoPrenom = ''; let thanatoNom = ''; let thanatoFullName = ''; if(myresp.thanato_nom != null && myresp.thanato_nom.length != 0){ thanatoNom = myresp.thanato_nom; thanatoFullName += thanatoNom; } if(myresp.thanato_prenom != null && myresp.thanato_prenom.length != 0){ thanatoPrenom = myresp.thanato_prenom; if(thanatoNom.length > 0 && thanatoPrenom.length > 0){ thanatoFullName += ' ' } thanatoFullName += thanatoPrenom; } return (thanatoFullName.length === 0) ? '-' : thanatoFullName; } /** * Get datatable row for a fee per thanato per product */ getDTRow() { let thanatoProductFeeRow = [ '