feat: bsNotify-Methode und Benachrichtigung für Clipboard-Kopie hinzufügen

- 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.
This commit is contained in:
Developer 02 2024-10-11 14:15:06 +02:00
parent dc83486032
commit c4f0ce7d4b
6 changed files with 32 additions and 7 deletions

View File

@ -215,9 +215,9 @@ else
document.getElementById('btn-copy').addEventListener('click', function () { document.getElementById('btn-copy').addEventListener('click', function () {
const url = window.location.href; const url = window.location.href;
navigator.clipboard.writeText(url).then(function () { navigator.clipboard.writeText(url).then(function () {
console.log('URL panoya başarıyla kopyalandı!'); bsNotify('Kopiert', { alert_type: 'success', delay: 4, icon_name: 'check_circle' });
}).catch(function (err) { }).catch(function (err) {
console.error('URL kopyalanamadı: ', err); bsNotify('Unerwarteter Fehler', { alert_type: 'danger', delay: 4, icon_name: 'error' });
}); });
}); });
</script> </script>

View File

@ -18,7 +18,6 @@
<link rel="stylesheet" href="~/EnvelopeGenerator.Web.styles.css" asp-append-version="true" /> <link rel="stylesheet" href="~/EnvelopeGenerator.Web.styles.css" asp-append-version="true" />
<link rel="stylesheet" href="~/lib/flag-icons-main/css/flag-icons.min.css" asp-append-version="true" /> <link rel="stylesheet" href="~/lib/flag-icons-main/css/flag-icons.min.css" asp-append-version="true" />
<link rel="stylesheet" href="~/lib/alertifyjs/css/alertify.min.css" /> <link rel="stylesheet" href="~/lib/alertifyjs/css/alertify.min.css" />
<link rel="stylesheet" href="~/lib/alertifyjs/css/themes/default.min.css" />
<link href="https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined" rel="stylesheet"> <link href="https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined" rel="stylesheet">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" /> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" />
</head> </head>

View File

@ -369,6 +369,27 @@ footer#page-footer {
.no-receiver-explanation { .no-receiver-explanation {
padding: 2.5rem; padding: 2.5rem;
} }
.ajs-message.ajs-custom {
margin: 0rem 0rem 0rem 0rem;
padding: 0rem 0rem 0rem 0rem;
width:50rem;
}
.ajs-message.ajs-custom .alert {
display: flex;
flex-direction: row;
}
.ajs-message.ajs-custom span {
margin: 0 1rem 0 0;
}
.ajs-message.ajs-custom p {
margin: 0;
padding: 0;
}
/* styles for mobile responsiveness */ /* styles for mobile responsiveness */
@media (max-height: 850px) { @media (max-height: 850px) {
.navbar .container { .navbar .container {

File diff suppressed because one or more lines are too long

View File

@ -36,7 +36,7 @@ $('.btn_reject').click(_ =>
})); }));
document.querySelectorAll('.email-input').forEach(input => { document.querySelectorAll('.email-input').forEach(input => {
input.addEventListener('input', function() { input.addEventListener('input', function () {
if (/^\S+@\S+\.\S+$/.test(this.value)) { if (/^\S+@\S+\.\S+$/.test(this.value)) {
this.classList.remove('is-invalid'); this.classList.remove('is-invalid');
} else { } else {
@ -45,6 +45,11 @@ document.querySelectorAll('.email-input').forEach(input => {
}); });
}); });
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 { class Comp {
static ActPanel = class { static ActPanel = class {
static __Root; static __Root;
@ -77,7 +82,7 @@ class Comp {
static SignatureProgress = class { static SignatureProgress = class {
static __SignatureCount; static __SignatureCount;
static get SignatureCount() { static get SignatureCount() {
this.__SignatureCount = parseInt(document.getElementById("signature-count").innerText); this.__SignatureCount = parseInt(document.getElementById("signature-count").innerText);
return this.__SignatureCount; return this.__SignatureCount;
} }

View File

@ -1,3 +1,3 @@
$(".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:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:localized.complete,cancelButtonText:localized.back,showLoaderOnConfirm:!0,preConfirm:async n=>{try{return await rejectEnvelope(n)}catch(t){Swal.showValidationMessage(` $(".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:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:localized.complete,cancelButtonText:localized.back,showLoaderOnConfirm:!0,preConfirm:async n=>{try{return await rejectEnvelope(n)}catch(t){Swal.showValidationMessage(`
Request failed: ${t} Request failed: ${t}
`)}},allowOutsideClick:()=>!Swal.isLoading()}).then(n=>{if(n.isConfirmed){const t=n.value;t.ok?redirRejected():Swal.showValidationMessage(`Request failed: ${t.message}`)}}));document.querySelectorAll(".email-input").forEach(n=>{n.addEventListener("input",function(){/^\S+@\S+\.\S+$/.test(this.value)?this.classList.remove("is-invalid"):this.classList.add("is-invalid")})});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"}static set Display(n){Comp.ActPanel.Root.style.display=n;Comp.ActPanel.Elements.forEach(t=>t.style.display=n)}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(n){this.__signedCount=n;const t=(n/this.SignatureCount)*100;this.SignedCountBar.style.setProperty("--progress-width",t+"%");this.SignedCountSpan.innerText=n.toString()}static __SignedCountBar;static get SignedCountBar(){this.__SignedCountBar??=document.getElementById("signed-count-bar");return this.__SignedCountBar}};} `)}},allowOutsideClick:()=>!Swal.isLoading()}).then(n=>{if(n.isConfirmed){const t=n.value;t.ok?redirRejected():Swal.showValidationMessage(`Request failed: ${t.message}`)}}));document.querySelectorAll(".email-input").forEach(n=>{n.addEventListener("input",function(){/^\S+@\S+\.\S+$/.test(this.value)?this.classList.remove("is-invalid"):this.classList.add("is-invalid")})});const bsNotify=(n,t)=>alertify.notify(`<div class="alert ${t.alert_type?"alert-"+t.alert_type:""}" role="alert"><span class="material-symbols-outlined">${t?.icon_name??""}</span><p>${n}</p></div>`,"custom",t?.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"}static set Display(n){Comp.ActPanel.Root.style.display=n;Comp.ActPanel.Elements.forEach(t=>t.style.display=n)}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(n){this.__signedCount=n;const t=(n/this.SignatureCount)*100;this.SignedCountBar.style.setProperty("--progress-width",t+"%");this.SignedCountSpan.innerText=n.toString()}static __SignedCountBar;static get SignedCountBar(){this.__SignedCountBar??=document.getElementById("signed-count-bar");return this.__SignedCountBar}};}