@@ -11,37 +11,40 @@ function getSyncStatusIcon(syncStatus, paperlessDocId = null) {
1111 // Get Paperless URL from global config (set by server)
1212 const paperlessUrl = window . paperlessConfig ?. url ;
1313
14+ // Cloud icon path
15+ const cloudPath = 'M18 10h-1.26A8 8 0 1 0 9 20h9a5 5 0 0 0 0-10z' ;
16+
1417 switch ( syncStatus ) {
1518 case 'synced' :
1619 // If we have paperless URL and doc ID, make it a link
1720 if ( paperlessUrl && paperlessDocId ) {
1821 return `<a href="${ paperlessUrl } /documents/${ paperlessDocId } " target="_blank" rel="noopener"
1922 class="sync-status sync-synced" title="View in Paperless (opens in new tab)">
2023 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
21- <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14 "/>
22- <polyline points="22 4 12 14.01 9 11.01 "/>
24+ <path d="${ cloudPath } "/>
25+ <polyline points="9 13 12 16 16 11"/>
2326 </svg>
2427 </a>` ;
2528 }
2629 return `<span class="sync-status sync-synced" title="Synced to Paperless">
2730 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
28- <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14 "/>
29- <polyline points="22 4 12 14.01 9 11.01 "/>
31+ <path d="${ cloudPath } "/>
32+ <polyline points="9 13 12 16 16 11"/>
3033 </svg>
3134 </span>` ;
3235 case 'failed' :
3336 return `<span class="sync-status sync-failed" title="Paperless sync failed - click to retry">
3437 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
35- <circle cx="12" cy="12" r="10 "/>
36- <line x1="15 " y1="9 " x2="9 " y2="15"/>
37- <line x1="9 " y1="9 " x2="15 " y2="15"/>
38+ <path d=" ${ cloudPath } "/>
39+ <line x1="10 " y1="11 " x2="14 " y2="15"/>
40+ <line x1="14 " y1="11 " x2="10 " y2="15"/>
3841 </svg>
3942 </span>` ;
4043 case 'pending' :
41- return `<span class="sync-status sync-pending" title="Sync pending ">
44+ return `<span class="sync-status sync-pending" title="Syncing to Paperless ">
4245 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
43- <circle cx="12" cy="12" r="10 "/>
44- <polyline points="12 6 12 12 16 14"/>
46+ <path d=" ${ cloudPath } "/>
47+ <polyline points="12 17 12 11 15 14"/>
4548 </svg>
4649 </span>` ;
4750 default :
@@ -132,7 +135,9 @@ function createPolicyDocumentItem(doc) {
132135 const docItem = document . createElement ( 'div' ) ;
133136 docItem . className = 'existing-receipt-item' ;
134137
135- const fileName = doc . original_filename ;
138+ // Extract the renamed filename from file_path (the actual saved filename)
139+ const filePathParts = doc . file_path . split ( '/' ) ;
140+ const fileName = filePathParts [ filePathParts . length - 1 ] ;
136141 const fileType = doc . file_type . toLowerCase ( ) ;
137142 // Remove data/{user_id}/ prefix to show just benefit_plans/{year}/filename
138143 const filePath = doc . file_path . replace ( / ^ d a t a \/ \d + \/ / , '' ) ;
@@ -190,7 +195,10 @@ function createPolicyDocumentItem(doc) {
190195 }
191196 }
192197
193- // Add delete button
198+ // Add actions container with delete button (prevents button from stretching)
199+ const actionsDiv = document . createElement ( 'div' ) ;
200+ actionsDiv . className = 'existing-receipt-actions' ;
201+
194202 const deleteBtn = document . createElement ( 'button' ) ;
195203 deleteBtn . type = 'button' ;
196204 deleteBtn . className = 'btn btn-small existing-receipt-delete receipt-delete-btn' ;
@@ -200,15 +208,19 @@ function createPolicyDocumentItem(doc) {
200208 deletePolicyDocument ( doc . id ) ;
201209 } ;
202210
203- docItem . appendChild ( deleteBtn ) ;
211+ actionsDiv . appendChild ( deleteBtn ) ;
212+ docItem . appendChild ( actionsDiv ) ;
204213
205214 return docItem ;
206215}
207216
208217/**
209218 * Upload documents for a policy year
219+ * @param {number } planYearId - The plan year ID
220+ * @param {FileList } files - Files to upload
221+ * @param {boolean } silent - If true, don't show success toast (caller handles it)
210222 */
211- export async function uploadPolicyDocuments ( planYearId , files ) {
223+ export async function uploadPolicyDocuments ( planYearId , files , silent = false ) {
212224 if ( ! files || files . length === 0 ) {
213225 return ;
214226 }
@@ -227,7 +239,10 @@ export async function uploadPolicyDocuments(planYearId, files) {
227239 const data = await response . json ( ) ;
228240
229241 if ( response . ok && data . success ) {
230- showAlert ( `${ data . uploaded . length } document(s) uploaded successfully!` , 'success' ) ;
242+ // Only show toast if not silent (caller may handle messaging)
243+ if ( ! silent ) {
244+ showAlert ( `${ data . uploaded . length } document(s) uploaded successfully!` , 'success' ) ;
245+ }
231246
232247 // Reload documents
233248 const documents = await loadPolicyDocuments ( planYearId ) ;
0 commit comments