- Implementierung der bsNotify-Methode für benutzerdefinierte Benachrichtigungen mit alertify. - Hinzufügen von benutzerdefinierten Styles für den benutzerdefinierten Benachrichtigungstyp von alertify. - Hinzufügen der Clipboard-Kopie-Funktionalität mit Erfolgs- und Fehlerbenachrichtigungen.
113 lines
3.5 KiB
JavaScript
113 lines
3.5 KiB
JavaScript
$('.btn_reject').click(_ =>
|
|
Swal.fire({
|
|
title: localized.rejection,
|
|
html: `<div class="text-start fs-6 p-0 m-0">${localized.rejectionReasonQ}</div>`,
|
|
icon: "question",
|
|
input: "text",
|
|
inputAttributes: {
|
|
autocapitalize: "off"
|
|
},
|
|
showCancelButton: true,
|
|
confirmButtonColor: "#3085d6",
|
|
cancelButtonColor: "#d33",
|
|
confirmButtonText: localized.complete,
|
|
cancelButtonText: localized.back,
|
|
showLoaderOnConfirm: true,
|
|
preConfirm: async (reason) => {
|
|
try {
|
|
var res = await rejectEnvelope(reason);
|
|
return res;
|
|
} catch (error) {
|
|
Swal.showValidationMessage(`
|
|
Request failed: ${error}
|
|
`);
|
|
}
|
|
},
|
|
allowOutsideClick: () => !Swal.isLoading()
|
|
}).then((result) => {
|
|
if (!result.isConfirmed)
|
|
return;
|
|
const res = result.value;
|
|
if (res.ok) {
|
|
redirRejected()
|
|
}
|
|
else
|
|
Swal.showValidationMessage(`Request failed: ${res.message}`);
|
|
}));
|
|
|
|
document.querySelectorAll('.email-input').forEach(input => {
|
|
input.addEventListener('input', function () {
|
|
if (/^\S+@\S+\.\S+$/.test(this.value)) {
|
|
this.classList.remove('is-invalid');
|
|
} else {
|
|
this.classList.add('is-invalid');
|
|
}
|
|
});
|
|
});
|
|
|
|
const bsNotify = (message, options) => alertify.notify(
|
|
`<div class="alert ${options.alert_type ? 'alert-' + options.alert_type : ''}" role="alert"><span class="material-symbols-outlined">${options?.icon_name ?? ''}</span><p>${message}</p></div>`,
|
|
'custom',
|
|
options?.delay ?? 5);
|
|
|
|
class Comp {
|
|
static ActPanel = class {
|
|
static __Root;
|
|
static get Root() {
|
|
Comp.ActPanel.__Root ??= document.getElementById("flex-action-panel")
|
|
return Comp.ActPanel.__Root
|
|
}
|
|
|
|
static get Elements() {
|
|
return [...Comp.ActPanel.Root.children]
|
|
}
|
|
|
|
static get IsHided() {
|
|
return Comp.ActPanel.Root.style.display == 'none';
|
|
}
|
|
|
|
/**
|
|
* @param {string} value
|
|
*/
|
|
static set Display(value) {
|
|
Comp.ActPanel.Root.style.display = value
|
|
Comp.ActPanel.Elements.forEach(e => e.style.display = value);
|
|
}
|
|
|
|
static Toggle() {
|
|
Comp.ActPanel.Display = Comp.ActPanel.IsHided ? '' : 'none'
|
|
}
|
|
}
|
|
|
|
static SignatureProgress = class {
|
|
static __SignatureCount;
|
|
static get SignatureCount() {
|
|
this.__SignatureCount = parseInt(document.getElementById("signature-count").innerText);
|
|
return this.__SignatureCount;
|
|
}
|
|
|
|
static __SignedCountSpan;
|
|
static get SignedCountSpan() {
|
|
this.__SignedCountSpan ??= document.getElementById("signed-count");
|
|
return Comp.SignatureProgress.__SignedCountSpan;
|
|
}
|
|
|
|
static __signedCount = 0;
|
|
static get SignedCount() {
|
|
return this.__signedCount;
|
|
}
|
|
|
|
static set SignedCount(value) {
|
|
this.__signedCount = value;
|
|
const width = (value / this.SignatureCount) * 100;
|
|
this.SignedCountBar.style.setProperty('--progress-width', width + '%');
|
|
this.SignedCountSpan.innerText = value.toString();
|
|
}
|
|
|
|
static __SignedCountBar;
|
|
static get SignedCountBar() {
|
|
this.__SignedCountBar ??= document.getElementById("signed-count-bar");
|
|
return this.__SignedCountBar;
|
|
}
|
|
}
|
|
} |