Add clientBaseUrl and download PDF

This commit is contained in:
Thilina
2021-06-27 18:12:01 +02:00
parent 66b3f006e6
commit 74e448bf5d

View File

@@ -44,6 +44,7 @@ class ModuleBase {
this.currentProfile = null; this.currentProfile = null;
this.permissions = {}; this.permissions = {};
this.baseUrl = null; this.baseUrl = null;
this.clientUrl = null;
this.that = this; this.that = this;
} }
@@ -96,6 +97,10 @@ class ModuleBase {
this.baseUrl = url; this.baseUrl = url;
} }
setClientUrl(url) {
this.clientUrl = url;
}
setUser(user) { setUser(user) {
this.user = user; this.user = user;
} }
@@ -143,7 +148,7 @@ class ModuleBase {
gt(key) { gt(key) {
if (this.translations[key] === undefined || this.translations[key] === null) { if (this.translations[key] === undefined || this.translations[key] === null) {
console.log("Tr:" + key); console.log(`Tr:${key}`);
return key; return key;
} }
return this.translations[key][0]; return this.translations[key][0];
@@ -2683,6 +2688,11 @@ class ModuleBase {
return `https://avatars.dicebear.com/api/initials/:${seed}.svg`; return `https://avatars.dicebear.com/api/initials/:${seed}.svg`;
} }
downloadPdf(type, data) {
const url = `${this.clientUrl}service.php?a=pdf&h=${type}&data=${data}`;
window.open(url,'_blank');
}
} }
export default ModuleBase; export default ModuleBase;