Developer 02 fa44b82493 feat(EnvelopeLocked): Timer mit CSS-Konfiguration und Javascript-Ereignis hinzugefügt.
- Ablauf über Home-Controller-Ansichtsdaten hinzugefügt
2024-11-30 01:56:02 +01:00

119 lines
3.9 KiB
JavaScript

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');
}
});
});
document.addEventListener('DOMContentLoaded', function () {
var dropdownItems = document.querySelectorAll('.culture-dropdown-item');
dropdownItems.forEach(function (item) {
item.addEventListener('click', async function (event) {
event.preventDefault();
var language = this.getAttribute('data-language');
var flagCode = this.getAttribute('data-flag');
document.getElementById('selectedFlag').className = 'fi ' + flagCode + ' me-2';
await setLanguage(language);
});
});
});
const setTimer = (elementId, expirationTime) => {
const element = document.getElementById(elementId);
const interval = setInterval(function () {
var now = new Date();
var diffInMillis = expirationTime - now;
if (diffInMillis <= 0) {
element.textContent = "00:00";
clearInterval(interval);
}
var minutes = Math.floor(diffInMillis / 1000 / 60);
var seconds = Math.floor((diffInMillis / 1000) % 60);
var formattedMinutes = minutes.toString().padStart(2, '0');
var formattedSeconds = seconds.toString().padStart(2, '0');
var remainingTime = `${formattedMinutes}:${formattedSeconds}`;
element.textContent = remainingTime;
}, 1000);
}
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;
}
}
static __ShareBackdrop;
static get ShareBackdrop() {
Comp.__ShareBackdrop ??= new bootstrap.Modal(document.getElementById('shareBackdrop'));
return this.__ShareBackdrop;
}
}