1import { a as __toESM } from "./rolldown-runtime-Cql5ZV07.js"; 2import "./vendor-charts-D81iZKCV.js"; 3import { g as require_compiler_runtime, p as useParams, t as require_jsx_runtime } from "./vendor-react-HZz3WA9p.js"; 4import "./vendor-dnd-D_JGdZnv.js"; 5import "./vendor-mixpanel-Dh8wsiZW.js"; 6import "./device-CBwMusKw.js"; 7import "./vendor-redux-CLEI5hTp.js"; 8import "./vendor-pdf-DksyQ9Qr.js"; 9import "./vendor-utils-DiM3BD4o.js"; 10import "./vendor-ui-G6aSO5L-.js"; 11import "./dist-Bh07-69G.js"; 12import { kn as ChevronLeft } from "./vendor-lucide-EY3Z5fcy.js"; 13import { t as Button } from "./button-BWyXpawe.js"; 14import "./vendor-twilio-BWAG7uEQ.js"; 15import "./biz-icon-BHlHk8WD.js"; 16import "./ping-one-CpLVEVLd.js"; 17import "./vendor-tiptap-_i5A4X7p.js"; 18import "./app-storage-slice-mFVFfzPf.js"; 19import "./vendor-date-d6_4rWHy.js"; 20import "./dates-B2P7D4-n.js"; 21import "./vendor-tanstack-N3AJtZOe.js"; 22import "./spin-Bjb5hq6_.js"; 23import "./vendor-form-DCqShb_y.js"; 24import "./label-BU8XDazs.js"; 25import { Yn as trackMethodCall } from "./main-DDHJZG-i.js"; 26import { A as useToolbarItems, B as useGetDocumentsQuery, F as new_document_button_default, I as DocumentsDialogProvider, O as DocumentNavigationProvider, R as rename_dialog_default, a as useDocumentPermissions, c as send_email_dialog_default, f as merge_files_dialog_default, g as DocumentTableView, i as useDocumentFilters, j as DocumentHeaderToolbar, k as useDocumentNavigation, l as create_billing_packet_success_dialog_default, n as useDocumentDialogs, o as useDocumentOperations, p as UploadDocumentDialog, r as useFolderQuery, s as useDocumentSelection, t as useDocumentActions, u as create_billing_packet_dialog_default, v as DocumentContextMenuProvider, z as new_folder_dialog_default } from "./hooks-D28ke8RY.js"; 27import "./select-multiple-Cw2fNSBe.js"; 28import "./toggle-dkWcMWXB.js"; 29import "./toggle-group-THklAHjp.js"; 30import { t as DocumentHeaderFilters } from "./document-header-filters-CAkqv-CV.js"; 31import "./button-group-BAAxXGl0.js"; 32import "./use-fleet-permission-otVvJqAQ.js"; 33import "./checkbox-group-BcQiMlUj.js"; 34import "./document-upload-CFFEvI8B.js"; 35import "./progress-BMT-Tsbj.js"; 36import "./document-upload-H5V5QdR-.js"; 37import "./upload-field.utils-D6MOo_v7.js"; 38import "./upload-field-_uA03Ut7.js"; 39import "./profile-service-Dr5sIh12.js"; 40import "./scroll-area-DFVujIwJ.js"; 41import "./pdf-BGKmZv-x.js"; 42var import_compiler_runtime = /* @__PURE__ */ __toESM(require_compiler_runtime()); 43var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime()); 44var DriversDetailsDocumentsInner = () => { 45 const $ = (0, import_compiler_runtime.c)(108); 46 const { id } = useParams(); 47 const driverId = id ? Number(id) : 0; 48 const navigation = useDocumentNavigation(); 49 if (!navigation) throw new Error("DriversDetailsDocuments must be used within DocumentNavigationProvider"); 50 let t0; 51 if ($[0] !== driverId) { 52 t0 = { 53 relationId: driverId, 54 source: "driver_folder", 55 autoCreate: true 56 }; 57 $[0] = driverId; 58 $[1] = t0; 59 } else t0 = $[1]; 60 const folder = useFolderQuery(t0); 61 const filters = useDocumentFilters(); 62 const activeFolderId = navigation.currentFolderId ?? folder.folderId; 63 let t1; 64 if ($[2] !== activeFolderId || $[3] !== filters.apiParams) { 65 t1 = { 66 folderId: activeFolderId, 67 size: 1e3, 68 current: 1, 69 ...filters.apiParams 70 }; 71 $[2] = activeFolderId; 72 $[3] = filters.apiParams; 73 $[4] = t1; 74 } else t1 = $[4]; 75 const t2 = !folder.folderId; 76 let t3; 77 if ($[5] !== t2) { 78 t3 = { skip: t2 }; 79 $[5] = t2; 80 $[6] = t3; 81 } else t3 = $[6]; 82 const { data: documentsData, isLoading: isDocumentsLoading } = useGetDocumentsQuery(t1, t3); 83 let t4; 84 if ($[7] !== documentsData?.data?.records) { 85 t4 = documentsData?.data?.records ?? []; 86 $[7] = documentsData?.data?.records; 87 $[8] = t4; 88 } else t4 = $[8]; 89 const currentData = t4; 90 let t5; 91 if ($[9] !== currentData) { 92 t5 = { data: currentData }; 93 $[9] = currentData; 94 $[10] = t5; 95 } else t5 = $[10]; 96 const selection = useDocumentSelection(t5); 97 const operations = useDocumentOperations(); 98 let t6; 99 if ($[11] !== selection.selectedItems) { 100 t6 = { selectedItems: selection.selectedItems }; 101 $[11] = selection.selectedItems; 102 $[12] = t6; 103 } else t6 = $[12]; 104 const permissions = useDocumentPermissions(t6); 105 const dialogs = useDocumentDialogs(selection.clearSelection); 106 let t7; 107 if ($[13] !== dialogs || $[14] !== navigation || $[15] !== operations || $[16] !== selection) { 108 t7 = { 109 selection, 110 operations, 111 dialogs, 112 navigation 113 }; 114 $[13] = dialogs; 115 $[14] = navigation; 116 $[15] = operations; 117 $[16] = selection; 118 $[17] = t7; 119 } else t7 = $[17]; 120 const actions = useDocumentActions(t7); 121 let t8; 122 if ($[18] !== permissions.allAreFiles || $[19] !== permissions.canDelete) { 123 t8 = { 124 canDelete: permissions.canDelete, 125 allAreFiles: permissions.allAreFiles 126 }; 127 $[18] = permissions.allAreFiles; 128 $[19] = permissions.canDelete; 129 $[20] = t8; 130 } else t8 = $[20]; 131 const toolbarItems = useToolbarItems(t8); 132 let t9; 133 if ($[21] !== filters || $[22] !== selection) { 134 t9 = (newFilters) => { 135 trackMethodCall("handleFilterChange", [newFilters]); 136 filters.setFilters(newFilters); 137 selection.clearSelection(); 138 }; 139 $[21] = filters; 140 $[22] = selection; 141 $[23] = t9; 142 } else t9 = $[23]; 143 const handleFilterChange = t9; 144 let t10; 145 if ($[24] !== filters || $[25] !== selection) { 146 t10 = () => { 147 trackMethodCall("handleResetFilters", []); 148 filters.resetFilters(); 149 selection.clearSelection(); 150 }; 151 $[24] = filters; 152 $[25] = selection; 153 $[26] = t10; 154 } else t10 = $[26]; 155 const handleResetFilters = t10; 156 const isLoading = folder.isLoading || isDocumentsLoading; 157 if (!driverId) { 158 let t11$1; 159 if ($[27] === Symbol.for("react.memo_cache_sentinel")) { 160 t11$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 161 className: "text-sm text-muted-foreground", 162 children: "Invalid driver ID" 163 }); 164 $[27] = t11$1; 165 } else t11$1 = $[27]; 166 return t11$1; 167 } 168 let t11; 169 if ($[28] !== navigation) {
170 t11 = navigation.currentFolderId !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 171 variant: "ghost", 172 size: "icon-sm", 173 className: "text-muted-foreground", 174 onClick: () => navigation.navigateToBreadcrumb(navigation.breadcrumbs.length - 2), 175 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronLeft, { className: "size-4" }) 176 }); 177 $[28] = navigation; 178 $[29] = t11; 179 } else t11 = $[29]; 180 let t12; 181 if ($[30] !== filters.filters || $[31] !== handleFilterChange || $[32] !== handleResetFilters) { 182 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DocumentHeaderFilters, { 183 filters: filters.filters, 184 onFilter: handleFilterChange, 185 onReset: handleResetFilters 186 }); 187 $[30] = filters.filters; 188 $[31] = handleFilterChange; 189 $[32] = handleResetFilters; 190 $[33] = t12; 191 } else t12 = $[33]; 192 let t13; 193 if ($[34] !== t11 || $[35] !== t12) { 194 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 195 className: "flex items-center gap-2", 196 children: [t11, t12] 197 }); 198 $[34] = t11; 199 $[35] = t12; 200 $[36] = t13; 201 } else t13 = $[36]; 202 let t14; 203 if ($[37] === Symbol.for("react.memo_cache_sentinel")) { 204 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(new_document_button_default, {}); 205 $[37] = t14; 206 } else t14 = $[37]; 207 let t15; 208 if ($[38] !== t13) { 209 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 210 className: "flex items-center justify-between gap-2 py-6", 211 children: [t13, t14] 212 }); 213 $[38] = t13; 214 $[39] = t15; 215 } else t15 = $[39]; 216 let t16; 217 if ($[40] !== actions.handleContextMenuAction || $[41] !== actions.handleToolbarAction || $[42] !== currentData || $[43] !== folder.folderId || $[44] !== isLoading || $[45] !== selection.rowSelection || $[46] !== selection.selectedCount || $[47] !== selection.setRowSelection || $[48] !== toolbarItems) {
218 t16 = isLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 219 className: "text-sm text-muted-foreground", 220 children: "Loading documents..." 221 }) : !folder.folderId ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 222 className: "text-sm text-muted-foreground", 223 children: "No folder found for this driver" 224 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 225 className: "flex flex-col gap-4", 226 children: [selection.selectedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DocumentHeaderToolbar, { 227 selectedCount: selection.selectedCount, 228 items: toolbarItems, 229 onAction: actions.handleToolbarAction 230 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DocumentContextMenuProvider, { 231 currentData, 232 onAction: actions.handleContextMenuAction, 233 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DocumentTableView, { 234 data: currentData, 235 rowSelection: selection.rowSelection, 236 onRowSelectionChange: selection.setRowSelection, 237 virtualizationThreshold: 50 238 }) 239 })] 240 }); 241 $[40] = actions.handleContextMenuAction; 242 $[41] = actions.handleToolbarAction; 243 $[42] = currentData; 244 $[43] = folder.folderId; 245 $[44] = isLoading; 246 $[45] = selection.rowSelection; 247 $[46] = selection.selectedCount; 248 $[47] = selection.setRowSelection; 249 $[48] = toolbarItems; 250 $[49] = t16; 251 } else t16 = $[49]; 252 let t17; 253 if ($[50] !== t15 || $[51] !== t16) { 254 t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 255 className: "flex flex-col", 256 children: [t15, t16] 257 }); 258 $[50] = t15; 259 $[51] = t16; 260 $[52] = t17; 261 } else t17 = $[52]; 262 let t18; 263 if ($[53] !== dialogs.setUploadDialogOpen || $[54] !== dialogs.uploadDialogOpen || $[55] !== folder.getFolderId) { 264 t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UploadDocumentDialog, { 265 open: dialogs.uploadDialogOpen, 266 onOpenChange: dialogs.setUploadDialogOpen, 267 getFolderId: folder.getFolderId, 268 entityType: "driver" 269 }); 270 $[53] = dialogs.setUploadDialogOpen; 271 $[54] = dialogs.uploadDialogOpen; 272 $[55] = folder.getFolderId; 273 $[56] = t18; 274 } else t18 = $[56]; 275 const t19 = navigation.currentFolderId === null ? folder.getFolderId : void 0; 276 let t20; 277 if ($[57] !== activeFolderId || $[58] !== dialogs.newFolderDialogOpen || $[59] !== dialogs.setNewFolderDialogOpen || $[60] !== t19) { 278 t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(new_folder_dialog_default, { 279 open: dialogs.newFolderDialogOpen, 280 onOpenChange: dialogs.setNewFolderDialogOpen, 281 parentFolderId: activeFolderId, 282 getParentFolderId: t19 283 }); 284 $[57] = activeFolderId; 285 $[58] = dialogs.newFolderDialogOpen; 286 $[59] = dialogs.setNewFolderDialogOpen; 287 $[60] = t19; 288 $[61] = t20; 289 } else t20 = $[61]; 290 const t21 = dialogs.activeActionId === "RENAME"; 291 let t22; 292 if ($[62] !== dialogs) { 293 t22 = (open) => { 294 if (!open) { 295 dialogs.setActiveActionId(null); 296 dialogs.setActionDocument(null); 297 } 298 }; 299 $[62] = dialogs; 300 $[63] = t22; 301 } else t22 = $[63]; 302 const t23 = dialogs.actionDocument?.name; 303 let t24; 304 if ($[64] !== actions.handleRename || $[65] !== t21 || $[66] !== t22 || $[67] !== t23) { 305 t24 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(rename_dialog_default, { 306 open: t21, 307 onOpenChange: t22, 308 initialName: t23, 309 onRename: actions.handleRename 310 }); 311 $[64] = actions.handleRename; 312 $[65] = t21; 313 $[66] = t22; 314 $[67] = t23; 315 $[68] = t24; 316 } else t24 = $[68]; 317 let t25; 318 if ($[69] !== dialogs.emailAttachments || $[70] !== dialogs.mergedBillingPacket || $[71] !== dialogs.onSendEmailDialogOpenChange || $[72] !== dialogs.sendEmailDialogOpen) { 319 t25 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(send_email_dialog_default, { 320 open: dialogs.sendEmailDialogOpen, 321 onOpenChange: dialogs.onSendEmailDialogOpenChange, 322 preAttachedFile: dialogs.mergedBillingPacket, 323 externalAttachments: dialogs.emailAttachments 324 }); 325 $[69] = dialogs.emailAttachments; 326 $[70] = dialogs.mergedBillingPacket; 327 $[71] = dialogs.onSendEmailDialogOpenChange; 328 $[72] = dialogs.sendEmailDialogOpen; 329 $[73] = t25; 330 } else t25 = $[73]; 331 const t26 = dialogs.activeActionId === "MERGE_FILE"; 332 const t27 = dialogs.folderFiles.length > 0 ? dialogs.folderFiles : selection.selectedItems; 333 let t28; 334 if ($[74] !== dialogs.onMergeFilesDialogOpenChange || $[75] !== t26 || $[76] !== t27) { 335 t28 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(merge_files_dialog_default, { 336 open: t26, 337 onOpenChange: dialogs.onMergeFilesDialogOpenChange, 338 selectedItems: t27 339 }); 340 $[74] = dialogs.onMergeFilesDialogOpenChange; 341 $[75] = t26; 342 $[76] = t27; 343 $[77] = t28; 344 } else t28 = $[77]; 345 const t29 = dialogs.folderFiles.length > 0 ? dialogs.folderFiles : selection.selectedItems; 346 let t30; 347 if ($[78] !== dialogs) { 348 t30 = (_data, mergedFile) => {
349 dialogs.setMergedBillingPacket(mergedFile); 350 dialogs.setCreateBillingPacketSuccessDialogOpen(true); 351 }; 352 $[78] = dialogs; 353 $[79] = t30; 354 } else t30 = $[79]; 355 let t31; 356 if ($[80] !== dialogs.createBillingPacketDialogOpen || $[81] !== dialogs.onCreateBillingPacketDialogOpenChange || $[82] !== t29 || $[83] !== t30) { 357 t31 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(create_billing_packet_dialog_default, { 358 open: dialogs.createBillingPacketDialogOpen, 359 onOpenChange: dialogs.onCreateBillingPacketDialogOpenChange, 360 selectedItems: t29, 361 onCreatePacketSuccess: t30 362 }); 363 $[80] = dialogs.createBillingPacketDialogOpen; 364 $[81] = dialogs.onCreateBillingPacketDialogOpenChange; 365 $[82] = t29; 366 $[83] = t30; 367 $[84] = t31; 368 } else t31 = $[84]; 369 let t32; 370 let t33; 371 if ($[85] !== dialogs) { 372 t32 = () => { 373 dialogs.setCreateBillingPacketSuccessDialogOpen(false); 374 }; 375 t33 = (attachedFile) => { 376 dialogs.setCreateBillingPacketSuccessDialogOpen(false); 377 dialogs.setMergedBillingPacket(attachedFile); 378 dialogs.setSendEmailDialogOpen(true); 379 }; 380 $[85] = dialogs; 381 $[86] = t32; 382 $[87] = t33; 383 } else { 384 t32 = $[86]; 385 t33 = $[87]; 386 } 387 let t34; 388 if ($[88] !== dialogs.createBillingPacketSuccessDialogOpen || $[89] !== dialogs.mergedBillingPacket || $[90] !== dialogs.setCreateBillingPacketSuccessDialogOpen || $[91] !== folder.folderId || $[92] !== t32 || $[93] !== t33) { 389 t34 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(create_billing_packet_success_dialog_default, { 390 open: dialogs.createBillingPacketSuccessDialogOpen, 391 onOpenChange: dialogs.setCreateBillingPacketSuccessDialogOpen, 392 mergedFile: dialogs.mergedBillingPacket, 393 currentFolderId: folder.folderId, 394 onSaveToFolder: t32, 395 onEmailFactoring: t33 396 }); 397 $[88] = dialogs.createBillingPacketSuccessDialogOpen; 398 $[89] = dialogs.mergedBillingPacket; 399 $[90] = dialogs.setCreateBillingPacketSuccessDialogOpen; 400 $[91] = folder.folderId; 401 $[92] = t32; 402 $[93] = t33; 403 $[94] = t34; 404 } else t34 = $[94]; 405 let t35; 406 if ($[95] !== dialogs.onCreateBillingPacketDialogOpenChange || $[96] !== dialogs.onMergeFilesDialogOpenChange || $[97] !== dialogs.setNewFolderDialogOpen || $[98] !== dialogs.setUploadDialogOpen || $[99] !== t17 || $[100] !== t18 || $[101] !== t20 || $[102] !== t24 || $[103] !== t25 || $[104] !== t28 || $[105] !== t31 || $[106] !== t34) { 407 t35 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DocumentsDialogProvider, { 408 onUploadDocumentDialogOpenChange: dialogs.setUploadDialogOpen, 409 onNewFolderDialogOpenChange: dialogs.setNewFolderDialogOpen, 410 onMergeFilesDialogOpenChange: dialogs.onMergeFilesDialogOpenChange, 411 onCreateBillingPacketDialogOpenChange: dialogs.onCreateBillingPacketDialogOpenChange, 412 children: [ 413 t17, 414 t18, 415 t20, 416 t24, 417 t25, 418 t28, 419 t31, 420 t34 421 ] 422 }); 423 $[95] = dialogs.onCreateBillingPacketDialogOpenChange; 424 $[96] = dialogs.onMergeFilesDialogOpenChange; 425 $[97] = dialogs.setNewFolderDialogOpen; 426 $[98] = dialogs.setUploadDialogOpen; 427 $[99] = t17; 428 $[100] = t18; 429 $[101] = t20; 430 $[102] = t24; 431 $[103] = t25; 432 $[104] = t28; 433 $[105] = t31; 434 $[106] = t34; 435 $[107] = t35; 436 } else t35 = $[107]; 437 return t35; 438}; 439var DriversDetailsDocuments = () => { 440 const $ = (0, import_compiler_runtime.c)(1); 441 let t0; 442 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 443 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DocumentNavigationProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DriversDetailsDocumentsInner, {}) }); 444 $[0] = t0; 445 } else t0 = $[0]; 446 return t0; 447}; 448export { DriversDetailsDocuments };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.