@@ -200,14 +200,31 @@ function loadMail(id) {
200200 '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6" style="height: 22px;width: 22px;"><path stroke-linecap="round" stroke-linejoin="round" d="m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m8.25 3v6.75m0 0-3-3m3 3 3-3M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"></path></svg><div class="ml5">Save changes</div>'
201201 ]
202202 } ) ,
203- jsCreateElement ( 'button ' , {
203+ jsCreateElement ( 'div ' , {
204204 attrs : {
205- class : 'mailSend buttonIcon' ,
206- style : 'width: fit-content;' ,
207- onclick : 'sendMail(' + id + ')'
205+ style : 'display: flex;align-items: center;gap: 10px;'
208206 } ,
209- rawHtml : [
210- '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0L3.32 8.91a2.25 2.25 0 0 1-1.07-1.916V6.75" /></svg><div class="ml5">Send email</div>'
207+ children : [
208+ jsCreateElement ( 'button' , {
209+ attrs : {
210+ class : 'mailSend buttonIcon' ,
211+ style : 'width: fit-content;' ,
212+ onclick : 'duplicateMail(' + id + ')' ,
213+ } ,
214+ rawHtml : [
215+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" width="24" height="24" stroke-width="2"><path d="M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"></path><path d="M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"></path></svg><div class="ml5">Duplicate</div>'
216+ ]
217+ } ) ,
218+ jsCreateElement ( 'button' , {
219+ attrs : {
220+ class : 'mailSend buttonIcon' ,
221+ style : 'width: fit-content;' ,
222+ onclick : 'sendMail(' + id + ')'
223+ } ,
224+ rawHtml : [
225+ '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0L3.32 8.91a2.25 2.25 0 0 1-1.07-1.916V6.75" /></svg><div class="ml5">Send email</div>'
226+ ]
227+ } )
211228 ]
212229 } )
213230 ]
@@ -766,6 +783,18 @@ function saveMail(mailID) {
766783 } ) ;
767784}
768785
786+ async function duplicateMail ( mailID ) {
787+ let mailData = await fetch ( "/api/mails/duplicate?mailID=" + mailID , {
788+ method : "POST"
789+ } )
790+ . then ( manageErrors )
791+ . then ( response => response . json ( ) )
792+ . then ( data => {
793+ window . location . reload ( ) ;
794+ } ) ;
795+
796+ console . log ( mailData ) ;
797+ }
769798
770799async function sendMail ( mailID ) {
771800 let lists = await fetch ( "/api/lists/all" , {
0 commit comments