11<!DOCTYPE html>
22<html lang =" en" >
3+
34<head >
45 <meta charset =" UTF-8" >
56 <meta name =" viewport" content =" width=device-width, initial-scale=1.0" >
1314 }
1415 </style >
1516</head >
17+
1618<body >
1719 <div class =" container mt-5" >
1820 <h2 class =" mb-4 text-center" >Email Logs</h2 >
2123 <form id =" filter-form" class =" mb-4" >
2224 <div class =" row" >
2325 <div class =" col-md-3" >
24- <input type =" text" id =" recipient" name =" recipient" class =" form-control" placeholder =" Recipient" value =" {{ request (' recipient' ) } }" >
26+ <input type =" text" id =" recipient" name =" recipient" class =" form-control" placeholder =" Recipient"
27+ value =" {{ request (' recipient' ) } }" >
2528 </div >
2629 <div class =" col-md-3" >
27- <input type =" text" id =" subject" name =" subject" class =" form-control" placeholder =" Subject" value =" {{ request (' subject' ) } }" >
30+ <input type =" text" id =" subject" name =" subject" class =" form-control" placeholder =" Subject"
31+ value =" {{ request (' subject' ) } }" >
2832 </div >
2933 <div class =" col-md-3" >
30- <input type =" date" id =" sent_date" name =" sent_date" class =" form-control" value =" {{ request (' sent_date' ) } }" >
34+ <input type =" date" id =" sent_date" name =" sent_date" class =" form-control"
35+ value =" {{ request (' sent_date' ) } }" >
3136 </div >
3237 <div class =" col-md-3" >
3338 <button type =" submit" class =" btn btn-primary" >Filter</button >
5661 <p ><strong >BCC:</strong > <span id =" log-bcc" ></span ></p >
5762 <p ><strong >Subject:</strong > <span id =" log-subject" ></span ></p >
5863 <p ><strong >Body:</strong ></p >
59- <pre id =" log-body" ></pre >
64+ <iframe src = " " id =" log-body" class = " w-100 " style = " height : 400 px " ></iframe >
6065 <p ><strong >Attachments:</strong ></p >
6166 <div id =" log-attachments" ></div >
6267 </div >
@@ -109,25 +114,27 @@ function fetchLogs() {
109114
110115 // JavaScript to handle the modal data population
111116 const logDetailModal = document .getElementById (' logDetailModal' );
112- logDetailModal .addEventListener (' show.bs.modal' , function (event ) {
117+ logDetailModal .addEventListener (' show.bs.modal' , function (event ) {
113118 const button = event .relatedTarget ;
114119
115120 // Extract data from the button attributes
121+ const id = button .getAttribute (' data-id' );
116122 const sender = button .getAttribute (' data-sender' );
117123 const recipient = button .getAttribute (' data-recipient' );
118124 const cc = button .getAttribute (' data-cc' ) || ' N/A' ;
119125 const bcc = button .getAttribute (' data-bcc' ) || ' N/A' ;
120126 const subject = button .getAttribute (' data-subject' );
121127 const body = button .getAttribute (' data-body' );
122128 const attachments = JSON .parse (button .getAttribute (' data-attachments' ));
129+ const url = ' {{ route (' email.logs.body' , ' :id' ) } }' ;
123130
124131 // Update the modal content
125132 document .getElementById (' log-sender' ).textContent = sender;
126133 document .getElementById (' log-recipient' ).textContent = recipient;
127134 document .getElementById (' log-cc' ).textContent = cc;
128135 document .getElementById (' log-bcc' ).textContent = bcc;
129136 document .getElementById (' log-subject' ).textContent = subject;
130- document .getElementById (' log-body' ).textContent = body ;
137+ document .getElementById (' log-body' ).src = url . replace ( ' :id ' , id) ;
131138
132139 // Handle attachments
133140 const attachmentsContainer = document .getElementById (' log-attachments' );
@@ -147,4 +154,5 @@ function fetchLogs() {
147154 });
148155 </script >
149156</body >
157+
150158</html >
0 commit comments