PageSourceSearch

https://armm-shield.netlify.app/assets/EditFoundWork-DPncqeHb.js

js armm-shield.netlify.app collected 2026-10-03 10:28:20 UTC 63,861 bytes, 889 lines download raw bytes

1import { ad as Pe, c as j, b as M, E as z, j as a, B as o, S as b, x as $, m as S, n as E, d as N, ai as P, N as Oe, y as u, U as ae, t as Ne } from "./task-spreadsheet-D5k0iGrQ.js";
2import { F as de, az as Be, aA as Le } from "./runtime-UCdpVvNx.js";
3import { T as Me } from "./Title-Dh3yyKmZ.js";
4import { B as He } from "./Breadcrumb-zu28Z_zw.js";
5import "./vendor_quill-Bw4YNUoM.js";
6import { T as W } from "./TextInput-De3xlp8z.js";
7import { S as Ve } from "./SfComboBox-DtdNkV8m.js";
8import { g as je, O as ze, q as Je, a as Ue, m as qe, p as Ye, u as Ke, S as Qe, t as le, n as ie, z as Ge, Q as Xe, __tla as __tla_0 } from "./main-B1e8Vwqe.js";
9import { T as Ze } from "./TabComponent-jcgzd0WP.js";
10import { M as er, __tla as __tla_1 } from "./ManageAttachments-tw7DJNtv.js";
11import { b as rr, d as tr, e as or, f as nr, a as ar } from "./singleFlight-DDWKDvPv.js";
12import { u as lr, a as ir } from "./foundwork-live-DrlhPXKF.js";
13import { u as sr } from "./tasks-live-C_nITOBo.js";
14import { R as J, __tla as __tla_2 } from "./RichTextEditor-CiuhCJjF.js";
15import { R as dr, r as cr, a as ur, b as pr } from "./RegulatoryDocumentSelector-BTDIo7_8.js";
16import { F as mr } from "./FoundWorkLoadError-CkZxKvzF.js";
17import { c as gr, s as C, g as br } from "./Form-CJbhDv8J.js";
18import { s as vr } from "./setValues-BSkn2sZ2.js";
19import "./vendor_exceljs-CaB4LguK.js";
20import "./vendor_xlsx-DSqvgYLF.js";
21import "./Modal-aJIEr64l.js";
22import "./vendor__syncfusion_ej2_dropdowns-C-OVeyV-.js";
23import "./vendor__syncfusion_ej2_base-jCPBJ8j7.js";
24import "./vendor__syncfusion_ej2_data-CyiKjD3J.js";
25import "./vendor__syncfusion_ej2_inputs-hTEX-N5T.js";
26import "./vendor__syncfusion_ej2_popups-3Qfp5HKd.js";
27import "./vendor__syncfusion_ej2_buttons-RpETH-n0.js";
28import "./vendor__syncfusion_ej2_notifications-Df5YOjhc.js";
29import "./vendor__syncfusion_ej2_lists-DCy-L53y.js";
30import { __tla as __tla_3 } from "./vendor_jspdf-pIh6QOep.js";
31import { __tla as __tla_4 } from "./SyncfusionFileUploader-2vn5OJHG.js";
32import { __tla as __tla_5 } from "./merge-Bfi6EpMN.js";
33import "./project-model-BW83Rub6.js";
34import { __tla as __tla_6 } from "./fullfat_bundler-CIyKZvs_.js";
35import "./staged-attachment-uploads-DRinP1Ax.js";
36import { __tla as __tla_7 } from "./foundwork-attachment-transport-BjuDzHn4.js";
37import "./useLiveQuery-DU5n_TyY.js";
38import "./project-data-scope-DQxQrn0B.js";
39import "./project-data-live-9x5kEs1d.js";
40import "./vendor_quill_mention-Ce2mWBHk.js";
41let Mt;
42let __tla = Promise.all([
43    (()=>{
44        try {
45            return __tla_0;
46        } catch  {}
47    })(),
48    (()=>{
49        try {
50            return __tla_1;
51        } catch  {}
52    })(),
53    (()=>{
54        try {
55            return __tla_2;
56        } catch  {}
57    })(),
58    (()=>{
59        try {
60            return __tla_3;
61        } catch  {}
62    })(),
63    (()=>{
64        try {
65            return __tla_4;
66        } catch  {}
67    })(),
68    (()=>{
69        try {
70            return __tla_5;
71        } catch  {}
72    })(),
73    (()=>{
74        try {
75            return __tla_6;
76        } catch  {}
77    })(),
78    (()=>{
79        try {
80            return __tla_7;
81        } catch  {}
82    })()
83]).then(async ()=>{
84    const fr = de.omit({
85        reportOrigin: !0,
86        approvedAt: !0,
87        approvedBy: !0,
88        taskId: !0,
89        owner: !0,
90        attachments: !0,
91        auditTrail: !0,
92        previousVersions: !0,
93        version: !0
94    });
95    function c(l, i) {
96        return l ?? i;
97    }
98    function hr(l, i) {
99        return typeof l == "string" ? Number.parseInt(l, 10) || 0 : l ?? i;
100    }
101    function ce(l, i) {
102        return {
103            id: c(i.id, l.id),
104            projectId: c(i.projectId, l.projectId),
105            tag: c(i.tag, l.tag),
106            component: c(i.component, l.component),
107            activity: c(i.activity, l.activity),
108            findingSummary: c(i.findingSummary, c(l.findingSummary, Pe(l))),
109            revision: hr(i.revision, l.revision),
110            foundWorkNumber: c(i.foundWorkNumber, l.foundWorkNumber),
111            clientFoundWorkNumber: c(i.clientFoundWorkNumber, l.clientFoundWorkNumber),
112            repairContractorJobNumber: c(i.repairContractorJobNumber, l.repairContractorJobNumber),
113            sourceWorkPackage: c(i.sourceWorkPackage, l.sourceWorkPackage),
114            sourceWorkOrder: c(i.sourceWorkOrder, l.sourceWorkOrder),
115            repairWorkPackage: c(i.repairWorkPackage, l.repairWorkPackage),
116            repairWorkOrder: c(i.repairWorkOrder, l.repairWorkOrder),
117            regulatoryDocumentType: c(i.regulatoryDocumentType, c(l.regulatoryDocumentType, null)),
118            regulatoryDocumentCompletedAt: c(i.regulatoryDocumentCompletedAt, l.regulatoryDocumentCompletedAt),
119            regulatoryDocumentCompletedBy: c(i.regulatoryDocumentCompletedBy, l.regulatoryDocumentCompletedBy),
120            problemDescription: c(i.problemDescription, l.problemDescription),
121            problemDescriptionRichText: c(i.problemDescriptionRichText, l.problemDescriptionRichText),
122            recommendedAction: c(i.recommendedAction, l.recommendedAction),
123            recommendedActionRichText: c(i.recommendedActionRichText, l.recommendedActionRichText),
124            approvedSolution: c(i.approvedSolution, l.approvedSolution),
125            approvedSolutionRichText: c(i.approvedSolutionRichText, l.approvedSolutionRichText),
126            createdBy: c(i.createdBy, l.createdBy),
127            createdAt: c(i.createdAt, l.createdAt),
128            assignedTo: c(i.assignedTo, l.assignedTo),
129            approved: c(i.approved, l.approved),
130            complete: c(i.complete, l.complete),
131            completedAt: c(i.completedAt, l.completedAt),
132            deletedAt: c(i.deletedAt, l.deletedAt),
133            deletedBy: c(i.deletedBy, l.deletedBy),
134            deletedInVersion: c(i.deletedInVersion, l.deletedInVersion)
135        };
136    }
137    function se(l, i) {
138        return l || i || "";
139    }
140    function kr(l, i) {
141        return {
142            ...ce(l, {}),
143            sourceWorkPackage: se(l.sourceWorkPackage, i?.workPackage),
144            sourceWorkOrder: se(l.sourceWorkOrder, i?.workOrder)
145        };
146    }
147    var xr = u('<div class="rounded-xl border border-base-300 bg-base-100 p-4 space-y-3"><div class="flex items-center gap-2"><p class="text-sm font-semibold text-base-content">Problem Description</p><span class="text-error text-sm"aria-hidden=true>*'), U = u('<div class="max-w-[90dvw] p-3 border border-base-300 rounded-md bg-base-100 min-w-0 overflow-x-auto break-words whitespace-pre-wrap">'), yr = u('<div class="rounded-xl border border-base-300 bg-base-100 p-4 space-y-3"><div class="flex items-center gap-2"><p class="text-sm font-semibold text-base-content">Recommended Action</p><span class="text-error text-sm"aria-hidden=true>*'), _r = u('<div class="rounded-xl border border-base-300 bg-base-100 p-4 space-y-3"><div class="flex items-center gap-2"><p class="text-sm font-semibold text-base-content">Approved Solution'), $r = u('<div class="flex flex-wrap gap-2 mb-2">'), Sr = u('<div class="max-w-full mx-auto p-4">
147'), Wr = u('<p class="text-error text-sm">'), Cr = u('<div class="compact-form-actions fixed bottom-0 left-0 right-0 bg-base-100 border-t border-base-300 px-4 py-3 flex flex-col gap-2"><button type=button class="btn btn-primary btn-sm btn-block"></button><button type=button class="btn btn-sm btn-outline btn-block">Cancel'), Tr = u('<div class="grid grid-cols-1 md:grid-cols-3 gap-4">'), Ar = u('<div class="rounded-xl border border-base-300 bg-base-100 p-4 space-y-2"><p class="text-xs text-base-content/60">The latest revision uses this title. Historical revisions retain their own title.'), Rr = u('<div class="rounded-xl border border-base-300 bg-base-100 p-4 space-y-4"><p class="text-sm font-semibold text-base-content">Context</p><div class="grid grid-cols-1 md:grid-cols-3 gap-4">'), wr = u('<div class="rounded-xl border border-base-300 bg-base-100 p-4 space-y-4"><p class="text-sm font-semibold text-base-content"></p><div class="grid grid-cols-1 md:grid-cols-3 gap-4">'), Fr = u('<div class="rounded-xl border border-base-300 bg-base-100 p-4 space-y-4"><p class="text-sm font-semibold text-base-content">Found work references</p><div class="grid grid-cols-1 md:grid-cols-2 gap-4">'), Dr = u('<div class="rounded-xl border border-base-300 bg-base-100 p-4 space-y-4"><p class="text-sm font-semibold text-base-content">Work package references</p><div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">'), Ir = u('<div class="rounded-xl border border-base-300 bg-base-100 p-4 space-y-4"><p class="text-sm font-semibold text-base-content">Approval and completion</p><div class="grid md:grid-cols-2 gap-4"></div><div class="space-y-3 pt-1">'), R = u("<input hidden>"), Er = u('<fieldset class=fieldset><legend class="text-sm font-semibold text-base-content/80">Created At</legend><label class="label gap-2"><input hidden><input type=text class="input input-bordered w-full"readonly>'), Pr = u('<fieldset class=fieldset><legend class="text-sm font-semibold text-base-content">Mark as approved</legend><label class="label gap-2"><input type=checkbox aria-label="Mark as approved"class="toggle toggle-primary">'), Or = u('<fieldset class=fieldset><legend class="text-sm font-semibold text-base-content">Repair complete</legend><label class="label gap-2"><input type=checkbox aria-label="Repair complete"class="toggle toggle-primary">'), Nr = u("<div class=space-y-3>"), Br = u("<div class=space-y-4>"), Lr = u('<div class="text-sm text-base-content/70 px-2">No revisions yet.'), Mr = u("<div>Client FW: "), Hr = u("<div>Contractor job: "), Vr = u("<div>Inspection CWP: "), jr = u("<div>Inspection WO: "), zr = u("<div>Repair CWP: "), Jr = u("<div>Repair WO: "), Ur = u("<div>ABSA document: "), qr = u('<div class="grid sm:grid-cols-2 lg:grid-cols-3 gap-x-4 gap-y-1 border-t border-base-200 pt-2 text-xs text-base-content/70">'), Yr = u('<div class="space-y-1 text-base-content/80"><div class="font-semibold text-base-content uppercase">Approved Solution</div><div class=leading-snug></div><div class="grid md:grid-cols-2 gap-2 text-xs text-base-content/70"><div>'), Kr = u('<div class="border border-base-300 rounded-xl p-4 shadow-sm bg-base-100 text-sm space-y-2"><div class="flex flex-wrap items-center gap-2"><span class="badge badge-outline badge-sm">Rev </span><span class="text-xs text-base-content/60">Created </span></div><div class="grid md:grid-cols-2 gap-2 text-base-content/80"><div class=space-y-1><div class="font-semibold text-base-content uppercase">Problem Description</div><div class=leading-snug></div></div><div class=space-y-1><div class="font-semibold text-base-content uppercase">Recommended Action</div><div class=leading-snug></div></div></div><div class="grid md:grid-cols-2 gap-2 text-xs text-base-content/70"><div>Created By: ');
148    const q = [
149        "assignedTo",
150        "tag",
151        "component",
152        "activity",
153        "findingSummary",
154        "clientFoundWorkNumber",
155        "repairContractorJobNumber",
156        "sourceWorkPackage",
157        "sourceWorkOrder",
158        "repairWorkPackage",
159        "repairWorkOrder",
160        "problemDescriptionRichText",
161        "recommendedActionRichText",
162        "approvedSolutionRichText",
163        "approved",
164        "complete",
165        "regulatoryDocumentType"
166    ], Qr = (l)=>{
167        if (l) return {
168            ...l,
169            revision: typeof l.revision == "string" ? Number.parseInt(l.revision, 10) || 0 : l.revision ?? 0
170        };
171    };
172    Mt = function() {
173        const l = je(), i = ze((t)=>t.selectItem), { item: ue, serverItem: Y, error: pe } = lr(()=>l.id), d = j(()=>ue()), { user: x } = Je(), { canUpdate: K } = Ue(), { updateFoundWork: me } = qe(), w = Ye((t)=>t.project), { tasks: ge } = sr(()=>w()?.id), { items: be } = ir(()=>w()?.id), Q = ()=>(ge() ?? []).find((t)=>t.id === d()?.taskId), [ve, fe] = M(), [G, T] = M(), [X, Z] = M(!1), [he, ee] = M(""), ke = ar
173(), B = Ke(), re = j(()=>d()?.previousVersions || []);
174        z(()=>{
175            const t = Qr(d() ?? null);
176            t && i(t);
177        });
178        const D = ()=>tr(d(), x(), w()), L = ()=>or(d(), w(), x()), H = ()=>nr(d(), x(), K("FOUND WORK")), V = ()=>rr(d(), x(), K("FOUND WORK")), I = ()=>V() || D() || L(), xe = j(()=>H() || D() && d()?.approved ? "Save" : L() && d()?.approved ? "Mark Complete" : D() && !d()?.approved ? "Approve" : "Save"), ye = (t, r)=>{
179            const n = fr.omit({
180                approvedSolutionRichText: !0,
181                approvedSolution: !0
182            }).safeParse({
183                ...t
184            });
185            if (!n.success) return Ge(n.error.issues, q);
186            if (r && !D()) return {
187                approved: "You must be the assignee to approve."
188            };
189            const e = Le(t);
190            if (e) return {
191                regulatoryDocumentType: e,
192                complete: e
193            };
194        }, _e = (t, r, n, e)=>Xe({
195                ...t,
196                ...r,
197                tag: t.tag,
198                component: t.component,
199                activity: t.activity,
200                completedAt: r.complete === !0 ? t.completedAt ?? new Date().toISOString() : t.completedAt ?? new Date(0).toISOString(),
201                approvedBy: e ? P(n) : P(t.approvedBy),
202                approvedAt: e ? new Date().toISOString() : t.approvedAt ?? new Date(0).toISOString()
203            }), $e = async (t, r)=>{
204            try {
205                if (!await me({
206                    kind: "updateFoundWork",
207                    foundWork: t,
208                    status: r
209                })) {
210                    const e = "We couldn't save this found work. Please review your entries and try again.";
211                    return ae({
212                        name: "foundwork.edit.save.returned_empty",
213                        message: "Edit-found-work save returned no updated record.",
214                        context: {
215                            foundWorkId: d()?.id,
216                            taskId: d()?.taskId,
217                            currentUserId: x()?.id
218                        }
219                    }), T(e), {
220                        _error: e
221                    };
222                }
223                B("/tasks");
224            } catch (n) {
225                const e = le(ie({
226                    error: n
227                }), q);
228                return ae({
229                    name: "foundwork.edit.save.exception",
230                    message: "Edit-found-work save failed.",
231                    context: {
232                        foundWorkId: d()?.id,
233                        taskId: d()?.taskId,
234                        currentUserId: x()?.id
235                    },
236                    error: n
237                }), T(e.formError), {
238                    ...e.fieldErrors,
239                    ...e.formError ? {
240                        _error: e.formError
241                    } : {}
242                };
243            }
244            return {};
245        }, te = async (t)=>await ke(async ()=>{
246                Z(!0), T(void 0);
247                try {
248                    if (!d()) {
249                        const m = "Found work is still loading. Please wait.";
250                        return T(m), {
251                            _error: m
252                        };
253                    }
254                    if (!x()) {
255                        const m = "You need to sign in again before saving changes.";
256                        return T(m), {
257                            _error: m
258                        };
259                    }
260                    if (!I()) {
261                        const m = "You do not have permission to save changes for this found work.";
262                        return T(m), {
263                            _error: m
264                        };
265                    }
266                    const r = ce(d(), t);
267                    if (!Y()) {
268                        const m = "The server record is still loading. Please wait a moment and save again.";
269                        return T(m), {
270                            _error: m
271                        };
272                    }
273                    const n = cr(he(), r.approvedSolutionRichText, d().approvedSolutionRichText, d().approvedSolution), e = {
274                        ...r,
275                        approvedSolution: pr(n),
276                        approvedSolutionRichText: n,
277                        assignedTo: ur(r.assignedTo, Y().assignedTo)
278                    }, s = e.approved && !d()?.approved, k = ye(e, s);
279                    if (k) return k;
280                    const v = _e(d(), e, x()?.email, s), h = de.safeParse(v);
281                    if (!h.success) {
282                        const m = le(ie({
283                            source: "local",
284                            issues: h.error.issues
285                        }), q);
286                        return T(m.formError), {
287                            ...m.fieldErrors,
288                            ...m.formError ? {
289                                _error: m.formError
290                            } : {}
291                        };
292                    }
293                    const A = Be(h.data, be() ?? []);
294                    return await $e(h.data, A);
295                } finally{
296                    Z(!1);
297                }
298            }) ?? {}, [g, { Form: Se, Field: f }] = gr({
299            validate: te,
300            initialValues: {},
301            validateOn: "submit",
302            revalidateOn: "submit"
303        }), We = async ()=>{
304            try {
305                const t = await te(br(g)), r = t._error ?? Object.values(t)[0];
306                r && T(r);
307            } catch (t) {
308                T(t instanceof Error ? t.message : "We couldn't save this found work. Please try again.");
309            }
310        };
311        z(()=>{
312            const t = d();
313            if (!t || ve() === t.id) return;
314            const r = kr(t, Q());
315            vr(g, r), ee(t.approvedSolutionRichText || t.approvedSolution || ""), fe(t.id);
316        }), z(()=>{
317            const t = d(), r = Q();
318            !t || !r || (t.sourceWorkPackage || C(g, "sourceWorkPackage", r.workPackage ?? ""), t.sourceWorkOrder || C(g, "sourceWorkOrder", r.workOrder ?? ""));
319        });
320        const Ce = ()=>(()=>{
321                var t = xr();
322                return t.firstChild, o(t, a(b, {
323                    get when () {
324                        return H();
325                    },
326                    get fallback () {
327                        return (()=>{
328                            var r = U();
329                            return N(()=>r.innerHTML = d()?.problemDescriptionRichText === "undefined" ? "" : d()?.problemDescriptionRichText ?? ""), r;
330                        })();
331                    },
332                    get children () {
333                        return a(f, {
334                            name: "problemDescriptionRichText",
335                            children: (r, n)=>a(J, {
336                                    label: "Problem Description",
337                                    legendHidden: !0,
338                                    error: ()=>r.error,
339                                    placeholder: "Enter details...",
340                                    valueHtml: ()=>r.value ? r.value === "undefined" ? "" : r.value : "",
341                                    onChange: ({ html: e, text: s })=>{
342                                        C(g, "problemDescription", s, {
343                                            shouldFocus: !1
344                                        }), C(g, "problemDescriptionRichText", e, {
345                                            shouldFocus: !1
346                                        });
347                                    }
348                                })
349                        });
350                    }
351                }), null), t;
352            })(), Te = ()=>(()=>{
353                var t = yr();
354                return t.firstChild, o(t, a(b, {
355                    get when () {
356                        return H();
357                    },
358                    get fallback () {
359                        return (()=>{
360                            var r = U();
361                            return N(()=>r.innerHTML = d()?.recommendedActionRichText === "undefined" ? "" : d()?.recommendedActionRichText ?? ""), r;
362                        })();
363                    },
364                    get children () {
365                        return a(f, {
366                            name: "recommendedActionRichText",
367                            children: (r, n)=>a(J, {
368                                    label: "Recommended Action",
369                                    legendHidden: !0,
370                                    error: ()=>r.error,
371                                    placeholder: "Enter details...",
372                                    valueHtml: ()=>r.value === "undefined" ? "" : r.value ?? "",
373                                    onChange: ({ html: e, text: s })=>{
374                                        C(g, "recommendedAction", s, {
375                                            shouldFocus: !1
376                                        }), C(g, "recommendedActionRichText", e, {
377                                            shouldFocus: !1
378                                        });
379                                    }
380                                })
381                        });
382                    }
383                }), null), t;
384            })(), Ae = ()=>(()=>{
385                var t = _r();
386                return t.firstChild, o(t, a(b, {
387                    get when () {
388                        return D();
389                    },
390                    get fallback () {
391                        return (()=>{
392                            var r = U();
393                            return N(()=>r.innerHTML = d()?.approvedSolutionRichText === "undefined" ? "" : d()?.approvedSolutionRichText ?? ""), r;
394                        })();
395                    },
396                    get children () {
397                        return a(f, {
398                            name: "approvedSolutionRichText",
399                            children: (r, n)=>a(J, {
400                                    label: "Approved Solution",
401                                    error: ()=>r.error,
402                                    placeholder: "Enter details...",
403                                    valueHtml: ()=>r.value ? r.value === "undefined" ? "" : r.value : "",
404                                    onChange: ({ html: e, text: s })=>{
405                                        ee(e), C(g, "approvedSolution", s, {
406                                            shouldFocus: !1
407                                        }), C(g, "approvedSolutionRichText", e, {
408                                            shouldFocus: !1
409                                        });
410                                    }
411                                })
412                        });
413                    }
414                }), null), t;
415            })();
416        return a(b, {
417            get when () {
418                return !pe();
419            },
420            get fallback () {
421                return a(mr, {
422                    onRetry: ()=>window.location.reload(),
423                    onBack: ()=>B("/tasks")
424                });
425            },
426            get children () {
427                return [
428                    a(He, {
429                        breadcrumbs: [
430                            {
431                                displayText: "Home",
432                                iconCss: "fa-solid fa-house",
433                                path: "/",
434                                isRoot: !1
435                            },
436                            {
437                                displayText: "Tasks",
438                                iconCss: "fa-solid fa-list-check",
439                                path: "/tasks",
440                                isRoot: !1
441                            },
442                            {
443                                displayText: "Edit Found Work",
444                                iconCss: "fa-solid fa-bars-progress",
445                                isRoot: !0,
446                                path: ""
447                            }
448                        ]
449                    }),
450                    (()=>{
451                        var t = Sr();
452                        return o(t, a(b, {
453                            get when () {
454                                return d();
455                            },
456                            get fallback () {
457                                return a(Qe, {});
458                            },
459                            get children () {
460                                return [
461                                    a(Me, {
462                                        get title () {
463                                            return `Edit Found Work: ${d()?.foundWorkNumber} REV:${d()?.revision ?? ""}`;
464                                        }
465                                    }),
466                                    $r(),
467                                    a(Ze, {
468                                        tabID: "found-work",
469                                        keepMounted: !0,
470                                        initialTab: 0,
471                                        tabItems: [
472                                            {
473                                                label: "FORM",
474                                                content: ()=>a(Se, {
475                                                        id: "edit-foundwork-form",
476                                                        class: "space-y-5 pb-32",
477                                                        shouldFocus: !1,
478                                                        get children () {
479                                                            return [
480                                                                (()=>{
481                                                                    var r = Tr();
482                                                                    return o(r, a(f, {
483                                                                        name: "id",
484                                                                        children: (n, e)=>(()=>{
485                                                                                var s = R();
486                                                                                return $(s, S(n, e), !1, !1), s;
487                                                                            })()
488                                                                    }), null), o(r, a(f, {
489                                                                        name: "projectId",
490                                                                        children: (n, e)=>(()=>{
491                                                                                var s = R();
492                                                                                return $(s, S(n, e), !1, !1), s;
493                                                                            })()
494                                                                    }), null), o(r, a(f, {
495                                                                        name: "createdBy",
496                                                                        children: (n, e)=>(()=>{
497                                                                                var s = R();
498                                                                                return $(s, S(n, e, {
499                                                                                    get value () {
500                                                                                        return String(n.value);
501                                                                                    }
502                                                                                }), !1, !1), s;
503                                                                            })()
504                                                                    }), null), o(r, a(f, {
505                                                                        name: "completedAt",
506                                                                        children: (n, e)=>(()=>{
507                                                                                var s = R();
508                                                                                return $(s, S(n, e, {
509                                                                                    get value () {
510                                                                                        return E(()=>!!n.value)() ? String(n.value) : "";
511                                                                                    }
512                                                                                }), !1, !1), s;
513                                                                            })()
514                                                                    }), null), o(r, a(f, {
515                                                                        name: "approvedSolution",
516                                                                        children: (n, e)=>(()=>{
517                                                                                var s = R();
518                                                                                return $(s, S(n, e, {
519                                                                                    type: "text",
520                                                                                    get value () {
521                                                                                        return String(n.value);
522                                                                                    }
523                                                                                }), !1, !1), s;
524                                                                            })()
525                                                                    }), null), o(r, a(f, {
526                                                                        name: "complete",
527                                                                        type: "boolean",
528                                                                        children: (n, e)=>(()=>{
529                                                                                var s = R();
530                                                                                return $(s, S(n, e, {
531                                                                                    get value () {
532                                                                                        return String(n.value);
533                                                                                    }
534                                                                                }), !1, !1), s;
535                                                                            })()
536                                                                    }), null), o(r, a(f, {
537                                                                        name: "problemDescription",
538                                                                        children: (n, e)=>(()=>{
539                                                                                var s = R();
540                                                                                return $(s, S(n, e, {
541                                                                                    type: "text",
542                                                                                    get value () {
543                                                                                        return String(n.value);
544                                                                                    }
545                                                                                }), !1, !1), s;
546                                                                            })()
547                                                                    }), null), o(r, a(f, {
548                                                                        name: "recommendedAction",
549                                                                        children: (n, e)=>(()=>{
550                                                                                var s = R();
551                                                                                return $(s, S(n, e, {
552                                                                                    type: "text",
553                                                                                    get value () {
554                                                                                        return String(n.value);
555                                                                                    }
556                                                                                }), !1, !1), s;
557                                                                            })()
558                                                                    }), null), r;
559                                                                })(),
560                                                                (()=>{
561                                                                    var r = Ar(), n = r.firstChild;
562                                                                    return o(r, a(W, {
563                                                                        form: g,
564                                                                        name: "findingSummary",
565                                                                        label: "Finding Summary",
566                                                                        placeholder: "e.g., Cracking at outlet nozzle weld",
567                                                                        tooltip: "Concise management-facing description used in the daily report and printed Found Work form.",
568                                                                        maxLength: 100,
569                                                                        get readonly () {
570                                                                            return !V();
571                                                                        },
572                                                                        required: !0
573                                                                    }), n), r;
574                                                                })(),
575                                                                (()=>{
576                                                                    var r = Rr(), n = r.firstChild, e = n.nextSibling;
577                                                                    return o(e, a(W, {
578                                                                        form: g,
579                                                                        name: "foundWorkNumber",
580                                                                        label: "FW No.",
581                                                                        readonly: !0
582                                                                    }), null), o(e, a(f, {
583                                                                        name: "createdAt",
584                                                                        children: (s, k)=>(()=>{
585                                                                                var v = Er(), h = v.firstChild, A = h.nextSibling, m = A.firstChild, F = m.nextSibling;
586                                                                                return $(m, S(k, {
587                                                                                    get value () {
588                                                                                        return String(s.value || d()?.createdAt || "");
589                                                                                    }
590                                                                                }), !1, !1), N(()=>F.value = (()=>{
591                                                                                        const y = s.value || d()?.createdAt;
592                                                                                        if (!y) return "";
593                                                                                        try {
594                                                                                            return new Date(y).toISOString().split("T")[0];
595                                                                                        } catch  {
596                                                                                            return y;
597                                                                                        }
598                                                                                    })()), v;
599                                                                            })()
600                                                                    }), null), o(e, a(Ve, {
601                                                                        label: "Assign To",
602                                                                        name: "assignedTo",
603                                                                        placeholder: "Select users to assign",
604                                                                        tooltip: "Required. The assignee will be notified by email on save.",
605                                                                        dataSource: ()=>w() && w().sharedWith && x() ? [
606                                                                                ...w().sharedWith,
607                                                                                x().email
608                                                                            ] : x() ? [
609                                                                                x().email
610                                                                            ] : [],
611                                                                        get readonly () {
612                                                                            return !V();
613                                                                        },
614                                                                        value: ()=>P(d()?.assignedTo),
615                                                                        form: g,
616                                                                        required: !0
617                                                                    }), null), r;
618                                                                })(),
619                                                                (()=>{
620                                                                    var r = wr(), n = r.firstChild, e = n.nextSibling;
621                                                                    return o(n, ()=>d()?.reportOrigin ? "Inspection report context" : "Task context"), o(e, a(W, {
622                                                                        form: g,
623                                                                        name: "tag",
624                                                                        label: "Tag",
625                                                                        readonly: !0
626                                                                    }), null), o(e, a(W, {
627                                                                        form: g,
628                                                                        name: "component",
629                                                                        label: "Component",
630                                                                        readonly: !0
631                                                                    }), null), o(e, a(W, {
632                                                                        form: g,
633                                                                        name: "activity",
634                                                                        label: "Activity",
635                                                                        readonly: !0
636                                                                    }), null), r;
637                                                                })(),
638                                                                (()=>{
639                                                                    var r = Fr(), n = r.firstChild, e = n.nextSibling;
640                                                                    return o(e, a(W, {
641                                                                        form: g,
642                                                                        name: "clientFoundWorkNumber",
643                                                                        label: "Client FW No.",
644                                             
644                           placeholder: "e.g., C-FW-1042",
645                                                                        get readonly () {
646                                                                            return !I();
647                                                                        }
648                                                                    }), null), o(e, a(W, {
649                                                                        form: g,
650                                                                        name: "repairContractorJobNumber",
651                                                                        label: "Repair Contractor Job No.",
652                                                                        placeholder: "e.g., RC-78215",
653                                                                        get readonly () {
654                                                                            return !I();
655                                                                        }
656                                                                    }), null), r;
657                                                                })(),
658                                                                (()=>{
659                                                                    var r = Dr(), n = r.firstChild, e = n.nextSibling;
660                                                                    return o(e, a(W, {
661                                                                        form: g,
662                                                                        name: "sourceWorkPackage",
663                                                                        label: "Inspection CWP No.",
664                                                                        readonly: !0
665                                                                    }), null), o(e, a(W, {
666                                                                        form: g,
667                                                                        name: "sourceWorkOrder",
668                                                                        label: "Inspection WO No.",
669                                                                        readonly: !0
670                                                                    }), null), o(e, a(W, {
671                                                                        form: g,
672                                                                        name: "repairWorkPackage",
673                                                                        label: "Repair CWP No.",
674                                                                        placeholder: "Leave blank if unchanged",
675                                                                        get readonly () {
676                                                                            return !I();
677                                                                        }
678                                                                    }), null), o(e, a(W, {
679                                                                        form: g,
680                                                                        name: "repairWorkOrder",
681                                                                        label: "Repair WO No.",
682                                                                        placeholder: "Leave blank if unchanged",
683                                                                        get readonly () {
684                                                                            return !I();
685                                                                        }
686                                                                    }), null), r;
687                                                                })(),
688                                                                E(()=>Ce()),
689                                                                E(()=>Te()),
690                                                                E(()=>Ae()),
691                                                                (()=>{
692                                                                    var r = Ir(), n = r.firstChild, e = n.nextSibling, s = e.nextSibling;
693                                                                    return o(e, a(f, {
694                                                                        name: "approved",
695                                                                        type: "boolean",
696                                                                        children: (k, v)=>(()=>{
697                                                                                var h = Pr(), A = h.firstChild, m = A.nextSibling, F = m.firstChild;
698                                                                                return $(F, S({
699                                                                                    get checked () {
700                                                                                        return !!k.value;
701                                                                                    }
702                                                                                }, v, {
703                                                                                    get disabled () {
704                                                                                        return !D();
705                                                                                    },
706                                                                                    onChange: (y)=>{
707                                                                                        const O = y.currentTarget.checked;
708                                                                                        C(g, "approved", O), v?.onChange?.(y);
709                                                                                    }
710                                                                                }), !1, !1), h;
711                                                                            })()
712                                                                    }), null), o(e, a(f, {
713                                                                        name: "complete",
714                                                                        type: "boolean",
715                                                                        children: (k, v)=>(()=>{
716                                                                                var h = Or(), A = h.firstChild, m = A.nextSibling, F = m.firstChild;
717                                                                                return $(F, S({
718                                                                                    get checked () {
719                                                                                        return !!k.value;
720                                                                                    }
721                                                                                }, v, {
722                                                                                    get disabled () {
723                                                                                        return !L();
724                                                                                    },
725                                                                                    onChange: (y)=>{
726                                                                                        const O = y.currentTarget.checked;
727                                                                                        C(g, "complete", O), v?.onChange?.(y);
728                                                                                    }
729                                                                                }), !1, !1), h;
730                                                                            })()
731                                                                    }), null), o(r, a(b, {
732                                                                        get when () {
733                                                                            return d()?.approved || d()?.complete;
734                                                                        },
735                                                                        get children () {
736                                                                            return a(f, {
737                                                                                name: "regulatoryDocumentType",
738                                                                                children: (k)=>a(dr, {
739                                                                                        value: ()=>k.value ?? null,
740                                                                                        disabled: ()=>!L(),
741                                                                                        error: ()=>k.error,
742                                                                                        onChange: (v)=>C(g, "regulatoryDocumentType", v)
743                                                                                    })
744                                                                            });
745                                                                        }
746                                                                    }), s), r;
747                                                                })()
748                                                            ];
749                                                        }
750                                                    })
751                                            },
752                                            {
753                                                label: "ATTACHMENTS",
754                                                content: ()=>a(er, {})
755                                            },
756                                            {
757                                                label: "REVISIONS",
758                                                content: ()=>(()=>{
759                                                        var r = Br();
760                                                        return o(r, a(b, {
761                                                            get when () {
762                                                                return (re()?.length ?? 0) > 0;
763                                                            },
764                                                            get fallback () {
765                                                                return Lr();
766                                                            },
767                                                            get children () {
768                                                                var n = Nr();
769                                                                return o(n, ()=>re()?.map((e)=>(()=>{
770                                                                            var s = Kr(
770), k = s.firstChild, v = k.firstChild;
771                                                                            v.firstChild;
772                                                                            var h = v.nextSibling;
773                                                                            h.firstChild;
774                                                                            var A = k.nextSibling, m = A.firstChild, F = m.firstChild, y = F.nextSibling, O = m.nextSibling, Re = O.firstChild, we = Re.nextSibling, Fe = A.nextSibling, oe = Fe.firstChild;
775                                                                            return oe.firstChild, o(v, ()=>e.revision, null), o(h, ()=>new Date(e.createdAt).toLocaleDateString(), null), o(y, ()=>e.problemDescription), o(we, ()=>e.recommendedAction), o(oe, ()=>P(e.createdBy), null), o(s, a(b, {
776                                                                                get when () {
777                                                                                    return e.clientFoundWorkNumber || e.repairContractorJobNumber || e.sourceWorkPackage || e.sourceWorkOrder || e.repairWorkPackage || e.repairWorkOrder || e.regulatoryDocumentType;
778                                                                                },
779                                                                                get children () {
780                                                                                    var _ = qr();
781                                                                                    return o(_, a(b, {
782                                                                                        get when () {
783                                                                                            return e.clientFoundWorkNumber;
784                                                                                        },
785                                                                                        get children () {
786                                                                                            var p = Mr();
787                                                                                            return p.firstChild, o(p, ()=>e.clientFoundWorkNumber, null), p;
788                                                                                        }
789                                                                                    }), null), o(_, a(b, {
790                                                                                        get when () {
791                                                                                            return e.repairContractorJobNumber;
792                                                                                        },
793                                                                                        get children () {
794                                                                                            var p = Hr();
795                                                                                            return p.firstChild, o(p, ()=>e.repairContractorJobNumber, null), p;
796                                                                                        }
797                                                                                    }), null), o(_, a(b, {
798                                                                                        get when () {
799                                                                                            return e.sourceWorkPackage;
800                                                                                        },
801                                                                                        get children () {
802                                                                                            var p = Vr();
803                                                                                            return p.firstChild, o(p, ()=>e.sourceWorkPackage, null), p;
804                                                                                        }
805                                                                                    }), null), o(_, a(b, {
806                                                                                        get when () {
807                                                                                            return e.sourceWorkOrder;
808                                                                                        },
809                                                                                        get children () {
810                                                                                            var p = jr();
811                                                                                            return p.firstChild, o(p, ()=>e.sourceWorkOrder, null), p;
812                                                                                        }
813                                                                                    }), null), o(_, a(b, {
814                                                                                        get when () {
815                                                                                            return e.repairWorkPackage;
816                                                                                        },
817                                                                                        get children () {
818                                                                                            var p = zr();
819                                                                                            return p.firstChild, o(p, ()=>e.repairWorkPackage, null), p;
820                                                                                        }
821                                                                                    }), null), o(_, a(b, {
822                                                                                        get when () {
823                                                                                            return e.repairWorkOrder;
824                                                                                        },
825                                                                                        get children () {
826                                                                                            var p = Jr();
827                                                                                            return p.firstChild, o(p, ()=>e.repairWorkOrder, null), p;
828                                                                                        }
829                                                                                    }), null), o(_, a(b, {
830                                                                                        get when () {
831                                                                                            return e.regulatoryDocumentType;
832                                                                                        },
833                                                                                        get children () {
834                                                                                            var p = Ur();
835                                                                                            return p.firstChild, o(p, ()=>e.regulatoryDocumentType === "NOT_APPLICABLE" ? "Not applicable" : e.regulatoryDocumentType, null), p;
836                                                                                        }
837                                                                                    }), null), _;
838                                                                                }
839                                                                            }), null), o(s, a(b, {
840                                                                                get when () {
841                                                                                    return e.approvedSolution;
842                                                                                },
843                                                                                get children () {
844                                                                                    var _ = Yr(), p = _.firstChild, ne = p.nextSibling, De = ne.nextSibling, Ie = De.firstChild;
845                                                                                    return o(ne, ()=>e.approvedSolution), o(Ie, (()=>{
846                                                                                        var Ee = E(()=>!!e.approvedAt);
847                                                                                        return ()=>Ee() ? `${P(e.approvedBy) ? `Approved by ${P(e.approvedBy)} - ` : ""}
847${new Date(e.approvedAt).toLocaleString()}` : "Not approved";
848                                                                                    })()), _;
849                                                                                }
850                                                                            }), null), s;
851                                                                        })())), n;
852                                                            }
853                                                        })), r;
854                                                    })()
855                                            }
856                                        ]
857                                    })
858                                ];
859                            }
860                        })), t;
861                    })(),
862                    (()=>{
863                        var t = Cr(), r = t.firstChild, n = r.nextSibling;
864                        return t.style.setProperty("box-shadow", "0 -2px 4px -2px rgba(0,0,0,0.1)"), Oe(r, "click", ()=>void We()), o(r, (()=>{
865                            var e = E(()=>!!X());
866                            return ()=>e() ? "Saving..." : xe();
867                        })()), n.$$click = ()=>{
868                            i(void 0);
869                            const e = d()?.id ?? l.id;
870                            B(e ? `/details-found-work/${e}` : "/tasks");
871                        }, o(t, a(b, {
872                            get when () {
873                                return G();
874                            },
875                            get children () {
876                                var e = Wr();
877                                return o(e, G), e;
878                            }
879                        }), null), N(()=>r.disabled = !I() || X()), t;
880                    })()
881                ];
882            }
883        });
884    };
885    Ne([
886        "click"
887    ]);
888});
889export { Mt as EditFoundWork, __tla };

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.